From e389272971ada76e6b1c3a8efa9b3156b153e75d Mon Sep 17 00:00:00 2001 From: Mikhail Yohman Date: Sat, 14 Aug 2021 16:23:31 -0600 Subject: [PATCH] Integration tests (#72) --- .bandit.yml | 5 + .gitignore | 1 + .travis.yml | 83 +- Dockerfile | 118 +++ README.md | 2 +- development/dev.env | 31 + development/docker-compose.yml | 32 + docker-compose.yml | 38 + .../contributing/modules/index.rst | 3 +- .../contributing/modules/testing_locally.rst | 66 ++ galaxy.yml | 6 - plugins/action/query_graphql.py | 15 +- plugins/lookup/lookup.py | 29 +- plugins/lookup/lookup_graphql.py | 17 +- plugins/module_utils/dcim.py | 20 +- plugins/module_utils/utils.py | 35 +- plugins/modules/aggregate.py | 3 +- plugins/modules/circuit.py | 3 +- plugins/modules/cluster.py | 3 +- plugins/modules/console_port.py | 3 +- plugins/modules/console_server_port.py | 3 +- plugins/modules/device_bay.py | 3 +- plugins/modules/device_interface.py | 7 +- plugins/modules/device_type.py | 3 +- plugins/modules/front_port.py | 3 +- plugins/modules/inventory_item.py | 3 +- plugins/modules/ip_address.py | 3 +- plugins/modules/power_feed.py | 3 +- plugins/modules/power_outlet.py | 3 +- plugins/modules/power_outlet_template.py | 4 +- plugins/modules/power_port.py | 3 +- plugins/modules/prefix.py | 3 +- plugins/modules/provider.py | 3 +- plugins/modules/rack.py | 3 +- plugins/modules/rear_port.py | 3 +- plugins/modules/route_target.py | 3 +- plugins/modules/service.py | 9 +- plugins/modules/site.py | 3 +- plugins/modules/tenant.py | 3 +- plugins/modules/virtual_chassis.py | 3 +- plugins/modules/virtual_machine.py | 3 +- plugins/modules/vlan.py | 3 +- plugins/modules/vm_interface.py | 3 +- plugins/modules/vrf.py | 3 +- poetry.lock | 215 +++- pyproject.toml | 4 +- tasks.py | 223 ++++ tests/integration/entrypoint.sh | 40 + tests/integration/integration_config.tmpl.yml | 3 + tests/integration/nautobot-populate.py | 200 +++- .../files/test-inventory-legacy.yml | 2 +- .../files/test-inventory-options-flatten.yml | 2 +- .../files/test-inventory-options.yml | 2 +- .../files/test-inventory-plurals-flatten.yml | 2 +- .../files/test-inventory-plurals.yml | 2 +- .../inventory-latest/files/test-inventory.yml | 2 +- .../targets/inventory-v2.9/.gitignore | 1 - .../targets/inventory-v2.9/aliases | 1 - .../inventory-v2.9/compare_inventory_json.py | 153 --- .../files/test-inventory-legacy.json | 369 ------- .../files/test-inventory-legacy.yml | 9 - .../files/test-inventory-options-flatten.json | 836 --------------- .../files/test-inventory-options-flatten.yml | 39 - .../files/test-inventory-options.json | 335 ------ .../files/test-inventory-options.yml | 60 -- .../files/test-inventory-plurals-flatten.json | 387 ------- .../files/test-inventory-plurals-flatten.yml | 30 - .../files/test-inventory-plurals.json | 955 ------------------ .../files/test-inventory-plurals.yml | 35 - .../inventory-v2.9/files/test-inventory.json | 881 ---------------- .../inventory-v2.9/files/test-inventory.yml | 27 - .../targets/inventory-v2.9/runme.sh | 66 -- .../inventory-v2.9/runme_config.template | 6 - .../targets/latest/tasks/aggregate.yml | 69 +- .../targets/latest/tasks/cable.yml | 189 ++-- .../targets/latest/tasks/circuit.yml | 81 +- .../latest/tasks/circuit_termination.yml | 85 +- .../targets/latest/tasks/circuit_type.yml | 39 +- .../targets/latest/tasks/cluster.yml | 83 +- .../targets/latest/tasks/cluster_group.yml | 39 +- .../targets/latest/tasks/cluster_type.yml | 39 +- .../targets/latest/tasks/console_port.yml | 60 +- .../latest/tasks/console_port_template.yml | 58 +- .../latest/tasks/console_server_port.yml | 60 +- .../tasks/console_server_port_template.yml | 58 +- .../targets/latest/tasks/device.yml | 208 ++-- .../targets/latest/tasks/device_bay.yml | 65 +- .../latest/tasks/device_bay_template.yml | 47 +- .../targets/latest/tasks/device_interface.yml | 217 ++-- .../tasks/device_interface_template.yml | 70 +- .../targets/latest/tasks/device_role.yml | 43 +- .../targets/latest/tasks/device_type.yml | 77 +- .../targets/latest/tasks/front_port.yml | 108 +- .../latest/tasks/front_port_template.yml | 109 +- .../targets/latest/tasks/inventory_item.yml | 77 +- .../targets/latest/tasks/ip_address.yml | 235 ++--- .../targets/latest/tasks/ipam_role.yml | 37 +- .../targets/latest/tasks/lookup.yml | 57 +- .../integration/targets/latest/tasks/main.yml | 432 +++++++- .../targets/latest/tasks/manufacturer.yml | 35 +- .../targets/latest/tasks/platform.yml | 49 +- .../targets/latest/tasks/power_feed.yml | 76 +- .../targets/latest/tasks/power_outlet.yml | 88 +- .../latest/tasks/power_outlet_template.yml | 83 +- .../targets/latest/tasks/power_panel.yml | 64 +- .../targets/latest/tasks/power_port.yml | 78 +- .../latest/tasks/power_port_template.yml | 71 +- .../targets/latest/tasks/prefix.yml | 167 +-- .../targets/latest/tasks/provider.yml | 40 +- .../integration/targets/latest/tasks/rack.yml | 185 ++-- .../targets/latest/tasks/rack_group.yml | 32 +- .../targets/latest/tasks/rack_role.yml | 32 +- .../targets/latest/tasks/rear_port.yml | 85 +- .../latest/tasks/rear_port_template.yml | 82 +- .../targets/latest/tasks/region.yml | 39 +- .../integration/targets/latest/tasks/rir.yml | 30 +- .../targets/latest/tasks/route_target.yml | 132 ++- .../targets/latest/tasks/service.yml | 145 +-- .../integration/targets/latest/tasks/site.yml | 130 +-- .../integration/targets/latest/tasks/tag.yml | 53 +- .../targets/latest/tasks/tenant.yml | 57 +- .../targets/latest/tasks/tenant_group.yml | 30 +- .../targets/latest/tasks/virtual_chassis.yml | 97 +- .../targets/latest/tasks/virtual_machine.yml | 74 +- .../integration/targets/latest/tasks/vlan.yml | 163 +-- .../targets/latest/tasks/vlan_group.yml | 64 +- .../targets/latest/tasks/vm_interface.yml | 140 +-- .../integration/targets/latest/tasks/vrf.yml | 82 +- .../targets/regression-latest/tasks/main.yml | 211 ++-- .../targets/regression-v2.9/tasks/main.yml | 218 ---- .../targets/v2.9/tasks/aggregate.yml | 115 --- .../integration/targets/v2.9/tasks/cable.yml | 186 ---- .../targets/v2.9/tasks/circuit.yml | 109 -- .../v2.9/tasks/circuit_termination.yml | 129 --- .../targets/v2.9/tasks/circuit_type.yml | 96 -- .../targets/v2.9/tasks/cluster.yml | 98 -- .../targets/v2.9/tasks/cluster_group.yml | 96 -- .../targets/v2.9/tasks/cluster_type.yml | 95 -- .../targets/v2.9/tasks/console_port.yml | 108 -- .../v2.9/tasks/console_port_template.yml | 105 -- .../v2.9/tasks/console_server_port.yml | 108 -- .../tasks/console_server_port_template.yml | 105 -- .../integration/targets/v2.9/tasks/device.yml | 241 ----- .../targets/v2.9/tasks/device_bay.yml | 87 -- .../v2.9/tasks/device_bay_template.yml | 81 -- .../targets/v2.9/tasks/device_interface.yml | 291 ------ .../v2.9/tasks/device_interface_template.yml | 109 -- .../targets/v2.9/tasks/device_role.yml | 101 -- .../targets/v2.9/tasks/device_type.yml | 131 --- .../targets/v2.9/tasks/front_port.yml | 150 --- .../v2.9/tasks/front_port_template.yml | 147 --- .../targets/v2.9/tasks/inventory_item.yml | 107 -- .../targets/v2.9/tasks/ip_address.yml | 350 ------- .../targets/v2.9/tasks/ipam_role.yml | 94 -- .../integration/targets/v2.9/tasks/lookup.yml | 82 -- tests/integration/targets/v2.9/tasks/main.yml | 159 --- .../targets/v2.9/tasks/manufacturer.yml | 91 -- .../targets/v2.9/tasks/platform.yml | 99 -- .../targets/v2.9/tasks/power_feed.yml | 127 --- .../targets/v2.9/tasks/power_outlet.yml | 114 --- .../v2.9/tasks/power_outlet_template.yml | 111 -- .../targets/v2.9/tasks/power_panel.yml | 106 -- .../targets/v2.9/tasks/power_port.yml | 125 --- .../v2.9/tasks/power_port_template.yml | 120 --- .../integration/targets/v2.9/tasks/prefix.yml | 245 ----- .../targets/v2.9/tasks/provider.yml | 99 -- tests/integration/targets/v2.9/tasks/rack.yml | 225 ----- .../targets/v2.9/tasks/rack_group.yml | 62 -- .../targets/v2.9/tasks/rack_role.yml | 81 -- .../targets/v2.9/tasks/rear_port.yml | 139 --- .../targets/v2.9/tasks/rear_port_template.yml | 136 --- .../integration/targets/v2.9/tasks/region.yml | 79 -- tests/integration/targets/v2.9/tasks/rir.yml | 79 -- .../targets/v2.9/tasks/service.yml | 193 ---- tests/integration/targets/v2.9/tasks/site.yml | 180 ---- tests/integration/targets/v2.9/tasks/tag.yml | 110 -- .../integration/targets/v2.9/tasks/tenant.yml | 106 -- .../targets/v2.9/tasks/tenant_group.yml | 75 -- .../targets/v2.9/tasks/virtual_chassis.yml | 131 --- .../targets/v2.9/tasks/virtual_machine.yml | 99 -- tests/integration/targets/v2.9/tasks/vlan.yml | 193 ---- .../targets/v2.9/tasks/vlan_group.yml | 118 --- .../targets/v2.9/tasks/vm_interface.yml | 159 --- tests/integration/targets/v2.9/tasks/vrf.yml | 128 --- tests/sanity/ignore-2.10.txt | 27 - tests/sanity/ignore-2.11.txt | 1 + .../test_data/normalize_data/data.json | 4 +- 187 files changed, 3866 insertions(+), 14133 deletions(-) create mode 100644 .bandit.yml create mode 100644 Dockerfile create mode 100644 development/dev.env create mode 100644 development/docker-compose.yml create mode 100644 docker-compose.yml create mode 100644 docs/getting_started/contributing/modules/testing_locally.rst create mode 100644 tasks.py create mode 100755 tests/integration/entrypoint.sh create mode 100644 tests/integration/integration_config.tmpl.yml delete mode 100644 tests/integration/targets/inventory-v2.9/.gitignore delete mode 100644 tests/integration/targets/inventory-v2.9/aliases delete mode 100755 tests/integration/targets/inventory-v2.9/compare_inventory_json.py delete mode 100644 tests/integration/targets/inventory-v2.9/files/test-inventory-legacy.json delete mode 100644 tests/integration/targets/inventory-v2.9/files/test-inventory-legacy.yml delete mode 100644 tests/integration/targets/inventory-v2.9/files/test-inventory-options-flatten.json delete mode 100644 tests/integration/targets/inventory-v2.9/files/test-inventory-options-flatten.yml delete mode 100644 tests/integration/targets/inventory-v2.9/files/test-inventory-options.json delete mode 100644 tests/integration/targets/inventory-v2.9/files/test-inventory-options.yml delete mode 100644 tests/integration/targets/inventory-v2.9/files/test-inventory-plurals-flatten.json delete mode 100644 tests/integration/targets/inventory-v2.9/files/test-inventory-plurals-flatten.yml delete mode 100644 tests/integration/targets/inventory-v2.9/files/test-inventory-plurals.json delete mode 100644 tests/integration/targets/inventory-v2.9/files/test-inventory-plurals.yml delete mode 100644 tests/integration/targets/inventory-v2.9/files/test-inventory.json delete mode 100644 tests/integration/targets/inventory-v2.9/files/test-inventory.yml delete mode 100755 tests/integration/targets/inventory-v2.9/runme.sh delete mode 100644 tests/integration/targets/inventory-v2.9/runme_config.template delete mode 100644 tests/integration/targets/regression-v2.9/tasks/main.yml delete mode 100644 tests/integration/targets/v2.9/tasks/aggregate.yml delete mode 100644 tests/integration/targets/v2.9/tasks/cable.yml delete mode 100644 tests/integration/targets/v2.9/tasks/circuit.yml delete mode 100644 tests/integration/targets/v2.9/tasks/circuit_termination.yml delete mode 100644 tests/integration/targets/v2.9/tasks/circuit_type.yml delete mode 100644 tests/integration/targets/v2.9/tasks/cluster.yml delete mode 100644 tests/integration/targets/v2.9/tasks/cluster_group.yml delete mode 100644 tests/integration/targets/v2.9/tasks/cluster_type.yml delete mode 100644 tests/integration/targets/v2.9/tasks/console_port.yml delete mode 100644 tests/integration/targets/v2.9/tasks/console_port_template.yml delete mode 100644 tests/integration/targets/v2.9/tasks/console_server_port.yml delete mode 100644 tests/integration/targets/v2.9/tasks/console_server_port_template.yml delete mode 100644 tests/integration/targets/v2.9/tasks/device.yml delete mode 100644 tests/integration/targets/v2.9/tasks/device_bay.yml delete mode 100644 tests/integration/targets/v2.9/tasks/device_bay_template.yml delete mode 100644 tests/integration/targets/v2.9/tasks/device_interface.yml delete mode 100644 tests/integration/targets/v2.9/tasks/device_interface_template.yml delete mode 100644 tests/integration/targets/v2.9/tasks/device_role.yml delete mode 100644 tests/integration/targets/v2.9/tasks/device_type.yml delete mode 100644 tests/integration/targets/v2.9/tasks/front_port.yml delete mode 100644 tests/integration/targets/v2.9/tasks/front_port_template.yml delete mode 100644 tests/integration/targets/v2.9/tasks/inventory_item.yml delete mode 100644 tests/integration/targets/v2.9/tasks/ip_address.yml delete mode 100644 tests/integration/targets/v2.9/tasks/ipam_role.yml delete mode 100644 tests/integration/targets/v2.9/tasks/lookup.yml delete mode 100644 tests/integration/targets/v2.9/tasks/main.yml delete mode 100644 tests/integration/targets/v2.9/tasks/manufacturer.yml delete mode 100644 tests/integration/targets/v2.9/tasks/platform.yml delete mode 100644 tests/integration/targets/v2.9/tasks/power_feed.yml delete mode 100644 tests/integration/targets/v2.9/tasks/power_outlet.yml delete mode 100644 tests/integration/targets/v2.9/tasks/power_outlet_template.yml delete mode 100644 tests/integration/targets/v2.9/tasks/power_panel.yml delete mode 100644 tests/integration/targets/v2.9/tasks/power_port.yml delete mode 100644 tests/integration/targets/v2.9/tasks/power_port_template.yml delete mode 100644 tests/integration/targets/v2.9/tasks/prefix.yml delete mode 100644 tests/integration/targets/v2.9/tasks/provider.yml delete mode 100644 tests/integration/targets/v2.9/tasks/rack.yml delete mode 100644 tests/integration/targets/v2.9/tasks/rack_group.yml delete mode 100644 tests/integration/targets/v2.9/tasks/rack_role.yml delete mode 100644 tests/integration/targets/v2.9/tasks/rear_port.yml delete mode 100644 tests/integration/targets/v2.9/tasks/rear_port_template.yml delete mode 100644 tests/integration/targets/v2.9/tasks/region.yml delete mode 100644 tests/integration/targets/v2.9/tasks/rir.yml delete mode 100644 tests/integration/targets/v2.9/tasks/service.yml delete mode 100644 tests/integration/targets/v2.9/tasks/site.yml delete mode 100644 tests/integration/targets/v2.9/tasks/tag.yml delete mode 100644 tests/integration/targets/v2.9/tasks/tenant.yml delete mode 100644 tests/integration/targets/v2.9/tasks/tenant_group.yml delete mode 100644 tests/integration/targets/v2.9/tasks/virtual_chassis.yml delete mode 100644 tests/integration/targets/v2.9/tasks/virtual_machine.yml delete mode 100644 tests/integration/targets/v2.9/tasks/vlan.yml delete mode 100644 tests/integration/targets/v2.9/tasks/vlan_group.yml delete mode 100644 tests/integration/targets/v2.9/tasks/vm_interface.yml delete mode 100644 tests/integration/targets/v2.9/tasks/vrf.yml delete mode 100644 tests/sanity/ignore-2.10.txt create mode 100644 tests/sanity/ignore-2.11.txt diff --git a/.bandit.yml b/.bandit.yml new file mode 100644 index 00000000..55c6741b --- /dev/null +++ b/.bandit.yml @@ -0,0 +1,5 @@ +--- +skips: [] +# No need to check for security issues in the test scripts! +exclude_dirs: + - "./tests/" diff --git a/.gitignore b/.gitignore index 10842bf2..15b959c0 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ docs/_build/* .python-version pb.*.yml .DS_Store +.env # https://github.com/ansible/ansible/issues/68499 # ansible_collections/ diff --git a/.travis.yml b/.travis.yml index 29ea47a1..fb91b28f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,53 +4,72 @@ services: - docker os: linux -dist: bionic +dist: focal + +stages: + - test + - integration env: global: - COLLECTION_NAMESPACE: "networktocode" - COLLECTION_NAME: "nautobot" - - COLLECTION_VERSION: "2.0.1" + - COLLECTION_VERSION: "3.0.0" + - COMPOSE_PROJECT_NAME: "nautobot_ansible" + +python: + - 3.6 + - 3.7 + - 3.8 + - 3.9 + +install: + - pip install -U pip + - pip install invoke + - invoke start + +script: + - invoke unit jobs: + fast_finish: true include: - - name: "Python 3.6 - Nautobot - Latest PyPi Ansible" + - name: "Python 3.6 - Nautobot 1.0.X - ansible-base 2.10.X" python: 3.6 + stage: integration + env: + - INVOKE_NAUTOBOT_ANSIBLE_PYTHON_VER=3.6 + - INVOKE_NAUTOBOT_ANSIBLE_NAUTOBOT_VER=1.0.3 + script: + - invoke integration + - name: "Python 3.7 - Nautobot 1.1.X - Latest Ansible Core" + python: 3.9 + stage: integration env: - - PYTHON_VER=3.6 - install: - - pip install -U pip + - INVOKE_NAUTOBOT_ANSIBLE_PYTHON_VER=3.7 + - INVOKE_NAUTOBOT_ANSIBLE_NAUTOBOT_VER=1.1.1 + before_script: + - pip uninstall -y virtualenv + - sudo apt update && sudo apt install python3-virtualenv + script: - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - - export PATH=$HOME/.poetry/bin:$PATH - - poetry config virtualenvs.create false && poetry install - -before_script: - - mkdir -p ~/ansible_collections/$COLLECTION_NAMESPACE - - ansible-galaxy collection install community.general -p /home/travis/.ansible/collections - - ansible-galaxy collection build . - - ansible-galaxy collection install $COLLECTION_NAMESPACE-$COLLECTION_NAME*.tar.gz -p /home/travis/.ansible/collections - - # Run all further tests from within the installed directory - # Required to resolve imports of other collections - - cd /home/travis/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME - -script: - # Check python syntax - - black . --check --diff - - # Sanity tests - # --requirements - install pip packages as necessary - # Skip pep8 as we use black instead - - ansible-test sanity -v --requirements --python $PYTHON_VER --skip-test pep8 plugins/ - - # Unit tests, with code coverage - - ansible-test units -v --coverage --python $PYTHON_VER - # Report code coverage - - ansible-test coverage report --all --omit "tests/*,hacking/*,docs/*" --show-missing + - poetry config virtualenvs.create false + - poetry remove ansible-base + - poetry add ansible-core + - invoke integration + # - name: "Python 3.8 - Nautobot 1.1.X - Latest Ansible Core" + # python: 3.8 + # env: + # - INVOKE_NAUTOBOT_ANSIBLE_PYTHON_VER=3.8 + # - INVOKE_NAUTOBOT_ANSIBLE_NAUTOBOT_VER=develop + # script: + # - poetry install ansible-core + # - invoke integration deploy: provider: script - skip_cleanup: true + cleanup: true script: ansible-galaxy collection publish $TRAVIS_BUILD_DIR/$COLLECTION_NAMESPACE-$COLLECTION_NAME-$COLLECTION_VERSION.tar.gz --api-key="$GALAXY_API_TOKEN" on: tags: true diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..b43350bf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,118 @@ +############# +# Dependencies +# +# This base stage just installs the dependencies required for production +# without any development deps. +ARG PYTHON_VER=3.8 +FROM python:${PYTHON_VER} AS base + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update -yqq && apt-get install -yqq shellcheck && apt-get clean + +WORKDIR /usr/src/app + +# Update pip to latest +RUN python -m pip install -U pip + +# Install poetry for dep management +RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python +ENV PATH="$PATH:/root/.poetry/bin" +RUN poetry config virtualenvs.create false + +# Install project manifest +COPY pyproject.toml . + +# Install poetry.lock from which to build +COPY poetry.lock . + +# Install all dependencies +RUN poetry install + +# Allow for flexible Python versions, for broader testing +ARG PYTHON_VER +ENV PYTHON_VERSION=${PYTHON_VER} + +# Set a custom collection path for all ansible commands +# Note: This only allows for one path, not colon-separated, because we use it +# elsewhere +ARG ANSIBLE_COLLECTIONS_PATH=/usr/share/ansible/collections +ENV ANSIBLE_COLLECTIONS_PATH=${ANSIBLE_COLLECTIONS_PATH} + +# For Module unit tests as we use some testing features avaiable in this collection +RUN ansible-galaxy collection install community.general + +# Copy in the application source and everything not explicitly banned by +# .dockerignore +COPY . . + +######### +# Linting +# +# Runs all necessary linting and code checks +FROM base AS lint + + +# We should look into pylint/flake8, etc. in the future +# RUN echo 'Running Flake8' && \ +# flake8 . && \ +RUN echo 'Running Black' && \ + black --check --diff . && \ + # Removed and running Pylint in unit tests after project has been created + # echo 'Running Pylint' && \ + # find . -name '*.py' | xargs pylint && \ + echo 'Running Bandit' && \ + bandit --recursive ./ --configfile .bandit.yml + + +############ +# Unit Tests +# +# This test stage runs true unit tests (no outside services) at build time, as +# well as enforcing codestyle and performing fast syntax checks. It is built +# into an image with docker-compose for running the full test suite. +FROM base AS unittests + +ARG PYTHON_VER=3.8 +ENV PYTHON_VERSION=${PYTHON_VER} + +# Allows for custom command line arguments to be passed to ansible-test (like -vvv) +ARG ANSIBLE_SANITY_ARGS +ENV ANSIBLE_SANITY_ARGS=${ANSIBLE_SANITY_ARGS} +ARG ANSIBLE_UNIT_ARGS +ENV ANSIBLE_UNIT_ARGS=${ANSIBLE_UNIT_ARGS} + +# Ansible sanity and unit tests +# +# Runs the sanity and unit tests inside the container build context to isolate +# thsoe tests from all runtime influences + +# Build Collection to run ansible-tests against +RUN ansible-galaxy collection build --output-path ./dist/ . + +# Install built library +RUN ansible-galaxy collection install ./dist/networktocode*.tar.gz + +# Switch to the collection path for tests +WORKDIR ${ANSIBLE_COLLECTIONS_PATH}/ansible_collections/networktocode/nautobot + +# Run sanity tests +RUN ansible-test sanity $ANSIBLE_SANITY_ARGS \ + --requirements \ + --skip-test pep8 \ + --python ${PYTHON_VER} \ + plugins/ + +# Run unit tests +RUN ansible-test units $ANSIBLE_UNIT_ARGS --coverage --python $PYTHON_VERSION + +############ +# Integration Tests +FROM unittests AS integration + +ARG ANSIBLE_INTEGRATION_ARGS +ENV ANSIBLE_INTEGRATION_ARGS=${ANSIBLE_INTEGRATION_ARGS} + +# Integration test entrypoint +ENTRYPOINT ${ANSIBLE_COLLECTIONS_PATH}/ansible_collections/networktocode/nautobot/tests/integration/entrypoint.sh + +CMD ["--help"] diff --git a/README.md b/README.md index ad58e2ac..1942bc67 100644 --- a/README.md +++ b/README.md @@ -14,4 +14,4 @@ To keep the code simple, we only officially support the two latest releases of N We have a new docs site live that can be found [here](https://nautobot-ansible.readthedocs.io/en/latest/). -> This is a fork of the netbox.netbox Ansible Galaxy collection found at [https://github.com/netbox-community/ansible_modules](https://github.com/netbox-community/ansible_modules) in February, 2021 \ No newline at end of file +> This is a fork of the netbox.netbox Ansible Galaxy collection found at [https://github.com/netbox-community/ansible_modules](https://github.com/netbox-community/ansible_modules) in February, 2021 diff --git a/development/dev.env b/development/dev.env new file mode 100644 index 00000000..79d49669 --- /dev/null +++ b/development/dev.env @@ -0,0 +1,31 @@ +NAUTOBOT_CREATE_SUPERUSER="true" +NAUTOBOT_SUPERUSER_NAME="admin" +NAUTOBOT_SUPERUSER_PASSWORD="admin" +NAUTOBOT_SUPERUSER_API_TOKEN="0123456789abcdef0123456789abcdef01234567" + +NAUTOBOT_ALLOWED_HOSTS=* +NAUTOBOT_CHANGELOG_RETENTION=0 +NAUTOBOT_CONFIG=/opt/nautobot/nautobot_config.py +NAUTOBOT_DB_HOST=postgres +NAUTOBOT_DB_NAME=nautobot +NAUTOBOT_DB_PASSWORD=decinablesprewad +NAUTOBOT_DB_USER=nautobot +NAUTOBOT_DB_TIMEOUT=300 +NAUTOBOT_DB_ENGINE=django.db.backends.postgresql +NAUTOBOT_MAX_PAGE_SIZE=0 +NAUTOBOT_NAPALM_TIMEOUT=5 +NAUTOBOT_REDIS_HOST=redis +NAUTOBOT_REDIS_PASSWORD=decinablesprewad +NAUTOBOT_REDIS_PORT=6379 +# Uncomment REDIS_SSL if using SSL +# NAUTOBOT_REDIS_SSL=True +NAUTOBOT_SECRET_KEY=0123456789abcdef0123456789abcdef01234567 + +# Needed for Postgres should match the values for Nautobot above +PGPASSWORD=decinablesprewad +POSTGRES_DB=nautobot +POSTGRES_PASSWORD=decinablesprewad +POSTGRES_USER=nautobot + +# Needed for Redis should match the values for Nautobot above +REDIS_PASSWORD=decinablesprewad \ No newline at end of file diff --git a/development/docker-compose.yml b/development/docker-compose.yml new file mode 100644 index 00000000..3e9f911c --- /dev/null +++ b/development/docker-compose.yml @@ -0,0 +1,32 @@ +version: "3" +services: + nautobot: + image: "ghcr.io/nautobot/nautobot:${NAUTOBOT_VER}-py${PYTHON_VER}" + command: "nautobot-server runserver 0.0.0.0:8000" + ports: + - "8000:8000" + depends_on: + - "postgres" + - "redis" + env_file: + - "./dev.env" + tty: true + worker: + image: "ghcr.io/nautobot/nautobot:${NAUTOBOT_VER}-py${PYTHON_VER}" + entrypoint: "nautobot-server rqworker" + depends_on: + - "nautobot" + env_file: + - "./dev.env" + tty: true + postgres: + image: "postgres:13" + env_file: + - "./dev.env" + redis: + image: "redis:6-alpine" + command: + - "sh" + - "-c" # this is to evaluate the $REDIS_PASSWORD from the env + - "redis-server --appendonly yes --requirepass $$REDIS_PASSWORD" ## $$ because of docker-compose + env_file: "./dev.env" \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..0a7d47e1 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,38 @@ +--- +version: "3.4" +x-args: &args + PYTHON_VER: ${PYTHON_VER:-3.8} +# Build block with context and target default +x-build: &build + args: *args + context: . + target: unittests +x-service: &service + environment: + ANSIBLE_INTEGRATION_ARGS: ${ANSIBLE_INTEGRATION_ARGS:-} + ANSIBLE_SANITY_ARGS: ${ANSIBLE_SANITY_ARGS:-} + ANSIBLE_UNIT_ARGS: ${ANSIBLE_UNIT_ARGS:-} + +services: + unit: + <<: *service + build: + <<: *build + + lint: + <<: *service + build: + <<: *build + target: lint + + integration: + <<: *service + build: + <<: *build + target: integration + +# Attach these services to the Nautobot network that gets spun up from invoke start +networks: + default: + external: + name: nautobot_ansible_default \ No newline at end of file diff --git a/docs/getting_started/contributing/modules/index.rst b/docs/getting_started/contributing/modules/index.rst index 98df3d43..99c14e0c 100644 --- a/docs/getting_started/contributing/modules/index.rst +++ b/docs/getting_started/contributing/modules/index.rst @@ -7,4 +7,5 @@ Contributing Modules to the Ansible Collection Module Architecture Creating a New Ansible Module - Adding New Module Options \ No newline at end of file + Adding New Module Options + Running Tests Locally \ No newline at end of file diff --git a/docs/getting_started/contributing/modules/testing_locally.rst b/docs/getting_started/contributing/modules/testing_locally.rst new file mode 100644 index 00000000..304092eb --- /dev/null +++ b/docs/getting_started/contributing/modules/testing_locally.rst @@ -0,0 +1,66 @@ +========================== +Testing Locally +========================== + +Testing Locally Overview +------------------------------ + +We provide the ability to run the tests locally to make sure the CI/CD pipeline will pass without having to wait for the CI/CD to run. + +The tests are provided by enabling the environment using Poetry to provide the Invoke commands to run the tests. + +Invoke Tasks +---------------------- + +You can get the list of available Invoke commands available for running the tests after launching `poetry shell`. + +```shell +❯ poetry shell +``` + +```shell +❯ invoke --list +Available tasks: + + cli Launch a bash shell inside the running Nautobot container. + createsuperuser Create a new Nautobot superuser account (default: "admin"), will prompt for password. + debug Start Nautobot and its dependencies in debug mode. + destroy Destroy all containers and volumes. + integration Run all tests including integration tests + lint Run linting tools + makemigrations Perform makemigrations operation in Django. + migrate Perform migrate operation in Django. + nbshell Launch an interactive nbshell session. + post-upgrade Performs Nautobot common post-upgrade operations using a single entrypoint. + restart Gracefully restart all containers. + start Start Nautobot and its dependencies in detached mode. + stop Stop Nautobot and its dependencies. + unit Run unit tests +``` + +To start the Nautobot services to run the integration tests against, run the `invoke start` command. + +```shell +❯ invoke start +Starting Nautobot in detached mode... +Running docker-compose command "up --detach" +Creating network "nautobot_ansible_default" with the default driver +Creating nautobot_ansible_postgres_1 ... done +Creating nautobot_ansible_redis_1 ... done +Creating nautobot_ansible_nautobot_1 ... done +Creating nautobot_ansible_worker_1 ... done +``` + +You can then run `invoke integration` to run the integration tests against Nautobot. + +``` +❯ invoke integration +``` + +Using Environment Variables +------------------------------ + +You can use the following environment variables to test against different Python or Nautobot version. + +- **INVOKE_NAUTOBOT_ANSIBLE_NAUTOBOT_VER** +- **INVOKE_NAUTOBOT_ANSIBLE_PYTHON_VER** diff --git a/galaxy.yml b/galaxy.yml index 272d3534..df856584 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -59,13 +59,7 @@ homepage: https://nautobot-ansible.readthedocs.io/en/latest/ # The URL to the collection issue tracker issues: https://github.com/nautobot/nautobot-ansible/issues -# Files to ignore when building collection. Only supported when building with Ansible 2.10 -# https://github.com/ansible/ansible/issues/67543 -# https://docs.ansible.com/ansible/devel/dev_guide/developing_collections.html#ignoring-files-and-folders build_ignore: - - "venv" - - "ansible_collections" - - "tests/output" - ".pytest_cache" - ".vscode" - "*.tar.gz" diff --git a/plugins/action/query_graphql.py b/plugins/action/query_graphql.py index 1bd2499a..ca3fac54 100644 --- a/plugins/action/query_graphql.py +++ b/plugins/action/query_graphql.py @@ -4,9 +4,16 @@ import os +from ansible.module_utils.six import raise_from from ansible.errors import AnsibleError from ansible.plugins.action import ActionBase -import pynautobot + +try: + import pynautobot +except ImportError as imp_exc: + PYNAUTOBOT_IMPORT_ERROR = imp_exc +else: + PYNAUTOBOT_IMPORT_ERROR = None from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( NautobotApiBase, @@ -100,6 +107,12 @@ def run(self, tmp=None, task_vars=None): tmp ([type], optional): [description]. Defaults to None. task_vars ([type], optional): [description]. Defaults to None. """ + if PYNAUTOBOT_IMPORT_ERROR: + raise_from( + AnsibleError("pynautobot must be installed to use this plugin"), + PYNAUTOBOT_IMPORT_ERROR, + ) + self._supports_check_mode = False self._supports_async = False diff --git a/plugins/lookup/lookup.py b/plugins/lookup/lookup.py index 2773d984..c20f1ef8 100644 --- a/plugins/lookup/lookup.py +++ b/plugins/lookup/lookup.py @@ -19,9 +19,22 @@ from ansible.plugins.lookup import LookupBase from ansible.parsing.splitter import parse_kv, split_args from ansible.utils.display import Display +from ansible.module_utils.six import raise_from + +try: + import pynautobot +except ImportError as imp_exc: + PYNAUTOBOT_IMPORT_ERROR = imp_exc +else: + PYNAUTOBOT_IMPORT_ERROR = None + +try: + import requests +except ImportError as imp_exc: + REQUESTS_IMPORT_ERROR = imp_exc +else: + REQUESTS_IMPORT_ERROR = None -import pynautobot -import requests __metaclass__ = type @@ -164,6 +177,7 @@ def get_endpoint(nautobot, term): "power-connections": {"endpoint": nautobot.dcim.power_connections}, "power-outlet-templates": {"endpoint": nautobot.dcim.power_outlet_templates}, "power-outlets": {"endpoint": nautobot.dcim.power_outlets}, + "power-panels": {"endpoint": nautobot.dcim.power_panels}, "power-port-templates": {"endpoint": nautobot.dcim.power_port_templates}, "power-ports": {"endpoint": nautobot.dcim.power_ports}, "prefixes": {"endpoint": nautobot.ipam.prefixes}, @@ -179,6 +193,7 @@ def get_endpoint(nautobot, term): "roles": {"endpoint": nautobot.ipam.roles}, "services": {"endpoint": nautobot.ipam.services}, "sites": {"endpoint": nautobot.dcim.sites}, + "statuses": {"endpoint": nautobot.extras.statuses}, "tags": {"endpoint": nautobot.extras.tags}, "tenant-groups": {"endpoint": nautobot.tenancy.tenant_groups}, "tenants": {"endpoint": nautobot.tenancy.tenants}, @@ -272,6 +287,16 @@ class LookupModule(LookupBase): """ def run(self, terms, variables=None, **kwargs): + if PYNAUTOBOT_IMPORT_ERROR: + raise_from( + AnsibleError("pynautobot must be installed to use this plugin"), + PYNAUTOBOT_IMPORT_ERROR, + ) + if REQUESTS_IMPORT_ERROR: + raise_from( + AnsibleError("requests must be installed to use this plugin"), + REQUESTS_IMPORT_ERROR, + ) api_token = kwargs.get("token") or os.getenv("NAUTOBOT_TOKEN") api_endpoint = kwargs.get("api_endpoint") or os.getenv("NAUTOBOT_URL") diff --git a/plugins/lookup/lookup_graphql.py b/plugins/lookup/lookup_graphql.py index f0d4395e..aa2299be 100644 --- a/plugins/lookup/lookup_graphql.py +++ b/plugins/lookup/lookup_graphql.py @@ -7,8 +7,15 @@ import os from ansible.plugins.lookup import LookupBase -from ansible.errors import AnsibleLookupError -import pynautobot +from ansible.errors import AnsibleLookupError, AnsibleError +from ansible.module_utils.six import raise_from + +try: + import pynautobot +except ImportError as imp_exc: + PYNAUTOBOT_IMPORT_ERROR = imp_exc +else: + PYNAUTOBOT_IMPORT_ERROR = None try: from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( @@ -197,6 +204,12 @@ def run(self, query, variables=None, graph_variables=None, **kwargs): Returns: dict: Data returned from GraphQL endpoint """ + if PYNAUTOBOT_IMPORT_ERROR: + raise_from( + AnsibleError("pynautobot must be installed to use this plugin"), + PYNAUTOBOT_IMPORT_ERROR, + ) + # Query comes in as a list, this needs to be moved to string for pynautobot lookup_info = nautobot_lookup_graphql( query=query[0], diff --git a/plugins/module_utils/dcim.py b/plugins/module_utils/dcim.py index 794807b1..b46f8136 100644 --- a/plugins/module_utils/dcim.py +++ b/plugins/module_utils/dcim.py @@ -106,17 +106,21 @@ def run(self): elif data.get("slug"): name = data["slug"] elif endpoint_name == "cable": - if self.module.params["data"]["termination_a"].get("name"): - termination_a_name = self.module.params["data"]["termination_a"]["name"] - elif self.module.params["data"]["termination_a"].get("slug"): - termination_a_name = self.module.params["data"]["termination_a"]["slug"] + if self.module.params["termination_a"].get("name"): + termination_a_name = self.module.params["termination_a"]["name"] + elif self.module.params["termination_a"].get("slug"): + termination_a_name = self.module.params["termination_a"]["slug"] + elif self.module.params["termination_a"].get("circuit"): + termination_a_name = self.module.params["termination_a"]["circuit"] else: termination_a_name = data.get("termination_a_id") - if self.module.params["data"]["termination_b"].get("name"): - termination_b_name = self.module.params["data"]["termination_b"]["name"] - elif self.module.params["data"]["termination_b"].get("slug"): - termination_b_name = self.module.params["data"]["termination_b"]["slug"] + if self.module.params["termination_b"].get("name"): + termination_b_name = self.module.params["termination_b"]["name"] + elif self.module.params["termination_b"].get("slug"): + termination_b_name = self.module.params["termination_b"]["slug"] + elif self.module.params["termination_a"].get("circuit"): + termination_a_name = self.module.params["termination_b"]["circuit"] else: termination_b_name = data.get("termination_b_id") diff --git a/plugins/module_utils/utils.py b/plugins/module_utils/utils.py index 04d5f19c..8c648014 100644 --- a/plugins/module_utils/utils.py +++ b/plugins/module_utils/utils.py @@ -107,6 +107,7 @@ parent_region="slug", power_panel="name", power_port="name", + power_port_template="name", platform="slug", prefix_role="slug", primary_ip="address", @@ -174,6 +175,7 @@ "parent_region": "regions", "power_panel": "power_panels", "power_port": "power_ports", + "power_port_template": "power_port_templates", "prefix_role": "roles", "primary_ip": "ip_addresses", "primary_ip4": "ip_addresses", @@ -394,6 +396,7 @@ "cluster_group": "group", "parent_rack_group": "parent", "parent_region": "parent", + "power_port_template": "power_port", "prefix_role": "role", "rack_group": "group", "rack_role": "role", @@ -495,7 +498,7 @@ def _build_payload(self, data, remove_keys): """ keys_to_remove = set(NAUTOBOT_ARG_SPEC) if remove_keys: - keys_to_remove.extend(remove_keys) + keys_to_remove.update(remove_keys) return {k: v for k, v in data.items() if k not in keys_to_remove} @@ -595,8 +598,7 @@ def _handle_errors(self, msg): Returns message and changed = False :params msg (str): Message indicating why there is no change """ - if msg: - self.module.fail_json(msg=msg, changed=False) + self.module.fail_json(msg=msg, changed=False) def _build_diff(self, before=None, after=None): """Builds diff of before and after changes""" @@ -800,7 +802,7 @@ def _fetch_choice_value(self, search, endpoint): msg="Failed to fetch endpoint choices to validate against. This requires a write-enabled token. Make sure the token is write-enabled. If looking to fetch only information, use either the inventory or lookup plugin." ) - choices = [x for x in chain.from_iterable(endpoint_choices.values())] + choices = list(chain.from_iterable(endpoint_choices.values())) for item in choices: if item["display"].lower() == search.lower(): @@ -873,7 +875,11 @@ def _find_ids(self, data, user_query_params): elif isinstance(v, list): id_list = list() for list_item in v: - if k == "tags" and isinstance(list_item, str): + if ( + k == "tags" + and isinstance(list_item, str) + and not self.is_valid_uuid(list_item) + ): temp_dict = {"slug": self._to_slug(list_item)} elif isinstance(list_item, dict): norm_data = self._normalize_data(list_item) @@ -939,15 +945,16 @@ def _normalize_data(self, data): for k, v in data.items(): if isinstance(v, dict): if v.get("id"): - try: - data[k] = int(v["id"]) - except (ValueError, TypeError): - pass - else: - for subk, subv in v.items(): - sub_data_type = QUERY_TYPES.get(subk, "q") - if sub_data_type == "slug": - data[k][subk] = self._to_slug(subv) + if self.is_valid_uuid(v["id"]): + data[k] = v["id"] + continue + else: + self._handle_errors(f"Invalid ID passed for {k}: {v['id']}") + + for subk, subv in v.items(): + sub_data_type = QUERY_TYPES.get(subk, "q") + if sub_data_type == "slug": + data[k][subk] = self._to_slug(subv) else: data_type = QUERY_TYPES.get(k, "q") if data_type == "slug": diff --git a/plugins/modules/aggregate.py b/plugins/modules/aggregate.py index c7a1203e..2208c221 100644 --- a/plugins/modules/aggregate.py +++ b/plugins/modules/aggregate.py @@ -63,6 +63,7 @@ - "Any tags that the aggregate may need to be associated with" required: false type: list + elements: raw custom_fields: description: - "must exist in Nautobot" @@ -157,7 +158,7 @@ def main(): rir=dict(required=False, type="raw"), date_added=dict(required=False, type="str"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/circuit.py b/plugins/modules/circuit.py index e7f12473..b7863732 100644 --- a/plugins/modules/circuit.py +++ b/plugins/modules/circuit.py @@ -89,6 +89,7 @@ - Any tags that the device may need to be associated with required: false type: list + elements: raw custom_fields: description: - must exist in Nautobot @@ -194,7 +195,7 @@ def main(): commit_rate=dict(required=False, type="int"), description=dict(required=False, type="str"), comments=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/cluster.py b/plugins/modules/cluster.py index 5f8700d0..187914a6 100644 --- a/plugins/modules/cluster.py +++ b/plugins/modules/cluster.py @@ -73,6 +73,7 @@ - Any tags that the cluster may need to be associated with required: false type: list + elements: raw custom_fields: description: - must exist in Nautobot @@ -177,7 +178,7 @@ def main(): site=dict(required=False, type="raw"), tenant=dict(required=False, type="raw"), comments=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/console_port.py b/plugins/modules/console_port.py index 79acec2e..d14f58c0 100644 --- a/plugins/modules/console_port.py +++ b/plugins/modules/console_port.py @@ -78,6 +78,7 @@ - Any tags that the console port may need to be associated with required: false type: list + elements: raw state: description: - Use C(present) or C(absent) for adding or removing. @@ -184,7 +185,7 @@ def main(): type="str", ), description=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/console_server_port.py b/plugins/modules/console_server_port.py index f3e8ac81..2641f768 100644 --- a/plugins/modules/console_server_port.py +++ b/plugins/modules/console_server_port.py @@ -78,6 +78,7 @@ - Any tags that the console server port may need to be associated with required: false type: list + elements: raw state: description: - Use C(present) or C(absent) for adding or removing. @@ -184,7 +185,7 @@ def main(): type="str", ), description=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/device_bay.py b/plugins/modules/device_bay.py index b18d58a2..ad5db259 100644 --- a/plugins/modules/device_bay.py +++ b/plugins/modules/device_bay.py @@ -63,6 +63,7 @@ - Any tags that the device bay may need to be associated with required: false type: list + elements: raw state: description: - Use C(present) or C(absent) for adding or removing. @@ -150,7 +151,7 @@ def main(): name=dict(required=True, type="str"), description=dict(required=False, type="str"), installed_device=dict(required=False, type="raw"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/device_interface.py b/plugins/modules/device_interface.py index 4a4d5c3e..50d0778b 100644 --- a/plugins/modules/device_interface.py +++ b/plugins/modules/device_interface.py @@ -111,6 +111,7 @@ - Any tags that the interface may need to be associated with required: false type: list + elements: raw update_vc_child: type: bool default: False @@ -259,13 +260,15 @@ def main(): mode=dict(required=False, type="raw"), untagged_vlan=dict(required=False, type="raw"), tagged_vlans=dict(required=False, type="raw"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), ) ) module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) - device_interface = NautobotDcimModule(module, NB_INTERFACES) + device_interface = NautobotDcimModule( + module, NB_INTERFACES, remove_keys=["update_vc_child"] + ) device_interface.run() diff --git a/plugins/modules/device_type.py b/plugins/modules/device_type.py index 854728a0..108433ea 100644 --- a/plugins/modules/device_type.py +++ b/plugins/modules/device_type.py @@ -90,6 +90,7 @@ - Any tags that the device type may need to be associated with required: false type: list + elements: raw custom_fields: description: - must exist in Nautobot @@ -194,7 +195,7 @@ def main(): type="str", ), comments=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/front_port.py b/plugins/modules/front_port.py index 9be48664..36829917 100644 --- a/plugins/modules/front_port.py +++ b/plugins/modules/front_port.py @@ -89,6 +89,7 @@ - Any tags that the front port may need to be associated with required: false type: list + elements: raw state: description: - Use C(present) or C(absent) for adding or removing. @@ -204,7 +205,7 @@ def main(): rear_port=dict(required=True, type="raw"), rear_port_position=dict(required=False, type="int"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/inventory_item.py b/plugins/modules/inventory_item.py index 1a7b3980..b9214a6a 100644 --- a/plugins/modules/inventory_item.py +++ b/plugins/modules/inventory_item.py @@ -84,6 +84,7 @@ - Any tags that the device may need to be associated with required: false type: list + elements: raw state: description: - Use C(present) or C(absent) for adding or removing. @@ -180,7 +181,7 @@ def main(): asset_tag=dict(required=False, type="str"), description=dict(required=False, type="str"), discovered=dict(required=False, type="bool", default=False), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/ip_address.py b/plugins/modules/ip_address.py index bd647eaf..4b5a9a58 100644 --- a/plugins/modules/ip_address.py +++ b/plugins/modules/ip_address.py @@ -128,6 +128,7 @@ - Any tags that the IP address may need to be associated with required: false type: list + elements: raw custom_fields: description: - must exist in Nautobot @@ -303,7 +304,7 @@ def main(): virtual_machine=dict(required=False, type="str"), ), ), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/power_feed.py b/plugins/modules/power_feed.py index 2632e8a6..68f15e3a 100644 --- a/plugins/modules/power_feed.py +++ b/plugins/modules/power_feed.py @@ -108,6 +108,7 @@ - Any tags that the power feed may need to be associated with required: false type: list + elements: raw custom_fields: description: - must exist in Nautobot @@ -217,7 +218,7 @@ def main(): amperage=dict(required=False, type="int"), max_utilization=dict(required=False, type="int"), comments=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/power_outlet.py b/plugins/modules/power_outlet.py index 08cc22f0..85fc35ed 100644 --- a/plugins/modules/power_outlet.py +++ b/plugins/modules/power_outlet.py @@ -133,6 +133,7 @@ - Any tags that the power outlet may need to be associated with required: false type: list + elements: raw state: description: - Use C(present) or C(absent) for adding or removing. @@ -284,7 +285,7 @@ def main(): power_port=dict(required=False, type="raw"), feed_leg=dict(required=False, choices=["A", "B", "C"], type="str"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/power_outlet_template.py b/plugins/modules/power_outlet_template.py index 5f1be4db..32fe6397 100644 --- a/plugins/modules/power_outlet_template.py +++ b/plugins/modules/power_outlet_template.py @@ -109,7 +109,7 @@ - hdot-cx required: false type: str - power_port: + power_port_template: description: - The attached power port required: false @@ -270,7 +270,7 @@ def main(): ], type="str", ), - power_port=dict(required=False, type="raw"), + power_port_template=dict(required=False, type="raw"), feed_leg=dict(required=False, choices=["A", "B", "C"], type="str"), ) ) diff --git a/plugins/modules/power_port.py b/plugins/modules/power_port.py index daaef8d6..805d3f3e 100644 --- a/plugins/modules/power_port.py +++ b/plugins/modules/power_port.py @@ -129,6 +129,7 @@ - Any tags that the power port may need to be associated with required: false type: list + elements: raw state: description: - Use C(present) or C(absent) for adding or removing. @@ -280,7 +281,7 @@ def main(): allocated_draw=dict(required=False, type="int"), maximum_draw=dict(required=False, type="int"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/prefix.py b/plugins/modules/prefix.py index 92735a01..744e3fc3 100644 --- a/plugins/modules/prefix.py +++ b/plugins/modules/prefix.py @@ -106,6 +106,7 @@ - Any tags that the prefix may need to be associated with required: false type: list + elements: raw custom_fields: description: - Must exist in Nautobot and in key/value format @@ -263,7 +264,7 @@ def main(): prefix_role=dict(required=False, type="raw"), is_pool=dict(required=False, type="bool"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), custom_fields=dict(required=False, type="dict"), first_available=dict(required=False, type="bool", default=False), ) diff --git a/plugins/modules/provider.py b/plugins/modules/provider.py index 75068f55..36432e3d 100644 --- a/plugins/modules/provider.py +++ b/plugins/modules/provider.py @@ -78,6 +78,7 @@ - Any tags that the device may need to be associated with required: false type: list + elements: raw custom_fields: description: - must exist in Nautobot @@ -175,7 +176,7 @@ def main(): noc_contact=dict(required=False, type="str"), admin_contact=dict(required=False, type="str"), comments=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), custom_fields=dict(required=False, type="dict"), ), ) diff --git a/plugins/modules/rack.py b/plugins/modules/rack.py index db55b4fb..9aa92998 100644 --- a/plugins/modules/rack.py +++ b/plugins/modules/rack.py @@ -142,6 +142,7 @@ - Any tags that the rack may need to be associated with required: false type: list + elements: raw custom_fields: description: - must exist in Nautobot @@ -250,7 +251,7 @@ def main(): required=False, type="str", choices=["Millimeters", "Inches",], ), comments=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/rear_port.py b/plugins/modules/rear_port.py index 06d3f4db..3acee201 100644 --- a/plugins/modules/rear_port.py +++ b/plugins/modules/rear_port.py @@ -84,6 +84,7 @@ - Any tags that the rear port may need to be associated with required: false type: list + elements: raw state: description: - Use C(present) or C(absent) for adding or removing. @@ -195,7 +196,7 @@ def main(): ), positions=dict(required=False, type="int"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/route_target.py b/plugins/modules/route_target.py index a4d46de2..ab529aeb 100644 --- a/plugins/modules/route_target.py +++ b/plugins/modules/route_target.py @@ -58,6 +58,7 @@ - Any tags that the device may need to be associated with required: false type: list + elements: raw custom_fields: description: - must exist in Nautobot @@ -160,7 +161,7 @@ def main(): name=dict(required=True, type="str"), tenant=dict(required=False, type="raw"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/service.py b/plugins/modules/service.py index 8fb880a9..e01ad345 100644 --- a/plugins/modules/service.py +++ b/plugins/modules/service.py @@ -77,6 +77,7 @@ - What tags to add/update required: false type: list + elements: raw custom_fields: description: - Must exist in Nautobot and in key/value format @@ -116,7 +117,8 @@ token: token device: Test666 name: node-exporter - port: 9100 + ports: + - 9100 protocol: TCP ipaddresses: - address: 127.0.0.1 @@ -136,7 +138,8 @@ token: token device: Test666 name: node-exporter - ports: 9100 + ports: + - 9100 protocol: TCP state: absent """ @@ -166,7 +169,7 @@ def main(): protocol=dict(required=True, type="raw"), ipaddresses=dict(required=False, type="raw"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/site.py b/plugins/modules/site.py index c3f9eb92..fade215f 100644 --- a/plugins/modules/site.py +++ b/plugins/modules/site.py @@ -128,6 +128,7 @@ - Any tags that the prefix may need to be associated with required: false type: list + elements: raw custom_fields: description: - must exist in Nautobot @@ -247,7 +248,7 @@ def main(): contact_email=dict(required=False, type="str"), comments=dict(required=False, type="str"), slug=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/tenant.py b/plugins/modules/tenant.py index 06ae5f60..3019a8ae 100644 --- a/plugins/modules/tenant.py +++ b/plugins/modules/tenant.py @@ -68,6 +68,7 @@ - Any tags that the tenant may need to be associated with required: false type: list + elements: raw custom_fields: description: - must exist in Nautobot @@ -166,7 +167,7 @@ def main(): description=dict(required=False, type="str"), comments=dict(required=False, type="str"), slug=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/virtual_chassis.py b/plugins/modules/virtual_chassis.py index 67aa3547..ce92e86d 100644 --- a/plugins/modules/virtual_chassis.py +++ b/plugins/modules/virtual_chassis.py @@ -59,6 +59,7 @@ - Any tags that the virtual chassis may need to be associated with required: false type: list + elements: raw state: description: - Use C(present) or C(absent) for adding or removing. @@ -143,7 +144,7 @@ def main(): name=dict(required=True, type="str"), master=dict(required=False, type="raw"), domain=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/virtual_machine.py b/plugins/modules/virtual_machine.py index 59447613..c000c431 100644 --- a/plugins/modules/virtual_machine.py +++ b/plugins/modules/virtual_machine.py @@ -103,6 +103,7 @@ - Any tags that the virtual machine may need to be associated with required: false type: list + elements: raw custom_fields: description: - Must exist in Nautobot @@ -226,7 +227,7 @@ def main(): memory=dict(required=False, type="int"), disk=dict(required=False, type="int"), status=dict(required=False, type="raw"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), custom_fields=dict(required=False, type="dict"), local_context_data=dict(required=False, type="dict"), comments=dict(required=False, type="str"), diff --git a/plugins/modules/vlan.py b/plugins/modules/vlan.py index 0f8e432a..51f4224f 100644 --- a/plugins/modules/vlan.py +++ b/plugins/modules/vlan.py @@ -83,6 +83,7 @@ - Any tags that the vlan may need to be associated with required: false type: list + elements: raw custom_fields: description: - must exist in Nautobot @@ -188,7 +189,7 @@ def main(): status=dict(required=False, type="raw"), vlan_role=dict(required=False, type="raw"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/vm_interface.py b/plugins/modules/vm_interface.py index 23101dc4..f610294b 100644 --- a/plugins/modules/vm_interface.py +++ b/plugins/modules/vm_interface.py @@ -88,6 +88,7 @@ - Any tags that the prefix may need to be associated with required: false type: list + elements: raw state: description: - Use C(present) or C(absent) for adding or removing. @@ -191,7 +192,7 @@ def main(): mode=dict(required=False, type="raw"), untagged_vlan=dict(required=False, type="raw"), tagged_vlans=dict(required=False, type="raw"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/vrf.py b/plugins/modules/vrf.py index 2513df17..7072d02b 100644 --- a/plugins/modules/vrf.py +++ b/plugins/modules/vrf.py @@ -82,6 +82,7 @@ - Any tags that the vrf may need to be associated with required: false type: list + elements: raw custom_fields: description: - must exist in Nautobot @@ -183,7 +184,7 @@ def main(): import_targets=dict(required=False, type="list", elements="str"), export_targets=dict(required=False, type="list", elements="str"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list"), + tags=dict(required=False, type="list", elements="raw"), custom_fields=dict(required=False, type="dict"), ) ) diff --git a/poetry.lock b/poetry.lock index cdc4b45b..e8507cf4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -111,7 +111,7 @@ python-versions = "*" [[package]] name = "astroid" -version = "2.6.5" +version = "2.6.6" description = "An abstract syntax tree for Python with inference support." category = "dev" optional = false @@ -172,6 +172,21 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" [package.dependencies] pytz = ">=2015.7" +[[package]] +name = "bandit" +version = "1.7.0" +description = "Security oriented static analyser for python code." +category = "dev" +optional = false +python-versions = ">=3.5" + +[package.dependencies] +colorama = {version = ">=0.3.9", markers = "platform_system == \"Windows\""} +GitPython = ">=1.0.1" +PyYAML = ">=5.3.1" +six = ">=1.10.0" +stevedore = ">=1.20.0" + [[package]] name = "black" version = "19.10b0" @@ -221,7 +236,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "charset-normalizer" -version = "2.0.3" +version = "2.0.4" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." category = "dev" optional = false @@ -244,7 +259,7 @@ importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} [[package]] name = "codecov" -version = "2.1.11" +version = "2.1.12" description = "Hosted coverage reports for GitHub, Bitbucket and Gitlab" category = "dev" optional = false @@ -327,6 +342,29 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [package.extras] testing = ["pre-commit"] +[[package]] +name = "gitdb" +version = "4.0.7" +description = "Git Object Database" +category = "dev" +optional = false +python-versions = ">=3.4" + +[package.dependencies] +smmap = ">=3.0.1,<5" + +[[package]] +name = "gitpython" +version = "3.1.20" +description = "Python Git Library" +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +gitdb = ">=4.0.1,<5" +typing-extensions = {version = ">=3.7.4.3", markers = "python_version < \"3.10\""} + [[package]] name = "hypothesis" version = "6.14.5" @@ -416,6 +454,14 @@ category = "dev" optional = false python-versions = "*" +[[package]] +name = "invoke" +version = "1.6.0" +description = "Pythonic task execution" +category = "dev" +optional = false +python-versions = "*" + [[package]] name = "isort" version = "5.8.0" @@ -523,6 +569,14 @@ category = "dev" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" +[[package]] +name = "pbr" +version = "5.6.0" +description = "Python Build Reasonableness" +category = "dev" +optional = false +python-versions = ">=2.6" + [[package]] name = "perky" version = "0.5.5" @@ -587,7 +641,7 @@ python-versions = ">=3.5" [[package]] name = "pylint" -version = "2.9.5" +version = "2.9.6" description = "python code static checker" category = "dev" optional = false @@ -716,7 +770,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" [[package]] name = "regex" -version = "2021.7.6" +version = "2021.8.3" description = "Alternative regular expression module, to replace re." category = "dev" optional = false @@ -775,6 +829,14 @@ category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +[[package]] +name = "smmap" +version = "4.0.0" +description = "A pure Python implementation of a sliding window memory map manager" +category = "dev" +optional = false +python-versions = ">=3.5" + [[package]] name = "snowballstemmer" version = "2.1.0" @@ -908,6 +970,18 @@ python-versions = ">=3.5" lint = ["flake8", "mypy", "docutils-stubs"] test = ["pytest"] +[[package]] +name = "stevedore" +version = "3.3.0" +description = "Manage dynamic plugins for Python applications" +category = "dev" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +importlib-metadata = {version = ">=1.7.0", markers = "python_version < \"3.8\""} +pbr = ">=2.0.0,<2.1.0 || >2.1.0" + [[package]] name = "toml" version = "0.10.2" @@ -992,7 +1066,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes [metadata] lock-version = "1.1" python-versions = "^3.6" -content-hash = "7fadf74c54d42653202d455b46156c7efa536d8bdda42710b418684de76637c0" +content-hash = "b185ee1290ba99bd422a475c514051f15af9034fe61765a2668d8dba6754e6e3" [metadata.files] aiocontextvars = [ @@ -1062,8 +1136,8 @@ appdirs = [ {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, ] astroid = [ - {file = "astroid-2.6.5-py3-none-any.whl", hash = "sha256:7b963d1c590d490f60d2973e57437115978d3a2529843f160b5003b721e1e925"}, - {file = "astroid-2.6.5.tar.gz", hash = "sha256:83e494b02d75d07d4e347b27c066fd791c0c74fc96c613d1ea3de0c82c48168f"}, + {file = "astroid-2.6.6-py3-none-any.whl", hash = "sha256:ab7f36e8a78b8e54a62028ba6beef7561db4cdb6f2a5009ecc44a6f42b5697ef"}, + {file = "astroid-2.6.6.tar.gz", hash = "sha256:3975a0bd5373bdce166e60c851cfcbaf21ee96de80ec518c1f4cb3e94c3fb334"}, ] async-timeout = [ {file = "async-timeout-3.0.1.tar.gz", hash = "sha256:0c3c816a028d47f659d6ff5c745cb2acf1f966da1fe5c19c77a70282b25f4c5f"}, @@ -1085,6 +1159,10 @@ babel = [ {file = "Babel-2.9.1-py2.py3-none-any.whl", hash = "sha256:ab49e12b91d937cd11f0b67cb259a57ab4ad2b59ac7a3b41d6c06c0ac5b0def9"}, {file = "Babel-2.9.1.tar.gz", hash = "sha256:bc0c176f9f6a994582230df350aa6e05ba2ebe4b3ac317eab29d9be5d2768da0"}, ] +bandit = [ + {file = "bandit-1.7.0-py3-none-any.whl", hash = "sha256:216be4d044209fa06cf2a3e51b319769a51be8318140659719aa7a115c35ed07"}, + {file = "bandit-1.7.0.tar.gz", hash = "sha256:8a4c7415254d75df8ff3c3b15cfe9042ecee628a1e40b44c15a98890fbfc2608"}, +] black = [ {file = "black-19.10b0-py36-none-any.whl", hash = "sha256:1b30e59be925fafc1ee4565e5e08abef6b03fe455102883820fe5ee2e4734e0b"}, {file = "black-19.10b0.tar.gz", hash = "sha256:c2edb73a08e9e0e6f65a0e6af18b059b8b1cdd5bef997d7a0b181df93dc81539"}, @@ -1145,17 +1223,17 @@ chardet = [ {file = "chardet-4.0.0.tar.gz", hash = "sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa"}, ] charset-normalizer = [ - {file = "charset-normalizer-2.0.3.tar.gz", hash = "sha256:c46c3ace2d744cfbdebceaa3c19ae691f53ae621b39fd7570f59d14fb7f2fd12"}, - {file = "charset_normalizer-2.0.3-py3-none-any.whl", hash = "sha256:88fce3fa5b1a84fdcb3f603d889f723d1dd89b26059d0123ca435570e848d5e1"}, + {file = "charset-normalizer-2.0.4.tar.gz", hash = "sha256:f23667ebe1084be45f6ae0538e4a5a865206544097e4e8bbcacf42cd02a348f3"}, + {file = "charset_normalizer-2.0.4-py3-none-any.whl", hash = "sha256:0c8911edd15d19223366a194a513099a302055a962bca2cec0f54b8b63175d8b"}, ] click = [ {file = "click-8.0.1-py3-none-any.whl", hash = "sha256:fba402a4a47334742d782209a7c79bc448911afe1149d07bdabdf480b3e2f4b6"}, {file = "click-8.0.1.tar.gz", hash = "sha256:8c04c11192119b1ef78ea049e0a6f0463e4c48ef00a30160c704337586f3ad7a"}, ] codecov = [ - {file = "codecov-2.1.11-py2.py3-none-any.whl", hash = "sha256:ba8553a82942ce37d4da92b70ffd6d54cf635fc1793ab0a7dc3fecd6ebfb3df8"}, - {file = "codecov-2.1.11-py3.8.egg", hash = "sha256:e95901d4350e99fc39c8353efa450050d2446c55bac91d90fcfd2354e19a6aef"}, - {file = "codecov-2.1.11.tar.gz", hash = "sha256:6cde272454009d27355f9434f4e49f238c0273b216beda8472a65dc4957f473b"}, + {file = "codecov-2.1.12-py2.py3-none-any.whl", hash = "sha256:585dc217dc3d8185198ceb402f85d5cb5dbfa0c5f350a5abcdf9e347776a5b47"}, + {file = "codecov-2.1.12-py3.8.egg", hash = "sha256:782a8e5352f22593cbc5427a35320b99490eb24d9dcfa2155fd99d2b75cfb635"}, + {file = "codecov-2.1.12.tar.gz", hash = "sha256:a0da46bb5025426da895af90938def8ee12d37fcbcbbbc15b6dc64cf7ebc51c1"}, ] colorama = [ {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, @@ -1224,6 +1302,14 @@ execnet = [ {file = "execnet-1.9.0-py2.py3-none-any.whl", hash = "sha256:a295f7cc774947aac58dde7fdc85f4aa00c42adf5d8f5468fc630c1acf30a142"}, {file = "execnet-1.9.0.tar.gz", hash = "sha256:8f694f3ba9cc92cab508b152dcfe322153975c29bda272e2fd7f3f00f36e47c5"}, ] +gitdb = [ + {file = "gitdb-4.0.7-py3-none-any.whl", hash = "sha256:6c4cc71933456991da20917998acbe6cf4fb41eeaab7d6d67fbc05ecd4c865b0"}, + {file = "gitdb-4.0.7.tar.gz", hash = "sha256:96bf5c08b157a666fec41129e6d327235284cca4c81e92109260f353ba138005"}, +] +gitpython = [ + {file = "GitPython-3.1.20-py3-none-any.whl", hash = "sha256:b1e1c269deab1b08ce65403cf14e10d2ef1f6c89e33ea7c5e5bb0222ea593b8a"}, + {file = "GitPython-3.1.20.tar.gz", hash = "sha256:df0e072a200703a65387b0cfdf0466e3bab729c0458cf6b7349d0e9877636519"}, +] hypothesis = [ {file = "hypothesis-6.14.5-py3-none-any.whl", hash = "sha256:cc4efbce2446fa6f04ce55bb20d53dcfef9cf2187ec51332aac2c30306f537e2"}, {file = "hypothesis-6.14.5.tar.gz", hash = "sha256:0563b9711fd9bf478cb591580a575c369d2c396f283efa85d0f9a75b26db65b5"}, @@ -1264,6 +1350,11 @@ iniconfig = [ {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, ] +invoke = [ + {file = "invoke-1.6.0-py2-none-any.whl", hash = "sha256:e6c9917a1e3e73e7ea91fdf82d5f151ccfe85bf30cc65cdb892444c02dbb5f74"}, + {file = "invoke-1.6.0-py3-none-any.whl", hash = "sha256:769e90caeb1bd07d484821732f931f1ad8916a38e3f3e618644687fc09cb6317"}, + {file = "invoke-1.6.0.tar.gz", hash = "sha256:374d1e2ecf78981da94bfaf95366216aaec27c2d6a7b7d5818d92da55aa258d3"}, +] isort = [ {file = "isort-5.8.0-py3-none-any.whl", hash = "sha256:2bb1680aad211e3c9944dbce1d4ba09a989f04e238296c87fe2139faa26d655d"}, {file = "isort-5.8.0.tar.gz", hash = "sha256:0a943902919f65c5684ac4e0154b1ad4fac6dcaa5d9f3426b732f1c8b5419be6"}, @@ -1394,6 +1485,10 @@ pathspec = [ {file = "pathspec-0.9.0-py2.py3-none-any.whl", hash = "sha256:7d15c4ddb0b5c802d161efc417ec1a2558ea2653c2e8ad9c19098201dc1c993a"}, {file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"}, ] +pbr = [ + {file = "pbr-5.6.0-py2.py3-none-any.whl", hash = "sha256:c68c661ac5cc81058ac94247278eeda6d2e6aecb3e227b0387c30d277e7ef8d4"}, + {file = "pbr-5.6.0.tar.gz", hash = "sha256:42df03e7797b796625b1029c0400279c7c34fd7df24a7d7818a1abb5b38710dd"}, +] perky = [ {file = "perky-0.5.5-py3-none-any.whl", hash = "sha256:29857b816d4d02bfb9cb875f07424af66b93c06d9e610943b25b2d50b75888e4"}, {file = "perky-0.5.5.tar.gz", hash = "sha256:7998a8131fd2313ce948e27e290e49764837d99dd6133e2ee88f05e12561aaa1"}, @@ -1439,8 +1534,8 @@ pygments = [ {file = "Pygments-2.9.0.tar.gz", hash = "sha256:a18f47b506a429f6f4b9df81bb02beab9ca21d0a5fee38ed15aef65f0545519f"}, ] pylint = [ - {file = "pylint-2.9.5-py3-none-any.whl", hash = "sha256:748f81e5776d6273a6619506e08f1b48ff9bcb8198366a56821cf11aac14fc87"}, - {file = "pylint-2.9.5.tar.gz", hash = "sha256:1f333dc72ef7f5ea166b3230936ebcfb1f3b722e76c980cb9fe6b9f95e8d3172"}, + {file = "pylint-2.9.6-py3-none-any.whl", hash = "sha256:2e1a0eb2e8ab41d6b5dbada87f066492bb1557b12b76c47c2ee8aa8a11186594"}, + {file = "pylint-2.9.6.tar.gz", hash = "sha256:8b838c8983ee1904b2de66cce9d0b96649a91901350e956d78f289c3bc87b48e"}, ] pynautobot = [ {file = "pynautobot-1.0.2-py3-none-any.whl", hash = "sha256:19dd6fbb4663440f0d890137ff58dd5206cb4452f885f3eba7874888ca22727d"}, @@ -1480,64 +1575,64 @@ pyyaml = [ {file = "PyYAML-5.4.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:bb4191dfc9306777bc594117aee052446b3fa88737cd13b7188d0e7aa8162185"}, {file = "PyYAML-5.4.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:6c78645d400265a062508ae399b60b8c167bf003db364ecb26dcab2bda048253"}, {file = "PyYAML-5.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:4e0583d24c881e14342eaf4ec5fbc97f934b999a6828693a99157fde912540cc"}, + {file = "PyYAML-5.4.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:72a01f726a9c7851ca9bfad6fd09ca4e090a023c00945ea05ba1638c09dc3347"}, + {file = "PyYAML-5.4.1-cp36-cp36m-manylinux2014_s390x.whl", hash = "sha256:895f61ef02e8fed38159bb70f7e100e00f471eae2bc838cd0f4ebb21e28f8541"}, {file = "PyYAML-5.4.1-cp36-cp36m-win32.whl", hash = "sha256:3bd0e463264cf257d1ffd2e40223b197271046d09dadf73a0fe82b9c1fc385a5"}, {file = "PyYAML-5.4.1-cp36-cp36m-win_amd64.whl", hash = "sha256:e4fac90784481d221a8e4b1162afa7c47ed953be40d31ab4629ae917510051df"}, {file = "PyYAML-5.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:5accb17103e43963b80e6f837831f38d314a0495500067cb25afab2e8d7a4018"}, {file = "PyYAML-5.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:e1d4970ea66be07ae37a3c2e48b5ec63f7ba6804bdddfdbd3cfd954d25a82e63"}, + {file = "PyYAML-5.4.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:cb333c16912324fd5f769fff6bc5de372e9e7a202247b48870bc251ed40239aa"}, + {file = "PyYAML-5.4.1-cp37-cp37m-manylinux2014_s390x.whl", hash = "sha256:fe69978f3f768926cfa37b867e3843918e012cf83f680806599ddce33c2c68b0"}, {file = "PyYAML-5.4.1-cp37-cp37m-win32.whl", hash = "sha256:dd5de0646207f053eb0d6c74ae45ba98c3395a571a2891858e87df7c9b9bd51b"}, {file = "PyYAML-5.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:08682f6b72c722394747bddaf0aa62277e02557c0fd1c42cb853016a38f8dedf"}, {file = "PyYAML-5.4.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d2d9808ea7b4af864f35ea216be506ecec180628aced0704e34aca0b040ffe46"}, {file = "PyYAML-5.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:8c1be557ee92a20f184922c7b6424e8ab6691788e6d86137c5d93c1a6ec1b8fb"}, + {file = "PyYAML-5.4.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:fd7f6999a8070df521b6384004ef42833b9bd62cfee11a09bda1079b4b704247"}, + {file = "PyYAML-5.4.1-cp38-cp38-manylinux2014_s390x.whl", hash = "sha256:bfb51918d4ff3d77c1c856a9699f8492c612cde32fd3bcd344af9be34999bfdc"}, {file = "PyYAML-5.4.1-cp38-cp38-win32.whl", hash = "sha256:fa5ae20527d8e831e8230cbffd9f8fe952815b2b7dae6ffec25318803a7528fc"}, {file = "PyYAML-5.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:0f5f5786c0e09baddcd8b4b45f20a7b5d61a7e7e99846e3c799b05c7c53fa696"}, {file = "PyYAML-5.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:294db365efa064d00b8d1ef65d8ea2c3426ac366c0c4368d930bf1c5fb497f77"}, {file = "PyYAML-5.4.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:74c1485f7707cf707a7aef42ef6322b8f97921bd89be2ab6317fd782c2d53183"}, + {file = "PyYAML-5.4.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:d483ad4e639292c90170eb6f7783ad19490e7a8defb3e46f97dfe4bacae89122"}, + {file = "PyYAML-5.4.1-cp39-cp39-manylinux2014_s390x.whl", hash = "sha256:fdc842473cd33f45ff6bce46aea678a54e3d21f1b61a7750ce3c498eedfe25d6"}, {file = "PyYAML-5.4.1-cp39-cp39-win32.whl", hash = "sha256:49d4cdd9065b9b6e206d0595fee27a96b5dd22618e7520c33204a4a3239d5b10"}, {file = "PyYAML-5.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:c20cfa2d49991c8b4147af39859b167664f2ad4561704ee74c1de03318e898db"}, {file = "PyYAML-5.4.1.tar.gz", hash = "sha256:607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e"}, ] regex = [ - {file = "regex-2021.7.6-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:e6a1e5ca97d411a461041d057348e578dc344ecd2add3555aedba3b408c9f874"}, - {file = "regex-2021.7.6-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:6afe6a627888c9a6cfbb603d1d017ce204cebd589d66e0703309b8048c3b0854"}, - {file = "regex-2021.7.6-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:ccb3d2190476d00414aab36cca453e4596e8f70a206e2aa8db3d495a109153d2"}, - {file = "regex-2021.7.6-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:ed693137a9187052fc46eedfafdcb74e09917166362af4cc4fddc3b31560e93d"}, - {file = "regex-2021.7.6-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:99d8ab206a5270c1002bfcf25c51bf329ca951e5a169f3b43214fdda1f0b5f0d"}, - {file = "regex-2021.7.6-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:b85ac458354165405c8a84725de7bbd07b00d9f72c31a60ffbf96bb38d3e25fa"}, - {file = "regex-2021.7.6-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:3f5716923d3d0bfb27048242a6e0f14eecdb2e2a7fac47eda1d055288595f222"}, - {file = "regex-2021.7.6-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e5983c19d0beb6af88cb4d47afb92d96751fb3fa1784d8785b1cdf14c6519407"}, - {file = "regex-2021.7.6-cp36-cp36m-win32.whl", hash = "sha256:c92831dac113a6e0ab28bc98f33781383fe294df1a2c3dfd1e850114da35fd5b"}, - {file = "regex-2021.7.6-cp36-cp36m-win_amd64.whl", hash = "sha256:791aa1b300e5b6e5d597c37c346fb4d66422178566bbb426dd87eaae475053fb"}, - {file = "regex-2021.7.6-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:59506c6e8bd9306cd8a41511e32d16d5d1194110b8cfe5a11d102d8b63cf945d"}, - {file = "regex-2021.7.6-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:564a4c8a29435d1f2256ba247a0315325ea63335508ad8ed938a4f14c4116a5d"}, - {file = "regex-2021.7.6-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:59c00bb8dd8775473cbfb967925ad2c3ecc8886b3b2d0c90a8e2707e06c743f0"}, - {file = "regex-2021.7.6-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:9a854b916806c7e3b40e6616ac9e85d3cdb7649d9e6590653deb5b341a736cec"}, - {file = "regex-2021.7.6-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:db2b7df831c3187a37f3bb80ec095f249fa276dbe09abd3d35297fc250385694"}, - {file = "regex-2021.7.6-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:173bc44ff95bc1e96398c38f3629d86fa72e539c79900283afa895694229fe6a"}, - {file = "regex-2021.7.6-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:15dddb19823f5147e7517bb12635b3c82e6f2a3a6b696cc3e321522e8b9308ad"}, - {file = "regex-2021.7.6-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2ddeabc7652024803666ea09f32dd1ed40a0579b6fbb2a213eba590683025895"}, - {file = "regex-2021.7.6-cp37-cp37m-win32.whl", hash = "sha256:f080248b3e029d052bf74a897b9d74cfb7643537fbde97fe8225a6467fb559b5"}, - {file = "regex-2021.7.6-cp37-cp37m-win_amd64.whl", hash = "sha256:d8bbce0c96462dbceaa7ac4a7dfbbee92745b801b24bce10a98d2f2b1ea9432f"}, - {file = "regex-2021.7.6-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:edd1a68f79b89b0c57339bce297ad5d5ffcc6ae7e1afdb10f1947706ed066c9c"}, - {file = "regex-2021.7.6-cp38-cp38-manylinux1_i686.whl", hash = "sha256:422dec1e7cbb2efbbe50e3f1de36b82906def93ed48da12d1714cabcd993d7f0"}, - {file = "regex-2021.7.6-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:cbe23b323988a04c3e5b0c387fe3f8f363bf06c0680daf775875d979e376bd26"}, - {file = "regex-2021.7.6-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:0eb2c6e0fcec5e0f1d3bcc1133556563222a2ffd2211945d7b1480c1b1a42a6f"}, - {file = "regex-2021.7.6-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:1c78780bf46d620ff4fff40728f98b8afd8b8e35c3efd638c7df67be2d5cddbf"}, - {file = "regex-2021.7.6-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:bc84fb254a875a9f66616ed4538542fb7965db6356f3df571d783f7c8d256edd"}, - {file = "regex-2021.7.6-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:598c0a79b4b851b922f504f9f39a863d83ebdfff787261a5ed061c21e67dd761"}, - {file = "regex-2021.7.6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:875c355360d0f8d3d827e462b29ea7682bf52327d500a4f837e934e9e4656068"}, - {file = "regex-2021.7.6-cp38-cp38-win32.whl", hash = "sha256:e586f448df2bbc37dfadccdb7ccd125c62b4348cb90c10840d695592aa1b29e0"}, - {file = "regex-2021.7.6-cp38-cp38-win_amd64.whl", hash = "sha256:2fe5e71e11a54e3355fa272137d521a40aace5d937d08b494bed4529964c19c4"}, - {file = "regex-2021.7.6-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6110bab7eab6566492618540c70edd4d2a18f40ca1d51d704f1d81c52d245026"}, - {file = "regex-2021.7.6-cp39-cp39-manylinux1_i686.whl", hash = "sha256:4f64fc59fd5b10557f6cd0937e1597af022ad9b27d454e182485f1db3008f417"}, - {file = "regex-2021.7.6-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:89e5528803566af4df368df2d6f503c84fbfb8249e6631c7b025fe23e6bd0cde"}, - {file = "regex-2021.7.6-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:2366fe0479ca0e9afa534174faa2beae87847d208d457d200183f28c74eaea59"}, - {file = "regex-2021.7.6-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:f9392a4555f3e4cb45310a65b403d86b589adc773898c25a39184b1ba4db8985"}, - {file = "regex-2021.7.6-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:2bceeb491b38225b1fee4517107b8491ba54fba77cf22a12e996d96a3c55613d"}, - {file = "regex-2021.7.6-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:f98dc35ab9a749276f1a4a38ab3e0e2ba1662ce710f6530f5b0a6656f1c32b58"}, - {file = "regex-2021.7.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:319eb2a8d0888fa6f1d9177705f341bc9455a2c8aca130016e52c7fe8d6c37a3"}, - {file = "regex-2021.7.6-cp39-cp39-win32.whl", hash = "sha256:eaf58b9e30e0e546cdc3ac06cf9165a1ca5b3de8221e9df679416ca667972035"}, - {file = "regex-2021.7.6-cp39-cp39-win_amd64.whl", hash = "sha256:4c9c3155fe74269f61e27617529b7f09552fbb12e44b1189cebbdb24294e6e1c"}, - {file = "regex-2021.7.6.tar.gz", hash = "sha256:8394e266005f2d8c6f0bc6780001f7afa3ef81a7a2111fa35058ded6fce79e4d"}, + {file = "regex-2021.8.3-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:8764a78c5464ac6bde91a8c87dd718c27c1cabb7ed2b4beaf36d3e8e390567f9"}, + {file = "regex-2021.8.3-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4551728b767f35f86b8e5ec19a363df87450c7376d7419c3cac5b9ceb4bce576"}, + {file = "regex-2021.8.3-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:577737ec3d4c195c4aef01b757905779a9e9aee608fa1cf0aec16b5576c893d3"}, + {file = "regex-2021.8.3-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:c856ec9b42e5af4fe2d8e75970fcc3a2c15925cbcc6e7a9bcb44583b10b95e80"}, + {file = "regex-2021.8.3-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3835de96524a7b6869a6c710b26c90e94558c31006e96ca3cf6af6751b27dca1"}, + {file = "regex-2021.8.3-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:cea56288eeda8b7511d507bbe7790d89ae7049daa5f51ae31a35ae3c05408531"}, + {file = "regex-2021.8.3-cp36-cp36m-win32.whl", hash = "sha256:a4eddbe2a715b2dd3849afbdeacf1cc283160b24e09baf64fa5675f51940419d"}, + {file = "regex-2021.8.3-cp36-cp36m-win_amd64.whl", hash = "sha256:57fece29f7cc55d882fe282d9de52f2f522bb85290555b49394102f3621751ee"}, + {file = "regex-2021.8.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:a5c6dbe09aff091adfa8c7cfc1a0e83fdb8021ddb2c183512775a14f1435fe16"}, + {file = "regex-2021.8.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ff4a8ad9638b7ca52313d8732f37ecd5fd3c8e3aff10a8ccb93176fd5b3812f6"}, + {file = "regex-2021.8.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b63e3571b24a7959017573b6455e05b675050bbbea69408f35f3cb984ec54363"}, + {file = "regex-2021.8.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:fbc20975eee093efa2071de80df7f972b7b35e560b213aafabcec7c0bd00bd8c"}, + {file = "regex-2021.8.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:14caacd1853e40103f59571f169704367e79fb78fac3d6d09ac84d9197cadd16"}, + {file = "regex-2021.8.3-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:bb350eb1060591d8e89d6bac4713d41006cd4d479f5e11db334a48ff8999512f"}, + {file = "regex-2021.8.3-cp37-cp37m-win32.whl", hash = "sha256:18fdc51458abc0a974822333bd3a932d4e06ba2a3243e9a1da305668bd62ec6d"}, + {file = "regex-2021.8.3-cp37-cp37m-win_amd64.whl", hash = "sha256:026beb631097a4a3def7299aa5825e05e057de3c6d72b139c37813bfa351274b"}, + {file = "regex-2021.8.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:16d9eaa8c7e91537516c20da37db975f09ac2e7772a0694b245076c6d68f85da"}, + {file = "regex-2021.8.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3905c86cc4ab6d71635d6419a6f8d972cab7c634539bba6053c47354fd04452c"}, + {file = "regex-2021.8.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:937b20955806381e08e54bd9d71f83276d1f883264808521b70b33d98e4dec5d"}, + {file = "regex-2021.8.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:28e8af338240b6f39713a34e337c3813047896ace09d51593d6907c66c0708ba"}, + {file = "regex-2021.8.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3c09d88a07483231119f5017904db8f60ad67906efac3f1baa31b9b7f7cca281"}, + {file = "regex-2021.8.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:85f568892422a0e96235eb8ea6c5a41c8ccbf55576a2260c0160800dbd7c4f20"}, + {file = "regex-2021.8.3-cp38-cp38-win32.whl", hash = "sha256:bf6d987edd4a44dd2fa2723fca2790f9442ae4de2c8438e53fcb1befdf5d823a"}, + {file = "regex-2021.8.3-cp38-cp38-win_amd64.whl", hash = "sha256:8fe58d9f6e3d1abf690174fd75800fda9bdc23d2a287e77758dc0e8567e38ce6"}, + {file = "regex-2021.8.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:7976d410e42be9ae7458c1816a416218364e06e162b82e42f7060737e711d9ce"}, + {file = "regex-2021.8.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9569da9e78f0947b249370cb8fadf1015a193c359e7e442ac9ecc585d937f08d"}, + {file = "regex-2021.8.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:459bbe342c5b2dec5c5223e7c363f291558bc27982ef39ffd6569e8c082bdc83"}, + {file = "regex-2021.8.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:4f421e3cdd3a273bace013751c345f4ebeef08f05e8c10757533ada360b51a39"}, + {file = "regex-2021.8.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ea212df6e5d3f60341aef46401d32fcfded85593af1d82b8b4a7a68cd67fdd6b"}, + {file = "regex-2021.8.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:a3b73390511edd2db2d34ff09aa0b2c08be974c71b4c0505b4a048d5dc128c2b"}, + {file = "regex-2021.8.3-cp39-cp39-win32.whl", hash = "sha256:f35567470ee6dbfb946f069ed5f5615b40edcbb5f1e6e1d3d2b114468d505fc6"}, + {file = "regex-2021.8.3-cp39-cp39-win_amd64.whl", hash = "sha256:bfa6a679410b394600eafd16336b2ce8de43e9b13f7fb9247d84ef5ad2b45e91"}, + {file = "regex-2021.8.3.tar.gz", hash = "sha256:8935937dad2c9b369c3d932b0edbc52a62647c2afb2fafc0c280f14a8bf56a6a"}, ] requests = [ {file = "requests-2.26.0-py2.py3-none-any.whl", hash = "sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24"}, @@ -1558,6 +1653,10 @@ six = [ {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, ] +smmap = [ + {file = "smmap-4.0.0-py2.py3-none-any.whl", hash = "sha256:a9a7479e4c572e2e775c404dcd3080c8dc49f39918c2cf74913d30c4c478e3c2"}, + {file = "smmap-4.0.0.tar.gz", hash = "sha256:7e65386bd122d45405ddf795637b7f7d2b532e7e401d46bbe3fb49b9986d5182"}, +] snowballstemmer = [ {file = "snowballstemmer-2.1.0-py2.py3-none-any.whl", hash = "sha256:b51b447bea85f9968c13b650126a888aabd4cb4463fca868ec596826325dedc2"}, {file = "snowballstemmer-2.1.0.tar.gz", hash = "sha256:e997baa4f2e9139951b6f4c631bad912dfd3c792467e2f03d7239464af90e914"}, @@ -1598,6 +1697,10 @@ sphinxcontrib-serializinghtml = [ {file = "sphinxcontrib-serializinghtml-1.1.5.tar.gz", hash = "sha256:aa5f6de5dfdf809ef505c4895e51ef5c9eac17d0f287933eb49ec495280b6952"}, {file = "sphinxcontrib_serializinghtml-1.1.5-py2.py3-none-any.whl", hash = "sha256:352a9a00ae864471d3a7ead8d7d79f5fc0b57e8b3f95e9867eb9eb28999b92fd"}, ] +stevedore = [ + {file = "stevedore-3.3.0-py3-none-any.whl", hash = "sha256:50d7b78fbaf0d04cd62411188fa7eedcb03eb7f4c4b37005615ceebe582aa82a"}, + {file = "stevedore-3.3.0.tar.gz", hash = "sha256:3a5bbd0652bf552748871eaa73a4a8dc2899786bc497a2aa1fcb4dcdb0debeee"}, +] toml = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, diff --git a/pyproject.toml b/pyproject.toml index e2397d0a..0760847a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,8 +27,10 @@ importlib-metadata = "1.7.0" pylint = "^2.6.0" sphinx_rtd_theme = "*" hypothesis = "^6.8.0" -pynautobot = "^1.0.1" +pynautobot = "^1.0.2" pytest-pythonpath = "^0.7.3" +invoke = "^1.6.0" +bandit = "^1.7.0" [build-system] requires = ["poetry-core>=1.0.0"] diff --git a/tasks.py b/tasks.py new file mode 100644 index 00000000..4f2fa551 --- /dev/null +++ b/tasks.py @@ -0,0 +1,223 @@ +"""Tasks for use with Invoke.""" +from distutils.util import strtobool +from invoke import Collection, task as invoke_task +import os + + +def is_truthy(arg): + """Convert "truthy" strings into Booleans. + Examples: + >>> is_truthy('yes') + True + Args: + arg (str): Truthy string (True values are y, yes, t, true, on and 1; false values are n, no, + f, false, off and 0. Raises ValueError if val is anything else. + """ + if isinstance(arg, bool): + return arg + return bool(strtobool(arg)) + + +# Use pyinvoke configuration for default values, see http://docs.pyinvoke.org/en/stable/concepts/configuration.html +# Variables may be overwritten in invoke.yml or by the environment variables INVOKE_NAUTOBOT_ANSIBLE_xxx +namespace = Collection("nautobot_ansible") +namespace.configure( + { + "nautobot_ansible": { + "nautobot_ver": "1.0.3", + "project_name": "nautobot_ansible", + "python_ver": "3.6", + "local": False, + "compose_dir": os.path.join(os.path.dirname(__file__), "development"), + "compose_files": ["docker-compose.yml"], + } + } +) + + +def task(function=None, *args, **kwargs): + """Task decorator to override the default Invoke task decorator and add each task to the invoke namespace.""" + + def task_wrapper(function=None): + """Wrapper around invoke.task to add the task to the namespace as well.""" + if args or kwargs: + task_func = invoke_task(*args, **kwargs)(function) + else: + task_func = invoke_task(function) + namespace.add_task(task_func) + return task_func + + if function: + # The decorator was called with no arguments + return task_wrapper(function) + # The decorator was called with arguments + return task_wrapper + + +def docker_compose(context, command, **kwargs): + """Helper function for running a specific docker-compose command with all appropriate parameters and environment. + Args: + context (obj): Used to run specific commands + command (str): Command string to append to the "docker-compose ..." command, such as "build", "up", etc. + **kwargs: Passed through to the context.run() call. + """ + build_env = { + "NAUTOBOT_VER": context.nautobot_ansible.nautobot_ver, + "PYTHON_VER": context.nautobot_ansible.python_ver, + } + compose_command = f'docker-compose --project-name {context.nautobot_ansible.project_name} --project-directory "{context.nautobot_ansible.compose_dir}"' + for compose_file in context.nautobot_ansible.compose_files: + compose_file_path = os.path.join( + context.nautobot_ansible.compose_dir, compose_file + ) + compose_command += f' -f "{compose_file_path}"' + compose_command += f" {command}" + print(f'Running docker-compose command "{command}"') + return context.run(compose_command, env=build_env, **kwargs) + + +def run_command(context, command, **kwargs): + """Wrapper to run a command locally or inside the nautobot container.""" + if is_truthy(context.nautobot_ansible.local): + context.run(command, **kwargs) + else: + # Check if netbox is running, no need to start another netbox container to run a command + docker_compose_status = "ps --services --filter status=running" + results = docker_compose(context, docker_compose_status, hide="out") + if "nautobot" in results.stdout: + compose_command = f"exec nautobot {command}" + else: + compose_command = f"run --entrypoint '{command}' nautobot" + + docker_compose(context, compose_command, pty=True) + + +# ------------------------------------------------------------------------------ +# START / STOP / DEBUG +# ------------------------------------------------------------------------------ +@task +def debug(context): + """Start Nautobot and its dependencies in debug mode.""" + print("Starting Nautobot in debug mode...") + docker_compose(context, "up") + + +@task +def start(context): + """Start Nautobot and its dependencies in detached mode.""" + print("Starting Nautobot in detached mode...") + docker_compose(context, "up --detach") + + +@task +def restart(context): + """Gracefully restart all containers.""" + print("Restarting Nautobot...") + docker_compose(context, "restart") + + +@task +def stop(context): + """Stop Nautobot and its dependencies.""" + print("Stopping Nautobot...") + docker_compose(context, "down") + + +@task +def destroy(context): + """Destroy all containers and volumes.""" + print("Destroying Nautobot...") + docker_compose(context, "down --volumes") + + +# ------------------------------------------------------------------------------ +# ACTIONS +# ------------------------------------------------------------------------------ +@task +def nbshell(context): + """Launch an interactive nbshell session.""" + command = "nautobot-server nbshell" + run_command(context, command) + + +@task +def cli(context): + """Launch a bash shell inside the running Nautobot container.""" + run_command(context, "bash") + + +@task( + help={"user": "name of the superuser to create (default: admin)",} +) +def createsuperuser(context, user="admin"): + """Create a new Nautobot superuser account (default: "admin"), will prompt for password.""" + command = f"nautobot-server createsuperuser --username {user}" + + run_command(context, command) + + +@task( + help={ + "name": "name of the migration to be created; if unspecified, will autogenerate a name", + } +) +def makemigrations(context, name=""): + """Perform makemigrations operation in Django.""" + command = "nautobot-server makemigrations my_plugin" + + if name: + command += f" --name {name}" + + run_command(context, command) + + +@task +def migrate(context): + """Perform migrate operation in Django.""" + command = "nautobot-server migrate" + + run_command(context, command) + + +@task(help={}) +def post_upgrade(context): + """ + Performs Nautobot common post-upgrade operations using a single entrypoint. + This will run the following management commands with default settings, in order: + - migrate + - trace_paths + - collectstatic + - remove_stale_contenttypes + - clearsessions + - invalidate all + """ + command = "nautobot-server post_upgrade" + + run_command(context, command) + + +# ------------------------------------------------------------------------------ +# TESTING +# ------------------------------------------------------------------------------ +@task +def lint(context): + """Run linting tools""" + context.run( + "docker-compose up --build --force-recreate --quiet-pull --exit-code-from lint lint" + ) + + +@task +def unit(context): + """Run unit tests""" + context.run( + "docker-compose up --build --force-recreate --quiet-pull --exit-code-from unit unit" + ) + + +@task +def integration(context): + """Run all tests including integration tests""" + context.run( + "docker-compose up --build --force-recreate --quiet-pull --exit-code-from integration integration" + ) diff --git a/tests/integration/entrypoint.sh b/tests/integration/entrypoint.sh new file mode 100755 index 00000000..1fcc6743 --- /dev/null +++ b/tests/integration/entrypoint.sh @@ -0,0 +1,40 @@ +#!/bin/bash -eu + +######################################### +# Docker entrypoint for integration tests +# +# This probably is usable locally in a native setup, but it isn't recommended. +# You should manually configure `integration_config.yml` instead and then run +# your tests. + +set -o pipefail + +function render { + readonly template="$1"; shift + readonly content="$(cat "$template")" + + eval "echo \"$content\"" +} + +function main { + echo + echo "# Running integration tests..." + echo + + echo "# Rendering integration configuration" + render "./tests/integration/integration_config.tmpl.yml" > ./tests/integration/integration_config.yml + + echo "# Checking to make sure Nautobot server is reachable.." + timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' nautobot:8000)" != "200" ]]; do echo "waiting for Nautobot"; sleep 5; done' || false + + echo "# Populating Nautobot for running integration tests.." + python ./tests/integration/nautobot-populate.py + + echo "# Running..." + # shellcheck disable=SC2086 + ansible-test integration $ANSIBLE_INTEGRATION_ARGS --coverage --python "$PYTHON_VERSION" regression-latest "$@" + ansible-test integration $ANSIBLE_INTEGRATION_ARGS --coverage --python "$PYTHON_VERSION" latest "$@" + ansible-test coverage report +} + +main "$@" diff --git a/tests/integration/integration_config.tmpl.yml b/tests/integration/integration_config.tmpl.yml new file mode 100644 index 00000000..f9054301 --- /dev/null +++ b/tests/integration/integration_config.tmpl.yml @@ -0,0 +1,3 @@ +--- +nautobot_url: ${NAUTOBOT_URL:-"http://nautobot:8000"} +nautobot_token: ${NAUTOBOT_TOKEN:-"0123456789abcdef0123456789abcdef01234567"} diff --git a/tests/integration/nautobot-populate.py b/tests/integration/nautobot-populate.py index 187556c3..0af6dc8d 100755 --- a/tests/integration/nautobot-populate.py +++ b/tests/integration/nautobot-populate.py @@ -14,8 +14,8 @@ # Set nb variable to connect to Nautobot and use the veriable in future calls -nb_host = os.getenv("PYNAUTOBOT_HOST", "http://localhost:32768") -nb_token = os.getenv("PYNAUTOBOT_TOKEN", "0123456789abcdef0123456789abcdef01234567") +nb_host = os.getenv("NAUTOBOT_URL", "http://nautobot:8000") +nb_token = os.getenv("NAUTOBOT_TOKEN", "0123456789abcdef0123456789abcdef01234567") nb = pynautobot.api(nb_host, nb_token) nb_version = version.parse(nb.version) @@ -40,22 +40,21 @@ def make_nautobot_calls(endpoint, payload): # Create tags used in future tests -if nb_version >= version.parse("2.9"): - create_tags = make_nautobot_calls( - nb.extras.tags, - [ - {"name": "First", "slug": "first"}, - {"name": "Second", "slug": "second"}, - {"name": "Third", "slug": "third"}, - {"name": "Schnozzberry", "slug": "schnozzberry"}, - {"name": "Lookup", "slug": "lookup"}, - {"name": "Nolookup", "slug": "nolookup"}, - {"name": "tagA", "slug": "taga"}, - {"name": "tagB", "slug": "tagb"}, - {"name": "tagC", "slug": "tagc"}, - {"name": "Updated", "slug": "updated"}, - ], - ) +create_tags = make_nautobot_calls( + nb.extras.tags, + [ + {"name": "First", "slug": "first"}, + {"name": "Second", "slug": "second"}, + {"name": "Third", "slug": "third"}, + {"name": "Schnozzberry", "slug": "schnozzberry"}, + {"name": "Lookup", "slug": "lookup"}, + {"name": "Nolookup", "slug": "nolookup"}, + {"name": "tagA", "slug": "taga"}, + {"name": "tagB", "slug": "tagb"}, + {"name": "tagC", "slug": "tagc"}, + {"name": "Updated", "slug": "updated"}, + ], +) # ORDER OF OPERATIONS FOR THE MOST PART @@ -94,14 +93,18 @@ def make_nautobot_calls(endpoint, payload): "slug": "test-site", "tenant": test_tenant.id, "region": test_region.id, + "status": "active", }, - {"name": "Test Site2", "slug": "test-site2"}, + {"name": "Test Site2", "slug": "test-site2", "status": "active"}, ] created_sites = make_nautobot_calls(nb.dcim.sites, sites) ### Site variables to be used later on test_site = nb.dcim.sites.get(slug="test-site") test_site2 = nb.dcim.sites.get(slug="test-site2") +### Create power panel +power_panels = [{"name": "Test Power Panel", "site": test_site.id}] +created_power_panels = make_nautobot_calls(nb.dcim.power_panels, power_panels) ## Create VRFs vrfs = [{"name": "Test VRF", "rd": "1:1"}] @@ -110,8 +113,8 @@ def make_nautobot_calls(endpoint, payload): ## Create PREFIXES prefixes = [ - {"prefix": "192.168.100.0/24", "site": test_site2.id}, - {"prefix": "10.10.0.0/16"}, + {"prefix": "192.168.100.0/24", "site": test_site2.id, "status": "active"}, + {"prefix": "10.10.0.0/16", "status": "active"}, ] created_prefixes = make_nautobot_calls(nb.ipam.prefixes, prefixes) @@ -138,15 +141,16 @@ def make_nautobot_calls(endpoint, payload): ## Create VLANS vlans = [ - {"name": "Wireless", "vid": 100, "site": test_site.id}, - {"name": "Data", "vid": 200, "site": test_site.id}, - {"name": "VoIP", "vid": 300, "site": test_site.id}, + {"name": "Wireless", "vid": 100, "site": test_site.id, "status": "active"}, + {"name": "Data", "vid": 200, "site": test_site.id, "status": "active"}, + {"name": "VoIP", "vid": 300, "site": test_site.id, "status": "active"}, { "name": "Test VLAN", "vid": 400, "site": test_site.id, "tenant": test_tenant.id, "group": test_vlan_group.id, + "status": "active", }, ] created_vlans = make_nautobot_calls(nb.ipam.vlans, vlans) @@ -178,14 +182,14 @@ def make_nautobot_calls(endpoint, payload): "slug": "nexus-parent", "u_height": 0, "manufacturer": cisco_manu.id, - "subdevice_role": True, + "subdevice_role": "parent", }, { "model": "Nexus Child", "slug": "nexus-child", "u_height": 0, "manufacturer": cisco_manu.id, - "subdevice_role": False, + "subdevice_role": "child", }, {"model": "1841", "slug": "1841", "manufacturer": cisco_manu.id,}, ] @@ -197,6 +201,19 @@ def make_nautobot_calls(endpoint, payload): nexus_parent = nb.dcim.device_types.get(slug="nexus-parent") nexus_child = nb.dcim.device_types.get(slug="nexus-child") +# Create Rear Port Template +rear_port_templates = [ + { + "name": "Test Rear Port Template", + "device_type": cisco_test.id, + "type": "bnc", + "positions": 5, + } +] +created_rear_port_templates = make_nautobot_calls( + nb.dcim.rear_port_templates, rear_port_templates +) + ## Create Device Roles device_roles = [ {"name": "Core Switch", "slug": "core-switch", "color": "aa1409", "vm_role": False}, @@ -225,22 +242,31 @@ def make_nautobot_calls(endpoint, payload): ] created_rack_groups = make_nautobot_calls(nb.dcim.rack_groups, rack_groups) +rack_group1 = nb.dcim.rack_groups.get(slug="test-rack-group") +rack_group2 = nb.dcim.rack_groups.get(slug="parent-rack-group") ### Create Rack Group Parent relationship -created_rack_groups[0].parent = created_rack_groups[1] -created_rack_groups[0].save() +rack_group1.parent = rack_group2.id +rack_group1.save() ## Create Rack Roles rack_roles = [{"name": "Test Rack Role", "slug": "test-rack-role", "color": "4287f5"}] created_rack_roles = make_nautobot_calls(nb.dcim.rack_roles, rack_roles) +rack_role1 = nb.dcim.rack_roles.get(slug="test-rack-role") ## Create Racks racks = [ { "name": "Test Rack Site 2", "site": test_site2.id, - "role": created_rack_roles[0].id, + "role": rack_role1.id, + "status": "active", + }, + { + "name": "Test Rack", + "site": test_site.id, + "group": rack_group1.id, + "status": "active", }, - {"name": "Test Rack", "site": test_site.id, "group": created_rack_groups[0].id}, ] created_racks = make_nautobot_calls(nb.dcim.racks, racks) test_rack = nb.dcim.racks.get(name="Test Rack") # racks don't have slugs @@ -255,6 +281,7 @@ def make_nautobot_calls(endpoint, payload): "device_role": core_switch.id, "site": test_site.id, "local_context_data": {"ntp_servers": ["pool.ntp.org"]}, + "status": "active", }, { "name": "TestDeviceR1", @@ -262,6 +289,7 @@ def make_nautobot_calls(endpoint, payload): "device_role": core_switch.id, "site": test_site.id, "rack": test_rack.id, + "status": "active", }, { "name": "R1-Device", @@ -269,29 +297,55 @@ def make_nautobot_calls(endpoint, payload): "device_role": core_switch.id, "site": test_site2.id, "rack": test_rack_site2.id, + "status": "active", }, { "name": "Test Nexus One", "device_type": nexus_parent.id, "device_role": core_switch.id, "site": test_site.id, + "status": "active", }, { "name": "Test Nexus Child One", "device_type": nexus_child.id, "device_role": core_switch.id, "site": test_site.id, + "status": "active", }, ] created_devices = make_nautobot_calls(nb.dcim.devices, devices) ### Device variables to be used later on test100 = nb.dcim.devices.get(name="test100") +### Create rear port +rear_ports = [ + {"name": "Test Rear Port", "device": test100.id, "type": "bnc", "positions": 5} +] +created_rear_ports = make_nautobot_calls(nb.dcim.rear_ports, rear_ports) + +### Create power ports +power_ports = [{"name": "Test Power Port", "device": test100.id}] +created_power_ports = make_nautobot_calls(nb.dcim.power_ports, power_ports) + +### Create console ports +console_ports = [{"name": "Test Console Port", "device": test100.id}] +created_console_ports = make_nautobot_calls(nb.dcim.console_ports, console_ports) + +### Create console server ports +console_server_ports = [{"name": "Test Console Server Port", "device": test100.id}] +created_console_server_ports = make_nautobot_calls( + nb.dcim.console_server_ports, console_server_ports +) + # Create VC, assign member, create initial interface -created_vcs = make_nautobot_calls(nb.dcim.virtual_chassis, {"name": "VC1", "master": 4}) -nexus_child = nb.dcim.devices.get(5) -nexus_child.update({"virtual_chassis": 1, "vc_position": 2}) -nexus = nb.dcim.devices.get(4) +nexus = nb.dcim.devices.get(name="Test Nexus One") +created_vcs = make_nautobot_calls( + nb.dcim.virtual_chassis, {"name": "VC1", "master": nexus.id} +) +vc = nb.dcim.virtual_chassis.get(name="VC1") +nexus_child = nb.dcim.devices.get(name="Test Nexus Child One") +nexus_child.update({"virtual_chassis": vc.id, "vc_position": 2}) nexus.update({"vc_position": 0}) nexus_interfaces = [ {"device": nexus.id, "name": "Ethernet1/1", "type": "1000base-t"}, @@ -305,28 +359,58 @@ def make_nautobot_calls(endpoint, payload): {"name": "GigabitEthernet2", "device": test100.id, "type": "1000base-t"}, ] created_interfaces = make_nautobot_calls(nb.dcim.interfaces, dev_interfaces) +nexus_eth1 = nb.dcim.interfaces.get(device_id=nexus.id, name="Ethernet1/1") +nexus_child_eth1 = nb.dcim.interfaces.get(device_id=nexus_child.id, name="Ethernet2/1") + ## Interface variables to be used later on -test100_gi1 = nb.dcim.interfaces.get(name="GigabitEthernet1", device_id=1) -test100_gi2 = nb.dcim.interfaces.get(name="GigabitEthernet2", device_id=1) +test100_gi1 = nb.dcim.interfaces.get(name="GigabitEthernet1", device_id=test100.id) +test100_gi2 = nb.dcim.interfaces.get(name="GigabitEthernet2", device_id=test100.id) ## Create IP Addresses ip_addresses = [ - {"address": "172.16.180.1/24", "interface": test100_gi1.id}, - {"address": "2001::1:1/64", "interface": test100_gi2.id}, - {"address": "172.16.180.11/24", "interface": created_nexus_interfaces[0].id}, + { + "address": "172.16.180.1/24", + "assigned_object_type": "dcim.interface", + "assigned_object_id": test100_gi1.id, + "status": "active", + }, + { + "address": "2001::1:1/64", + "assigned_object_type": "dcim.interface", + "assigned_object_id": test100_gi2.id, + "status": "active", + }, + { + "address": "172.16.180.11/24", + "assigned_object_type": "dcim.interface", + "assigned_object_id": nexus_eth1.id, + "status": "active", + }, { "address": "172.16.180.12/24", - "interface": created_nexus_interfaces[1].id, + "assigned_object_type": "dcim.interface", + "assigned_object_id": nexus_child_eth1.id, "dns_name": "nexus.example.com", + "status": "active", }, - {"address": "172.16.180.254/24"}, + {"address": "172.16.180.254/24", "status": "active"}, ] created_ip_addresses = make_nautobot_calls(nb.ipam.ip_addresses, ip_addresses) +# Grab first two IPs +ip1 = nb.ipam.ip_addresses.get( + address="172.16.180.1/24", assigned_object_id=test100_gi1.id +) +ip2 = nb.ipam.ip_addresses.get( + address="2001::1:1/64", assigned_object_id=test100_gi2.id +) # Assign Primary IP -nexus.update({"primary_ip4": 4}) +nexus_eth1_ip = nb.ipam.ip_addresses.get( + address="172.16.180.11/24", assigned_object_id=nexus_eth1.id +) +nexus.update({"primary_ip4": nexus_eth1_ip}) ## Create RIRs rirs = [{"name": "Example RIR", "slug": "example-rir"}] @@ -354,7 +438,7 @@ def make_nautobot_calls(endpoint, payload): "group": test_cluster_group.id, "site": test_site.id, }, - {"name": "Test Cluster 2", "type": test_cluster_type.id,}, + {"name": "Test Cluster 2", "type": test_cluster_type.id}, ] created_clusters = make_nautobot_calls(nb.virtualization.clusters, clusters) test_cluster = nb.virtualization.clusters.get(name="Test Cluster") @@ -362,12 +446,12 @@ def make_nautobot_calls(endpoint, payload): ## Create Virtual Machine virtual_machines = [ - {"name": "test100-vm", "cluster": test_cluster.id}, - {"name": "test101-vm", "cluster": test_cluster.id}, - {"name": "test102-vm", "cluster": test_cluster.id}, - {"name": "test103-vm", "cluster": test_cluster.id}, - {"name": "test104-vm", "cluster": test_cluster2.id}, - {"name": "Test VM With Spaces", "cluster": test_cluster2.id}, + {"name": "test100-vm", "cluster": test_cluster.id, "status": "active"}, + {"name": "test101-vm", "cluster": test_cluster.id, "status": "active"}, + {"name": "test102-vm", "cluster": test_cluster.id, "status": "active"}, + {"name": "test103-vm", "cluster": test_cluster.id, "status": "active"}, + {"name": "test104-vm", "cluster": test_cluster2.id, "status": "active"}, + {"name": "Test VM With Spaces", "cluster": test_cluster2.id, "status": "active",}, ] created_virtual_machines = make_nautobot_calls( nb.virtualization.virtual_machines, virtual_machines @@ -401,19 +485,19 @@ def make_nautobot_calls(endpoint, payload): ## Create Services services = [ - {"device": test100.id, "name": "ssh", "port": 22, "protocol": "tcp"}, + {"device": test100.id, "name": "ssh", "ports": [22], "protocol": "tcp"}, { "device": test100.id, "name": "http", - "ports": 80, + "ports": [80], "protocol": "tcp", - "ipaddresses": [created_ip_addresses[0].id, created_ip_addresses[1].id], + "ipaddresses": [ip1.id, ip2.id], }, - {"device": nexus.id, "name": "telnet", "port": 23, "protocol": "tcp"}, + {"device": nexus.id, "name": "telnet", "ports": [23], "protocol": "tcp"}, { "virtual_machine": test_spaces_vm.id, "name": "ssh", - "ports": 22, + "ports": [22], "protocol": "tcp", }, ] @@ -433,11 +517,17 @@ def make_nautobot_calls(endpoint, payload): ## Create Circuit circuits = [ - {"cid": "Test Circuit", "provider": test_provider.id, "type": test_circuit_type.id}, + { + "cid": "Test Circuit", + "provider": test_provider.id, + "type": test_circuit_type.id, + "status": "active", + }, { "cid": "Test Circuit Two", "provider": test_provider.id, "type": test_circuit_type.id, + "status": "active", }, ] created_circuits = make_nautobot_calls(nb.circuits.circuits, circuits) diff --git a/tests/integration/targets/inventory-latest/files/test-inventory-legacy.yml b/tests/integration/targets/inventory-latest/files/test-inventory-legacy.yml index 1c7d97f3..8eed6372 100644 --- a/tests/integration/targets/inventory-latest/files/test-inventory-legacy.yml +++ b/tests/integration/targets/inventory-latest/files/test-inventory-legacy.yml @@ -4,6 +4,6 @@ # Checks that substantial work on the inventory does not diverge from what existing users are using by default. plugin: networktocode.nautobot.inventory -api_endpoint: "http://localhost:32768" +api_endpoint: "http://nautobot:8000" token: "0123456789abcdef0123456789abcdef01234567" validate_certs: false diff --git a/tests/integration/targets/inventory-latest/files/test-inventory-options-flatten.yml b/tests/integration/targets/inventory-latest/files/test-inventory-options-flatten.yml index d559e737..ed7de1c8 100644 --- a/tests/integration/targets/inventory-latest/files/test-inventory-options-flatten.yml +++ b/tests/integration/targets/inventory-latest/files/test-inventory-options-flatten.yml @@ -1,5 +1,5 @@ plugin: networktocode.nautobot.inventory -api_endpoint: "http://localhost:32768" +api_endpoint: "http://nautobot:8000" token: "0123456789abcdef0123456789abcdef01234567" validate_certs: False diff --git a/tests/integration/targets/inventory-latest/files/test-inventory-options.yml b/tests/integration/targets/inventory-latest/files/test-inventory-options.yml index 82bd9b45..d863c3f1 100644 --- a/tests/integration/targets/inventory-latest/files/test-inventory-options.yml +++ b/tests/integration/targets/inventory-latest/files/test-inventory-options.yml @@ -1,5 +1,5 @@ plugin: networktocode.nautobot.inventory -api_endpoint: "http://localhost:32768" +api_endpoint: "http://nautobot:8000" token: "0123456789abcdef0123456789abcdef01234567" validate_certs: False diff --git a/tests/integration/targets/inventory-latest/files/test-inventory-plurals-flatten.yml b/tests/integration/targets/inventory-latest/files/test-inventory-plurals-flatten.yml index fe94f45f..ec4b06c3 100644 --- a/tests/integration/targets/inventory-latest/files/test-inventory-plurals-flatten.yml +++ b/tests/integration/targets/inventory-latest/files/test-inventory-plurals-flatten.yml @@ -1,5 +1,5 @@ plugin: networktocode.nautobot.inventory -api_endpoint: "http://localhost:32768" +api_endpoint: "http://nautobot:8000" token: "0123456789abcdef0123456789abcdef01234567" validate_certs: False diff --git a/tests/integration/targets/inventory-latest/files/test-inventory-plurals.yml b/tests/integration/targets/inventory-latest/files/test-inventory-plurals.yml index 63b6ba66..7bf635cb 100644 --- a/tests/integration/targets/inventory-latest/files/test-inventory-plurals.yml +++ b/tests/integration/targets/inventory-latest/files/test-inventory-plurals.yml @@ -1,5 +1,5 @@ plugin: networktocode.nautobot.inventory -api_endpoint: "http://localhost:32768" +api_endpoint: "http://nautobot:8000" token: "0123456789abcdef0123456789abcdef01234567" validate_certs: false diff --git a/tests/integration/targets/inventory-latest/files/test-inventory.yml b/tests/integration/targets/inventory-latest/files/test-inventory.yml index 659cd598..4954836f 100644 --- a/tests/integration/targets/inventory-latest/files/test-inventory.yml +++ b/tests/integration/targets/inventory-latest/files/test-inventory.yml @@ -1,5 +1,5 @@ plugin: networktocode.nautobot.inventory -api_endpoint: "http://localhost:32768" +api_endpoint: "http://nautobot:8000" token: "0123456789abcdef0123456789abcdef01234567" validate_certs: False diff --git a/tests/integration/targets/inventory-v2.9/.gitignore b/tests/integration/targets/inventory-v2.9/.gitignore deleted file mode 100644 index df76504d..00000000 --- a/tests/integration/targets/inventory-v2.9/.gitignore +++ /dev/null @@ -1 +0,0 @@ -runme_config \ No newline at end of file diff --git a/tests/integration/targets/inventory-v2.9/aliases b/tests/integration/targets/inventory-v2.9/aliases deleted file mode 100644 index a3a2089b..00000000 --- a/tests/integration/targets/inventory-v2.9/aliases +++ /dev/null @@ -1 +0,0 @@ -# https://docs.ansible.com/ansible/devel/dev_guide/testing/sanity/integration-aliases.html diff --git a/tests/integration/targets/inventory-v2.9/compare_inventory_json.py b/tests/integration/targets/inventory-v2.9/compare_inventory_json.py deleted file mode 100755 index e0703c65..00000000 --- a/tests/integration/targets/inventory-v2.9/compare_inventory_json.py +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/env python - -# Inspired by community.aws collection script_inventory_ec2 test -# https://github.com/ansible-collections/community.aws/blob/master/tests/integration/targets/script_inventory_ec2/inventory_diff.py - -from __future__ import absolute_import, division, print_function - -__metaclass__ = type - -import sys -import json -import argparse -from jsondiff import diff -from typing import Iterable -from operator import itemgetter - -# Nautobot includes "created" and "last_updated" times on objects. These end up in the interfaces objects that are included verbatim from the Nautobot API. -# "url" may be different if local tests use a different host/port -# Remove these from files saved in git as test data -KEYS_REMOVE = frozenset(["created", "last_updated", "url"]) - -# Ignore these when performing diffs as they will be different for each test run -KEYS_IGNORE = frozenset() - - -def all_keys_to_ignore(nautobot_version): - keys = KEYS_REMOVE.union(KEYS_IGNORE) - - return keys - - -# Assume the object will not be recursive, as it originally came from JSON -def remove_keys(obj, keys): - - if isinstance(obj, dict): - keys_to_remove = keys.intersection(obj.keys()) - for key in keys_to_remove: - del obj[key] - - for (key, value) in obj.items(): - remove_keys(value, keys) - - elif isinstance(obj, list): - # Iterate over temporary copy, as we may remove items - for item in obj[:]: - if isinstance(item, str) and item in keys: - # List contains a string that we want to remove - # eg. a group name in list of groups - obj.remove(item) - remove_keys(item, keys) - - -def sort_hostvar_arrays(obj): - meta = obj.get("_meta") - if not meta: - return - - hostvars = meta.get("hostvars") - if not hostvars: - return - - for hostname, host in hostvars.items(): - interfaces = host.get("interfaces") - if interfaces: - host["interfaces"] = sorted(interfaces, key=itemgetter("id")) - - services = host.get("services") - if services: - host["services"] = sorted(services, key=itemgetter("id")) - - -def read_json(filename): - with open(filename, "r") as f: - return json.loads(f.read()) - - -def write_json(filename, data): - with open(filename, "w") as f: - json.dump(data, f, indent=4) - - -def main(): - parser = argparse.ArgumentParser(description="Diff Ansible inventory JSON output") - parser.add_argument( - "filename_a", - metavar="ORIGINAL.json", - type=str, - help="Original json to test against", - ) - parser.add_argument( - "filename_b", - metavar="NEW.json", - type=str, - help="Newly generated json to compare against original", - ) - parser.add_argument( - "--write", - action="store_true", - help=( - "When comparing files, various keys are removed. " - "This option will not compare the files, and instead writes ORIGINAL.json to NEW.json after removing these keys. " - "This is used to clean the test json files before saving to the git repo. " - "For example, this removes dates. " - ), - ) - parser.add_argument( - "--nautobot-version", - metavar="VERSION", - type=str, - help=( - "Apply comparison specific to Nautobot version. " - "For example, rack_groups arrays will only contain a single item in v2.7, so are ignored in the comparison." - ), - ) - - args = parser.parse_args() - - data_a = read_json(args.filename_a) - - if args.write: - # When writing test data, only remove "remove_keys" that will change on every git commit. - # This makes diffs more easily readable to ensure changes to test data look correct. - remove_keys(data_a, KEYS_REMOVE) - sort_hostvar_arrays(data_a) - write_json(args.filename_b, data_a) - - else: - data_b = read_json(args.filename_b) - - # Ignore keys that we don't want to diff, in addition to the ones removed that change on every commit - keys = all_keys_to_ignore(args.nautobot_version) - remove_keys(data_a, keys) - remove_keys(data_b, keys) - - sort_hostvar_arrays(data_a) - sort_hostvar_arrays(data_b) - - # Perform the diff - # syntax='symmetric' will produce output that prints both the before and after as "$insert" and "$delete" - # marshal=True removes any special types, allowing to be dumped as json - result = diff(data_a, data_b, marshal=True, syntax="symmetric") - - if result: - # Dictionary is not empty - print differences - print(json.dumps(result, sort_keys=True, indent=4)) - sys.exit(1) - else: - # Success, no differences - sys.exit(0) - - -if __name__ == "__main__": - main() diff --git a/tests/integration/targets/inventory-v2.9/files/test-inventory-legacy.json b/tests/integration/targets/inventory-v2.9/files/test-inventory-legacy.json deleted file mode 100644 index 1f418d5c..00000000 --- a/tests/integration/targets/inventory-v2.9/files/test-inventory-legacy.json +++ /dev/null @@ -1,369 +0,0 @@ -{ - "_meta": { - "hostvars": { - "R1-Device": { - "custom_fields": {}, - "device_roles": [ - "core-switch" - ], - "device_types": [ - "cisco-test" - ], - "is_virtual": false, - "local_context_data": [ - null - ], - "manufacturers": [ - "cisco" - ], - "rack_groups": [], - "rack_role": "test-rack-role", - "racks": [ - "Test Rack Site 2" - ], - "regions": [], - "services": [], - "sites": [ - "test-site2" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "Test Nexus One": { - "ansible_host": "172.16.180.12", - "custom_fields": {}, - "device_roles": [ - "core-switch" - ], - "device_types": [ - "nexus-parent" - ], - "is_virtual": false, - "local_context_data": [ - null - ], - "manufacturers": [ - "cisco" - ], - "primary_ip4": "172.16.180.12", - "regions": [ - "test-region", - "parent-region" - ], - "services": [ - { - "custom_fields": {}, - "description": "", - "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" - }, - "id": 3, - "ipaddresses": [], - "name": "telnet", - "port": 23, - "protocol": { - "label": "TCP", - "value": "tcp" - }, - "tags": [], - "virtual_machine": null - } - ], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "Test VM With Spaces": { - "cluster": "Test Cluster 2", - "cluster_type": "test-cluster-type", - "custom_fields": {}, - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [], - "services": [ - { - "custom_fields": {}, - "description": "", - "device": null, - "id": 4, - "ipaddresses": [], - "name": "ssh", - "port": 22, - "protocol": { - "label": "TCP", - "value": "tcp" - }, - "tags": [], - "virtual_machine": { - "id": 6, - "name": "Test VM With Spaces" - } - } - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "TestDeviceR1": { - "custom_fields": {}, - "device_roles": [ - "core-switch" - ], - "device_types": [ - "cisco-test" - ], - "is_virtual": false, - "local_context_data": [ - null - ], - "manufacturers": [ - "cisco" - ], - "rack_groups": [ - "test-rack-group", - "parent-rack-group" - ], - "racks": [ - "Test Rack" - ], - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test100": { - "custom_fields": {}, - "device_roles": [ - "core-switch" - ], - "device_types": [ - "cisco-test" - ], - "is_virtual": false, - "local_context_data": [ - { - "ntp_servers": [ - "pool.ntp.org" - ] - } - ], - "manufacturers": [ - "cisco" - ], - "regions": [ - "test-region", - "parent-region" - ], - "services": [ - { - "custom_fields": {}, - "description": "", - "device": { - "display": "test100", - "id": 1, - "name": "test100" - }, - "id": 1, - "ipaddresses": [], - "name": "ssh", - "port": 22, - "protocol": { - "label": "TCP", - "value": "tcp" - }, - "tags": [], - "virtual_machine": null - }, - { - "custom_fields": {}, - "description": "", - "device": { - "display": "test100", - "id": 1, - "name": "test100" - }, - "id": 2, - "ipaddresses": [ - { - "address": "172.16.180.1/24", - "family": 4, - "id": 1 - }, - { - "address": "2001::1:1/64", - "family": 6, - "id": 2 - } - ], - "name": "http", - "port": 80, - "protocol": { - "label": "TCP", - "value": "tcp" - }, - "tags": [], - "virtual_machine": null - } - ], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test100-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "custom_fields": {}, - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test101-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "custom_fields": {}, - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test102-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "custom_fields": {}, - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test103-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "custom_fields": {}, - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test104-vm": { - "cluster": "Test Cluster 2", - "cluster_type": "test-cluster-type", - "custom_fields": {}, - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [], - "services": [], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - } - } - }, - "all": { - "children": [ - "ungrouped" - ] - }, - "ungrouped": { - "hosts": [ - "R1-Device", - "Test Nexus One", - "Test VM With Spaces", - "TestDeviceR1", - "test100", - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm", - "test104-vm" - ] - } -} \ No newline at end of file diff --git a/tests/integration/targets/inventory-v2.9/files/test-inventory-legacy.yml b/tests/integration/targets/inventory-v2.9/files/test-inventory-legacy.yml deleted file mode 100644 index 1c7d97f3..00000000 --- a/tests/integration/targets/inventory-v2.9/files/test-inventory-legacy.yml +++ /dev/null @@ -1,9 +0,0 @@ -# To generate the json result, I checked out inventory.yml from the v0.2.0 release 2d6894b, -# and then ran it against this inventory with the latest test data. - -# Checks that substantial work on the inventory does not diverge from what existing users are using by default. - -plugin: networktocode.nautobot.inventory -api_endpoint: "http://localhost:32768" -token: "0123456789abcdef0123456789abcdef01234567" -validate_certs: false diff --git a/tests/integration/targets/inventory-v2.9/files/test-inventory-options-flatten.json b/tests/integration/targets/inventory-v2.9/files/test-inventory-options-flatten.json deleted file mode 100644 index 622344b4..00000000 --- a/tests/integration/targets/inventory-v2.9/files/test-inventory-options-flatten.json +++ /dev/null @@ -1,836 +0,0 @@ -{ - "Test_Cluster": { - "hosts": [ - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm" - ] - }, - "Test_Cluster_2": { - "hosts": [ - "Test VM With Spaces", - "test104-vm" - ] - }, - "Test_Rack": { - "hosts": [ - "TestDeviceR1" - ] - }, - "Test_Rack_Site_2": { - "hosts": [ - "R1-Device" - ] - }, - "_meta": { - "hostvars": { - "R1-Device": { - "device_type": "cisco-test", - "interfaces": [], - "is_virtual": false, - "manufacturer": "cisco", - "rack": "Test Rack Site 2", - "rack_groups": [], - "rack_role": "test-rack-role", - "regions": [], - "role": "core-switch", - "services": [], - "site": "test-site2", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "Test Nexus One": { - "ansible_host": "172.16.180.12", - "device_type": "nexus-parent", - "dns_name": "nexus.example.com", - "interfaces": [ - { - "cable": null, - "connected_endpoint": null, - "connected_endpoint_type": null, - "connection_status": null, - "count_ipaddresses": 1, - "description": "", - "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" - }, - "enabled": true, - "id": 1, - "ip_addresses": [ - { - "address": "172.16.180.11/24", - "custom_fields": {}, - "description": "", - "dns_name": "", - "family": { - "label": "IPv4", - "value": 4 - }, - "id": 3, - "nat_inside": null, - "nat_outside": null, - "role": null, - "status": { - "label": "Active", - "value": "active" - }, - "tags": [], - "tenant": null, - "vrf": null - } - ], - "label": "", - "lag": null, - "mac_address": null, - "mgmt_only": false, - "mode": null, - "mtu": null, - "name": "Ethernet1/1", - "tagged_vlans": [], - "tags": [], - "type": { - "label": "1000BASE-T (1GE)", - "value": "1000base-t" - }, - "untagged_vlan": null - }, - { - "cable": null, - "connected_endpoint": null, - "connected_endpoint_type": null, - "connection_status": null, - "count_ipaddresses": 1, - "description": "", - "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" - }, - "enabled": true, - "id": 2, - "ip_addresses": [ - { - "address": "172.16.180.12/24", - "custom_fields": {}, - "description": "", - "dns_name": "nexus.example.com", - "family": { - "label": "IPv4", - "value": 4 - }, - "id": 4, - "nat_inside": null, - "nat_outside": null, - "role": null, - "status": { - "label": "Active", - "value": "active" - }, - "tags": [], - "tenant": null, - "vrf": null - } - ], - "label": "", - "lag": null, - "mac_address": null, - "mgmt_only": false, - "mode": null, - "mtu": null, - "name": "Ethernet2/1", - "tagged_vlans": [], - "tags": [], - "type": { - "label": "1000BASE-T (1GE)", - "value": "1000base-t" - }, - "untagged_vlan": null - } - ], - "is_virtual": false, - "manufacturer": "cisco", - "primary_ip4": "172.16.180.12", - "regions": [ - "test-region", - "parent-region" - ], - "role": "core-switch", - "services": [ - { - "custom_fields": {}, - "description": "", - "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" - }, - "id": 3, - "ipaddresses": [], - "name": "telnet", - "port": 23, - "protocol": { - "label": "TCP", - "value": "tcp" - }, - "tags": [], - "virtual_machine": null - } - ], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "Test VM With Spaces": { - "cluster": "Test Cluster 2", - "cluster_type": "test-cluster-type", - "interfaces": [ - { - "description": "", - "enabled": true, - "id": 11, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth0", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 6, - "name": "Test VM With Spaces" - } - }, - { - "description": "", - "enabled": true, - "id": 12, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth1", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 6, - "name": "Test VM With Spaces" - } - } - ], - "is_virtual": true, - "regions": [], - "services": [ - { - "custom_fields": {}, - "description": "", - "device": null, - "id": 4, - "ipaddresses": [], - "name": "ssh", - "port": 22, - "protocol": { - "label": "TCP", - "value": "tcp" - }, - "tags": [], - "virtual_machine": { - "id": 6, - "name": "Test VM With Spaces" - } - } - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "TestDeviceR1": { - "device_type": "cisco-test", - "interfaces": [], - "is_virtual": false, - "manufacturer": "cisco", - "rack": "Test Rack", - "rack_groups": [ - "test-rack-group", - "parent-rack-group" - ], - "regions": [ - "test-region", - "parent-region" - ], - "role": "core-switch", - "services": [], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test100": { - "device_type": "cisco-test", - "interfaces": [ - { - "cable": null, - "connected_endpoint": null, - "connected_endpoint_type": null, - "connection_status": null, - "count_ipaddresses": 1, - "description": "", - "device": { - "display": "test100", - "id": 1, - "name": "test100" - }, - "enabled": true, - "id": 3, - "ip_addresses": [ - { - "address": "172.16.180.1/24", - "custom_fields": {}, - "description": "", - "dns_name": "", - "family": { - "label": "IPv4", - "value": 4 - }, - "id": 1, - "nat_inside": null, - "nat_outside": null, - "role": null, - "status": { - "label": "Active", - "value": "active" - }, - "tags": [], - "tenant": null, - "vrf": null - } - ], - "label": "", - "lag": null, - "mac_address": null, - "mgmt_only": false, - "mode": null, - "mtu": null, - "name": "GigabitEthernet1", - "tagged_vlans": [], - "tags": [], - "type": { - "label": "1000BASE-T (1GE)", - "value": "1000base-t" - }, - "untagged_vlan": null - }, - { - "cable": null, - "connected_endpoint": null, - "connected_endpoint_type": null, - "connection_status": null, - "count_ipaddresses": 1, - "description": "", - "device": { - "display": "test100", - "id": 1, - "name": "test100" - }, - "enabled": true, - "id": 4, - "ip_addresses": [ - { - "address": "2001::1:1/64", - "custom_fields": {}, - "description": "", - "dns_name": "", - "family": { - "label": "IPv6", - "value": 6 - }, - "id": 2, - "nat_inside": null, - "nat_outside": null, - "role": null, - "status": { - "label": "Active", - "value": "active" - }, - "tags": [], - "tenant": null, - "vrf": null - } - ], - "label": "", - "lag": null, - "mac_address": null, - "mgmt_only": false, - "mode": null, - "mtu": null, - "name": "GigabitEthernet2", - "tagged_vlans": [], - "tags": [], - "type": { - "label": "1000BASE-T (1GE)", - "value": "1000base-t" - }, - "untagged_vlan": null - } - ], - "is_virtual": false, - "manufacturer": "cisco", - "ntp_servers": [ - "pool.ntp.org" - ], - "regions": [ - "test-region", - "parent-region" - ], - "role": "core-switch", - "services": [ - { - "custom_fields": {}, - "description": "", - "device": { - "display": "test100", - "id": 1, - "name": "test100" - }, - "id": 1, - "ipaddresses": [], - "name": "ssh", - "port": 22, - "protocol": { - "label": "TCP", - "value": "tcp" - }, - "tags": [], - "virtual_machine": null - }, - { - "custom_fields": {}, - "description": "", - "device": { - "display": "test100", - "id": 1, - "name": "test100" - }, - "id": 2, - "ipaddresses": [ - { - "address": "172.16.180.1/24", - "family": 4, - "id": 1 - }, - { - "address": "2001::1:1/64", - "family": 6, - "id": 2 - } - ], - "name": "http", - "port": 80, - "protocol": { - "label": "TCP", - "value": "tcp" - }, - "tags": [], - "virtual_machine": null - } - ], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test100-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "interfaces": [ - { - "description": "", - "enabled": true, - "id": 1, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth0", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 1, - "name": "test100-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 2, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth1", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 1, - "name": "test100-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 3, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth2", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 1, - "name": "test100-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 4, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth3", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 1, - "name": "test100-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 5, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth4", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 1, - "name": "test100-vm" - } - } - ], - "is_virtual": true, - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test101-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "interfaces": [ - { - "description": "", - "enabled": true, - "id": 6, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth0", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 2, - "name": "test101-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 7, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth1", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 2, - "name": "test101-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 8, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth2", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 2, - "name": "test101-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 9, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth3", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 2, - "name": "test101-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 10, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth4", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 2, - "name": "test101-vm" - } - } - ], - "is_virtual": true, - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test102-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "interfaces": [], - "is_virtual": true, - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test103-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "interfaces": [], - "is_virtual": true, - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test104-vm": { - "cluster": "Test Cluster 2", - "cluster_type": "test-cluster-type", - "interfaces": [], - "is_virtual": true, - "regions": [], - "services": [], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - } - } - }, - "all": { - "children": [ - "Test_Cluster", - "Test_Cluster_2", - "Test_Rack", - "Test_Rack_Site_2", - "cisco", - "cisco_test", - "core_switch", - "is_virtual", - "nexus_parent", - "other_region", - "parent_rack_group", - "parent_region", - "test_cluster_group", - "test_cluster_type", - "test_rack_group", - "test_rack_role", - "test_site2", - "ungrouped" - ] - }, - "cisco": { - "hosts": [ - "R1-Device", - "Test Nexus One", - "TestDeviceR1", - "test100" - ] - }, - "cisco_test": { - "hosts": [ - "R1-Device", - "TestDeviceR1", - "test100" - ] - }, - "core_switch": { - "hosts": [ - "R1-Device", - "Test Nexus One", - "TestDeviceR1", - "test100" - ] - }, - "is_virtual": { - "hosts": [ - "Test VM With Spaces", - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm", - "test104-vm" - ] - }, - "nexus_parent": { - "hosts": [ - "Test Nexus One" - ] - }, - "parent_rack_group": { - "hosts": [ - "TestDeviceR1" - ] - }, - "parent_region": { - "children": [ - "test_region" - ] - }, - "test_cluster_group": { - "hosts": [ - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm" - ] - }, - "test_cluster_type": { - "hosts": [ - "Test VM With Spaces", - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm", - "test104-vm" - ] - }, - "test_rack_group": { - "hosts": [ - "TestDeviceR1" - ] - }, - "test_rack_role": { - "hosts": [ - "R1-Device" - ] - }, - "test_region": { - "children": [ - "test_site" - ] - }, - "test_site": { - "hosts": [ - "Test Nexus One", - "TestDeviceR1", - "test100", - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm" - ] - }, - "test_site2": { - "hosts": [ - "R1-Device" - ] - } -} \ No newline at end of file diff --git a/tests/integration/targets/inventory-v2.9/files/test-inventory-options-flatten.yml b/tests/integration/targets/inventory-v2.9/files/test-inventory-options-flatten.yml deleted file mode 100644 index 08d35c09..00000000 --- a/tests/integration/targets/inventory-v2.9/files/test-inventory-options-flatten.yml +++ /dev/null @@ -1,39 +0,0 @@ -plugin: networktocode.nautobot.inventory -api_endpoint: "http://localhost:32768" -token: "0123456789abcdef0123456789abcdef01234567" -validate_certs: False - -# Use cache on this test to make sure interfaces is tested via the cache -cache: True -cache_timeout: 3600 -cache_plugin: jsonfile -cache_connection: /tmp/inventory_nautobot - - -config_context: True -flatten_config_context: True -flatten_custom_fields: True -flatten_local_context_data: True -plurals: False -interfaces: True -services: True -fetch_all: False -max_uri_length: 0 -group_names_raw: True - -group_by: - - site - - tenant - - rack - - rack_group - - rack_role - - tag - - role - - device_type - - manufacturer - - platform - - region - - cluster - - cluster_group - - cluster_type - - is_virtual diff --git a/tests/integration/targets/inventory-v2.9/files/test-inventory-options.json b/tests/integration/targets/inventory-v2.9/files/test-inventory-options.json deleted file mode 100644 index 2b2609d2..00000000 --- a/tests/integration/targets/inventory-v2.9/files/test-inventory-options.json +++ /dev/null @@ -1,335 +0,0 @@ -{ - "Test_Cluster": { - "hosts": [ - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm" - ] - }, - "Test_Cluster_2": { - "hosts": [ - "Test VM With Spaces", - "test104-vm" - ] - }, - "Test_Rack": { - "hosts": [ - "TestDeviceR1" - ] - }, - "Test_Rack_Site_2": { - "hosts": [ - "R1-Device" - ] - }, - "_meta": { - "hostvars": { - "R1-Device": { - "custom_fields": {}, - "device_type": "cisco-test", - "display": "R1-Device", - "is_virtual": false, - "manufacturer": "cisco", - "rack": "Test Rack Site 2", - "rack_groups": [], - "rack_id": "1", - "rack_role": "test-rack-role", - "regions": [], - "role": "core-switch", - "site": "test-site2", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "Test VM With Spaces": { - "cluster": "Test Cluster 2", - "cluster_type": "test-cluster-type", - "custom_fields": {}, - "is_virtual": true, - "regions": [], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "TestDeviceR1": { - "custom_fields": {}, - "device_type": "cisco-test", - "display": "TestDeviceR1", - "is_virtual": false, - "manufacturer": "cisco", - "rack": "Test Rack", - "rack_groups": [ - "test-rack-group", - "parent-rack-group" - ], - "rack_id": "2", - "regions": [ - "test-region", - "parent-region" - ], - "role": "core-switch", - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "VC1": { - "ansible_host": "nexus.example.com", - "custom_fields": {}, - "device_type": "nexus-parent", - "display": "Test Nexus One", - "dns_name": "nexus.example.com", - "is_virtual": false, - "manufacturer": "cisco", - "primary_ip4": "172.16.180.12", - "regions": [ - "test-region", - "parent-region" - ], - "role": "core-switch", - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test100": { - "custom_fields": {}, - "device_type": "cisco-test", - "display": "test100", - "is_virtual": false, - "local_context_data": { - "ntp_servers": [ - "pool.ntp.org" - ] - }, - "manufacturer": "cisco", - "regions": [ - "test-region", - "parent-region" - ], - "role": "core-switch", - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test100-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "custom_fields": {}, - "is_virtual": true, - "regions": [ - "test-region", - "parent-region" - ], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test101-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "custom_fields": {}, - "is_virtual": true, - "regions": [ - "test-region", - "parent-region" - ], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test102-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "custom_fields": {}, - "is_virtual": true, - "regions": [ - "test-region", - "parent-region" - ], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test103-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "custom_fields": {}, - "is_virtual": true, - "regions": [ - "test-region", - "parent-region" - ], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test104-vm": { - "cluster": "Test Cluster 2", - "cluster_type": "test-cluster-type", - "custom_fields": {}, - "is_virtual": true, - "regions": [], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - } - } - }, - "all": { - "children": [ - "Test_Cluster", - "Test_Cluster_2", - "Test_Rack", - "Test_Rack_Site_2", - "cisco", - "cisco_test", - "core_switch", - "is_virtual", - "jinja_test_group", - "nexus_parent", - "other_region", - "parent_rack_group", - "parent_region", - "test_cluster_group", - "test_cluster_type", - "test_rack_group", - "test_rack_role", - "test_site2", - "ungrouped" - ] - }, - "cisco": { - "hosts": [ - "R1-Device", - "TestDeviceR1", - "VC1", - "test100" - ] - }, - "cisco_test": { - "hosts": [ - "R1-Device", - "TestDeviceR1", - "test100" - ] - }, - "core_switch": { - "hosts": [ - "R1-Device", - "TestDeviceR1", - "VC1", - "test100" - ] - }, - "is_virtual": { - "hosts": [ - "Test VM With Spaces", - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm", - "test104-vm" - ] - }, - "jinja_test_group": { - "hosts": [ - "Test VM With Spaces", - "TestDeviceR1" - ] - }, - "nexus_parent": { - "hosts": [ - "VC1" - ] - }, - "parent_rack_group": { - "hosts": [ - "TestDeviceR1" - ] - }, - "parent_region": { - "children": [ - "test_region" - ] - }, - "test_cluster_group": { - "hosts": [ - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm" - ] - }, - "test_cluster_type": { - "hosts": [ - "Test VM With Spaces", - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm", - "test104-vm" - ] - }, - "test_rack_group": { - "hosts": [ - "TestDeviceR1" - ] - }, - "test_rack_role": { - "hosts": [ - "R1-Device" - ] - }, - "test_region": { - "children": [ - "test_site" - ] - }, - "test_site": { - "hosts": [ - "TestDeviceR1", - "VC1", - "test100", - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm" - ] - }, - "test_site2": { - "hosts": [ - "R1-Device" - ] - } -} \ No newline at end of file diff --git a/tests/integration/targets/inventory-v2.9/files/test-inventory-options.yml b/tests/integration/targets/inventory-v2.9/files/test-inventory-options.yml deleted file mode 100644 index 2500dca7..00000000 --- a/tests/integration/targets/inventory-v2.9/files/test-inventory-options.yml +++ /dev/null @@ -1,60 +0,0 @@ -plugin: networktocode.nautobot.inventory -api_endpoint: "http://localhost:32768" -token: "0123456789abcdef0123456789abcdef01234567" -validate_certs: False - -# Cache is not for performance of tests, but to test the caching option works -# Also set on test-inventory-plurals.yml so that we actually hit the cache on one of these runs -cache: True -cache_timeout: 3600 -cache_plugin: jsonfile -cache_connection: /tmp/inventory_nautobot - -config_context: False -plurals: False -interfaces: False -services: False -group_names_raw: True -virtual_chassis_name: True -dns_name: True -ansible_host_dns_name: True - -group_by: - - site - - tenant - - rack - - rack_group - - rack_role - - tag - - role - - device_type - - manufacturer - - platform - - region - - cluster - - cluster_group - - cluster_type - - is_virtual - -query_filters: - -device_query_filters: - - role: core-switch - -vm_query_filters: - - cluster_type: test-cluster-type - -# See Constructed for details -# https://docs.ansible.com/ansible/latest/plugins/inventory/constructed.html - -compose: - display: display - rack_id: rack.id - ntp_servers: config_context.ntp_servers - -keyed_groups: - - prefix: rack - key: rack.name - -groups: - jinja_test_group: inventory_hostname.startswith('Test') diff --git a/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals-flatten.json b/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals-flatten.json deleted file mode 100644 index 3c16dc27..00000000 --- a/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals-flatten.json +++ /dev/null @@ -1,387 +0,0 @@ -{ - "Test_Cluster": { - "hosts": [ - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm" - ] - }, - "Test_Cluster_2": { - "hosts": [ - "Test VM With Spaces", - "test104-vm" - ] - }, - "Test_Rack": { - "hosts": [ - "TestDeviceR1" - ] - }, - "Test_Rack_Site_2": { - "hosts": [ - "R1-Device" - ] - }, - "_meta": { - "hostvars": { - "R1-Device": { - "device_roles": [ - "core-switch" - ], - "device_types": [ - "cisco-test" - ], - "is_virtual": false, - "local_context_data": [ - null - ], - "manufacturers": [ - "cisco" - ], - "rack_groups": [], - "rack_role": "test-rack-role", - "racks": [ - "Test Rack Site 2" - ], - "regions": [], - "sites": [ - "test-site2" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "Test Nexus One": { - "ansible_host": "172.16.180.12", - "device_roles": [ - "core-switch" - ], - "device_types": [ - "nexus-parent" - ], - "is_virtual": false, - "local_context_data": [ - null - ], - "manufacturers": [ - "cisco" - ], - "primary_ip4": "172.16.180.12", - "regions": [ - "test-region", - "parent-region" - ], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "Test VM With Spaces": { - "cluster": "Test Cluster 2", - "cluster_type": "test-cluster-type", - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "TestDeviceR1": { - "device_roles": [ - "core-switch" - ], - "device_types": [ - "cisco-test" - ], - "is_virtual": false, - "local_context_data": [ - null - ], - "manufacturers": [ - "cisco" - ], - "rack_groups": [ - "test-rack-group", - "parent-rack-group" - ], - "racks": [ - "Test Rack" - ], - "regions": [ - "test-region", - "parent-region" - ], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test100": { - "device_roles": [ - "core-switch" - ], - "device_types": [ - "cisco-test" - ], - "is_virtual": false, - "local_context_data": [ - { - "ntp_servers": [ - "pool.ntp.org" - ] - } - ], - "manufacturers": [ - "cisco" - ], - "ntp_servers": [ - "pool.ntp.org" - ], - "regions": [ - "test-region", - "parent-region" - ], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test100-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [ - "test-region", - "parent-region" - ], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test101-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [ - "test-region", - "parent-region" - ], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test102-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [ - "test-region", - "parent-region" - ], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test103-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [ - "test-region", - "parent-region" - ], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test104-vm": { - "cluster": "Test Cluster 2", - "cluster_type": "test-cluster-type", - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - } - } - }, - "all": { - "children": [ - "Test_Cluster", - "Test_Cluster_2", - "Test_Rack", - "Test_Rack_Site_2", - "cisco", - "cisco_test", - "core_switch", - "is_virtual", - "nexus_parent", - "other_region", - "parent_rack_group", - "parent_region", - "test_cluster_group", - "test_cluster_type", - "test_rack_group", - "test_rack_role", - "test_site2", - "ungrouped" - ] - }, - "cisco": { - "hosts": [ - "R1-Device", - "Test Nexus One", - "TestDeviceR1", - "test100" - ] - }, - "cisco_test": { - "hosts": [ - "R1-Device", - "TestDeviceR1", - "test100" - ] - }, - "core_switch": { - "hosts": [ - "R1-Device", - "Test Nexus One", - "TestDeviceR1", - "test100" - ] - }, - "is_virtual": { - "hosts": [ - "Test VM With Spaces", - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm", - "test104-vm" - ] - }, - "nexus_parent": { - "hosts": [ - "Test Nexus One" - ] - }, - "parent_rack_group": { - "hosts": [ - "TestDeviceR1" - ] - }, - "parent_region": { - "children": [ - "test_region" - ] - }, - "test_cluster_group": { - "hosts": [ - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm" - ] - }, - "test_cluster_type": { - "hosts": [ - "Test VM With Spaces", - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm", - "test104-vm" - ] - }, - "test_rack_group": { - "hosts": [ - "TestDeviceR1" - ] - }, - "test_rack_role": { - "hosts": [ - "R1-Device" - ] - }, - "test_region": { - "children": [ - "test_site" - ] - }, - "test_site": { - "hosts": [ - "Test Nexus One", - "TestDeviceR1", - "test100", - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm" - ] - }, - "test_site2": { - "hosts": [ - "R1-Device" - ] - } -} \ No newline at end of file diff --git a/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals-flatten.yml b/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals-flatten.yml deleted file mode 100644 index 403f4801..00000000 --- a/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals-flatten.yml +++ /dev/null @@ -1,30 +0,0 @@ -plugin: networktocode.nautobot.inventory -api_endpoint: "http://localhost:32768" -token: "0123456789abcdef0123456789abcdef01234567" -validate_certs: False - -config_context: True -flatten_config_context: True -flatten_custom_fields: True -plurals: True -interfaces: False -services: False -fetch_all: True -group_names_raw: True - -group_by: - - sites - - tenants - - racks - - rack_group - - rack_role - - tags - - device_roles - - device_types - - manufacturers - - platforms - - region - - cluster - - cluster_group - - cluster_type - - is_virtual diff --git a/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals.json b/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals.json deleted file mode 100644 index 7bb96b80..00000000 --- a/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals.json +++ /dev/null @@ -1,955 +0,0 @@ -{ - "_meta": { - "hostvars": { - "R1-Device": { - "config_context": [ - {} - ], - "custom_fields": {}, - "device_roles": [ - "core-switch" - ], - "device_types": [ - "cisco-test" - ], - "interfaces": [], - "is_virtual": false, - "local_context_data": [ - null - ], - "manufacturers": [ - "cisco" - ], - "rack_groups": [], - "rack_role": "test-rack-role", - "racks": [ - "Test Rack Site 2" - ], - "regions": [], - "services": [], - "sites": [ - "test-site2" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "Test Nexus One": { - "ansible_host": "172.16.180.12", - "config_context": [ - {} - ], - "custom_fields": {}, - "device_roles": [ - "core-switch" - ], - "device_types": [ - "nexus-parent" - ], - "dns_name": "nexus.example.com", - "interfaces": [ - { - "cable": null, - "connected_endpoint": null, - "connected_endpoint_type": null, - "connection_status": null, - "count_ipaddresses": 1, - "description": "", - "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" - }, - "enabled": true, - "id": 1, - "ip_addresses": [ - { - "address": "172.16.180.11/24", - "custom_fields": {}, - "description": "", - "dns_name": "", - "family": { - "label": "IPv4", - "value": 4 - }, - "id": 3, - "nat_inside": null, - "nat_outside": null, - "role": null, - "status": { - "label": "Active", - "value": "active" - }, - "tags": [], - "tenant": null, - "vrf": null - } - ], - "label": "", - "lag": null, - "mac_address": null, - "mgmt_only": false, - "mode": null, - "mtu": null, - "name": "Ethernet1/1", - "tagged_vlans": [], - "tags": [], - "type": { - "label": "1000BASE-T (1GE)", - "value": "1000base-t" - }, - "untagged_vlan": null - }, - { - "cable": null, - "connected_endpoint": null, - "connected_endpoint_type": null, - "connection_status": null, - "count_ipaddresses": 1, - "description": "", - "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" - }, - "enabled": true, - "id": 2, - "ip_addresses": [ - { - "address": "172.16.180.12/24", - "custom_fields": {}, - "description": "", - "dns_name": "nexus.example.com", - "family": { - "label": "IPv4", - "value": 4 - }, - "id": 4, - "nat_inside": null, - "nat_outside": null, - "role": null, - "status": { - "label": "Active", - "value": "active" - }, - "tags": [], - "tenant": null, - "vrf": null - } - ], - "label": "", - "lag": null, - "mac_address": null, - "mgmt_only": false, - "mode": null, - "mtu": null, - "name": "Ethernet2/1", - "tagged_vlans": [], - "tags": [], - "type": { - "label": "1000BASE-T (1GE)", - "value": "1000base-t" - }, - "untagged_vlan": null - } - ], - "is_virtual": false, - "local_context_data": [ - null - ], - "manufacturers": [ - "cisco" - ], - "primary_ip4": "172.16.180.12", - "regions": [ - "test-region", - "parent-region" - ], - "services": [ - { - "custom_fields": {}, - "description": "", - "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" - }, - "id": 3, - "ipaddresses": [], - "name": "telnet", - "port": 23, - "protocol": { - "label": "TCP", - "value": "tcp" - }, - "tags": [], - "virtual_machine": null - } - ], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "Test VM With Spaces": { - "cluster": "Test Cluster 2", - "cluster_type": "test-cluster-type", - "config_context": [ - {} - ], - "custom_fields": {}, - "interfaces": [ - { - "description": "", - "enabled": true, - "id": 11, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth0", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 6, - "name": "Test VM With Spaces" - } - }, - { - "description": "", - "enabled": true, - "id": 12, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth1", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 6, - "name": "Test VM With Spaces" - } - } - ], - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [], - "services": [ - { - "custom_fields": {}, - "description": "", - "device": null, - "id": 4, - "ipaddresses": [], - "name": "ssh", - "port": 22, - "protocol": { - "label": "TCP", - "value": "tcp" - }, - "tags": [], - "virtual_machine": { - "id": 6, - "name": "Test VM With Spaces" - } - } - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "TestDeviceR1": { - "config_context": [ - {} - ], - "custom_fields": {}, - "device_roles": [ - "core-switch" - ], - "device_types": [ - "cisco-test" - ], - "interfaces": [], - "is_virtual": false, - "local_context_data": [ - null - ], - "manufacturers": [ - "cisco" - ], - "rack_groups": [ - "test-rack-group", - "parent-rack-group" - ], - "racks": [ - "Test Rack" - ], - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test100": { - "config_context": [ - { - "ntp_servers": [ - "pool.ntp.org" - ] - } - ], - "custom_fields": {}, - "device_roles": [ - "core-switch" - ], - "device_types": [ - "cisco-test" - ], - "interfaces": [ - { - "cable": null, - "connected_endpoint": null, - "connected_endpoint_type": null, - "connection_status": null, - "count_ipaddresses": 1, - "description": "", - "device": { - "display": "test100", - "id": 1, - "name": "test100" - }, - "enabled": true, - "id": 3, - "ip_addresses": [ - { - "address": "172.16.180.1/24", - "custom_fields": {}, - "description": "", - "dns_name": "", - "family": { - "label": "IPv4", - "value": 4 - }, - "id": 1, - "nat_inside": null, - "nat_outside": null, - "role": null, - "status": { - "label": "Active", - "value": "active" - }, - "tags": [], - "tenant": null, - "vrf": null - } - ], - "label": "", - "lag": null, - "mac_address": null, - "mgmt_only": false, - "mode": null, - "mtu": null, - "name": "GigabitEthernet1", - "tagged_vlans": [], - "tags": [], - "type": { - "label": "1000BASE-T (1GE)", - "value": "1000base-t" - }, - "untagged_vlan": null - }, - { - "cable": null, - "connected_endpoint": null, - "connected_endpoint_type": null, - "connection_status": null, - "count_ipaddresses": 1, - "description": "", - "device": { - "display": "test100", - "id": 1, - "name": "test100" - }, - "enabled": true, - "id": 4, - "ip_addresses": [ - { - "address": "2001::1:1/64", - "custom_fields": {}, - "description": "", - "dns_name": "", - "family": { - "label": "IPv6", - "value": 6 - }, - "id": 2, - "nat_inside": null, - "nat_outside": null, - "role": null, - "status": { - "label": "Active", - "value": "active" - }, - "tags": [], - "tenant": null, - "vrf": null - } - ], - "label": "", - "lag": null, - "mac_address": null, - "mgmt_only": false, - "mode": null, - "mtu": null, - "name": "GigabitEthernet2", - "tagged_vlans": [], - "tags": [], - "type": { - "label": "1000BASE-T (1GE)", - "value": "1000base-t" - }, - "untagged_vlan": null - } - ], - "is_virtual": false, - "local_context_data": [ - { - "ntp_servers": [ - "pool.ntp.org" - ] - } - ], - "manufacturers": [ - "cisco" - ], - "regions": [ - "test-region", - "parent-region" - ], - "services": [ - { - "custom_fields": {}, - "description": "", - "device": { - "display": "test100", - "id": 1, - "name": "test100" - }, - "id": 1, - "ipaddresses": [], - "name": "ssh", - "port": 22, - "protocol": { - "label": "TCP", - "value": "tcp" - }, - "tags": [], - "virtual_machine": null - }, - { - "custom_fields": {}, - "description": "", - "device": { - "display": "test100", - "id": 1, - "name": "test100" - }, - "id": 2, - "ipaddresses": [ - { - "address": "172.16.180.1/24", - "family": 4, - "id": 1 - }, - { - "address": "2001::1:1/64", - "family": 6, - "id": 2 - } - ], - "name": "http", - "port": 80, - "protocol": { - "label": "TCP", - "value": "tcp" - }, - "tags": [], - "virtual_machine": null - } - ], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test100-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "config_context": [ - {} - ], - "custom_fields": {}, - "interfaces": [ - { - "description": "", - "enabled": true, - "id": 1, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth0", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 1, - "name": "test100-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 2, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth1", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 1, - "name": "test100-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 3, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth2", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 1, - "name": "test100-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 4, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth3", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 1, - "name": "test100-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 5, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth4", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 1, - "name": "test100-vm" - } - } - ], - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test101-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "config_context": [ - {} - ], - "custom_fields": {}, - "interfaces": [ - { - "description": "", - "enabled": true, - "id": 6, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth0", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 2, - "name": "test101-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 7, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth1", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 2, - "name": "test101-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 8, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth2", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 2, - "name": "test101-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 9, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth3", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 2, - "name": "test101-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 10, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth4", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 2, - "name": "test101-vm" - } - } - ], - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test102-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "config_context": [ - {} - ], - "custom_fields": {}, - "interfaces": [], - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test103-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "config_context": [ - {} - ], - "custom_fields": {}, - "interfaces": [], - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "sites": [ - "test-site" - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test104-vm": { - "cluster": "Test Cluster 2", - "cluster_type": "test-cluster-type", - "config_context": [ - {} - ], - "custom_fields": {}, - "interfaces": [], - "is_virtual": true, - "local_context_data": [ - null - ], - "regions": [], - "services": [], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - } - } - }, - "all": { - "children": [ - "cluster_Test_Cluster", - "cluster_Test_Cluster_2", - "cluster_group_test_cluster_group", - "cluster_type_test_cluster_type", - "device_roles_core_switch", - "device_types_cisco_test", - "device_types_nexus_parent", - "is_virtual", - "manufacturers_cisco", - "rack_group_parent_rack_group", - "rack_group_test_rack_group", - "rack_role_test_rack_role", - "racks_Test_Rack", - "racks_Test_Rack_Site_2", - "region_other_region", - "region_parent_region", - "sites_test_site2", - "ungrouped" - ] - }, - "cluster_Test_Cluster": { - "hosts": [ - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm" - ] - }, - "cluster_Test_Cluster_2": { - "hosts": [ - "Test VM With Spaces", - "test104-vm" - ] - }, - "cluster_group_test_cluster_group": { - "hosts": [ - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm" - ] - }, - "cluster_type_test_cluster_type": { - "hosts": [ - "Test VM With Spaces", - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm", - "test104-vm" - ] - }, - "device_roles_core_switch": { - "hosts": [ - "R1-Device", - "Test Nexus One", - "TestDeviceR1", - "test100" - ] - }, - "device_types_cisco_test": { - "hosts": [ - "R1-Device", - "TestDeviceR1", - "test100" - ] - }, - "device_types_nexus_parent": { - "hosts": [ - "Test Nexus One" - ] - }, - "is_virtual": { - "hosts": [ - "Test VM With Spaces", - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm", - "test104-vm" - ] - }, - "manufacturers_cisco": { - "hosts": [ - "R1-Device", - "Test Nexus One", - "TestDeviceR1", - "test100" - ] - }, - "rack_group_parent_rack_group": { - "hosts": [ - "TestDeviceR1" - ] - }, - "rack_group_test_rack_group": { - "hosts": [ - "TestDeviceR1" - ] - }, - "rack_role_test_rack_role": { - "hosts": [ - "R1-Device" - ] - }, - "racks_Test_Rack": { - "hosts": [ - "TestDeviceR1" - ] - }, - "racks_Test_Rack_Site_2": { - "hosts": [ - "R1-Device" - ] - }, - "region_parent_region": { - "children": [ - "region_test_region" - ] - }, - "region_test_region": { - "children": [ - "sites_test_site" - ] - }, - "sites_test_site": { - "hosts": [ - "Test Nexus One", - "TestDeviceR1", - "test100", - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm" - ] - }, - "sites_test_site2": { - "hosts": [ - "R1-Device" - ] - } -} \ No newline at end of file diff --git a/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals.yml b/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals.yml deleted file mode 100644 index 2bf6ed64..00000000 --- a/tests/integration/targets/inventory-v2.9/files/test-inventory-plurals.yml +++ /dev/null @@ -1,35 +0,0 @@ -plugin: networktocode.nautobot.inventory -api_endpoint: "http://localhost:32768" -token: "0123456789abcdef0123456789abcdef01234567" -validate_certs: false - -cache: True -cache_timeout: 3600 -cache_plugin: jsonfile -cache_connection: /tmp/inventory_nautobot - -config_context: True -plurals: True -interfaces: True -services: True - -# Enough to fit only 2 devices, so tests chunking logic -max_uri_length: 80 -fetch_all: False - -group_by: - - sites - - tenants - - racks - - rack_group - - rack_role - - tags - - device_roles - - device_types - - manufacturers - - platforms - - region - - cluster - - cluster_group - - cluster_type - - is_virtual diff --git a/tests/integration/targets/inventory-v2.9/files/test-inventory.json b/tests/integration/targets/inventory-v2.9/files/test-inventory.json deleted file mode 100644 index 06563c9e..00000000 --- a/tests/integration/targets/inventory-v2.9/files/test-inventory.json +++ /dev/null @@ -1,881 +0,0 @@ -{ - "_meta": { - "hostvars": { - "R1-Device": { - "config_context": {}, - "custom_fields": {}, - "device_type": "cisco-test", - "interfaces": [], - "is_virtual": false, - "manufacturer": "cisco", - "rack": "Test Rack Site 2", - "rack_groups": [], - "rack_role": "test-rack-role", - "regions": [], - "role": "core-switch", - "services": [], - "site": "test-site2", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "Test Nexus One": { - "ansible_host": "172.16.180.12", - "config_context": {}, - "custom_fields": {}, - "device_type": "nexus-parent", - "dns_name": "nexus.example.com", - "interfaces": [ - { - "cable": null, - "connected_endpoint": null, - "connected_endpoint_type": null, - "connection_status": null, - "count_ipaddresses": 1, - "description": "", - "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" - }, - "enabled": true, - "id": 1, - "ip_addresses": [ - { - "address": "172.16.180.11/24", - "custom_fields": {}, - "description": "", - "dns_name": "", - "family": { - "label": "IPv4", - "value": 4 - }, - "id": 3, - "nat_inside": null, - "nat_outside": null, - "role": null, - "status": { - "label": "Active", - "value": "active" - }, - "tags": [], - "tenant": null, - "vrf": null - } - ], - "label": "", - "lag": null, - "mac_address": null, - "mgmt_only": false, - "mode": null, - "mtu": null, - "name": "Ethernet1/1", - "tagged_vlans": [], - "tags": [], - "type": { - "label": "1000BASE-T (1GE)", - "value": "1000base-t" - }, - "untagged_vlan": null - }, - { - "cable": null, - "connected_endpoint": null, - "connected_endpoint_type": null, - "connection_status": null, - "count_ipaddresses": 1, - "description": "", - "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" - }, - "enabled": true, - "id": 2, - "ip_addresses": [ - { - "address": "172.16.180.12/24", - "custom_fields": {}, - "description": "", - "dns_name": "nexus.example.com", - "family": { - "label": "IPv4", - "value": 4 - }, - "id": 4, - "nat_inside": null, - "nat_outside": null, - "role": null, - "status": { - "label": "Active", - "value": "active" - }, - "tags": [], - "tenant": null, - "vrf": null - } - ], - "label": "", - "lag": null, - "mac_address": null, - "mgmt_only": false, - "mode": null, - "mtu": null, - "name": "Ethernet2/1", - "tagged_vlans": [], - "tags": [], - "type": { - "label": "1000BASE-T (1GE)", - "value": "1000base-t" - }, - "untagged_vlan": null - } - ], - "is_virtual": false, - "manufacturer": "cisco", - "primary_ip4": "172.16.180.12", - "regions": [ - "test-region", - "parent-region" - ], - "role": "core-switch", - "services": [ - { - "custom_fields": {}, - "description": "", - "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" - }, - "id": 3, - "ipaddresses": [], - "name": "telnet", - "port": 23, - "protocol": { - "label": "TCP", - "value": "tcp" - }, - "tags": [], - "virtual_machine": null - } - ], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "Test VM With Spaces": { - "cluster": "Test Cluster 2", - "cluster_type": "test-cluster-type", - "config_context": {}, - "custom_fields": {}, - "interfaces": [ - { - "description": "", - "enabled": true, - "id": 11, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth0", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 6, - "name": "Test VM With Spaces" - } - }, - { - "description": "", - "enabled": true, - "id": 12, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth1", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 6, - "name": "Test VM With Spaces" - } - } - ], - "is_virtual": true, - "regions": [], - "services": [ - { - "custom_fields": {}, - "description": "", - "device": null, - "id": 4, - "ipaddresses": [], - "name": "ssh", - "port": 22, - "protocol": { - "label": "TCP", - "value": "tcp" - }, - "tags": [], - "virtual_machine": { - "id": 6, - "name": "Test VM With Spaces" - } - } - ], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "TestDeviceR1": { - "config_context": {}, - "custom_fields": {}, - "device_type": "cisco-test", - "interfaces": [], - "is_virtual": false, - "manufacturer": "cisco", - "rack": "Test Rack", - "rack_groups": [ - "test-rack-group", - "parent-rack-group" - ], - "regions": [ - "test-region", - "parent-region" - ], - "role": "core-switch", - "services": [], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test100": { - "config_context": { - "ntp_servers": [ - "pool.ntp.org" - ] - }, - "custom_fields": {}, - "device_type": "cisco-test", - "interfaces": [ - { - "cable": null, - "connected_endpoint": null, - "connected_endpoint_type": null, - "connection_status": null, - "count_ipaddresses": 1, - "description": "", - "device": { - "display": "test100", - "id": 1, - "name": "test100" - }, - "enabled": true, - "id": 3, - "ip_addresses": [ - { - "address": "172.16.180.1/24", - "custom_fields": {}, - "description": "", - "dns_name": "", - "family": { - "label": "IPv4", - "value": 4 - }, - "id": 1, - "nat_inside": null, - "nat_outside": null, - "role": null, - "status": { - "label": "Active", - "value": "active" - }, - "tags": [], - "tenant": null, - "vrf": null - } - ], - "label": "", - "lag": null, - "mac_address": null, - "mgmt_only": false, - "mode": null, - "mtu": null, - "name": "GigabitEthernet1", - "tagged_vlans": [], - "tags": [], - "type": { - "label": "1000BASE-T (1GE)", - "value": "1000base-t" - }, - "untagged_vlan": null - }, - { - "cable": null, - "connected_endpoint": null, - "connected_endpoint_type": null, - "connection_status": null, - "count_ipaddresses": 1, - "description": "", - "device": { - "display": "test100", - "id": 1, - "name": "test100" - }, - "enabled": true, - "id": 4, - "ip_addresses": [ - { - "address": "2001::1:1/64", - "custom_fields": {}, - "description": "", - "dns_name": "", - "family": { - "label": "IPv6", - "value": 6 - }, - "id": 2, - "nat_inside": null, - "nat_outside": null, - "role": null, - "status": { - "label": "Active", - "value": "active" - }, - "tags": [], - "tenant": null, - "vrf": null - } - ], - "label": "", - "lag": null, - "mac_address": null, - "mgmt_only": false, - "mode": null, - "mtu": null, - "name": "GigabitEthernet2", - "tagged_vlans": [], - "tags": [], - "type": { - "label": "1000BASE-T (1GE)", - "value": "1000base-t" - }, - "untagged_vlan": null - } - ], - "is_virtual": false, - "local_context_data": { - "ntp_servers": [ - "pool.ntp.org" - ] - }, - "manufacturer": "cisco", - "regions": [ - "test-region", - "parent-region" - ], - "role": "core-switch", - "services": [ - { - "custom_fields": {}, - "description": "", - "device": { - "display": "test100", - "id": 1, - "name": "test100" - }, - "id": 1, - "ipaddresses": [], - "name": "ssh", - "port": 22, - "protocol": { - "label": "TCP", - "value": "tcp" - }, - "tags": [], - "virtual_machine": null - }, - { - "custom_fields": {}, - "description": "", - "device": { - "display": "test100", - "id": 1, - "name": "test100" - }, - "id": 2, - "ipaddresses": [ - { - "address": "172.16.180.1/24", - "family": 4, - "id": 1 - }, - { - "address": "2001::1:1/64", - "family": 6, - "id": 2 - } - ], - "name": "http", - "port": 80, - "protocol": { - "label": "TCP", - "value": "tcp" - }, - "tags": [], - "virtual_machine": null - } - ], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test100-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "config_context": {}, - "custom_fields": {}, - "interfaces": [ - { - "description": "", - "enabled": true, - "id": 1, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth0", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 1, - "name": "test100-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 2, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth1", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 1, - "name": "test100-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 3, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth2", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 1, - "name": "test100-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 4, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth3", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 1, - "name": "test100-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 5, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth4", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 1, - "name": "test100-vm" - } - } - ], - "is_virtual": true, - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test101-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "config_context": {}, - "custom_fields": {}, - "interfaces": [ - { - "description": "", - "enabled": true, - "id": 6, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth0", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 2, - "name": "test101-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 7, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth1", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 2, - "name": "test101-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 8, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth2", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 2, - "name": "test101-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 9, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth3", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 2, - "name": "test101-vm" - } - }, - { - "description": "", - "enabled": true, - "id": 10, - "ip_addresses": [], - "mac_address": null, - "mode": null, - "mtu": null, - "name": "Eth4", - "tagged_vlans": [], - "tags": [], - "untagged_vlan": null, - "virtual_machine": { - "id": 2, - "name": "test101-vm" - } - } - ], - "is_virtual": true, - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test102-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "config_context": {}, - "custom_fields": {}, - "interfaces": [], - "is_virtual": true, - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test103-vm": { - "cluster": "Test Cluster", - "cluster_group": "test-cluster-group", - "cluster_type": "test-cluster-type", - "config_context": {}, - "custom_fields": {}, - "interfaces": [], - "is_virtual": true, - "regions": [ - "test-region", - "parent-region" - ], - "services": [], - "site": "test-site", - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - }, - "test104-vm": { - "cluster": "Test Cluster 2", - "cluster_type": "test-cluster-type", - "config_context": {}, - "custom_fields": {}, - "interfaces": [], - "is_virtual": true, - "regions": [], - "services": [], - "status": { - "label": "Active", - "value": "active" - }, - "tags": [] - } - } - }, - "all": { - "children": [ - "cluster_Test_Cluster", - "cluster_Test_Cluster_2", - "cluster_group_test_cluster_group", - "cluster_type_test_cluster_type", - "device_type_cisco_test", - "device_type_nexus_parent", - "is_virtual", - "manufacturer_cisco", - "rack_Test_Rack", - "rack_Test_Rack_Site_2", - "rack_group_parent_rack_group", - "rack_group_test_rack_group", - "rack_role_test_rack_role", - "region_other_region", - "region_parent_region", - "role_core_switch", - "service_http", - "service_ssh", - "service_telnet", - "site_test_site2", - "ungrouped" - ] - }, - "cluster_Test_Cluster": { - "hosts": [ - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm" - ] - }, - "cluster_Test_Cluster_2": { - "hosts": [ - "Test VM With Spaces", - "test104-vm" - ] - }, - "cluster_group_test_cluster_group": { - "hosts": [ - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm" - ] - }, - "cluster_type_test_cluster_type": { - "hosts": [ - "Test VM With Spaces", - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm", - "test104-vm" - ] - }, - "device_type_cisco_test": { - "hosts": [ - "R1-Device", - "TestDeviceR1", - "test100" - ] - }, - "device_type_nexus_parent": { - "hosts": [ - "Test Nexus One" - ] - }, - "is_virtual": { - "hosts": [ - "Test VM With Spaces", - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm", - "test104-vm" - ] - }, - "manufacturer_cisco": { - "hosts": [ - "R1-Device", - "Test Nexus One", - "TestDeviceR1", - "test100" - ] - }, - "rack_Test_Rack": { - "hosts": [ - "TestDeviceR1" - ] - }, - "rack_Test_Rack_Site_2": { - "hosts": [ - "R1-Device" - ] - }, - "rack_group_parent_rack_group": { - "hosts": [ - "TestDeviceR1" - ] - }, - "rack_group_test_rack_group": { - "hosts": [ - "TestDeviceR1" - ] - }, - "rack_role_test_rack_role": { - "hosts": [ - "R1-Device" - ] - }, - "region_parent_region": { - "children": [ - "region_test_region" - ] - }, - "region_test_region": { - "children": [ - "site_test_site" - ] - }, - "role_core_switch": { - "hosts": [ - "R1-Device", - "Test Nexus One", - "TestDeviceR1", - "test100" - ] - }, - "service_http": { - "hosts": [ - "test100" - ] - }, - "service_ssh": { - "hosts": [ - "Test VM With Spaces", - "test100" - ] - }, - "service_telnet": { - "hosts": [ - "Test Nexus One" - ] - }, - "site_test_site": { - "hosts": [ - "Test Nexus One", - "TestDeviceR1", - "test100", - "test100-vm", - "test101-vm", - "test102-vm", - "test103-vm" - ] - }, - "site_test_site2": { - "hosts": [ - "R1-Device" - ] - } -} \ No newline at end of file diff --git a/tests/integration/targets/inventory-v2.9/files/test-inventory.yml b/tests/integration/targets/inventory-v2.9/files/test-inventory.yml deleted file mode 100644 index 32a37ec5..00000000 --- a/tests/integration/targets/inventory-v2.9/files/test-inventory.yml +++ /dev/null @@ -1,27 +0,0 @@ -plugin: networktocode.nautobot.inventory -api_endpoint: "http://localhost:32768" -token: "0123456789abcdef0123456789abcdef01234567" -validate_certs: False - -config_context: True -plurals: False -interfaces: True -services: True - -group_by: - - site - - tenant - - rack - - rack_group - - rack_role - - tag - - role - - device_type - - manufacturer - - platform - - region - - cluster - - cluster_group - - cluster_type - - is_virtual - - services diff --git a/tests/integration/targets/inventory-v2.9/runme.sh b/tests/integration/targets/inventory-v2.9/runme.sh deleted file mode 100755 index ad146d6f..00000000 --- a/tests/integration/targets/inventory-v2.9/runme.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env bash - -set -o xtrace # Print commands as they're run -set -o errexit # abort on nonzero exitstatus -set -o nounset # abort on unbound variable -set -o pipefail # don't hide errors within pipes - -# Directory of this script -SCRIPT_DIR="$( dirname "${BASH_SOURCE[0]}" )" -RUNME_CONFIG="$SCRIPT_DIR/runme_config" -INVENTORIES_DIR="$SCRIPT_DIR/files" - -# Load runme_config, if exists - the only way to pass environment when run through ansible-test -if [[ -f "$RUNME_CONFIG" ]] -then - source "$RUNME_CONFIG" -fi - -declare -a COMPARE_OPTIONS # empty array - -# OUTPUT_DIR is set by ansible-test -# OUTPUT_INVENTORY_JSON is only set if running hacking/update_test_inventories.sh to update the test diff data -if [[ -n "${OUTPUT_INVENTORY_JSON:-}" ]] -then - OUTPUT_DIR="$OUTPUT_INVENTORY_JSON" - - # Clean up JSON fields we don't want to store and compare against in tests (creation times, etc.) - COMPARE_OPTIONS+=(--write) -fi - -echo OUTPUT_DIR="$OUTPUT_DIR" - -inventory () { - if [[ -n "${OUTPUT_INVENTORY_JSON:-}" ]] - then - # Running for the purpose of updating test data - ansible-inventory "$@" - else - # Running inside ansible-test - # Run through python.py just to make sure we've definitely got the coverage environment set up - # Just running ansible-inventory directly may not actually find the right one in PATH - python.py "$(command -v ansible-inventory)" "$@" - fi -} - - -RESULT=0 - -for INVENTORY in "$INVENTORIES_DIR"/*.yml -do - NAME="$(basename "$INVENTORY")" - NAME_WITHOUT_EXTENSION="${NAME%.yml}" - - OUTPUT_JSON="$OUTPUT_DIR/$NAME_WITHOUT_EXTENSION.json" - inventory -vvvv --list --inventory "$INVENTORY" --output="$OUTPUT_JSON" - - # Compare the output - if ! "$SCRIPT_DIR/compare_inventory_json.py" "${COMPARE_OPTIONS[@]}" "$INVENTORIES_DIR/$NAME_WITHOUT_EXTENSION.json" "$OUTPUT_JSON" - then - # Returned non-zero status - RESULT=1 - fi - -done - -exit $RESULT diff --git a/tests/integration/targets/inventory-v2.9/runme_config.template b/tests/integration/targets/inventory-v2.9/runme_config.template deleted file mode 100644 index 7865d774..00000000 --- a/tests/integration/targets/inventory-v2.9/runme_config.template +++ /dev/null @@ -1,6 +0,0 @@ -# runme_config is source'd by runme.sh to set environment variables used to modify the test against different versions of Nautobot. -# .travis.yml uses render_config.sh to generate it from runme_config.template -# There is no other way to pass environment variables to a runme.sh integration test. -# (integration_config.yml files are only helpful to ansible yaml-based tests) - -export PYNAUTOBOT_VERSION=${VERSION} diff --git a/tests/integration/targets/latest/tasks/aggregate.yml b/tests/integration/targets/latest/tasks/aggregate.yml index b577a2ce..be4bed82 100644 --- a/tests/integration/targets/latest/tasks/aggregate.yml +++ b/tests/integration/targets/latest/tasks/aggregate.yml @@ -4,13 +4,16 @@ ### PYNAUTOBOT_AGGEGATE ## ## +- set_fact: + rir: "{{ lookup('networktocode.nautobot.lookup', 'rirs', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=example-rir') }}" + schnozzberry: "{{ lookup('networktocode.nautobot.lookup', 'tags', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=schnozzberry') }}" + - name: "AGGREGATE 1: Necessary info creation" networktocode.nautobot.aggregate: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: "10.0.0.0/8" - rir: "Example RIR" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + prefix: "10.0.0.0/8" + rir: "Example RIR" state: present register: test_one @@ -22,15 +25,14 @@ - test_one['diff']['after']['state'] == "present" - test_one['aggregate']['prefix'] == "10.0.0.0/8" - test_one['aggregate']['family'] == 4 - - test_one['aggregate']['rir'] == 1 + - test_one['aggregate']['rir'] == rir['key'] - test_one['msg'] == "aggregate 10.0.0.0/8 created" - name: "AGGREGATE 2: Create duplicate" networktocode.nautobot.aggregate: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: "10.0.0.0/8" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + prefix: "10.0.0.0/8" state: present register: test_two @@ -40,20 +42,19 @@ - not test_two['changed'] - test_two['aggregate']['prefix'] == "10.0.0.0/8" - test_two['aggregate']['family'] == 4 - - test_two['aggregate']['rir'] == 1 + - test_two['aggregate']['rir'] == rir['key'] - test_two['msg'] == "aggregate 10.0.0.0/8 already exists" - name: "AGGREGATE 3: ASSERT - Update" networktocode.nautobot.aggregate: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: "10.0.0.0/8" - rir: "Example RIR" - date_added: "1989-01-18" - description: "Test Description" - tags: - - "Schnozzberry" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + prefix: "10.0.0.0/8" + rir: "Example RIR" + date_added: "1989-01-18" + description: "Test Description" + tags: + - "Schnozzberry" state: present register: test_three @@ -63,21 +64,20 @@ - test_three is changed - test_three['diff']['after']['date_added'] == "1989-01-18" - test_three['diff']['after']['description'] == "Test Description" - - test_three['diff']['after']['tags'][0] == 4 + - test_three['diff']['after']['tags'][0] == schnozzberry['key'] - test_three['aggregate']['prefix'] == "10.0.0.0/8" - test_three['aggregate']['family'] == 4 - - test_three['aggregate']['rir'] == 1 + - test_three['aggregate']['rir'] == rir['key'] - test_three['aggregate']['date_added'] == "1989-01-18" - test_three['aggregate']['description'] == "Test Description" - - test_three['aggregate']['tags'][0] == 4 + - test_three['aggregate']['tags'][0] == schnozzberry['key'] - test_three['msg'] == "aggregate 10.0.0.0/8 updated" - name: "AGGREGATE 4: ASSERT - Delete" networktocode.nautobot.aggregate: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: "10.0.0.0/8" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + prefix: "10.0.0.0/8" state: absent register: test_four @@ -87,19 +87,18 @@ - test_four is changed - test_four['aggregate']['prefix'] == "10.0.0.0/8" - test_four['aggregate']['family'] == 4 - - test_four['aggregate']['rir'] == 1 + - test_four['aggregate']['rir'] == rir['key'] - test_four['aggregate']['date_added'] == "1989-01-18" - test_four['aggregate']['description'] == "Test Description" - - test_four['aggregate']['tags'][0] == 4 + - test_four['aggregate']['tags'][0] == schnozzberry['key'] - test_four['msg'] == "aggregate 10.0.0.0/8 deleted" - name: "AGGREGATE 5: Necessary info creation" networktocode.nautobot.aggregate: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: "2001::/32" - rir: "Example RIR" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + prefix: "2001::/32" + rir: "Example RIR" state: present register: test_five @@ -111,5 +110,5 @@ - test_five['diff']['after']['state'] == "present" - test_five['aggregate']['prefix'] == "2001::/32" - test_five['aggregate']['family'] == 6 - - test_five['aggregate']['rir'] == 1 + - test_five['aggregate']['rir'] == rir['key'] - test_five['msg'] == "aggregate 2001::/32 created" diff --git a/tests/integration/targets/latest/tasks/cable.yml b/tests/integration/targets/latest/tasks/cable.yml index 823c5a00..efc8fc86 100644 --- a/tests/integration/targets/latest/tasks/cable.yml +++ b/tests/integration/targets/latest/tasks/cable.yml @@ -7,19 +7,23 @@ ### PYNAUTOBOT_CABLE ## ## +- set_fact: + nexus_parent_intf: '{{ lookup(''networktocode.nautobot.lookup'', ''interfaces'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''device="Test Nexus One" name="Ethernet1/1"'') }}' + nexus_child_intf: '{{ lookup(''networktocode.nautobot.lookup'', ''interfaces'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''device="Test Nexus Child One" name="Ethernet2/1"'') }}' + - name: "CABLE 1: Necessary info creation" networktocode.nautobot.cable: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - termination_a_type: dcim.interface - termination_a: - device: Test Nexus Child One - name: Ethernet2/2 - termination_b_type: dcim.interface - termination_b: - device: Test Nexus Child One - name: Ethernet2/1 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + termination_a_type: dcim.interface + termination_a: + device: Test Nexus One + name: Ethernet1/1 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 + status: "connected" state: present register: test_one @@ -30,56 +34,55 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['cable']['termination_a_type'] == "dcim.interface" - - test_one['cable']['termination_a_id'] == 13 + - test_one['cable']['termination_a_id'] == nexus_parent_intf['key'] - test_one['cable']['termination_b_type'] == "dcim.interface" - - test_one['cable']['termination_b_id'] == 2 - - test_one['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 created" + - test_one['cable']['termination_b_id'] == nexus_child_intf['key'] + - test_one['msg'] == "cable dcim.interface Ethernet1/1 <> dcim.interface Ethernet2/1 created" - name: "CABLE 2: Create duplicate" networktocode.nautobot.cable: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - termination_a_type: dcim.interface - termination_a: - device: Test Nexus Child One - name: Ethernet2/2 - termination_b_type: dcim.interface - termination_b: - device: Test Nexus Child One - name: Ethernet2/1 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + termination_a_type: dcim.interface + termination_a: + device: Test Nexus One + name: Ethernet1/1 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 + status: "connected" state: present register: test_two - name: "CABLE 2: ASSERT - Create duplicate" assert: that: - - not test_two['changed'] + - test_two is not changed - test_two['cable']['termination_a_type'] == "dcim.interface" - - test_two['cable']['termination_a_id'] == 13 + - test_two['cable']['termination_a_id'] == nexus_parent_intf['key'] - test_two['cable']['termination_b_type'] == "dcim.interface" - - test_two['cable']['termination_b_id'] == 2 - - test_two['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 already exists" + - test_two['cable']['termination_b_id'] == nexus_child_intf['key'] + - test_two['msg'] == "cable dcim.interface Ethernet1/1 <> dcim.interface Ethernet2/1 already exists" - name: "CABLE 3: Update Cable with other fields" networktocode.nautobot.cable: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - termination_a_type: dcim.interface - termination_a: - device: Test Nexus Child One - name: Ethernet2/2 - termination_b_type: dcim.interface - termination_b: - device: Test Nexus Child One - name: Ethernet2/1 - type: mmf-om4 - status: planned - label: label123 - color: abcdef - length: 30 - length_unit: m + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + termination_a_type: dcim.interface + termination_a: + device: Test Nexus One + name: Ethernet1/1 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 + type: mmf-om4 + status: planned + label: label123 + color: abcdef + length: 30 + length_unit: m state: present register: test_three @@ -94,30 +97,29 @@ - test_three['diff']['after']['length'] == 30 - test_three['diff']['after']['length_unit'] == "m" - test_three['cable']['termination_a_type'] == "dcim.interface" - - test_three['cable']['termination_a_id'] == 13 + - test_three['cable']['termination_a_id'] == nexus_parent_intf['key'] - test_three['cable']['termination_b_type'] == "dcim.interface" - - test_three['cable']['termination_b_id'] == 2 + - test_three['cable']['termination_b_id'] == nexus_child_intf['key'] - test_three['cable']['type'] == "mmf-om4" - test_three['cable']['status'] == "planned" - test_three['cable']['label'] == "label123" - test_three['cable']['color'] == "abcdef" - test_three['cable']['length'] == 30 - test_three['cable']['length_unit'] == "m" - - test_three['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 updated" + - test_three['msg'] == "cable dcim.interface Ethernet1/1 <> dcim.interface Ethernet2/1 updated" - name: "CABLE 4: ASSERT - Delete" networktocode.nautobot.cable: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - termination_a_type: dcim.interface - termination_a: - device: Test Nexus Child One - name: Ethernet2/2 - termination_b_type: dcim.interface - termination_b: - device: Test Nexus Child One - name: Ethernet2/1 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + termination_a_type: dcim.interface + termination_a: + device: Test Nexus One + name: Ethernet1/1 + termination_b_type: dcim.interface + termination_b: + device: Test Nexus Child One + name: Ethernet2/1 state: absent register: test_four @@ -127,21 +129,21 @@ - test_four is changed - test_four['diff']['before']['state'] == "present" - test_four['diff']['after']['state'] == "absent" - - test_four['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 deleted" + - test_four['msg'] == "cable dcim.interface Ethernet1/1 <> dcim.interface Ethernet2/1 deleted" - name: "CABLE 5: Connect Console Port and Console Server Port" networktocode.nautobot.cable: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - termination_a_type: dcim.consoleserverport - termination_a: - name: Console Server Port - device: test100 - termination_b_type: dcim.consoleport - termination_b: - name: Console Port - device: test100 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + termination_a_type: dcim.consoleserverport + termination_a: + name: Test Console Server Port + device: test100 + termination_b_type: dcim.consoleport + termination_b: + name: Test Console Port + device: test100 + status: "connected" state: present register: test_five @@ -152,27 +154,33 @@ - test_five['diff']['before']['state'] == "absent" - test_five['diff']['after']['state'] == "present" - test_five['cable']['termination_a_type'] == "dcim.consoleserverport" - - test_five['cable']['termination_a_id'] == 1 + - test_five['cable']['termination_a_id'] == console_server_port['key'] - test_five['cable']['termination_b_type'] == "dcim.consoleport" - - test_five['cable']['termination_b_id'] == 1 - - test_five['msg'] == "cable dcim.consoleserverport Console Server Port <> dcim.consoleport Console Port created" + - test_five['cable']['termination_b_id'] == console_port['key'] + - test_five['msg'] == "cable dcim.consoleserverport Test Console Server Port <> dcim.consoleport Test Console Port created" + vars: + console_port: '{{ lookup(''networktocode.nautobot.lookup'', ''console-ports'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''device="test100" name="Test Console Port"'') }}' + console_server_port: '{{ lookup(''networktocode.nautobot.lookup'', ''console-server-ports'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''device="test100" name="Test Console Server Port"'') }}' - name: "CABLE 6: Circuits Termination as side A" networktocode.nautobot.cable: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - termination_a_type: circuits.circuittermination - termination_a: - circuit: "Test Circuit Two" - term_side: "A" - termination_b_type: dcim.interface - termination_b: - device: "test100" - name: "GigabitEthernet2" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + termination_a_type: circuits.circuittermination + termination_a: + circuit: "Test Circuit Two" + term_side: "A" + termination_b_type: dcim.interface + termination_b: + device: "test100" + name: "GigabitEthernet2" + status: "connected" state: present register: test_six +- set_fact: + circuit: '{{ lookup(''networktocode.nautobot.lookup'', ''circuits'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''cid="Test Circuit Two"'') }}' + - name: "CABLE 6: ASSERT - Circuits Termination as side A" assert: that: @@ -180,7 +188,10 @@ - test_six['diff']['before']['state'] == "absent" - test_six['diff']['after']['state'] == "present" - test_six['cable']['termination_a_type'] == "circuits.circuittermination" - - test_six['cable']['termination_a_id'] == 1 + - test_six['cable']['termination_a_id'] == circuit_termination['key'] - test_six['cable']['termination_b_type'] == "dcim.interface" - - test_six['cable']['termination_b_id'] == 4 - - test_six['msg'] == "cable circuits.circuittermination 1 <> dcim.interface GigabitEthernet2 created" + - test_six['cable']['termination_b_id'] == interface['key'] + - test_six['msg'] == "cable circuits.circuittermination Test Circuit Two <> dcim.interface GigabitEthernet2 created" + vars: + circuit_termination: "{{ lookup('networktocode.nautobot.lookup', 'circuit-terminations', api_endpoint=nautobot_url, token=nautobot_token, api_filter='circuit_id=' ~ circuit['key'] ~ ' term_side=A') }}" + interface: '{{ lookup(''networktocode.nautobot.lookup'', ''interfaces'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''device="test100" name="GigabitEthernet2"'') }}' diff --git a/tests/integration/targets/latest/tasks/circuit.yml b/tests/integration/targets/latest/tasks/circuit.yml index 46d3d316..16e1ff1b 100644 --- a/tests/integration/targets/latest/tasks/circuit.yml +++ b/tests/integration/targets/latest/tasks/circuit.yml @@ -4,14 +4,19 @@ ### PYNAUTOBOT_CIRCUIT ## ## +- set_fact: + provider: "{{ lookup('networktocode.nautobot.lookup', 'circuit-providers', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-provider') }}" + type: "{{ lookup('networktocode.nautobot.lookup', 'circuit-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-circuit-type') }}" + tenant: "{{ lookup('networktocode.nautobot.lookup', 'tenants', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-tenant') }}" + - name: "PYNAUTOBOT_CIRCUIT 1: Create provider within Nautobot with only required information" networktocode.nautobot.circuit: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - cid: Test Circuit One - provider: Test Provider - circuit_type: Test Circuit Type + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + cid: Test Circuit One + provider: Test Provider + circuit_type: Test Circuit Type + status: "Active" state: present register: test_one @@ -22,18 +27,18 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['circuit']['cid'] == "Test Circuit One" - - test_one['circuit']['provider'] == 1 - - test_one['circuit']['type'] == 1 + - test_one['circuit']['provider'] == provider['key'] + - test_one['circuit']['type'] == type['key'] - test_one['msg'] == "circuit Test Circuit One created" - name: "PYNAUTOBOT_CIRCUIT 2: Duplicate" networktocode.nautobot.circuit: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - cid: Test Circuit One - provider: Test Provider - circuit_type: Test Circuit Type + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + cid: Test Circuit One + provider: Test Provider + circuit_type: Test Circuit Type + status: "Active" state: present register: test_two @@ -42,24 +47,23 @@ that: - not test_two['changed'] - test_two['circuit']['cid'] == "Test Circuit One" - - test_two['circuit']['provider'] == 1 - - test_two['circuit']['type'] == 1 + - test_two['circuit']['provider'] == provider['key'] + - test_two['circuit']['type'] == type['key'] - test_two['msg'] == "circuit Test Circuit One already exists" - name: "PYNAUTOBOT_CIRCUIT 3: Update provider with other fields" networktocode.nautobot.circuit: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - cid: Test Circuit One - provider: Test Provider - circuit_type: Test Circuit Type - status: Planned - tenant: Test Tenant - install_date: "2018-12-25" - commit_rate: 10000 - description: "Test circuit " - comments: "FAST CIRCUIT" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + cid: Test Circuit One + provider: Test Provider + circuit_type: Test Circuit Type + status: Planned + tenant: Test Tenant + install_date: "2018-12-25" + commit_rate: 10000 + description: "Test circuit " + comments: "FAST CIRCUIT" state: present register: test_three @@ -68,16 +72,16 @@ that: - test_three is changed - test_three['diff']['after']['status'] == "planned" - - test_three['diff']['after']['tenant'] == 1 + - test_three['diff']['after']['tenant'] == tenant['key'] - test_three['diff']['after']['install_date'] == "2018-12-25" - test_three['diff']['after']['commit_rate'] == 10000 - test_three['diff']['after']['description'] == "Test circuit" - test_three['diff']['after']['comments'] == "FAST CIRCUIT" - test_three['circuit']['cid'] == "Test Circuit One" - - test_three['circuit']['provider'] == 1 - - test_three['circuit']['type'] == 1 + - test_three['circuit']['provider'] == provider['key'] + - test_three['circuit']['type'] == type['key'] - test_three['circuit']['status'] == "planned" - - test_three['circuit']['tenant'] == 1 + - test_three['circuit']['tenant'] == tenant['key'] - test_three['circuit']['install_date'] == "2018-12-25" - test_three['circuit']['commit_rate'] == 10000 - test_three['circuit']['description'] == "Test circuit" @@ -86,10 +90,9 @@ - name: "PYNAUTOBOT_CIRCUIT 4: Delete provider within nautobot" networktocode.nautobot.circuit: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - cid: Test Circuit One + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + cid: Test Circuit One state: absent register: test_four @@ -98,10 +101,10 @@ that: - test_four is changed - test_four['circuit']['cid'] == "Test Circuit One" - - test_four['circuit']['provider'] == 1 - - test_four['circuit']['type'] == 1 + - test_four['circuit']['provider'] == provider['key'] + - test_four['circuit']['type'] == type['key'] - test_four['circuit']['status'] == "planned" - - test_four['circuit']['tenant'] == 1 + - test_four['circuit']['tenant'] == tenant['key'] - test_four['circuit']['install_date'] == "2018-12-25" - test_four['circuit']['commit_rate'] == 10000 - test_four['circuit']['description'] == "Test circuit" diff --git a/tests/integration/targets/latest/tasks/circuit_termination.yml b/tests/integration/targets/latest/tasks/circuit_termination.yml index 3a270f61..05c559af 100644 --- a/tests/integration/targets/latest/tasks/circuit_termination.yml +++ b/tests/integration/targets/latest/tasks/circuit_termination.yml @@ -4,15 +4,18 @@ ### PYNAUTOBOT_CIRCUIT_TERMINATION ## ## +- set_fact: + test_site: "{{ lookup('networktocode.nautobot.lookup', 'sites', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-site') }}" + circuit: '{{ lookup(''networktocode.nautobot.lookup'', ''circuits'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''cid="Test Circuit"'') }}' + - name: "PYNAUTOBOT_CIRCUIT_TERMINATION 1: Create provider within Nautobot with only required information" networktocode.nautobot.circuit_termination: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - circuit: Test Circuit - term_side: A - site: "Test Site" - port_speed: 10000 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + circuit: Test Circuit + term_side: A + site: "Test Site" + port_speed: 10000 state: present register: test_one @@ -22,19 +25,18 @@ - test_one is changed - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - - test_one['circuit_termination']['circuit'] == 1 + - test_one['circuit_termination']['circuit'] == circuit['key'] - test_one['circuit_termination']['term_side'] == "A" - - test_one['circuit_termination']['site'] == 1 + - test_one['circuit_termination']['site'] == test_site['key'] - test_one['circuit_termination']['port_speed'] == 10000 - test_one['msg'] == "circuit_termination test_circuit_a created" - name: "PYNAUTOBOT_CIRCUIT_TERMINATION 2: Duplicate" networktocode.nautobot.circuit_termination: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - circuit: Test Circuit - term_side: A + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + circuit: Test Circuit + term_side: A state: present register: test_two @@ -42,23 +44,22 @@ assert: that: - not test_two['changed'] - - test_two['circuit_termination']['circuit'] == 1 + - test_two['circuit_termination']['circuit'] == circuit['key'] - test_two['circuit_termination']['term_side'] == "A" - - test_two['circuit_termination']['site'] == 1 + - test_two['circuit_termination']['site'] == test_site['key'] - test_two['circuit_termination']['port_speed'] == 10000 - test_two['msg'] == "circuit_termination test_circuit_a already exists" - name: "PYNAUTOBOT_CIRCUIT_TERMINATION 3: Update provider with other fields" networktocode.nautobot.circuit_termination: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - circuit: Test Circuit - term_side: A - upstream_speed: 1000 - xconnect_id: 10X100 - pp_info: PP10-24 - description: "Test description" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + circuit: Test Circuit + term_side: A + upstream_speed: 1000 + xconnect_id: 10X100 + pp_info: PP10-24 + description: "Test description" state: present register: test_three @@ -70,9 +71,9 @@ - test_three['diff']['after']['xconnect_id'] == "10X100" - test_three['diff']['after']['pp_info'] == "PP10-24" - test_three['diff']['after']['description'] == "Test description" - - test_three['circuit_termination']['circuit'] == 1 + - test_three['circuit_termination']['circuit'] == circuit['key'] - test_three['circuit_termination']['term_side'] == "A" - - test_three['circuit_termination']['site'] == 1 + - test_three['circuit_termination']['site'] == test_site['key'] - test_three['circuit_termination']['port_speed'] == 10000 - test_three['circuit_termination']['upstream_speed'] == 1000 - test_three['circuit_termination']['xconnect_id'] == "10X100" @@ -82,13 +83,12 @@ - name: "PYNAUTOBOT_CIRCUIT_TERMINATION 4: Create Z Side" networktocode.nautobot.circuit_termination: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - circuit: Test Circuit - term_side: Z - site: "Test Site" - port_speed: 10000 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + circuit: Test Circuit + term_side: Z + site: "Test Site" + port_speed: 10000 state: present register: test_four @@ -98,19 +98,18 @@ - test_four is changed - test_four['diff']['before']['state'] == "absent" - test_four['diff']['after']['state'] == "present" - - test_four['circuit_termination']['circuit'] == 1 + - test_four['circuit_termination']['circuit'] == circuit['key'] - test_four['circuit_termination']['term_side'] == "Z" - - test_four['circuit_termination']['site'] == 1 + - test_four['circuit_termination']['site'] == test_site['key'] - test_four['circuit_termination']['port_speed'] == 10000 - test_four['msg'] == "circuit_termination test_circuit_z created" - name: "PYNAUTOBOT_CIRCUIT_TERMINATION 5: Delete provider within nautobot" networktocode.nautobot.circuit_termination: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - circuit: Test Circuit - term_side: A + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + circuit: Test Circuit + term_side: A state: absent register: test_five @@ -118,9 +117,9 @@ assert: that: - test_five is changed - - test_five['circuit_termination']['circuit'] == 1 + - test_five['circuit_termination']['circuit'] == circuit['key'] - test_five['circuit_termination']['term_side'] == "A" - - test_five['circuit_termination']['site'] == 1 + - test_five['circuit_termination']['site'] == test_site['key'] - test_five['circuit_termination']['port_speed'] == 10000 - test_five['circuit_termination']['upstream_speed'] == 1000 - test_five['circuit_termination']['xconnect_id'] == "10X100" diff --git a/tests/integration/targets/latest/tasks/circuit_type.yml b/tests/integration/targets/latest/tasks/circuit_type.yml index a3e861e1..4a7c3ba7 100644 --- a/tests/integration/targets/latest/tasks/circuit_type.yml +++ b/tests/integration/targets/latest/tasks/circuit_type.yml @@ -6,10 +6,9 @@ ## - name: "CIRCUIT_TYPE 1: Necessary info creation" networktocode.nautobot.circuit_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Circuit Type One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Circuit Type One" state: present register: test_one @@ -25,10 +24,9 @@ - name: "CIRCUIT_TYPE 2: Create duplicate" networktocode.nautobot.circuit_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Circuit Type One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Circuit Type One" state: present register: test_two @@ -42,11 +40,10 @@ - name: "CIRCUIT_TYPE 3: User specified slug" networktocode.nautobot.circuit_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Circuit Type Two" - slug: "test-circuit-type-2" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Circuit Type Two" + slug: "test-circuit-type-2" state: present register: test_three @@ -62,10 +59,9 @@ - name: "CIRCUIT_TYPE 4: ASSERT - Delete" networktocode.nautobot.circuit_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Circuit Type One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Circuit Type One" state: absent register: test_four @@ -79,11 +75,10 @@ - name: "CIRCUIT_TYPE 5: ASSERT - Delete" networktocode.nautobot.circuit_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Circuit Type Two" - slug: "test-circuit-type-2" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Circuit Type Two" + slug: "test-circuit-type-2" state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/cluster.yml b/tests/integration/targets/latest/tasks/cluster.yml index e3b661ca..a2537c53 100644 --- a/tests/integration/targets/latest/tasks/cluster.yml +++ b/tests/integration/targets/latest/tasks/cluster.yml @@ -4,13 +4,19 @@ ### PYNAUTOBOT_CLUSTER ## ## +- set_fact: + test_cluster_type: "{{ lookup('networktocode.nautobot.lookup', 'cluster-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-cluster-type') }}" + test_cluster_group: "{{ lookup('networktocode.nautobot.lookup', 'cluster-groups', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-cluster-group') }}" + test_site: "{{ lookup('networktocode.nautobot.lookup', 'sites', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-site') }}" + tenant: "{{ lookup('networktocode.nautobot.lookup', 'tenants', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-tenant') }}" + tag_schnozzberry: "{{ lookup('networktocode.nautobot.lookup', 'tags', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=schnozzberry') }}" + - name: "CLUSTER 1: Necessary info creation" networktocode.nautobot.cluster: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster One" - cluster_type: "Test Cluster Type" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Cluster One" + cluster_type: "Test Cluster Type" state: present register: test_one @@ -21,16 +27,15 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['cluster']['name'] == "Test Cluster One" - - test_one['cluster']['type'] == 1 + - test_one['cluster']['type'] == test_cluster_type['key'] - test_one['msg'] == "cluster Test Cluster One created" - name: "CLUSTER 2: Create duplicate" networktocode.nautobot.cluster: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster One" - cluster_type: "Test Cluster Type" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Cluster One" + cluster_type: "Test Cluster Type" state: present register: test_two @@ -39,22 +44,21 @@ that: - not test_two['changed'] - test_two['cluster']['name'] == "Test Cluster One" - - test_two['cluster']['type'] == 1 + - test_two['cluster']['type'] == test_cluster_type['key'] - test_two['msg'] == "cluster Test Cluster One already exists" - name: "CLUSTER 3: Update" networktocode.nautobot.cluster: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster One" - cluster_type: "Test Cluster Type" - cluster_group: "Test Cluster Group" - site: "Test Site" - comments: "Updated cluster" - tenant: "Test Tenant" - tags: - - "Schnozzberry" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Cluster One" + cluster_type: "Test Cluster Type" + cluster_group: "Test Cluster Group" + site: "Test Site" + comments: "Updated cluster" + tenant: "Test Tenant" + tags: + - "Schnozzberry" state: present register: test_three @@ -62,26 +66,25 @@ assert: that: - test_three is changed - - test_three['diff']['after']['group'] == 1 - - test_three['diff']['after']['site'] == 1 + - test_three['diff']['after']['group'] == test_cluster_group['key'] + - test_three['diff']['after']['site'] == test_site['key'] - test_three['diff']['after']['comments'] == "Updated cluster" - - test_three['diff']['after']['tags'][0] == 4 - - test_three['diff']['after']['tenant'] == 1 + - test_three['diff']['after']['tags'][0] == tag_schnozzberry['key'] + - test_three['diff']['after']['tenant'] == tenant['key'] - test_three['cluster']['name'] == "Test Cluster One" - - test_three['cluster']['type'] == 1 - - test_three['cluster']['group'] == 1 - - test_three['cluster']['site'] == 1 + - test_three['cluster']['type'] == test_cluster_type['key'] + - test_three['cluster']['group'] == test_cluster_group['key'] + - test_three['cluster']['site'] == test_site['key'] - test_three['cluster']['comments'] == "Updated cluster" - - test_three['cluster']['tags'][0] == 4 - - test_three['cluster']['tenant'] == 1 + - test_three['cluster']['tags'][0] == tag_schnozzberry['key'] + - test_three['cluster']['tenant'] == tenant['key'] - test_three['msg'] == "cluster Test Cluster One updated" - name: "CLUSTER 4: ASSERT - Delete" networktocode.nautobot.cluster: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Cluster One" state: absent register: test_four @@ -90,9 +93,9 @@ that: - test_four is changed - test_four['cluster']['name'] == "Test Cluster One" - - test_four['cluster']['type'] == 1 - - test_four['cluster']['group'] == 1 - - test_four['cluster']['site'] == 1 + - test_four['cluster']['type'] == test_cluster_type['key'] + - test_four['cluster']['group'] == test_cluster_group['key'] + - test_four['cluster']['site'] == test_site['key'] - test_four['cluster']['comments'] == "Updated cluster" - - test_four['cluster']['tags'][0] == 4 + - test_four['cluster']['tags'][0] == tag_schnozzberry['key'] - test_four['msg'] == "cluster Test Cluster One deleted" diff --git a/tests/integration/targets/latest/tasks/cluster_group.yml b/tests/integration/targets/latest/tasks/cluster_group.yml index 1ce28771..d669ef07 100644 --- a/tests/integration/targets/latest/tasks/cluster_group.yml +++ b/tests/integration/targets/latest/tasks/cluster_group.yml @@ -6,10 +6,9 @@ ## - name: "CLUSTER_GROUP 1: Necessary info creation" networktocode.nautobot.cluster_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Group One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Cluster Group One" state: present register: test_one @@ -25,10 +24,9 @@ - name: "CLUSTER_GROUP 2: Create duplicate" networktocode.nautobot.cluster_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Group One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Cluster Group One" state: present register: test_two @@ -42,11 +40,10 @@ - name: "CLUSTER_GROUP 3: User specified slug" networktocode.nautobot.cluster_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Group Two" - slug: "test-cluster-group-2" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Cluster Group Two" + slug: "test-cluster-group-2" state: present register: test_three @@ -62,10 +59,9 @@ - name: "CLUSTER_GROUP 4: ASSERT - Delete" networktocode.nautobot.cluster_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Group One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Cluster Group One" state: absent register: test_four @@ -79,11 +75,10 @@ - name: "CLUSTER_GROUP 5: ASSERT - Delete" networktocode.nautobot.cluster_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Group Two" - slug: "test-cluster-group-2" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Cluster Group Two" + slug: "test-cluster-group-2" state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/cluster_type.yml b/tests/integration/targets/latest/tasks/cluster_type.yml index 1f4e01fb..f68012b0 100644 --- a/tests/integration/targets/latest/tasks/cluster_type.yml +++ b/tests/integration/targets/latest/tasks/cluster_type.yml @@ -5,10 +5,9 @@ ## - name: "CLUSTER_TYPE 1: Necessary info creation" networktocode.nautobot.cluster_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Type One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Cluster Type One" state: present register: test_one @@ -24,10 +23,9 @@ - name: "CLUSTER_TYPE 2: Create duplicate" networktocode.nautobot.cluster_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Type One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Cluster Type One" state: present register: test_two @@ -41,11 +39,10 @@ - name: "CLUSTER_TYPE 3: User specified slug" networktocode.nautobot.cluster_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Type Two" - slug: "test-cluster-type-2" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Cluster Type Two" + slug: "test-cluster-type-2" state: present register: test_three @@ -61,10 +58,9 @@ - name: "CLUSTER_TYPE 4: ASSERT - Delete" networktocode.nautobot.cluster_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Type One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Cluster Type One" state: absent register: test_four @@ -78,11 +74,10 @@ - name: "CLUSTER_TYPE 5: ASSERT - Delete" networktocode.nautobot.cluster_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Type Two" - slug: "test-cluster-type-2" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Cluster Type Two" + slug: "test-cluster-type-2" state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/console_port.yml b/tests/integration/targets/latest/tasks/console_port.yml index 1939ee63..7349da31 100644 --- a/tests/integration/targets/latest/tasks/console_port.yml +++ b/tests/integration/targets/latest/tasks/console_port.yml @@ -7,13 +7,15 @@ ### PYNAUTOBOT_CONSOLE_PORT ## ## +- set_fact: + test100: "{{ lookup('networktocode.nautobot.lookup', 'devices', api_endpoint=nautobot_url, token=nautobot_token, api_filter='name=test100') }}" + - name: "CONSOLE_PORT 1: Necessary info creation" networktocode.nautobot.console_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port - device: test100 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Port + device: test100 state: present register: test_one @@ -24,16 +26,15 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['console_port']['name'] == "Console Port" - - test_one['console_port']['device'] == 1 + - test_one['console_port']['device'] == test100['key'] - test_one['msg'] == "console_port Console Port created" - name: "CONSOLE_PORT 2: Create duplicate" networktocode.nautobot.console_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port - device: test100 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Port + device: test100 state: present register: test_two @@ -42,18 +43,17 @@ that: - not test_two['changed'] - test_two['console_port']['name'] == "Console Port" - - test_two['console_port']['device'] == 1 + - test_two['console_port']['device'] == test100['key'] - test_two['msg'] == "console_port Console Port already exists" - name: "CONSOLE_PORT 3: Update Console Port with other fields" networktocode.nautobot.console_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port - device: test100 - type: usb-a - description: test description + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Port + device: test100 + type: usb-a + description: test description state: present register: test_three @@ -64,18 +64,17 @@ - test_three['diff']['after']['type'] == "usb-a" - test_three['diff']['after']['description'] == "test description" - test_three['console_port']['name'] == "Console Port" - - test_three['console_port']['device'] == 1 + - test_three['console_port']['device'] == test100['key'] - test_three['console_port']['type'] == "usb-a" - test_three['console_port']['description'] == "test description" - test_three['msg'] == "console_port Console Port updated" - name: "CONSOLE_PORT 4: Create Console Port for Delete Test" networktocode.nautobot.console_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port 2 - device: test100 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Port 2 + device: test100 state: present register: test_four @@ -86,16 +85,15 @@ - test_four['diff']['before']['state'] == "absent" - test_four['diff']['after']['state'] == "present" - test_four['console_port']['name'] == "Console Port 2" - - test_four['console_port']['device'] == 1 + - test_four['console_port']['device'] == test100['key'] - test_four['msg'] == "console_port Console Port 2 created" - name: "CONSOLE_PORT 5: Delete Console Port" networktocode.nautobot.console_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port 2 - device: test100 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Port 2 + device: test100 state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/console_port_template.yml b/tests/integration/targets/latest/tasks/console_port_template.yml index 49ead67e..f2db9158 100644 --- a/tests/integration/targets/latest/tasks/console_port_template.yml +++ b/tests/integration/targets/latest/tasks/console_port_template.yml @@ -7,13 +7,15 @@ ### PYNAUTOBOT_CONSOLE_PORT_TEMPLATE ## ## +- set_fact: + cisco_test: "{{ lookup('networktocode.nautobot.lookup', 'device-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=cisco-test') }}" + - name: "CONSOLE_PORT_TEMPLATE 1: Necessary info creation" networktocode.nautobot.console_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port Template - device_type: Cisco Test + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Port Template + device_type: Cisco Test state: present register: test_one @@ -24,16 +26,15 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['console_port_template']['name'] == "Console Port Template" - - test_one['console_port_template']['device_type'] == 1 + - test_one['console_port_template']['device_type'] == cisco_test['key'] - test_one['msg'] == "console_port_template Console Port Template created" - name: "CONSOLE_PORT_TEMPLATE 2: Create duplicate" networktocode.nautobot.console_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port Template - device_type: Cisco Test + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Port Template + device_type: Cisco Test state: present register: test_two @@ -42,17 +43,16 @@ that: - not test_two['changed'] - test_two['console_port_template']['name'] == "Console Port Template" - - test_two['console_port_template']['device_type'] == 1 + - test_two['console_port_template']['device_type'] == cisco_test['key'] - test_two['msg'] == "console_port_template Console Port Template already exists" - name: "CONSOLE_PORT_TEMPLATE 3: Update Console Port Template with other fields" networktocode.nautobot.console_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port Template - device_type: Cisco Test - type: usb-a + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Port Template + device_type: Cisco Test + type: usb-a state: present register: test_three @@ -62,17 +62,16 @@ - test_three is changed - test_three['diff']['after']['type'] == "usb-a" - test_three['console_port_template']['name'] == "Console Port Template" - - test_three['console_port_template']['device_type'] == 1 + - test_three['console_port_template']['device_type'] == cisco_test['key'] - test_three['console_port_template']['type'] == "usb-a" - test_three['msg'] == "console_port_template Console Port Template updated" - name: "CONSOLE_PORT_TEMPLATE 4: Create Console Port Template for Delete Test" networktocode.nautobot.console_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port Template 2 - device_type: Cisco Test + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Port Template 2 + device_type: Cisco Test state: present register: test_four @@ -83,16 +82,15 @@ - test_four['diff']['before']['state'] == "absent" - test_four['diff']['after']['state'] == "present" - test_four['console_port_template']['name'] == "Console Port Template 2" - - test_four['console_port_template']['device_type'] == 1 + - test_four['console_port_template']['device_type'] == cisco_test['key'] - test_four['msg'] == "console_port_template Console Port Template 2 created" - name: "CONSOLE_PORT_TEMPLATE 5: Delete Console Port Template" networktocode.nautobot.console_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port Template 2 - device_type: Cisco Test + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Port Template 2 + device_type: Cisco Test state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/console_server_port.yml b/tests/integration/targets/latest/tasks/console_server_port.yml index 98c11690..3c0fc585 100644 --- a/tests/integration/targets/latest/tasks/console_server_port.yml +++ b/tests/integration/targets/latest/tasks/console_server_port.yml @@ -7,13 +7,15 @@ ### PYNAUTOBOT_CONSOLE_SERVER_PORT ## ## +- set_fact: + test100: "{{ lookup('networktocode.nautobot.lookup', 'devices', api_endpoint=nautobot_url, token=nautobot_token, api_filter='name=test100') }}" + - name: "CONSOLE_SERVER_PORT 1: Necessary info creation" networktocode.nautobot.console_server_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port - device: test100 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Server Port + device: test100 state: present register: test_one @@ -24,16 +26,15 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['console_server_port']['name'] == "Console Server Port" - - test_one['console_server_port']['device'] == 1 + - test_one['console_server_port']['device'] == test100['key'] - test_one['msg'] == "console_server_port Console Server Port created" - name: "CONSOLE_SERVER_PORT 2: Create duplicate" networktocode.nautobot.console_server_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port - device: test100 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Server Port + device: test100 state: present register: test_two @@ -42,18 +43,17 @@ that: - not test_two['changed'] - test_two['console_server_port']['name'] == "Console Server Port" - - test_two['console_server_port']['device'] == 1 + - test_two['console_server_port']['device'] == test100['key'] - test_two['msg'] == "console_server_port Console Server Port already exists" - name: "CONSOLE_SERVER_PORT 3: Update Console Server Port with other fields" networktocode.nautobot.console_server_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port - device: test100 - type: usb-a - description: test description + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Server Port + device: test100 + type: usb-a + description: test description state: present register: test_three @@ -64,18 +64,17 @@ - test_three['diff']['after']['type'] == "usb-a" - test_three['diff']['after']['description'] == "test description" - test_three['console_server_port']['name'] == "Console Server Port" - - test_three['console_server_port']['device'] == 1 + - test_three['console_server_port']['device'] == test100['key'] - test_three['console_server_port']['type'] == "usb-a" - test_three['console_server_port']['description'] == "test description" - test_three['msg'] == "console_server_port Console Server Port updated" - name: "CONSOLE_SERVER_PORT 4: Create Console Server Port for Delete Test" networktocode.nautobot.console_server_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port 2 - device: test100 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Server Port 2 + device: test100 state: present register: test_four @@ -86,16 +85,15 @@ - test_four['diff']['before']['state'] == "absent" - test_four['diff']['after']['state'] == "present" - test_four['console_server_port']['name'] == "Console Server Port 2" - - test_four['console_server_port']['device'] == 1 + - test_four['console_server_port']['device'] == test100['key'] - test_four['msg'] == "console_server_port Console Server Port 2 created" - name: "CONSOLE_SERVER_PORT 5: Delete Console Server Port" networktocode.nautobot.console_server_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port 2 - device: test100 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Server Port 2 + device: test100 state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/console_server_port_template.yml b/tests/integration/targets/latest/tasks/console_server_port_template.yml index 9420cb3d..f073a030 100644 --- a/tests/integration/targets/latest/tasks/console_server_port_template.yml +++ b/tests/integration/targets/latest/tasks/console_server_port_template.yml @@ -7,13 +7,15 @@ ### PYNAUTOBOT_CONSOLE_SERVER_PORT_TEMPLATE ## ## +- set_fact: + cisco_test: "{{ lookup('networktocode.nautobot.lookup', 'device-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=cisco-test') }}" + - name: "CONSOLE_SERVER_PORT_TEMPLATE 1: Necessary info creation" networktocode.nautobot.console_server_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port Template - device_type: Cisco Test + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Server Port Template + device_type: Cisco Test state: present register: test_one @@ -24,16 +26,15 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['console_server_port_template']['name'] == "Console Server Port Template" - - test_one['console_server_port_template']['device_type'] == 1 + - test_one['console_server_port_template']['device_type'] == cisco_test['key'] - test_one['msg'] == "console_server_port_template Console Server Port Template created" - name: "CONSOLE_SERVER_PORT_TEMPLATE 2: Create duplicate" networktocode.nautobot.console_server_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port Template - device_type: Cisco Test + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Server Port Template + device_type: Cisco Test state: present register: test_two @@ -42,17 +43,16 @@ that: - not test_two['changed'] - test_two['console_server_port_template']['name'] == "Console Server Port Template" - - test_two['console_server_port_template']['device_type'] == 1 + - test_two['console_server_port_template']['device_type'] == cisco_test['key'] - test_two['msg'] == "console_server_port_template Console Server Port Template already exists" - name: "CONSOLE_SERVER_PORT_TEMPLATE 3: Update Console Server Port Template with other fields" networktocode.nautobot.console_server_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port Template - device_type: Cisco Test - type: usb-a + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Server Port Template + device_type: Cisco Test + type: usb-a state: present register: test_three @@ -62,17 +62,16 @@ - test_three is changed - test_three['diff']['after']['type'] == "usb-a" - test_three['console_server_port_template']['name'] == "Console Server Port Template" - - test_three['console_server_port_template']['device_type'] == 1 + - test_three['console_server_port_template']['device_type'] == cisco_test['key'] - test_three['console_server_port_template']['type'] == "usb-a" - test_three['msg'] == "console_server_port_template Console Server Port Template updated" - name: "CONSOLE_SERVER_PORT_TEMPLATE 4: Create Console Server Port Template for Delete Test" networktocode.nautobot.console_server_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port Template 2 - device_type: Cisco Test + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Server Port Template 2 + device_type: Cisco Test state: present register: test_four @@ -83,16 +82,15 @@ - test_four['diff']['before']['state'] == "absent" - test_four['diff']['after']['state'] == "present" - test_four['console_server_port_template']['name'] == "Console Server Port Template 2" - - test_four['console_server_port_template']['device_type'] == 1 + - test_four['console_server_port_template']['device_type'] == cisco_test['key'] - test_four['msg'] == "console_server_port_template Console Server Port Template 2 created" - name: "CONSOLE_SERVER_PORT_TEMPLATE 5: Delete Console Server Port Template" networktocode.nautobot.console_server_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port Template 2 - device_type: Cisco Test + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Console Server Port Template 2 + device_type: Cisco Test state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/device.yml b/tests/integration/targets/latest/tasks/device.yml index f5bf2258..081e4dde 100644 --- a/tests/integration/targets/latest/tasks/device.yml +++ b/tests/integration/targets/latest/tasks/device.yml @@ -4,17 +4,22 @@ ### PYNAUTOBOT_DEVICE ## ## +- set_fact: + test_site: "{{ lookup('networktocode.nautobot.lookup', 'sites', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-site') }}" + device_type: "{{ lookup('networktocode.nautobot.lookup', 'device-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=cisco-test') }}" + device_role: "{{ lookup('networktocode.nautobot.lookup', 'device-roles', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=core-switch') }}" + vc1: "{{ lookup('networktocode.nautobot.lookup', 'virtual-chassis', api_endpoint=nautobot_url, token=nautobot_token, api_filter='name=VC1') }}" + - name: "1 - Device with required information" networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "R1" - device_type: - id: "1" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "R1" + device_type: + id: "{{ device_type['key'] }}" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" state: present register: test_one @@ -25,23 +30,22 @@ - test_one['diff']['before']['state'] == 'absent' - test_one['diff']['after']['state'] == 'present' - test_one['device']['name'] == "R1" - - test_one['device']['device_role'] == 1 - - test_one['device']['device_type'] == 1 - - test_one['device']['site'] == 1 + - test_one['device']['device_role'] == device_role['key'] + - test_one['device']['device_type'] == device_type['key'] + - test_one['device']['site'] == test_site['key'] - test_one['device']['status'] == "staged" - test_one['device']['name'] == "R1" - test_one['msg'] == "device R1 created" - name: "2 - Duplicate device" networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "R1" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "R1" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" state: present register: test_two @@ -50,24 +54,24 @@ that: - not test_two['changed'] - test_two['device']['name'] == "R1" - - test_two['device']['device_role'] == 1 - - test_two['device']['device_type'] == 1 - - test_two['device']['site'] == 1 + - test_two['device']['device_role'] == device_role['key'] + - test_two['device']['device_type'] == device_type['key'] + - test_two['device']['site'] == test_site['key'] - test_two['device']['status'] == "staged" - test_two['msg'] == "device R1 already exists" - name: "3 - Update device" networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "R1" - serial: "FXS1001" - local_context_data: - bgp_as: "65412" - virtual_chassis: "Test Nexus One" - vc_position: 3 - vc_priority: 15 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "R1" + serial: "FXS1001" + status: "Staged" + local_context_data: + bgp_as: "65412" + virtual_chassis: "VC1" + vc_position: 3 + vc_priority: 15 state: present register: test_three @@ -77,28 +81,28 @@ - test_three is changed - test_three['diff']['after']['serial'] == "FXS1001" - test_three['diff']['after']['local_context_data']["bgp_as"] == "65412" - - test_three['diff']['after']['virtual_chassis'] == 1 + - test_three['diff']['after']['virtual_chassis'] == vc1['key'] - test_three['diff']['after']['vc_position'] == 3 - test_three['diff']['after']['vc_priority'] == 15 - test_three['device']['name'] == "R1" - - test_three['device']['device_role'] == 1 - - test_three['device']['device_type'] == 1 - - test_three['device']['site'] == 1 + - test_three['device']['device_role'] == device_role['key'] + - test_three['device']['device_type'] == device_type['key'] + - test_three['device']['site'] == test_site['key'] - test_three['device']['status'] == "staged" - test_three['device']['serial'] == "FXS1001" - test_three['device']['local_context_data']["bgp_as"] == "65412" - - test_three['device']['virtual_chassis'] == 1 + - test_three['device']['virtual_chassis'] == vc1['key'] - test_three['device']['vc_position'] == 3 - test_three['device']['vc_priority'] == 15 - test_three['msg'] == "device R1 updated" - name: "3.1 - Update device name using query_params" networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "R1-changed-name" - serial: "FXS1001" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "R1-changed-name" + serial: "FXS1001" + status: "Staged" query_params: - serial state: present @@ -109,9 +113,9 @@ that: - test_three_dot_one is changed - test_three_dot_one['diff']['after']['name'] == "R1-changed-name" - - test_three_dot_one['device']['device_role'] == 1 - - test_three_dot_one['device']['device_type'] == 1 - - test_three_dot_one['device']['site'] == 1 + - test_three_dot_one['device']['device_role'] == device_role['key'] + - test_three_dot_one['device']['device_type'] == device_type['key'] + - test_three_dot_one['device']['site'] == test_site['key'] - test_three_dot_one['device']['status'] == "staged" - test_three_dot_one['device']['serial'] == "FXS1001" - test_three_dot_one['device']['local_context_data']["bgp_as"] == "65412" @@ -119,20 +123,20 @@ - name: "4 - Create device with tags and assign to rack" networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "TestR1" - device_type: "1841" - device_role: "Core Switch" - site: "Test Site2" - rack: "Test Rack Site 2" - position: 35 - face: "Front" - tags: - - "schnozzberry" - tenant: "Test Tenant" - asset_tag: "1234" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "TestR1" + device_type: "1841" + device_role: "Core Switch" + site: "Test Site2" + rack: "Test Rack Site 2" + status: "Active" + position: 35 + face: "Front" + tags: + - "schnozzberry" + tenant: "Test Tenant" + asset_tag: "1234" state: present register: test_four @@ -143,22 +147,27 @@ - test_four['diff']['before']['state'] == "absent" - test_four['diff']['after']['state'] == "present" - test_four['device']['name'] == "TestR1" - - test_four['device']['device_role'] == 1 - - test_four['device']['device_type'] == 5 - - test_four['device']['site'] == 2 + - test_four['device']['device_role'] == device_role['key'] + - test_four['device']['device_type'] == type['key'] + - test_four['device']['site'] == site['key'] - test_four['device']['status'] == "active" - - test_four['device']['rack'] == 1 - - test_four['device']['tags'][0] == 4 - - test_four['device']['tenant'] == 1 + - test_four['device']['rack'] == rack['key'] + - test_four['device']['tags'][0] == schnozzberry['key'] + - test_four['device']['tenant'] == tenant['key'] - test_four['device']['asset_tag'] == '1234' - test_four['msg'] == "device TestR1 created" + vars: + site: "{{ lookup('networktocode.nautobot.lookup', 'sites', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-site2') }}" + rack: '{{ lookup(''networktocode.nautobot.lookup'', ''racks'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''name="Test Rack Site 2"'') }}' + tenant: "{{ lookup('networktocode.nautobot.lookup', 'tenants', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-tenant') }}" + type: "{{ lookup('networktocode.nautobot.lookup', 'device-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=1841') }}" + schnozzberry: "{{ lookup('networktocode.nautobot.lookup', 'tags', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=schnozzberry') }}" - name: "5 - Delete previous device" networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "TestR1" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "TestR1" state: absent register: test_five @@ -172,10 +181,9 @@ - name: "6 - Delete R1" networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "R1-changed-name" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "R1-changed-name" state: absent register: test_six @@ -189,12 +197,12 @@ - name: "7 - Add primary_ip4/6 to test100" networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "test100" - primary_ip4: "172.16.180.1/24" - primary_ip6: "2001::1:1/64" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "test100" + primary_ip4: "172.16.180.1/24" + primary_ip6: "2001::1:1/64" + status: "Active" state: present register: test_seven @@ -202,28 +210,30 @@ assert: that: - test_seven is changed - - test_seven['diff']['after']['primary_ip4'] == 1 - - test_seven['diff']['after']['primary_ip6'] == 2 + - test_seven['diff']['after']['primary_ip4'] == ip4['key'] + - test_seven['diff']['after']['primary_ip6'] == ip6['key'] - test_seven['device']['name'] == "test100" - - test_seven['device']['device_role'] == 1 - - test_seven['device']['device_type'] == 1 - - test_seven['device']['site'] == 1 + - test_seven['device']['device_role'] == device_role['key'] + - test_seven['device']['device_type'] == device_type['key'] + - test_seven['device']['site'] == test_site['key'] - test_seven['device']['status'] == "active" - - test_seven['device']['primary_ip4'] == 1 - - test_seven['device']['primary_ip6'] == 2 + - test_seven['device']['primary_ip4'] == ip4['key'] + - test_seven['device']['primary_ip6'] == ip6['key'] - test_seven['msg'] == "device test100 updated" + vars: + ip4: "{{ lookup('networktocode.nautobot.lookup', 'ip-addresses', api_endpoint=nautobot_url, token=nautobot_token, api_filter='address=172.16.180.1/24') }}" + ip6: "{{ lookup('networktocode.nautobot.lookup', 'ip-addresses', api_endpoint=nautobot_url, token=nautobot_token, api_filter='address=2001::1:1/64') }}" - name: "8 - Device with empty string name" networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "" - device_type: - id: 1 - device_role: "Core Switch" - site: "Test Site" - status: "Staged" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "" + device_type: + id: "{{ device_type['key'] }}" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" state: present register: test_eight @@ -233,9 +243,9 @@ - test_eight is changed - test_eight['diff']['before']['state'] == 'absent' - test_eight['diff']['after']['state'] == 'present' - - test_eight['device']['device_role'] == 1 - - test_eight['device']['device_type'] == 1 - - test_eight['device']['site'] == 1 + - test_eight['device']['device_role'] == device_role['key'] + - test_eight['device']['device_type'] == device_type['key'] + - test_eight['device']['site'] == test_site['key'] - test_eight['device']['status'] == "staged" - "'-' in test_eight['device']['name']" - "test_eight['device']['name'] | length == 36" diff --git a/tests/integration/targets/latest/tasks/device_bay.yml b/tests/integration/targets/latest/tasks/device_bay.yml index 9e11ad9d..abc3f262 100644 --- a/tests/integration/targets/latest/tasks/device_bay.yml +++ b/tests/integration/targets/latest/tasks/device_bay.yml @@ -4,13 +4,17 @@ ### PYNAUTOBOT_DEVICE_BAY ## ## +- set_fact: + nexus_parent: '{{ lookup(''networktocode.nautobot.lookup'', ''devices'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''name="Test Nexus One"'') }}' + nexus_child: '{{ lookup(''networktocode.nautobot.lookup'', ''devices'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''name="Test Nexus Child One"'') }}' + tag_schnozzberry: "{{ lookup('networktocode.nautobot.lookup', 'tags', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=schnozzberry') }}" + - name: "DEVICE_BAY 1: Necessary info creation" networktocode.nautobot.device_bay: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device: "Test Nexus One" - name: "Device Bay One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: "Test Nexus One" + name: "Device Bay One" state: present register: test_one @@ -21,16 +25,15 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['device_bay']['name'] == "Device Bay One" - - test_one['device_bay']['device'] == 4 + - test_one['device_bay']['device'] == nexus_parent['key'] - test_one['msg'] == "device_bay Device Bay One created" - name: "DEVICE_BAY 2: Create duplicate" networktocode.nautobot.device_bay: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device: "Test Nexus One" - name: "Device Bay One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: "Test Nexus One" + name: "Device Bay One" state: present register: test_two @@ -39,19 +42,18 @@ that: - not test_two['changed'] - test_two['device_bay']['name'] == "Device Bay One" - - test_two['device_bay']['device'] == 4 + - test_two['device_bay']['device'] == nexus_parent['key'] - test_two['msg'] == "device_bay Device Bay One already exists" - name: "DEVICE_BAY 3: ASSERT - Update" networktocode.nautobot.device_bay: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device: "Test Nexus One" - name: "Device Bay One" - installed_device: "Test Nexus Child One" - tags: - - "Schnozzberry" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: "Test Nexus One" + name: "Device Bay One" + installed_device: "Test Nexus Child One" + tags: + - "Schnozzberry" state: present register: test_three @@ -59,20 +61,19 @@ assert: that: - test_three is changed - - test_three['diff']['after']['installed_device'] == 5 - - test_three['diff']['after']['tags'][0] == 4 + - test_three['diff']['after']['installed_device'] == nexus_child['key'] + - test_three['diff']['after']['tags'][0] == tag_schnozzberry['key'] - test_three['device_bay']['name'] == "Device Bay One" - - test_three['device_bay']['device'] == 4 - - test_three['device_bay']['installed_device'] == 5 - - test_three['device_bay']['tags'][0] == 4 + - test_three['device_bay']['device'] == nexus_parent['key'] + - test_three['device_bay']['installed_device'] == nexus_child['key'] + - test_three['device_bay']['tags'][0] == tag_schnozzberry['key'] - test_three['msg'] == "device_bay Device Bay One updated" - name: "DEVICE_BAY 4: ASSERT - Delete" networktocode.nautobot.device_bay: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Device Bay One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Device Bay One" state: absent register: test_four @@ -81,7 +82,7 @@ that: - test_four is changed - test_four['device_bay']['name'] == "Device Bay One" - - test_four['device_bay']['device'] == 4 - - test_four['device_bay']['installed_device'] == 5 - - test_four['device_bay']['tags'][0] == 4 + - test_four['device_bay']['device'] == nexus_parent['key'] + - test_four['device_bay']['installed_device'] == nexus_child['key'] + - test_four['device_bay']['tags'][0] == tag_schnozzberry['key'] - test_four['msg'] == "device_bay Device Bay One deleted" diff --git a/tests/integration/targets/latest/tasks/device_bay_template.yml b/tests/integration/targets/latest/tasks/device_bay_template.yml index 2aeefe48..f918dcd9 100644 --- a/tests/integration/targets/latest/tasks/device_bay_template.yml +++ b/tests/integration/targets/latest/tasks/device_bay_template.yml @@ -4,13 +4,15 @@ ### PYNAUTOBOT_DEVICE_BAY_TEMPLATE ## ## +- set_fact: + nexus_parent: "{{ lookup('networktocode.nautobot.lookup', 'device-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=nexus-parent') }}" + - name: "DEVICE_BAY_TEMPLATE 1: Necessary info creation" networktocode.nautobot.device_bay_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device_type: WS Test 3850 - name: Device Bay Template One + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device_type: Nexus Parent + name: Device Bay Template One state: present register: test_one @@ -21,16 +23,15 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['device_bay_template']['name'] == "Device Bay Template One" - - test_one['device_bay_template']['device_type'] == 7 + - test_one['device_bay_template']['device_type'] == nexus_parent['key'] - test_one['msg'] == "device_bay_template Device Bay Template One created" - name: "DEVICE_BAY_TEMPLATE 2: Create duplicate" networktocode.nautobot.device_bay_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device_type: WS Test 3850 - name: Device Bay Template One + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device_type: Nexus Parent + name: Device Bay Template One state: present register: test_two @@ -39,16 +40,15 @@ that: - not test_two['changed'] - test_two['device_bay_template']['name'] == "Device Bay Template One" - - test_two['device_bay_template']['device_type'] == 7 + - test_two['device_bay_template']['device_type'] == nexus_parent['key'] - test_two['msg'] == "device_bay_template Device Bay Template One already exists" - name: "DEVICE_BAY_TEMPLATE 3: ASSERT - Create Device Bay Template for Delete Test" networktocode.nautobot.device_bay_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device_type: WS Test 3850 - name: Device Bay Template Two + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device_type: Nexus Parent + name: Device Bay Template Two state: present register: test_three @@ -59,16 +59,15 @@ - test_three['diff']['before']['state'] == "absent" - test_three['diff']['after']['state'] == "present" - test_three['device_bay_template']['name'] == "Device Bay Template Two" - - test_three['device_bay_template']['device_type'] == 7 + - test_three['device_bay_template']['device_type'] == nexus_parent['key'] - test_three['msg'] == "device_bay_template Device Bay Template Two created" - name: "DEVICE_BAY_TEMPLATE 4: ASSERT - Delete" networktocode.nautobot.device_bay_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Device Bay Template Two - device_type: WS Test 3850 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Device Bay Template Two + device_type: Nexus Parent state: absent register: test_four @@ -77,5 +76,5 @@ that: - test_four is changed - test_four['device_bay_template']['name'] == "Device Bay Template Two" - - test_four['device_bay_template']['device_type'] == 7 + - test_four['device_bay_template']['device_type'] == nexus_parent['key'] - test_four['msg'] == "device_bay_template Device Bay Template Two deleted" diff --git a/tests/integration/targets/latest/tasks/device_interface.yml b/tests/integration/targets/latest/tasks/device_interface.yml index 4a167cab..8c58871b 100644 --- a/tests/integration/targets/latest/tasks/device_interface.yml +++ b/tests/integration/targets/latest/tasks/device_interface.yml @@ -4,14 +4,16 @@ ### PYNAUTOBOT_DEVICE_INTERFACE ## ## +- set_fact: + test100: "{{ lookup('networktocode.nautobot.lookup', 'devices', api_endpoint=nautobot_url, token=nautobot_token, api_filter='name=test100') }}" + - name: "1 - Interface with required information" networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: test100 - name: GigabitEthernet3 - type: "1000Base-T (1GE)" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: test100 + name: GigabitEthernet3 + type: "1000Base-T (1GE)" register: test_one - name: "1 - ASSERT" @@ -22,17 +24,16 @@ - test_one['diff']['before']['state'] == 'absent' - test_one['diff']['after']['state'] == 'present' - test_one['interface']['name'] == "GigabitEthernet3" - - test_one['interface']['device'] == 1 + - test_one['interface']['device'] == test100['key'] - name: "2 - Update test100 - GigabitEthernet3" networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: test100 - name: GigabitEthernet3 - mtu: 1600 - enabled: false + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: test100 + name: GigabitEthernet3 + mtu: 1600 + enabled: false register: test_two - name: "2 - ASSERT" @@ -43,17 +44,16 @@ - test_two['diff']['after']['enabled'] == false - test_two['diff']['after']['mtu'] == 1600 - test_two['interface']['name'] == "GigabitEthernet3" - - test_two['interface']['device'] == 1 + - test_two['interface']['device'] == test100['key'] - test_two['interface']['enabled'] == false - test_two['interface']['mtu'] == 1600 - name: "3 - Delete interface test100 - GigabitEthernet3" networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: test100 - name: GigabitEthernet3 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: test100 + name: GigabitEthernet3 state: absent register: test_three @@ -67,15 +67,14 @@ - name: "4 - Create LAG with several specified options" networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: test100 - name: port-channel1 - type: Link Aggregation Group (LAG) - mtu: 1600 - mgmt_only: false - mode: Access + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: test100 + name: port-channel1 + type: Link Aggregation Group (LAG) + mtu: 1600 + mgmt_only: false + mode: Access state: present register: test_four @@ -87,27 +86,29 @@ - test_four['diff']['before']['state'] == 'absent' - test_four['diff']['after']['state'] == 'present' - test_four['interface']['name'] == "port-channel1" - - test_four['interface']['device'] == 1 + - test_four['interface']['device'] == test100['key'] - test_four['interface']['enabled'] == true - test_four['interface']['type'] == "lag" - test_four['interface']['mgmt_only'] == false - test_four['interface']['mode'] == "access" - test_four['interface']['mtu'] == 1600 +- set_fact: + test100_lag: "{{ lookup('networktocode.nautobot.lookup', 'interfaces', api_endpoint=nautobot_url, token=nautobot_token, api_filter='name=port-channel1 device=test100') }}" + - name: "5 - Create interface and assign it to parent LAG" networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: test100 - name: GigabitEthernet3 - enabled: false - type: 1000Base-T (1GE) - lag: - name: port-channel1 - mtu: 1600 - mgmt_only: false - mode: Access + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: test100 + name: GigabitEthernet3 + enabled: false + type: 1000Base-T (1GE) + lag: + name: port-channel1 + mtu: 1600 + mgmt_only: false + mode: Access state: present register: test_five @@ -119,34 +120,33 @@ - test_five['diff']['before']['state'] == 'absent' - test_five['diff']['after']['state'] == 'present' - test_five['interface']['name'] == "GigabitEthernet3" - - test_five['interface']['device'] == 1 + - test_five['interface']['device'] == test100['key'] - test_five['interface']['enabled'] == false - test_five['interface']['type'] == "1000base-t" - test_five['interface']['mgmt_only'] == false - - test_five['interface']['lag'] == 8 + - test_five['interface']['lag'] == test100_lag['key'] - test_five['interface']['mode'] == "access" - test_five['interface']['mtu'] == 1600 - name: "6 - Create interface as trunk port" networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: test100 - name: GigabitEthernet21 - enabled: false - type: 1000Base-T (1GE) - untagged_vlan: - name: Wireless + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: test100 + name: GigabitEthernet21 + enabled: false + type: 1000Base-T (1GE) + untagged_vlan: + name: Wireless + site: Test Site + tagged_vlans: + - name: Data + site: Test Site + - name: VoIP site: Test Site - tagged_vlans: - - name: Data - site: Test Site - - name: VoIP - site: Test Site - mtu: 1600 - mgmt_only: true - mode: Tagged + mtu: 1600 + mgmt_only: true + mode: Tagged state: present register: test_six @@ -158,22 +158,23 @@ - test_six['diff']['before']['state'] == 'absent' - test_six['diff']['after']['state'] == 'present' - test_six['interface']['name'] == "GigabitEthernet21" - - test_six['interface']['device'] == 1 + - test_six['interface']['device'] == test100['key'] - test_six['interface']['enabled'] == false - test_six['interface']['type'] == "1000base-t" - test_six['interface']['mgmt_only'] == true - test_six['interface']['mode'] == "tagged" - test_six['interface']['mtu'] == 1600 - - test_six['interface']['tagged_vlans'] == [2, 3] - - test_six['interface']['untagged_vlan'] == 1 + - test_six['interface']['tagged_vlans']|length == 2 + - test_six['interface']['untagged_vlan'] == wireless_vlan['key'] + vars: + wireless_vlan: "{{ lookup('networktocode.nautobot.lookup', 'vlans', api_endpoint=nautobot_url, token=nautobot_token, api_filter='name=Wireless') }}" - name: "7 - Duplicate Interface" networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: test100 - name: GigabitEthernet1 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: test100 + name: GigabitEthernet1 register: test_seven - name: "7 - ASSERT" @@ -182,30 +183,28 @@ - not test_seven['changed'] - test_seven['msg'] == "interface GigabitEthernet1 already exists" - test_seven['interface']['name'] == "GigabitEthernet1" - - test_seven['interface']['device'] == 1 + - test_seven['interface']['device'] == test100['key'] - name: "Add port-channel1 to R1 to test finding proper port-channel1" networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: "R1-Device" - name: "port-channel1" - type: "Link Aggregation Group (LAG)" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: "R1-Device" + name: "port-channel1" + type: "Link Aggregation Group (LAG)" - name: "8 - Create interface and assign it to parent LAG - non dict" networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: test100 - name: GigabitEthernet4 - enabled: false - type: 1000Base-T (1GE) - lag: "port-channel1" - mtu: 1600 - mgmt_only: false - mode: Access + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: test100 + name: GigabitEthernet4 + enabled: false + type: 1000Base-T (1GE) + lag: "port-channel1" + mtu: 1600 + mgmt_only: false + mode: Access state: present register: test_eight @@ -217,25 +216,27 @@ - test_eight['diff']['before']['state'] == 'absent' - test_eight['diff']['after']['state'] == 'present' - test_eight['interface']['name'] == "GigabitEthernet4" - - test_eight['interface']['device'] == 1 + - test_eight['interface']['device'] == test100['key'] - test_eight['interface']['enabled'] == false - test_eight['interface']['type'] == "1000base-t" - test_eight['interface']['mgmt_only'] == false - - test_eight['interface']['lag'] == 8 + - test_eight['interface']['lag'] == test100_lag['key'] - test_eight['interface']['mode'] == "access" - test_eight['interface']['mtu'] == 1600 - name: "9 - Create interface on VC child" networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: Test Nexus Child One - name: Ethernet2/2 - type: 1000Base-T (1GE) + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: Test Nexus Child One + name: Ethernet2/2 + type: 1000Base-T (1GE) state: present register: test_nine +- set_fact: + nexus_child: '{{ lookup(''networktocode.nautobot.lookup'', ''devices'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''name="Test Nexus Child One"'') }}' + - name: "9 - ASSERT" assert: that: @@ -244,18 +245,17 @@ - test_nine['diff']['before']['state'] == 'absent' - test_nine['diff']['after']['state'] == 'present' - test_nine['interface']['name'] == "Ethernet2/2" - - test_nine['interface']['device'] == 5 + - test_nine['interface']['device'] == nexus_child['key'] - test_nine['interface']['enabled'] == true - test_nine['interface']['type'] == "1000base-t" - name: "10 - Update interface on VC child" networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: Test Nexus One - name: Ethernet2/2 - description: "Updated child interface from parent device" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: Test Nexus One + name: Ethernet2/2 + description: "Updated child interface from parent device" update_vc_child: True state: present register: test_ten @@ -267,19 +267,18 @@ - test_ten['msg'] == "interface Ethernet2/2 updated" - test_ten['diff']['after']['description'] == 'Updated child interface from parent device' - test_ten['interface']['name'] == "Ethernet2/2" - - test_ten['interface']['device'] == 5 + - test_ten['interface']['device'] == nexus_child['key'] - test_ten['interface']['enabled'] == true - test_ten['interface']['type'] == "1000base-t" - test_ten['interface']['description'] == 'Updated child interface from parent device' - name: "11 - Update interface on VC child w/o update_vc_child" networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: Test Nexus One - name: Ethernet2/2 - description: "Updated child interface from parent device - test" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: Test Nexus One + name: Ethernet2/2 + description: "Updated child interface from parent device - test" state: present ignore_errors: yes register: test_eleven diff --git a/tests/integration/targets/latest/tasks/device_interface_template.yml b/tests/integration/targets/latest/tasks/device_interface_template.yml index fe148d4b..5cc6551c 100644 --- a/tests/integration/targets/latest/tasks/device_interface_template.yml +++ b/tests/integration/targets/latest/tasks/device_interface_template.yml @@ -4,14 +4,16 @@ ### PYNAUTOBOT_DEVICE_INTERFACE_TEMPLATE ## ## +- set_fact: + dt_arista: "{{ lookup('networktocode.nautobot.lookup', 'device-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=arista-test') }}" + - name: "1 - Interface with required information" networktocode.nautobot.device_interface_template: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device_type: Arista Test - name: 10GBASE-T (10GE) - type: 10gbase-t + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device_type: Arista Test + name: 10GBASE-T (10GE) + type: 10gbase-t register: test_one - name: "1 - ASSERT" @@ -22,18 +24,17 @@ - test_one['diff']['before']['state'] == 'absent' - test_one['diff']['after']['state'] == 'present' - test_one['interface_template']['name'] == "10GBASE-T (10GE)" - - test_one['interface_template']['device_type'] == 2 + - test_one['interface_template']['device_type'] == dt_arista['key'] - test_one['interface_template']['type'] == '10gbase-t' - name: "2 - Update 10GBASE-T (10GE)" networktocode.nautobot.device_interface_template: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device_type: Arista Test - name: 10GBASE-T (10GE) - type: 10gbase-t - mgmt_only: true + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device_type: Arista Test + name: 10GBASE-T (10GE) + type: 10gbase-t + mgmt_only: true register: test_two - name: "2 - ASSERT" @@ -43,17 +44,16 @@ - test_two['msg'] == "interface_template 10GBASE-T (10GE) updated" - test_two['diff']['after']['mgmt_only'] == true - test_two['interface_template']['name'] == "10GBASE-T (10GE)" - - test_two['interface_template']['device_type'] == 2 + - test_two['interface_template']['device_type'] == dt_arista['key'] - test_two['interface_template']['mgmt_only'] == true - name: "3 - Delete interface template 10GBASE-T (10GE)" networktocode.nautobot.device_interface_template: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device_type: Arista Test - name: 10GBASE-T (10GE) - type: 10gbase-t + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device_type: Arista Test + name: 10GBASE-T (10GE) + type: 10gbase-t state: absent register: test_three @@ -67,13 +67,12 @@ - name: "4 - Create LAG with several specified options" networktocode.nautobot.device_interface_template: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device_type: Arista Test - name: port channel template - type: lag - mgmt_only: false + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device_type: Arista Test + name: port channel template + type: lag + mgmt_only: false state: present register: test_four @@ -85,18 +84,17 @@ - test_four['diff']['before']['state'] == 'absent' - test_four['diff']['after']['state'] == 'present' - test_four['interface_template']['name'] == "port channel template" - - test_four['interface_template']['device_type'] == 2 + - test_four['interface_template']['device_type'] == dt_arista['key'] - test_four['interface_template']['type'] == "lag" - test_four['interface_template']['mgmt_only'] == false - name: "5 - Duplicate Interface Template port channel template" networktocode.nautobot.device_interface_template: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device_type: Arista Test - name: port channel template - type: lag + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device_type: Arista Test + name: port channel template + type: lag register: test_five - name: "5 - ASSERT" @@ -105,5 +103,5 @@ - not test_five['changed'] - test_five['msg'] == "interface_template port channel template already exists" - test_five['interface_template']['name'] == "port channel template" - - test_five['interface_template']['device_type'] == 2 + - test_five['interface_template']['device_type'] == dt_arista['key'] - test_five['interface_template']['type'] == "lag" diff --git a/tests/integration/targets/latest/tasks/device_role.yml b/tests/integration/targets/latest/tasks/device_role.yml index fdcc0ca5..66738a3f 100644 --- a/tests/integration/targets/latest/tasks/device_role.yml +++ b/tests/integration/targets/latest/tasks/device_role.yml @@ -6,11 +6,10 @@ ## - name: "DEVICE_ROLE 1: Necessary info creation" networktocode.nautobot.device_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Device Role" - color: "FFFFFF" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Device Role" + color: "FFFFFF" state: present register: test_one @@ -27,11 +26,10 @@ - name: "DEVICE_ROLE 2: Create duplicate" networktocode.nautobot.device_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Device Role" - color: "FFFFFF" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Device Role" + color: "FFFFFF" state: present register: test_two @@ -46,12 +44,11 @@ - name: "DEVICE_ROLE 3: ASSERT - Update" networktocode.nautobot.device_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Device Role" - color: "003EFF" - vm_role: false + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Device Role" + color: "003EFF" + vm_role: false state: present register: test_three @@ -69,10 +66,9 @@ - name: "DEVICE_ROLE 4: ASSERT - Delete" networktocode.nautobot.device_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Device Role + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test Device Role state: absent register: test_four @@ -86,10 +82,9 @@ - name: "DEVICE_ROLE 5: ASSERT - Delete non existing" networktocode.nautobot.device_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Device Role + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test Device Role state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/device_type.yml b/tests/integration/targets/latest/tasks/device_type.yml index 16ac4fe7..27fe1b1a 100644 --- a/tests/integration/targets/latest/tasks/device_type.yml +++ b/tests/integration/targets/latest/tasks/device_type.yml @@ -4,14 +4,16 @@ ### PYNAUTOBOT_DEVICE_TYPE ## ## +- set_fact: + manufacturer: "{{ lookup('networktocode.nautobot.lookup', 'manufacturers', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-manufacturer') }}" + - name: "DEVICE_TYPE 1: Necessary info creation" networktocode.nautobot.device_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - slug: test-device-type - model: ws-test-3750 - manufacturer: Test Manufacturer + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + slug: test-device-type + model: ws-test-3750 + manufacturer: Test Manufacturer state: present register: test_one @@ -23,17 +25,16 @@ - test_one['diff']['after']['state'] == "present" - test_one['device_type']['slug'] == "test-device-type" - test_one['device_type']['model'] == "ws-test-3750" - - test_one['device_type']['manufacturer'] == 3 + - test_one['device_type']['manufacturer'] == manufacturer['key'] - test_one['msg'] == "device_type test-device-type created" - name: "DEVICE_TYPE 2: Create duplicate" networktocode.nautobot.device_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - slug: test-device-type - model: "ws-test-3750" - manufacturer: Test Manufacturer + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + slug: test-device-type + model: "ws-test-3750" + manufacturer: Test Manufacturer state: present register: test_two @@ -43,21 +44,20 @@ - not test_two['changed'] - test_one['device_type']['slug'] == "test-device-type" - test_one['device_type']['model'] == "ws-test-3750" - - test_one['device_type']['manufacturer'] == 3 + - test_one['device_type']['manufacturer'] == manufacturer['key'] - test_two['msg'] == "device_type test-device-type already exists" - name: "DEVICE_TYPE 3: ASSERT - Update" networktocode.nautobot.device_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - slug: test-device-type - model: ws-test-3750 - manufacturer: Test Manufacturer - part_number: ws-3750g-v2 - u_height: 1 - is_full_depth: false - subdevice_role: parent + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + slug: test-device-type + model: ws-test-3750 + manufacturer: Test Manufacturer + part_number: ws-3750g-v2 + u_height: 1 + is_full_depth: false + subdevice_role: parent state: present register: test_three @@ -70,7 +70,7 @@ - test_three['diff']['after']['subdevice_role'] == "parent" - test_three['device_type']['slug'] == "test-device-type" - test_three['device_type']['model'] == "ws-test-3750" - - test_three['device_type']['manufacturer'] == 3 + - test_three['device_type']['manufacturer'] == manufacturer['key'] - test_three['device_type']['is_full_depth'] == false - test_three['device_type']['part_number'] == "ws-3750g-v2" - test_three['device_type']['subdevice_role'] == "parent" @@ -78,10 +78,9 @@ - name: "DEVICE_TYPE 4: ASSERT - Delete" networktocode.nautobot.device_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - model: test-device-type + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + model: test-device-type state: absent register: test_four @@ -95,10 +94,9 @@ - name: "DEVICE_TYPE 5: ASSERT - Delete non existing" networktocode.nautobot.device_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - model: "Test Device Type" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + model: "Test Device Type" state: absent register: test_five @@ -111,12 +109,11 @@ - name: "DEVICE_TYPE 6: Without Slug" networktocode.nautobot.device_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - model: "WS Test 3850" - manufacturer: "Test Manufacturer" - subdevice_role: "parent" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + model: "WS Test 3850" + manufacturer: "Test Manufacturer" + subdevice_role: "parent" state: present register: test_six @@ -128,5 +125,5 @@ - test_six['diff']['after']['state'] == "present" - test_six['device_type']['slug'] == "ws-test-3850" - test_six['device_type']['model'] == "WS Test 3850" - - test_six['device_type']['manufacturer'] == 3 + - test_six['device_type']['manufacturer'] == manufacturer['key'] - test_six['msg'] == "device_type WS Test 3850 created" diff --git a/tests/integration/targets/latest/tasks/front_port.yml b/tests/integration/targets/latest/tasks/front_port.yml index 9d44a2b8..81b63bce 100644 --- a/tests/integration/targets/latest/tasks/front_port.yml +++ b/tests/integration/targets/latest/tasks/front_port.yml @@ -7,15 +7,18 @@ ### PYNAUTOBOT_FRONT_PORT ## ## +- set_fact: + test100: "{{ lookup('networktocode.nautobot.lookup', 'devices', api_endpoint=nautobot_url, token=nautobot_token, api_filter='name=test100') }}" + rear_port: '{{ lookup(''networktocode.nautobot.lookup'', ''rear-ports'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''name="Test Rear Port"'') }}' + - name: "FRONT_PORT 1: Necessary info creation" networktocode.nautobot.front_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port - device: test100 - type: bnc - rear_port: Rear Port + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Front Port + device: test100 + type: bnc + rear_port: Test Rear Port state: present register: test_one @@ -26,20 +29,19 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['front_port']['name'] == "Front Port" - - test_one['front_port']['device'] == 1 + - test_one['front_port']['device'] == test100['key'] - test_one['front_port']['type'] == "bnc" - - test_one['front_port']['rear_port'] == 1 + - test_one['front_port']['rear_port'] == rear_port['key'] - test_one['msg'] == "front_port Front Port created" - name: "FRONT_PORT 2: Create duplicate" networktocode.nautobot.front_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port - device: test100 - type: bnc - rear_port: Rear Port + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Front Port + device: test100 + type: bnc + rear_port: Test Rear Port state: present register: test_two @@ -48,22 +50,21 @@ that: - not test_two['changed'] - test_two['front_port']['name'] == "Front Port" - - test_two['front_port']['device'] == 1 + - test_two['front_port']['device'] == test100['key'] - test_two['front_port']['type'] == "bnc" - - test_two['front_port']['rear_port'] == 1 + - test_two['front_port']['rear_port'] == rear_port['key'] - test_two['msg'] == "front_port Front Port already exists" - name: "FRONT_PORT 3: Update Front Port with other fields" networktocode.nautobot.front_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port - device: test100 - type: bnc - rear_port: Rear Port - rear_port_position: 5 - description: test description + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Front Port + device: test100 + type: bnc + rear_port: Test Rear Port + rear_port_position: 5 + description: test description state: present register: test_three @@ -74,22 +75,21 @@ - test_three['diff']['after']['rear_port_position'] == 5 - test_three['diff']['after']['description'] == "test description" - test_three['front_port']['name'] == "Front Port" - - test_three['front_port']['device'] == 1 + - test_three['front_port']['device'] == test100['key'] - test_three['front_port']['type'] == "bnc" - - test_three['front_port']['rear_port'] == 1 + - test_three['front_port']['rear_port'] == rear_port['key'] - test_three['front_port']['rear_port_position'] == 5 - test_three['front_port']['description'] == "test description" - test_three['msg'] == "front_port Front Port updated" - name: "FRONT_PORT 4: Create Front Port for Delete Test" networktocode.nautobot.front_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port 2 - device: test100 - type: bnc - rear_port: Rear Port + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Front Port 2 + device: test100 + type: bnc + rear_port: Test Rear Port state: present register: test_four @@ -100,20 +100,19 @@ - test_four['diff']['before']['state'] == "absent" - test_four['diff']['after']['state'] == "present" - test_four['front_port']['name'] == "Front Port 2" - - test_four['front_port']['device'] == 1 + - test_four['front_port']['device'] == test100['key'] - test_four['front_port']['type'] == "bnc" - - test_four['front_port']['rear_port'] == 1 + - test_four['front_port']['rear_port'] == rear_port['key'] - test_four['msg'] == "front_port Front Port 2 created" - name: "FRONT_PORT 5: Delete Front Port" networktocode.nautobot.front_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port 2 - device: test100 - type: bnc - rear_port: Rear Port + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Front Port 2 + device: test100 + type: bnc + rear_port: Test Rear Port state: absent register: test_five @@ -127,15 +126,14 @@ - name: "FRONT_PORT 6: Create duplicate with rear_port dictionary" networktocode.nautobot.front_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Front Port + device: test100 + type: bnc + rear_port: device: test100 - type: bnc - rear_port: - device: test100 - name: Rear Port + name: Test Rear Port state: present register: test_six @@ -144,7 +142,7 @@ that: - not test_six['changed'] - test_six['front_port']['name'] == "Front Port" - - test_six['front_port']['device'] == 1 + - test_six['front_port']['device'] == test100['key'] - test_six['front_port']['type'] == "bnc" - - test_six['front_port']['rear_port'] == 1 + - test_six['front_port']['rear_port'] == rear_port['key'] - test_six['msg'] == "front_port Front Port already exists" diff --git a/tests/integration/targets/latest/tasks/front_port_template.yml b/tests/integration/targets/latest/tasks/front_port_template.yml index 88c3754d..f635332f 100644 --- a/tests/integration/targets/latest/tasks/front_port_template.yml +++ b/tests/integration/targets/latest/tasks/front_port_template.yml @@ -7,15 +7,19 @@ ### PYNAUTOBOT_FRONT_PORT_TEMPLATE ## ## +- set_fact: + cisco_test: "{{ lookup('networktocode.nautobot.lookup', 'device-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=cisco-test') }}" + arista_test: "{{ lookup('networktocode.nautobot.lookup', 'device-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=arista-test') }}" + rear_port: '{{ lookup(''networktocode.nautobot.lookup'', ''rear-port-templates'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''name="Test Rear Port Template"'') }}' + - name: "FRONT_PORT_TEMPLATE 1: Necessary info creation" networktocode.nautobot.front_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port Template - device_type: Cisco Test - type: bnc - rear_port_template: Rear Port Template + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Front Port Template + device_type: Cisco Test + type: bnc + rear_port_template: Test Rear Port Template state: present register: test_one @@ -26,20 +30,19 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['front_port_template']['name'] == "Front Port Template" - - test_one['front_port_template']['device_type'] == 1 + - test_one['front_port_template']['device_type'] == cisco_test['key'] - test_one['front_port_template']['type'] == "bnc" - - test_one['front_port_template']['rear_port'] == 1 + - test_one['front_port_template']['rear_port'] == rear_port['key'] - test_one['msg'] == "front_port_template Front Port Template created" - name: "FRONT_PORT_TEMPLATE 2: Create duplicate" networktocode.nautobot.front_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port Template - device_type: Cisco Test - type: bnc - rear_port_template: Rear Port Template + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Front Port Template + device_type: Cisco Test + type: bnc + rear_port_template: Test Rear Port Template state: present register: test_two @@ -48,21 +51,20 @@ that: - not test_two['changed'] - test_two['front_port_template']['name'] == "Front Port Template" - - test_two['front_port_template']['device_type'] == 1 + - test_two['front_port_template']['device_type'] == cisco_test['key'] - test_two['front_port_template']['type'] == "bnc" - - test_two['front_port_template']['rear_port'] == 1 + - test_two['front_port_template']['rear_port'] == rear_port['key'] - test_two['msg'] == "front_port_template Front Port Template already exists" - name: "FRONT_PORT_TEMPLATE 3: Update Front Port Template with other fields" networktocode.nautobot.front_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port Template - device_type: Cisco Test - type: bnc - rear_port_template: Rear Port Template - rear_port_template_position: 5 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Front Port Template + device_type: Cisco Test + type: bnc + rear_port_template: Test Rear Port Template + rear_port_template_position: 5 state: present register: test_three @@ -72,21 +74,20 @@ - test_three is changed - test_three['diff']['after']['rear_port_position'] == 5 - test_three['front_port_template']['name'] == "Front Port Template" - - test_three['front_port_template']['device_type'] == 1 + - test_three['front_port_template']['device_type'] == cisco_test['key'] - test_three['front_port_template']['type'] == "bnc" - test_three['front_port_template']['rear_port_position'] == 5 - - test_three['front_port_template']['rear_port'] == 1 + - test_three['front_port_template']['rear_port'] == rear_port['key'] - test_three['msg'] == "front_port_template Front Port Template updated" - name: "FRONT_PORT_TEMPLATE 4: Create Front Port Template for Delete Test" networktocode.nautobot.front_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port Template 2 - device_type: Cisco Test - type: bnc - rear_port_template: Rear Port Template + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Front Port Template 2 + device_type: Cisco Test + type: bnc + rear_port_template: Test Rear Port Template state: present register: test_four @@ -97,20 +98,19 @@ - test_four['diff']['before']['state'] == "absent" - test_four['diff']['after']['state'] == "present" - test_four['front_port_template']['name'] == "Front Port Template 2" - - test_four['front_port_template']['device_type'] == 1 + - test_four['front_port_template']['device_type'] == cisco_test['key'] - test_four['front_port_template']['type'] == "bnc" - - test_four['front_port_template']['rear_port'] == 1 + - test_four['front_port_template']['rear_port'] == rear_port['key'] - test_four['msg'] == "front_port_template Front Port Template 2 created" - name: "FRONT_PORT_TEMPLATE 5: Delete Front Port Template" networktocode.nautobot.front_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port Template 2 - device_type: Cisco Test - type: bnc - rear_port_template: Rear Port Template + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Front Port Template 2 + device_type: Cisco Test + type: bnc + rear_port_template: Test Rear Port Template state: absent register: test_five @@ -124,15 +124,14 @@ - name: "FRONT_PORT 6: Create duplicate with rear_port_template dictionary" networktocode.nautobot.front_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port Template - device_type: Cisco Test - type: bnc - rear_port_template: - device: Cisco Test - name: Rear Port Template + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Front Port Template + device_type: Cisco Test + type: bnc + rear_port_template: + device: Cisco Test + name: Test Rear Port Template state: present register: test_six @@ -141,7 +140,7 @@ that: - not test_six['changed'] - test_six['front_port_template']['name'] == "Front Port Template" - - test_six['front_port_template']['device_type'] == 1 + - test_six['front_port_template']['device_type'] == cisco_test['key'] - test_six['front_port_template']['type'] == "bnc" - - test_six['front_port_template']['rear_port'] == 1 + - test_six['front_port_template']['rear_port'] == rear_port['key'] - test_six['msg'] == "front_port_template Front Port Template already exists" diff --git a/tests/integration/targets/latest/tasks/inventory_item.yml b/tests/integration/targets/latest/tasks/inventory_item.yml index 4cdee971..9eaf62d9 100644 --- a/tests/integration/targets/latest/tasks/inventory_item.yml +++ b/tests/integration/targets/latest/tasks/inventory_item.yml @@ -4,13 +4,17 @@ ### PYNAUTOBOT_INVENTORY_ITEM ## ## +- set_fact: + test100: "{{ lookup('networktocode.nautobot.lookup', 'devices', api_endpoint=nautobot_url, token=nautobot_token, api_filter='name=test100') }}" + manufacturer: "{{ lookup('networktocode.nautobot.lookup', 'manufacturers', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=cisco') }}" + tag_schnozzberry: "{{ lookup('networktocode.nautobot.lookup', 'tags', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=schnozzberry') }}" + - name: "INVENTORY_ITEM 1: Necessary info creation" networktocode.nautobot.inventory_item: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device: "test100" - name: "10G-SFP+" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: "test100" + name: "10G-SFP+" state: present register: test_one @@ -21,16 +25,15 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['inventory_item']['name'] == "10G-SFP+" - - test_one['inventory_item']['device'] == 1 + - test_one['inventory_item']['device'] == test100['key'] - test_one['msg'] == "inventory_item 10G-SFP+ created" - name: "INVENTORY_ITEM 2: Create duplicate" networktocode.nautobot.inventory_item: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device: "test100" - name: "10G-SFP+" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: "test100" + name: "10G-SFP+" state: present register: test_two @@ -39,24 +42,23 @@ that: - not test_two['changed'] - test_two['inventory_item']['name'] == "10G-SFP+" - - test_two['inventory_item']['device'] == 1 + - test_two['inventory_item']['device'] == test100['key'] - test_two['msg'] == "inventory_item 10G-SFP+ already exists" - name: "INVENTORY_ITEM 3: ASSERT - Update" networktocode.nautobot.inventory_item: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device: "test100" - name: "10G-SFP+" - manufacturer: "Cisco" - part_id: "10G-SFP+" - serial: "1234" - asset_tag: "1234" - description: "New SFP" - discovered: True - tags: - - "Schnozzberry" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: "test100" + name: "10G-SFP+" + manufacturer: "Cisco" + part_id: "10G-SFP+" + serial: "1234" + asset_tag: "1234" + description: "New SFP" + discovered: True + tags: + - "Schnozzberry" state: present register: test_three @@ -67,28 +69,27 @@ - test_three['diff']['after']['asset_tag'] == "1234" - test_three['diff']['after']['serial'] == "1234" - test_three['diff']['after']['description'] == "New SFP" - - test_three['diff']['after']['manufacturer'] == 1 + - test_three['diff']['after']['manufacturer'] == manufacturer['key'] - test_three['diff']['after']['part_id'] == "10G-SFP+" - - test_three['diff']['after']['tags'][0] == 4 + - test_three['diff']['after']['tags'][0] == tag_schnozzberry['key'] - test_three['diff']['after']['discovered'] == True - test_three['inventory_item']['name'] == "10G-SFP+" - - test_three['inventory_item']['device'] == 1 + - test_three['inventory_item']['device'] == test100['key'] - test_three['inventory_item']['asset_tag'] == "1234" - test_three['inventory_item']['serial'] == "1234" - test_three['inventory_item']['description'] == "New SFP" - - test_three['inventory_item']['manufacturer'] == 1 + - test_three['inventory_item']['manufacturer'] == manufacturer['key'] - test_three['inventory_item']['part_id'] == "10G-SFP+" - - test_three['inventory_item']['tags'][0] == 4 + - test_three['inventory_item']['tags'][0] == tag_schnozzberry['key'] - test_three['inventory_item']['discovered'] == True - test_three['msg'] == "inventory_item 10G-SFP+ updated" - name: "INVENTORY_ITEM 4: ASSERT - Delete" networktocode.nautobot.inventory_item: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device: "test100" - name: "10G-SFP+" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: "test100" + name: "10G-SFP+" state: absent register: test_four @@ -97,11 +98,11 @@ that: - test_four is changed - test_four['inventory_item']['name'] == "10G-SFP+" - - test_four['inventory_item']['device'] == 1 + - test_four['inventory_item']['device'] == test100['key'] - test_four['inventory_item']['asset_tag'] == "1234" - test_four['inventory_item']['serial'] == "1234" - test_four['inventory_item']['description'] == "New SFP" - - test_four['inventory_item']['manufacturer'] == 1 + - test_four['inventory_item']['manufacturer'] == manufacturer['key'] - test_four['inventory_item']['part_id'] == "10G-SFP+" - - test_four['inventory_item']['tags'][0] == 4 + - test_four['inventory_item']['tags'][0] == tag_schnozzberry['key'] - test_four['msg'] == "inventory_item 10G-SFP+ deleted" diff --git a/tests/integration/targets/latest/tasks/ip_address.yml b/tests/integration/targets/latest/tasks/ip_address.yml index 1f597443..b53b4afe 100644 --- a/tests/integration/targets/latest/tasks/ip_address.yml +++ b/tests/integration/targets/latest/tasks/ip_address.yml @@ -6,10 +6,10 @@ ## - name: "1 - Create IP address within Nautobot with only required information - State: Present" networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - address: 192.168.1.10/30 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + address: 192.168.1.10/30 + status: "active" state: present register: test_one @@ -24,13 +24,13 @@ - name: "2 - Update 192.168.1.10/30" networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - address: 192.168.1.10/30 - description: "Updated ip address" - tags: - - "Updated" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + address: 192.168.1.10/30 + status: "active" + description: "Updated ip address" + tags: + - "Updated" state: present register: test_two @@ -39,18 +39,19 @@ that: - test_two is changed - test_two['diff']['after']['description'] == "Updated ip address" - - test_two['diff']['after']['tags'][0] == 10 + - test_two['diff']['after']['tags'][0] == tag_updated['key'] - test_two['msg'] == "ip_address 192.168.1.10/30 updated" - test_two['ip_address']['address'] == "192.168.1.10/30" - - test_two['ip_address']['tags'][0] == 10 + - test_two['ip_address']['tags'][0] == tag_updated['key'] - test_two['ip_address']['description'] == "Updated ip address" + vars: + tag_updated: "{{ lookup('networktocode.nautobot.lookup', 'tags', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=updated') }}" - name: "3 - Delete IP - 192.168.1.10 - State: Absent" networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - address: 192.168.1.10/30 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + address: 192.168.1.10/30 state: absent register: test_three @@ -64,10 +65,10 @@ - name: "4 - Create IP in global VRF - 192.168.1.20/30 - State: Present" networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - address: 192.168.1.20/30 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + address: 192.168.1.20/30 + status: "active" state: present register: test_four @@ -82,10 +83,10 @@ - name: "5 - Create IP in global VRF - 192.168.1.20/30 - State: New" networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - address: 192.168.1.20/30 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + address: 192.168.1.20/30 + status: "active" state: new register: test_five @@ -100,10 +101,10 @@ - name: "6 - Create new address with only prefix specified - State: new" networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: 192.168.100.0/24 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + prefix: 192.168.100.0/24 + status: "active" state: new register: test_six @@ -118,21 +119,24 @@ - name: "7 - Create IP address with several specified" networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - family: 4 - address: 172.16.1.20/24 - vrf: Test VRF - tenant: Test Tenant - status: Reserved - role: Loopback - description: Test description - tags: - - "Schnozzberry" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + address: 172.16.1.20/24 + vrf: Test VRF + tenant: Test Tenant + status: Reserved + role: Loopback + description: Test description + tags: + - "Schnozzberry" state: present register: test_seven +- set_fact: + tag_schnozzberry: "{{ lookup('networktocode.nautobot.lookup', 'tags', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=schnozzberry') }}" + vrf: '{{ lookup(''networktocode.nautobot.lookup'', ''vrfs'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''"name=Test VRF"'') }}' + tenant: "{{ lookup('networktocode.nautobot.lookup', 'tenants', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-tenant') }}" + - name: "7 - ASSERT" assert: that: @@ -145,21 +149,20 @@ - test_seven['ip_address']['family'] == 4 - test_seven['ip_address']['role'] == "loopback" - test_seven['ip_address']['status'] == "reserved" - - test_seven['ip_address']['tags'][0] == 4 - - test_seven['ip_address']['tenant'] == 1 - - test_seven['ip_address']['vrf'] == 1 + - test_seven['ip_address']['tags'][0] == tag_schnozzberry['key'] + - test_seven['ip_address']['tenant'] == tenant['key'] + - test_seven['ip_address']['vrf'] == vrf['key'] - name: "8 - Create IP address and assign a nat_inside IP" networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - family: 4 - address: 10.10.1.30/16 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + address: 10.10.1.30/16 + vrf: Test VRF + status: "active" + nat_inside: + address: 172.16.1.20 vrf: Test VRF - nat_inside: - address: 172.16.1.20 - vrf: Test VRF register: test_eight - name: "8 - ASSERT" @@ -171,21 +174,25 @@ - test_eight['msg'] == "ip_address 10.10.1.30/16 created" - test_eight['ip_address']['address'] == "10.10.1.30/16" - test_eight['ip_address']['family'] == 4 - - test_eight['ip_address'].get('nat_inside') - - test_eight['ip_address']['vrf'] == 1 + - test_eight['ip_address']['nat_inside'] == nat_inside['key'] + - test_eight['ip_address']['vrf'] == vrf['key'] + vars: + nat_inside: "{{ lookup('networktocode.nautobot.lookup', 'ip-addresses', api_endpoint=nautobot_url, token=nautobot_token, api_filter='address=172.16.1.20/24 vrf_id=' ~ vrf['key']) }}" - name: "9 - Create IP address on GigabitEthernet2 - test100 - State: present" networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - family: 4 - address: 10.10.200.30/16 - assigned_object: - name: GigabitEthernet2 - device: test100 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + address: 10.10.200.30/16 + status: "active" + assigned_object: + name: GigabitEthernet2 + device: test100 register: test_nine +- set_fact: + test100_gi2: "{{ lookup('networktocode.nautobot.lookup', 'interfaces', api_endpoint=nautobot_url, token=nautobot_token, api_filter='name=GigabitEthernet2 device=test100') }}" + - name: "9 - ASSERT" assert: that: @@ -196,18 +203,17 @@ - test_nine['ip_address']['address'] == "10.10.200.30/16" - test_nine['ip_address']['family'] == 4 - test_nine['ip_address']['assigned_object_type'] == "dcim.interface" - - test_nine['ip_address']['assigned_object_id'] == 4 + - test_nine['ip_address']['assigned_object_id'] == test100_gi2['key'] - name: "10 - Create IP address on GigabitEthernet2 - test100 - State: new" networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - family: 4 - prefix: 10.10.0.0/16 - assigned_object: - name: GigabitEthernet2 - device: test100 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + prefix: 10.10.0.0/16 + status: "active" + assigned_object: + name: GigabitEthernet2 + device: test100 state: new register: test_ten @@ -221,18 +227,17 @@ - test_ten['ip_address']['address'] == "10.10.0.1/16" - test_ten['ip_address']['family'] == 4 - test_ten['ip_address']['assigned_object_type'] == "dcim.interface" - - test_ten['ip_address']['assigned_object_id'] == 4 + - test_ten['ip_address']['assigned_object_id'] == test100_gi2['key'] - name: "11 - Create IP address on GigabitEthernet2 - test100 - State: present" networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - family: 4 - prefix: 192.168.100.0/24 - assigned_object: - name: GigabitEthernet2 - device: test100 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + prefix: 192.168.100.0/24 + status: "active" + assigned_object: + name: GigabitEthernet2 + device: test100 state: present register: test_eleven @@ -247,13 +252,13 @@ - name: "12 - Duplicate - 192.168.100.2/24 on interface" networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - address: 192.168.100.2/24 - assigned_object: - name: GigabitEthernet2 - device: test100 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + address: 192.168.100.2/24 + status: "active" + assigned_object: + name: GigabitEthernet2 + device: test100 state: present register: test_twelve @@ -264,14 +269,14 @@ - test_twelve['msg'] == "ip_address 192.168.100.2/24 already exists" - test_twelve['ip_address']['address'] == "192.168.100.2/24" - test_twelve['ip_address']['assigned_object_type'] == "dcim.interface" - - test_twelve['ip_address']['assigned_object_id'] == 4 + - test_twelve['ip_address']['assigned_object_id'] == test100_gi2['key'] - name: "13 - Duplicate - 192.168.100.2/24" networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - address: 192.168.100.2/24 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + address: 192.168.100.2/24 + status: "active" state: present register: test_thirteen @@ -284,14 +289,13 @@ - name: "14 - Create IP address on Eth0 - test100-vm - State: present" networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - family: 4 - address: 10.188.1.100/24 - assigned_object: - name: Eth0 - virtual_machine: test100-vm + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + address: 10.188.1.100/24 + status: "active" + assigned_object: + name: Eth0 + virtual_machine: test100-vm register: test_fourteen - name: "14 - ASSERT" @@ -304,18 +308,19 @@ - test_fourteen['ip_address']['address'] == "10.188.1.100/24" - test_fourteen['ip_address']['family'] == 4 - test_fourteen['ip_address']['assigned_object_type'] == "virtualization.vminterface" - - test_fourteen['ip_address']['assigned_object_id'] == 1 + - test_fourteen['ip_address']['assigned_object_id'] == interface['key'] + vars: + interface: "{{ lookup('networktocode.nautobot.lookup', 'virtualization-interfaces', api_endpoint=nautobot_url, token=nautobot_token, api_filter='name=Eth0 virtual_machine=test100-vm') }}" - name: "15 - Create same IP address on Eth0 - test101-vm - State: present" networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - family: 4 - address: 10.188.1.100/24 - assigned_object: - name: Eth0 - virtual_machine: test101-vm + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + address: 10.188.1.100/24 + status: "active" + assigned_object: + name: Eth0 + virtual_machine: test101-vm state: "present" register: test_fifteen @@ -329,14 +334,16 @@ - test_fifteen['ip_address']['address'] == "10.188.1.100/24" - test_fifteen['ip_address']['family'] == 4 - test_fifteen['ip_address']['assigned_object_type'] == "virtualization.vminterface" - - test_fifteen['ip_address']['assigned_object_id'] == 6 + - test_fifteen['ip_address']['assigned_object_id'] == interface['key'] + vars: + interface: "{{ lookup('networktocode.nautobot.lookup', 'virtualization-interfaces', api_endpoint=nautobot_url, token=nautobot_token, api_filter='name=Eth0 virtual_machine=test101-vm') }}" - name: "16 - Create IP address with no mask - State: Present" networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - address: 10.120.10.1 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + address: 10.120.10.1 + status: "active" state: present register: test_sixteen diff --git a/tests/integration/targets/latest/tasks/ipam_role.yml b/tests/integration/targets/latest/tasks/ipam_role.yml index f2a7d023..6d9c70f5 100644 --- a/tests/integration/targets/latest/tasks/ipam_role.yml +++ b/tests/integration/targets/latest/tasks/ipam_role.yml @@ -6,10 +6,9 @@ ## - name: "IPAM_ROLE 1: Necessary info creation" networktocode.nautobot.ipam_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test IPAM Role" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test IPAM Role" state: present register: test_one @@ -25,10 +24,9 @@ - name: "IPAM_ROLE 2: Create duplicate" networktocode.nautobot.ipam_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test IPAM Role" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test IPAM Role" state: present register: test_two @@ -42,11 +40,10 @@ - name: "IPAM_ROLE 3: ASSERT - Update" networktocode.nautobot.ipam_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test IPAM Role" - weight: 4096 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test IPAM Role" + weight: 4096 state: present register: test_three @@ -62,10 +59,9 @@ - name: "IPAM_ROLE 4: ASSERT - Delete" networktocode.nautobot.ipam_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test IPAM Role + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test IPAM Role state: absent register: test_four @@ -79,10 +75,9 @@ - name: "IPAM_ROLE 5: ASSERT - Delete non existing" networktocode.nautobot.ipam_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test IPAM Role + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test IPAM Role state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/lookup.yml b/tests/integration/targets/latest/tasks/lookup.yml index 08ff2f12..77975a70 100644 --- a/tests/integration/targets/latest/tasks/lookup.yml +++ b/tests/integration/targets/latest/tasks/lookup.yml @@ -8,65 +8,63 @@ assert: that: "{{ query_result|count }} == 3" vars: - query_result: "{{ query('networktocode.nautobot.lookup', 'sites', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" + query_result: "{{ query('networktocode.nautobot.lookup', 'sites', api_endpoint=nautobot_url, token=nautobot_token) }}" - name: "PYNAUTOBOT_LOOKUP 2: Query doesn't return Wibble (sanity check json_query)" assert: that: "{{ query_result|json_query('[?value.display==`Wibble`]')|count }} == 0" vars: - query_result: "{{ query('networktocode.nautobot.lookup', 'devices', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" + query_result: "{{ query('networktocode.nautobot.lookup', 'devices', api_endpoint=nautobot_url, token=nautobot_token) }}" - name: "PYNAUTOBOT_LOOKUP 3: Device query returns exactly one TestDeviceR1" assert: that: "{{ query_result|json_query('[?value.display==`TestDeviceR1`]')|count }} == 1" vars: - query_result: "{{ query('networktocode.nautobot.lookup', 'devices', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" + query_result: "{{ query('networktocode.nautobot.lookup', 'devices', api_endpoint=nautobot_url, token=nautobot_token) }}" - name: "PYNAUTOBOT_LOOKUP 4: VLAN ID 400 can be queried and is named 'Test VLAN'" assert: that: "{{ (query_result|json_query('[?value.vid==`400`].value.name'))[0] == 'Test VLAN' }}" vars: - query_result: "{{ query('networktocode.nautobot.lookup', 'vlans', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" + query_result: "{{ query('networktocode.nautobot.lookup', 'vlans', api_endpoint=nautobot_url, token=nautobot_token) }}" - name: "PYNAUTOBOT_LOOKUP 5: Add one of two devices for lookup filter test." networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "L1" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" - tags: - - "nolookup" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "L1" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + tags: + - "nolookup" state: present - name: "PYNAUTOBOT_LOOKUP 6: Add two of two devices for lookup filter test." networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "L2" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site2" - status: "Staged" - tags: - - "lookup" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "L2" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site2" + status: "Staged" + tags: + - "lookup" state: present - name: "PYNAUTOBOT_LOOKUP 7: Device query returns exactly the L2 device" assert: that: "{{ query_result|json_query('[?value.display==`L2`]')|count }} == 1" vars: - query_result: "{{ query('networktocode.nautobot.lookup', 'devices', api_filter='role=core-switch tag=lookup', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" + query_result: "{{ query('networktocode.nautobot.lookup', 'devices', api_filter='role=core-switch tag=lookup', api_endpoint=nautobot_url, token=nautobot_token) }}" - name: "PYNAUTOBOT_LOOKUP 8: Device query specifying raw data returns payload without key/value dict" assert: that: "{{ query_result|json_query('[?display==`L2`]')|count }} == 1" vars: - query_result: "{{ query('networktocode.nautobot.lookup', 'devices', api_filter='role=core-switch tag=lookup', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567', raw_data=True) }}" + query_result: "{{ query('networktocode.nautobot.lookup', 'devices', api_filter='role=core-switch tag=lookup', api_endpoint=nautobot_url, token=nautobot_token, raw_data=True) }}" - name: "PYNAUTOBOT_LOOKUP 9: Device query specifying multiple sites, Make sure L1 and L2 are in the results" assert: @@ -74,9 +72,4 @@ - "'L1' in {{ query_result |json_query('[*].display') }}" - "'L2' in {{ query_result |json_query('[*].display') }}" vars: - query_result: "{{ query('networktocode.nautobot.lookup', 'devices', api_filter='role=core-switch site=test-site site=test-site2', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567', raw_data=True) }}" - -- name: "PYNAUTOBOT_LOOKUP 10: Device query by ID" - assert: - that: - - "{{ query('networktocode.nautobot.lookup', 'devices', api_filter='id=1', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" + query_result: "{{ query('networktocode.nautobot.lookup', 'devices', api_filter='role=core-switch site=test-site site=test-site2', api_endpoint=nautobot_url, token=nautobot_token, raw_data=True) }}" diff --git a/tests/integration/targets/latest/tasks/main.yml b/tests/integration/targets/latest/tasks/main.yml index bd718ae9..919c189e 100644 --- a/tests/integration/targets/latest/tasks/main.yml +++ b/tests/integration/targets/latest/tasks/main.yml @@ -1,162 +1,486 @@ --- - name: "PYNAUTOBOT_DEVICE TESTS" - include_tasks: "device.yml" + include_tasks: + file: "device.yml" + apply: + tags: + - device + tags: + - device - name: "PYNAUTOBOT_DEVICE_INTERFACE TESTS" - include_tasks: "device_interface.yml" + include_tasks: + file: "device_interface.yml" + apply: + tags: + - device_interface + tags: + - device_interface - name: "PYNAUTOBOT_DEVICE_INTERFACE_TEMPLATE TESTS" - include_tasks: "device_interface_template.yml" + include_tasks: + file: "device_interface_template.yml" + apply: + tags: + - device_interface_template + tags: + - device_interface_template - name: "PYNAUTOBOT_IP_ADDRESS TESTS" - include_tasks: "ip_address.yml" + include_tasks: + file: "ip_address.yml" + apply: + tags: + - ip_address + tags: + - ip_address - name: "PYNAUTOBOT_PREFIX TESTS" - include_tasks: "prefix.yml" + include_tasks: + file: "prefix.yml" + apply: + tags: + - prefix + tags: + - prefix - name: "PYNAUTOBOT_SITE TESTS" - include_tasks: "site.yml" + include_tasks: + file: "site.yml" + apply: + tags: + - site + tags: + - site - name: "PYNAUTOBOT_TENTANT TESTS" - include_tasks: "tenant.yml" + include_tasks: + file: "tenant.yml" + apply: + tags: + - tenant + tags: + - tenant - name: "PYNAUTOBOT_TENTANT_GROUP TESTS" - include_tasks: "tenant_group.yml" + include_tasks: + file: "tenant_group.yml" + apply: + tags: + - tenant_group + tags: + - tenant_group - name: "PYNAUTOBOT_RACK TESTS" - include_tasks: "rack.yml" + include_tasks: + file: "rack.yml" + apply: + tags: + - rack + tags: + - rack - name: "PYNAUTOBOT_RACK_ROLE TESTS" - include_tasks: "rack_role.yml" + include_tasks: + file: "rack_role.yml" + apply: + tags: + - rack_role + tags: + - rack_role - name: "PYNAUTOBOT_RACK_GROUP TESTS" - include_tasks: "rack_group.yml" + include_tasks: + file: "rack_group.yml" + apply: + tags: + - rack_group + tags: + - rack_group - name: "PYNAUTOBOT_MANUFACTURER TESTS" - include_tasks: "manufacturer.yml" + include_tasks: + file: "manufacturer.yml" + apply: + tags: + - manufacturer + tags: + - manufacturer - name: "PYNAUTOBOT_PLATFORM TESTS" - include_tasks: "platform.yml" + include_tasks: + file: "platform.yml" + apply: + tags: + - platform + tags: + - platform - name: "PYNAUTOBOT_DEVICE_TYPE TESTS" - include_tasks: "device_type.yml" + include_tasks: + file: "device_type.yml" + apply: + tags: + - device_type + tags: + - device_type - name: "PYNAUTOBOT_DEVICE_ROLE TESTS" - include_tasks: "device_role.yml" + include_tasks: + file: "device_role.yml" + apply: + tags: + - device_role + tags: + - device_role - name: "PYNAUTOBOT_IPAM_ROLE TESTS" - include_tasks: "ipam_role.yml" + include_tasks: + file: "ipam_role.yml" + apply: + tags: + - ipam_role + tags: + - ipam_role - name: "PYNAUTOBOT_VLAN_GROUP TESTS" - include_tasks: "vlan_group.yml" + include_tasks: + file: "vlan_group.yml" + apply: + tags: + - vlan_group + tags: + - vlan_group - name: "PYNAUTOBOT_VLAN TESTS" - include_tasks: "vlan.yml" + include_tasks: + file: "vlan.yml" + apply: + tags: + - vlan + tags: + - vlan - name: "PYNAUTOBOT_VRF TESTS" - include_tasks: "vrf.yml" + include_tasks: + file: "vrf.yml" + apply: + tags: + - vrf + tags: + - vrf - name: "PYNAUTOBOT_RIR TESTS" - include_tasks: "rir.yml" + include_tasks: + file: "rir.yml" + apply: + tags: + - rir + tags: + - rir - name: "PYNAUTOBOT_AGGREGATE TESTS" - include_tasks: "aggregate.yml" + include_tasks: + file: "aggregate.yml" + apply: + tags: + - aggregate + tags: + - aggregate - name: "PYNAUTOBOT_REGION TESTS" - include_tasks: "region.yml" + include_tasks: + file: "region.yml" + apply: + tags: + - region + tags: + - region - name: "PYNAUTOBOT_DEVICE_BAY TESTS" - include_tasks: "device_bay.yml" + include_tasks: + file: "device_bay.yml" + apply: + tags: + - device_bay + tags: + - device_bay - name: "PYNAUTOBOT_DEVICE_BAY_TEMPLATE TESTS" - include_tasks: "device_bay_template.yml" + include_tasks: + file: "device_bay_template.yml" + apply: + tags: + - device_bay_template + tags: + - device_bay_template - name: "PYNAUTOBOT_INVENTORY_ITEM TESTS" - include_tasks: "inventory_item.yml" + include_tasks: + file: "inventory_item.yml" + apply: + tags: + - inventory_item + tags: + - inventory_item - name: "PYNAUTOBOT_VIRTUAL_MACHINE TESTS" - include_tasks: "virtual_machine.yml" + include_tasks: + file: "virtual_machine.yml" + apply: + tags: + - virtual_machine + tags: + - virtual_machine - name: "PYNAUTOBOT_CLUSTER TESTS" - include_tasks: "cluster.yml" + include_tasks: + file: "cluster.yml" + apply: + tags: + - cluster + tags: + - cluster - name: "PYNAUTOBOT_CLUSTER_GROUP TESTS" - include_tasks: "cluster_group.yml" + include_tasks: + file: "cluster_group.yml" + apply: + tags: + - cluster_group + tags: + - cluster_group - name: "PYNAUTOBOT_CLUSTER_TYPE TESTS" - include_tasks: "cluster_type.yml" + include_tasks: + file: "cluster_type.yml" + apply: + tags: + - cluster_type + tags: + - cluster_type - name: "PYNAUTOBOT_VM_INTERFACE TESTS" - include_tasks: "vm_interface.yml" + include_tasks: + file: "vm_interface.yml" + apply: + tags: + - vm_interface + tags: + - vm_interface - name: "PYNAUTOBOT_PROVIDER TESTS" - include_tasks: "provider.yml" + include_tasks: + file: "provider.yml" + apply: + tags: + - provider + tags: + - provider - name: "PYNAUTOBOT_CIRCUIT_TYPE TESTS" - include_tasks: "circuit_type.yml" + include_tasks: + file: "circuit_type.yml" + apply: + tags: + - circuit_type + tags: + - circuit_type - name: "PYNAUTOBOT_CIRCUIT TESTS" - include_tasks: "circuit.yml" + include_tasks: + file: "circuit.yml" + apply: + tags: + - circuit + tags: + - circuit - name: "PYNAUTOBOT_CIRCUIT_TERMINATION TESTS" - include_tasks: "circuit_termination.yml" + include_tasks: + file: "circuit_termination.yml" + apply: + tags: + - circuit_termination + tags: + - circuit_termination - name: "PYNAUTOBOT_REAR_PORT TESTS" - include_tasks: "rear_port.yml" + include_tasks: + file: "rear_port.yml" + apply: + tags: + - rear_port + tags: + - rear_port - name: "PYNAUTOBOT_REAR_PORT_TEMPLATE TESTS" - include_tasks: "rear_port_template.yml" + include_tasks: + file: "rear_port_template.yml" + apply: + tags: + - rear_port_template + tags: + - rear_port_template - name: "PYNAUTOBOT_FRONT_PORT TESTS" - include_tasks: "front_port.yml" + include_tasks: + file: "front_port.yml" + apply: + tags: + - front_port + tags: + - front_port - name: "PYNAUTOBOT_FRONT_PORT_TEMPLATE TESTS" - include_tasks: "front_port_template.yml" + include_tasks: + file: "front_port_template.yml" + apply: + tags: + - front_port_template + tags: + - front_port_template - name: "PYNAUTOBOT_CONSOLE_PORT TESTS" - include_tasks: "console_port.yml" + include_tasks: + file: "console_port.yml" + apply: + tags: + - console_port + tags: + - console_port - name: "PYNAUTOBOT_CONSOLE_PORT_TEMPLATE TESTS" - include_tasks: "console_port_template.yml" + include_tasks: + file: "console_port_template.yml" + apply: + tags: + - console_port_template + tags: + - console_port_template - name: "PYNAUTOBOT_CONSOLE_SERVER_PORT TESTS" - include_tasks: "console_server_port.yml" + include_tasks: + file: "console_server_port.yml" + apply: + tags: + - console_server_port + tags: + - console_server_port - name: "PYNAUTOBOT_CONSOLE_SERVER_PORT_TEMPLATE TESTS" - include_tasks: "console_server_port_template.yml" + include_tasks: + file: "console_server_port_template.yml" + apply: + tags: + - console_server_port_template + tags: + - console_server_port_template - name: "PYNAUTOBOT_POWER_PANEL TESTS" - include_tasks: "power_panel.yml" + include_tasks: + file: "power_panel.yml" + apply: + tags: + - power_panel + tags: + - power_panel - name: "PYNAUTOBOT_POWER_FEED TESTS" - include_tasks: "power_feed.yml" + include_tasks: + file: "power_feed.yml" + apply: + tags: + - power_feed + tags: + - power_feed - name: "PYNAUTOBOT_POWER_PORT TESTS" - include_tasks: "power_port.yml" + include_tasks: + file: "power_port.yml" + apply: + tags: + - power_port + tags: + - power_port - name: "PYNAUTOBOT_POWER_PORT_TEMPLATE TESTS" - include_tasks: "power_port_template.yml" + include_tasks: + file: "power_port_template.yml" + apply: + tags: + - power_port_template + tags: + - power_port_template - name: "PYNAUTOBOT_POWER_OUTLET TESTS" - include_tasks: "power_outlet.yml" + include_tasks: + file: "power_outlet.yml" + apply: + tags: + - power_outlet + tags: + - power_outlet - name: "PYNAUTOBOT_POWER_OUTLET_TEMPLATE TESTS" - include_tasks: "power_outlet_template.yml" + include_tasks: + file: "power_outlet_template.yml" + apply: + tags: + - power_outlet_template + tags: + - power_outlet_template - name: "PYNAUTOBOT_VIRTUAL_CHASSIS TESTS" - include_tasks: "virtual_chassis.yml" + include_tasks: + file: "virtual_chassis.yml" + apply: + tags: + - virtual_chassis + tags: + - virtual_chassis - name: "PYNAUTOBOT_CABLE TESTS" - include_tasks: "cable.yml" + include_tasks: + file: "cable.yml" + apply: + tags: + - cable + tags: + - cable - name: "PYNAUTOBOT_SERVICE TESTS" - include_tasks: "service.yml" + include_tasks: + file: "service.yml" + apply: + tags: + - service + tags: + - service - name: "PYNAUTOBOT_LOOKUP TESTS" - include_tasks: "lookup.yml" + include_tasks: + file: "lookup.yml" + apply: + tags: + - lookup + tags: + - lookup - name: "PYNAUTOBOT_TAG_TESTS" - include_tasks: "tag.yml" + include_tasks: + file: "tag.yml" + apply: + tags: + - tag + tags: + - tag - name: "PYNAUTOBOT_ROUTE_TARGET_TESTS" - include_tasks: "route_target.yml" + include_tasks: + file: "route_target.yml" + apply: + tags: + - route_target + tags: + - route_target diff --git a/tests/integration/targets/latest/tasks/manufacturer.yml b/tests/integration/targets/latest/tasks/manufacturer.yml index 1199683c..d83401a6 100644 --- a/tests/integration/targets/latest/tasks/manufacturer.yml +++ b/tests/integration/targets/latest/tasks/manufacturer.yml @@ -6,10 +6,9 @@ ## - name: "MANUFACTURER 1: Necessary info creation" networktocode.nautobot.manufacturer: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Manufacturer Two + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test Manufacturer Two state: present register: test_one @@ -25,10 +24,9 @@ - name: "MANUFACTURER 2: Create duplicate" networktocode.nautobot.manufacturer: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Manufacturer Two + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test Manufacturer Two state: present register: test_two @@ -42,10 +40,9 @@ - name: "MANUFACTURER 3: Update" networktocode.nautobot.manufacturer: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: test manufacturer two + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: test manufacturer two state: present register: test_three @@ -59,10 +56,9 @@ - name: "MANUFACTURER 4: ASSERT - Delete" networktocode.nautobot.manufacturer: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: test manufacturer two + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: test manufacturer two state: absent register: test_four @@ -76,10 +72,9 @@ - name: "MANUFACTURER 5: ASSERT - Delete non existing" networktocode.nautobot.manufacturer: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Manufacturer Two + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test Manufacturer Two state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/platform.yml b/tests/integration/targets/latest/tasks/platform.yml index 5e9c84ec..2a7e552e 100644 --- a/tests/integration/targets/latest/tasks/platform.yml +++ b/tests/integration/targets/latest/tasks/platform.yml @@ -6,10 +6,9 @@ ## - name: "PLATFORM 1: Necessary info creation" networktocode.nautobot.platform: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Platform + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test Platform state: present register: test_one @@ -25,10 +24,9 @@ - name: "PLATFORM 2: Create duplicate" networktocode.nautobot.platform: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Platform + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test Platform state: present register: test_two @@ -42,14 +40,13 @@ - name: "PLATFORM 3: ASSERT - Update" networktocode.nautobot.platform: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Platform - manufacturer: Test Manufacturer - napalm_driver: ios - napalm_args: - global_delay_factor: 2 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test Platform + manufacturer: Test Manufacturer + napalm_driver: ios + napalm_args: + global_delay_factor: 2 state: present register: test_three @@ -57,20 +54,21 @@ assert: that: - test_three is changed - - test_three['diff']['after']['manufacturer'] == 3 + - test_three['diff']['after']['manufacturer'] == manufacturer['key'] - test_three['diff']['after']['napalm_args']['global_delay_factor'] == 2 - test_three['diff']['after']['napalm_driver'] == "ios" - - test_three['platform']['manufacturer'] == 3 + - test_three['platform']['manufacturer'] == manufacturer['key'] - test_three['platform']['napalm_args']['global_delay_factor'] == 2 - test_three['platform']['napalm_driver'] == "ios" - test_three['msg'] == "platform Test Platform updated" + vars: + manufacturer: "{{ lookup('networktocode.nautobot.lookup', 'manufacturers', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-manufacturer') }}" - name: "PLATFORM 4: ASSERT - Delete" networktocode.nautobot.platform: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Platform + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test Platform state: absent register: test_four @@ -84,10 +82,9 @@ - name: "PLATFORM 5: ASSERT - Delete non existing" networktocode.nautobot.platform: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Platform + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test Platform state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/power_feed.yml b/tests/integration/targets/latest/tasks/power_feed.yml index 3014756c..86349101 100644 --- a/tests/integration/targets/latest/tasks/power_feed.yml +++ b/tests/integration/targets/latest/tasks/power_feed.yml @@ -7,13 +7,16 @@ ### PYNAUTOBOT_POWER_FEED ## ## +- set_fact: + power_panel: '{{ lookup(''networktocode.nautobot.lookup'', ''power-panels'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''name="Test Power Panel"'') }}' + - name: "POWER_FEED 1: Necessary info creation" networktocode.nautobot.power_feed: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Feed - power_panel: Power Panel + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Feed + power_panel: Test Power Panel + status: "Active" state: present register: test_one @@ -24,16 +27,16 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['power_feed']['name'] == "Power Feed" - - test_one['power_feed']['power_panel'] == 1 + - test_one['power_feed']['power_panel'] == power_panel['key'] - test_one['msg'] == "power_feed Power Feed created" - name: "POWER_FEED 2: Create duplicate" networktocode.nautobot.power_feed: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Feed - power_panel: Power Panel + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Feed + power_panel: Test Power Panel + status: "Active" state: present register: test_two @@ -42,24 +45,23 @@ that: - not test_two['changed'] - test_two['power_feed']['name'] == "Power Feed" - - test_two['power_feed']['power_panel'] == 1 + - test_two['power_feed']['power_panel'] == power_panel['key'] - test_two['msg'] == "power_feed Power Feed already exists" - name: "POWER_FEED 3: Update power_feed with other fields" networktocode.nautobot.power_feed: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Feed - power_panel: Power Panel - status: offline - type: redundant - supply: dc - phase: three-phase - voltage: 400 - amperage: 32 - max_utilization: 25 - comments: totally normal power feed + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Feed + power_panel: Test Power Panel + status: offline + type: redundant + supply: dc + phase: three-phase + voltage: 400 + amperage: 32 + max_utilization: 25 + comments: totally normal power feed state: present register: test_three @@ -76,7 +78,7 @@ - test_three['diff']['after']['max_utilization'] == 25 - test_three['diff']['after']['comments'] == "totally normal power feed" - test_three['power_feed']['name'] == "Power Feed" - - test_three['power_feed']['power_panel'] == 1 + - test_three['power_feed']['power_panel'] == power_panel['key'] - test_three['power_feed']['status'] == "offline" - test_three['power_feed']['type'] == "redundant" - test_three['power_feed']['supply'] == "dc" @@ -89,11 +91,11 @@ - name: "POWER_FEED 4: Create Power Feed for Delete Test" networktocode.nautobot.power_feed: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Feed 2 - power_panel: Power Panel + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Feed 2 + power_panel: Test Power Panel + status: "Active" state: present register: test_four @@ -104,17 +106,15 @@ - test_four['diff']['before']['state'] == "absent" - test_four['diff']['after']['state'] == "present" - test_four['power_feed']['name'] == "Power Feed 2" - - test_four['power_feed']['power_panel'] == 1 + - test_four['power_feed']['power_panel'] == power_panel['key'] - test_four['msg'] == "power_feed Power Feed 2 created" - - name: "POWER_FEED 5: Delete Power Feed" networktocode.nautobot.power_feed: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Feed 2 - power_panel: Power Panel + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Feed 2 + power_panel: Test Power Panel state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/power_outlet.yml b/tests/integration/targets/latest/tasks/power_outlet.yml index 32ab2cf7..57d89827 100644 --- a/tests/integration/targets/latest/tasks/power_outlet.yml +++ b/tests/integration/targets/latest/tasks/power_outlet.yml @@ -7,13 +7,35 @@ ### PYNAUTOBOT_POWER_OUTLET ## ## +- name: "POWER_PORT 0: Create device for testing power ports" + networktocode.nautobot.device: + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Device Power Outlet + device_type: Cisco Test + device_role: Core Switch + site: Test Site + status: "Active" + state: present + +- name: "Create Power Port for testing" + networktocode.nautobot.power_port: + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Device Power Outlet Power Port + device: Device Power Outlet + state: present + +- set_fact: + device: '{{ lookup(''networktocode.nautobot.lookup'', ''devices'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''name="Device Power Outlet"'') }}' + power_port: '{{ lookup(''networktocode.nautobot.lookup'', ''power-ports'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''name="Device Power Outlet Power Port"'') }}' + - name: "POWER_OUTLET 1: Necessary info creation" networktocode.nautobot.power_outlet: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet - device: Device Power Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Outlet + device: Device Power Outlet state: present register: test_one @@ -24,16 +46,15 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['power_outlet']['name'] == "Power Outlet" - - test_one['power_outlet']['device'] == 10 + - test_one['power_outlet']['device'] == device['key'] - test_one['msg'] == "power_outlet Power Outlet created" - name: "POWER_OUTLET 2: Create duplicate" networktocode.nautobot.power_outlet: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet - device: Device Power Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Outlet + device: Device Power Outlet state: present register: test_two @@ -42,20 +63,19 @@ that: - not test_two['changed'] - test_two['power_outlet']['name'] == "Power Outlet" - - test_two['power_outlet']['device'] == 10 + - test_two['power_outlet']['device'] == device['key'] - test_two['msg'] == "power_outlet Power Outlet already exists" - name: "POWER_OUTLET 3: Update power_outlet with other fields" networktocode.nautobot.power_outlet: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet - device: Device Power Tests - type: ita-e - power_port: Power Port - feed_leg: B - description: test description + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Outlet + device: Device Power Outlet + type: ita-e + power_port: Device Power Outlet Power Port + feed_leg: B + description: test description state: present register: test_three @@ -64,24 +84,23 @@ that: - test_three is changed - test_three['diff']['after']['type'] == "ita-e" - - test_three['diff']['after']['power_port'] == 1 + - test_three['diff']['after']['power_port'] == power_port['key'] - test_three['diff']['after']['feed_leg'] == "B" - test_three['diff']['after']['description'] == "test description" - test_three['power_outlet']['name'] == "Power Outlet" - - test_three['power_outlet']['device'] == 10 + - test_three['power_outlet']['device'] == device['key'] - test_three['power_outlet']['type'] == "ita-e" - - test_three['power_outlet']['power_port'] == 1 + - test_three['power_outlet']['power_port'] == power_port['key'] - test_three['power_outlet']['feed_leg'] == "B" - test_three['power_outlet']['description'] == "test description" - test_three['msg'] == "power_outlet Power Outlet updated" - name: "POWER_OUTLET 4: Create Power Outlet for Delete Test" networktocode.nautobot.power_outlet: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet 2 - device: Device Power Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Outlet 2 + device: Device Power Outlet state: present register: test_four @@ -92,16 +111,15 @@ - test_four['diff']['before']['state'] == "absent" - test_four['diff']['after']['state'] == "present" - test_four['power_outlet']['name'] == "Power Outlet 2" - - test_four['power_outlet']['device'] == 10 + - test_four['power_outlet']['device'] == device['key'] - test_four['msg'] == "power_outlet Power Outlet 2 created" - name: "POWER_OUTLET 5: Delete Power Outlet" networktocode.nautobot.power_outlet: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet 2 - device: Device Power Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Outlet 2 + device: Device Power Outlet state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/power_outlet_template.yml b/tests/integration/targets/latest/tasks/power_outlet_template.yml index ae196e74..d9ad28f5 100644 --- a/tests/integration/targets/latest/tasks/power_outlet_template.yml +++ b/tests/integration/targets/latest/tasks/power_outlet_template.yml @@ -7,13 +7,32 @@ ### PYNAUTOBOT_POWER_OUTLET_TEMPLATE ## ## +- name: "POWER_PORT_TEMPLATE 0: Create device type for testing power ports" + networktocode.nautobot.device_type: + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + model: Device Type Power Outlet + manufacturer: Test Manufacturer + state: present + +- name: "POWER_PORT_TEMPLATE 1: Necessary info creation" + networktocode.nautobot.power_port_template: + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Port Template - Outlet + device_type: Device Type Power Outlet + state: present + +- set_fact: + device_type: "{{ lookup('networktocode.nautobot.lookup', 'device-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=device-type-power-outlet') }}" + power_port_template: '{{ lookup(''networktocode.nautobot.lookup'', ''power-port-templates'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''name="Power Port Template - Outlet"'') }}' + - name: "POWER_OUTLET_TEMPLATE 1: Necessary info creation" networktocode.nautobot.power_outlet_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet Template - device_type: Device Type Power Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Outlet Template + device_type: Device Type Power Outlet state: present register: test_one @@ -24,16 +43,15 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['power_outlet_template']['name'] == "Power Outlet Template" - - test_one['power_outlet_template']['device_type'] == 8 + - test_one['power_outlet_template']['device_type'] == device_type['key'] - test_one['msg'] == "power_outlet_template Power Outlet Template created" - name: "POWER_OUTLET_TEMPLATE 2: Create duplicate" networktocode.nautobot.power_outlet_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet Template - device_type: Device Type Power Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Outlet Template + device_type: Device Type Power Outlet state: present register: test_two @@ -42,19 +60,18 @@ that: - not test_two['changed'] - test_two['power_outlet_template']['name'] == "Power Outlet Template" - - test_two['power_outlet_template']['device_type'] == 8 + - test_two['power_outlet_template']['device_type'] == device_type['key'] - test_two['msg'] == "power_outlet_template Power Outlet Template already exists" - name: "POWER_OUTLET_TEMPLATE 3: Update power_outlet_template with other fields" networktocode.nautobot.power_outlet_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet Template - device_type: Device Type Power Tests - type: ita-e - power_port: Power Port - feed_leg: B + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Outlet Template + device_type: Device Type Power Outlet + type: ita-e + power_port_template: Power Port Template - Outlet + feed_leg: B state: present register: test_three @@ -63,22 +80,21 @@ that: - test_three is changed - test_three['diff']['after']['type'] == "ita-e" - - test_three['diff']['after']['power_port'] == 1 + - test_three['diff']['after']['power_port'] == power_port_template['key'] - test_three['diff']['after']['feed_leg'] == "B" - test_three['power_outlet_template']['name'] == "Power Outlet Template" - - test_three['power_outlet_template']['device_type'] == 8 + - test_three['power_outlet_template']['device_type'] == device_type['key'] - test_three['power_outlet_template']['type'] == "ita-e" - - test_three['power_outlet_template']['power_port'] == 1 + - test_three['power_outlet_template']['power_port'] == power_port_template['key'] - test_three['power_outlet_template']['feed_leg'] == "B" - test_three['msg'] == "power_outlet_template Power Outlet Template updated" - name: "POWER_OUTLET_TEMPLATE 4: Create Power Outlet Template for Delete Test" networktocode.nautobot.power_outlet_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet Template 2 - device_type: Device Type Power Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Outlet Template 2 + device_type: Device Type Power Outlet state: present register: test_four @@ -89,16 +105,15 @@ - test_four['diff']['before']['state'] == "absent" - test_four['diff']['after']['state'] == "present" - test_four['power_outlet_template']['name'] == "Power Outlet Template 2" - - test_four['power_outlet_template']['device_type'] == 8 + - test_four['power_outlet_template']['device_type'] == device_type['key'] - test_four['msg'] == "power_outlet_template Power Outlet Template 2 created" - name: "POWER_OUTLET_TEMPLATE 5: Delete Power Outlet Template" networktocode.nautobot.power_outlet_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet Template 2 - device_type: Device Type Power Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Outlet Template 2 + device_type: Device Type Power Outlet state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/power_panel.yml b/tests/integration/targets/latest/tasks/power_panel.yml index 184cdcb4..0e09dbe1 100644 --- a/tests/integration/targets/latest/tasks/power_panel.yml +++ b/tests/integration/targets/latest/tasks/power_panel.yml @@ -7,13 +7,16 @@ ### PYNAUTOBOT_POWER_PANEL ## ## +- set_fact: + test_site: "{{ lookup('networktocode.nautobot.lookup', 'sites', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-site') }}" + rack_group: "{{ lookup('networktocode.nautobot.lookup', 'rack-groups', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-rack-group') }}" + - name: "POWER_PANEL 1: Necessary info creation" networktocode.nautobot.power_panel: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Panel - site: Test Site + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Panel + site: Test Site state: present register: test_one @@ -24,16 +27,15 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['power_panel']['name'] == "Power Panel" - - test_one['power_panel']['site'] == 1 + - test_one['power_panel']['site'] == test_site['key'] - test_one['msg'] == "power_panel Power Panel created" - name: "POWER_PANEL 2: Create duplicate" networktocode.nautobot.power_panel: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Panel - site: Test Site + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Panel + site: Test Site state: present register: test_two @@ -42,17 +44,16 @@ that: - not test_two['changed'] - test_two['power_panel']['name'] == "Power Panel" - - test_two['power_panel']['site'] == 1 + - test_two['power_panel']['site'] == test_site['key'] - test_two['msg'] == "power_panel Power Panel already exists" - name: "POWER_PANEL 3: Update power_panel with other fields" networktocode.nautobot.power_panel: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Panel - site: Test Site - rack_group: Test Rack Group + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Panel + site: Test Site + rack_group: Test Rack Group state: present register: test_three @@ -60,19 +61,18 @@ assert: that: - test_three is changed - - test_three['diff']['after']['rack_group'] == 1 + - test_three['diff']['after']['rack_group'] == rack_group['key'] - test_three['power_panel']['name'] == "Power Panel" - - test_three['power_panel']['site'] == 1 - - test_three['power_panel']['rack_group'] == 1 + - test_three['power_panel']['site'] == test_site['key'] + - test_three['power_panel']['rack_group'] == rack_group['key'] - test_three['msg'] == "power_panel Power Panel updated" - name: "POWER_PANEL 4: Create Power Panel for Delete Test" networktocode.nautobot.power_panel: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Panel 2 - site: Test Site + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Panel 2 + site: Test Site state: present register: test_four @@ -83,17 +83,15 @@ - test_four['diff']['before']['state'] == "absent" - test_four['diff']['after']['state'] == "present" - test_four['power_panel']['name'] == "Power Panel 2" - - test_four['power_panel']['site'] == 1 + - test_four['power_panel']['site'] == test_site['key'] - test_four['msg'] == "power_panel Power Panel 2 created" - - name: "POWER_PANEL 5: Delete Power Panel" networktocode.nautobot.power_panel: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Panel 2 - site: Test Site + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Panel 2 + site: Test Site state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/power_port.yml b/tests/integration/targets/latest/tasks/power_port.yml index 3583361b..8dd8be87 100644 --- a/tests/integration/targets/latest/tasks/power_port.yml +++ b/tests/integration/targets/latest/tasks/power_port.yml @@ -9,22 +9,24 @@ ## - name: "POWER_PORT 0: Create device for testing power ports" networktocode.nautobot.device: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Device Power Tests - device_type: Cisco Test - device_role: Core Switch - site: Test Site + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Device Power Tests + device_type: Cisco Test + device_role: Core Switch + status: "Active" + site: Test Site state: present +- set_fact: + device: '{{ lookup(''networktocode.nautobot.lookup'', ''devices'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''name="Device Power Tests"'') }}' + - name: "POWER_PORT 1: Necessary info creation" networktocode.nautobot.power_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port - device: Device Power Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Port + device: Device Power Tests state: present register: test_one @@ -35,16 +37,15 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['power_port']['name'] == "Power Port" - - test_one['power_port']['device'] == 10 + - test_one['power_port']['device'] == device['key'] - test_one['msg'] == "power_port Power Port created" - name: "POWER_PORT 2: Create duplicate" networktocode.nautobot.power_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port - device: Device Power Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Port + device: Device Power Tests state: present register: test_two @@ -53,20 +54,19 @@ that: - not test_two['changed'] - test_two['power_port']['name'] == "Power Port" - - test_two['power_port']['device'] == 10 + - test_two['power_port']['device'] == device['key'] - test_two['msg'] == "power_port Power Port already exists" - name: "POWER_FEED 3: Update power_port with other fields" networktocode.nautobot.power_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port - device: Device Power Tests - type: ita-e - allocated_draw: 10 - maximum_draw: 20 - description: test description + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Port + device: Device Power Tests + type: ita-e + allocated_draw: 10 + maximum_draw: 20 + description: test description state: present register: test_three @@ -79,7 +79,7 @@ - test_three['diff']['after']['maximum_draw'] == 20 - test_three['diff']['after']['description'] == "test description" - test_three['power_port']['name'] == "Power Port" - - test_three['power_port']['device'] == 10 + - test_three['power_port']['device'] == device['key'] - test_three['power_port']['type'] == "ita-e" - test_three['power_port']['allocated_draw'] == 10 - test_three['power_port']['maximum_draw'] == 20 @@ -88,11 +88,10 @@ - name: "POWER_PORT 4: Create Power Port for Delete Test" networktocode.nautobot.power_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port 2 - device: Device Power Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Port 2 + device: Device Power Tests state: present register: test_four @@ -103,16 +102,15 @@ - test_four['diff']['before']['state'] == "absent" - test_four['diff']['after']['state'] == "present" - test_four['power_port']['name'] == "Power Port 2" - - test_four['power_port']['device'] == 10 + - test_four['power_port']['device'] == device['key'] - test_four['msg'] == "power_port Power Port 2 created" - name: "POWER_PORT 5: Delete Power Port" networktocode.nautobot.power_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port 2 - device: Device Power Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Port 2 + device: Device Power Tests state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/power_port_template.yml b/tests/integration/targets/latest/tasks/power_port_template.yml index e6a4407d..168e7320 100644 --- a/tests/integration/targets/latest/tasks/power_port_template.yml +++ b/tests/integration/targets/latest/tasks/power_port_template.yml @@ -9,20 +9,21 @@ ## - name: "POWER_PORT_TEMPLATE 0: Create device type for testing power ports" networktocode.nautobot.device_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - model: Device Type Power Tests - manufacturer: Test Manufacturer + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + model: Device Type Power Tests + manufacturer: Test Manufacturer state: present +- set_fact: + device_type: "{{ lookup('networktocode.nautobot.lookup', 'device-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=device-type-power-tests') }}" + - name: "POWER_PORT_TEMPLATE 1: Necessary info creation" networktocode.nautobot.power_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port Template - device_type: Device Type Power Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Port Template + device_type: Device Type Power Tests state: present register: test_one @@ -33,16 +34,15 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['power_port_template']['name'] == "Power Port Template" - - test_one['power_port_template']['device_type'] == 8 + - test_one['power_port_template']['device_type'] == device_type['key'] - test_one['msg'] == "power_port_template Power Port Template created" - name: "POWER_PORT_TEMPLATE 2: Create duplicate" networktocode.nautobot.power_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port Template - device_type: Device Type Power Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Port Template + device_type: Device Type Power Tests state: present register: test_two @@ -51,19 +51,18 @@ that: - not test_two['changed'] - test_two['power_port_template']['name'] == "Power Port Template" - - test_two['power_port_template']['device_type'] == 8 + - test_two['power_port_template']['device_type'] == device_type['key'] - test_two['msg'] == "power_port_template Power Port Template already exists" - name: "POWER_PORT_TEMPLATE 3: Update power_port_template with other fields" networktocode.nautobot.power_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port Template - device_type: Device Type Power Tests - type: ita-e - allocated_draw: 10 - maximum_draw: 20 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Port Template + device_type: Device Type Power Tests + type: ita-e + allocated_draw: 10 + maximum_draw: 20 state: present register: test_three @@ -75,7 +74,7 @@ - test_three['diff']['after']['allocated_draw'] == 10 - test_three['diff']['after']['maximum_draw'] == 20 - test_three['power_port_template']['name'] == "Power Port Template" - - test_three['power_port_template']['device_type'] == 8 + - test_three['power_port_template']['device_type'] == device_type['key'] - test_three['power_port_template']['type'] == "ita-e" - test_three['power_port_template']['allocated_draw'] == 10 - test_three['power_port_template']['maximum_draw'] == 20 @@ -83,11 +82,10 @@ - name: "POWER_PORT_TEMPLATE 4: Create Power Port Template for Delete Test" networktocode.nautobot.power_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port Template 2 - device_type: Device Type Power Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Port Template 2 + device_type: Device Type Power Tests state: present register: test_four @@ -98,16 +96,15 @@ - test_four['diff']['before']['state'] == "absent" - test_four['diff']['after']['state'] == "present" - test_four['power_port_template']['name'] == "Power Port Template 2" - - test_four['power_port_template']['device_type'] == 8 + - test_four['power_port_template']['device_type'] == device_type['key'] - test_four['msg'] == "power_port_template Power Port Template 2 created" - name: "POWER_PORT_TEMPLATE 5: Delete Power Port Template" networktocode.nautobot.power_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port Template 2 - device_type: Device Type Power Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Power Port Template 2 + device_type: Device Type Power Tests state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/prefix.yml b/tests/integration/targets/latest/tasks/prefix.yml index 71fdbd00..36bd0c8f 100644 --- a/tests/integration/targets/latest/tasks/prefix.yml +++ b/tests/integration/targets/latest/tasks/prefix.yml @@ -4,12 +4,19 @@ ### PYNAUTOBOT_PREFIX ## ## +- set_fact: + test_site: "{{ lookup('networktocode.nautobot.lookup', 'sites', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-site') }}" + tenant: "{{ lookup('networktocode.nautobot.lookup', 'tenants', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-tenant') }}" + tag_schnozzberry: "{{ lookup('networktocode.nautobot.lookup', 'tags', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=schnozzberry') }}" + vrf: '{{ lookup(''networktocode.nautobot.lookup'', ''vrfs'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''"name=Test VRF"'') }}' + vlan_group: "{{ lookup('networktocode.nautobot.lookup', 'vlan-groups', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-vlan-group') }}" + - name: "1 - Create prefix within Nautobot with only required information" networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: 10.156.0.0/19 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + prefix: 10.156.0.0/19 + status: "Active" state: present register: test_one @@ -24,10 +31,10 @@ - name: "2 - Duplicate" networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: 10.156.0.0/19 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + prefix: 10.156.0.0/19 + status: "Active" state: present register: test_two @@ -40,13 +47,12 @@ - name: "3 - Update 10.156.0.0/19" networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: 10.156.0.0/19 - site: Test Site - status: Reserved - description: "This prefix has been updated" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + prefix: 10.156.0.0/19 + site: Test Site + status: Reserved + description: "This prefix has been updated" state: present register: test_three @@ -54,21 +60,20 @@ assert: that: - test_three is changed - - test_three['diff']['after']['site'] == 1 + - test_three['diff']['after']['site'] == test_site['key'] - test_three['diff']['after']['status'] == "reserved" - test_three['diff']['after']['description'] == "This prefix has been updated" - test_three['msg'] == "prefix 10.156.0.0/19 updated" - test_three['prefix']['prefix'] == "10.156.0.0/19" - - test_three['prefix']['site'] == 1 + - test_three['prefix']['site'] == test_site['key'] - test_three['prefix']['status'] == "reserved" - test_three['prefix']['description'] == "This prefix has been updated" - name: "4 - Delete prefix within nautobot" networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: 10.156.0.0/19 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + prefix: 10.156.0.0/19 state: absent register: test_four @@ -82,25 +87,24 @@ - name: "5 - Create prefix with several specified options" networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - family: 4 - prefix: 10.156.32.0/19 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + family: 4 + prefix: 10.156.32.0/19 + site: Test Site + vrf: Test VRF + tenant: Test Tenant + vlan: + name: Test VLAN site: Test Site - vrf: Test VRF tenant: Test Tenant - vlan: - name: Test VLAN - site: Test Site - tenant: Test Tenant - vlan_group: Test Vlan Group - status: Reserved - prefix_role: Network of care - description: Test description - is_pool: true - tags: - - "Schnozzberry" + vlan_group: Test Vlan Group + status: Reserved + prefix_role: Network of care + description: Test description + is_pool: true + tags: + - "Schnozzberry" state: present register: test_five @@ -113,23 +117,26 @@ - test_five['msg'] == "prefix 10.156.32.0/19 created" - test_five['prefix']['prefix'] == "10.156.32.0/19" - test_five['prefix']['family'] == 4 - - test_five['prefix']['site'] == 1 - - test_five['prefix']['vrf'] == 1 - - test_five['prefix']['tenant'] == 1 - - test_five['prefix']['vlan'] == 4 + - test_five['prefix']['site'] == test_site['key'] + - test_five['prefix']['vrf'] == vrf['key'] + - test_five['prefix']['tenant'] == tenant['key'] + - test_five['prefix']['vlan'] == vlan['key'] - test_five['prefix']['status'] == "reserved" - - test_five['prefix']['role'] == 1 + - test_five['prefix']['role'] == role['key'] - test_five['prefix']['description'] == "Test description" - test_five['prefix']['is_pool'] == true - - test_five['prefix']['tags'][0] == 4 + - test_five['prefix']['tags'][0] == tag_schnozzberry['key'] + vars: + role: '{{ lookup(''networktocode.nautobot.lookup'', ''roles'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''slug="network-of-care"'') }}' + vlan: '{{ lookup(''networktocode.nautobot.lookup'', ''vlans'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''name="Test VLAN"'') }}' - name: "6 - Get a new /24 inside 10.156.0.0/19 within Nautobot - Parent doesn't exist" networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - parent: 10.156.0.0/19 - prefix_length: 24 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + parent: 10.156.0.0/19 + prefix_length: 24 + status: "Active" state: present first_available: yes register: test_six @@ -142,10 +149,10 @@ - name: "7 - Create prefix within Nautobot with only required information" networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: 10.156.0.0/19 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + prefix: 10.156.0.0/19 + status: "Active" state: present register: test_seven @@ -160,11 +167,11 @@ - name: "8 - Get a new /24 inside 10.156.0.0/19 within Nautobot" networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - parent: 10.156.0.0/19 - prefix_length: 24 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + parent: 10.156.0.0/19 + prefix_length: 24 + status: "Active" state: present first_available: yes register: test_eight @@ -180,12 +187,12 @@ - name: "9 - Create 10.157.0.0/19" networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: 10.157.0.0/19 - vrf: Test VRF - site: Test Site + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + prefix: 10.157.0.0/19 + vrf: Test VRF + site: Test Site + status: "Active" state: present register: test_nine @@ -197,18 +204,18 @@ - test_nine['diff']['after']['state'] == "present" - test_nine['msg'] == "prefix 10.157.0.0/19 created" - test_nine['prefix']['prefix'] == "10.157.0.0/19" - - test_nine['prefix']['site'] == 1 - - test_nine['prefix']['vrf'] == 1 + - test_nine['prefix']['site'] == test_site['key'] + - test_nine['prefix']['vrf'] == vrf['key'] - name: "10 - Get a new /24 inside 10.157.0.0/19 within Nautobot with additional values" networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - parent: 10.157.0.0/19 - prefix_length: 24 - vrf: Test VRF - site: Test Site + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + parent: 10.157.0.0/19 + prefix_length: 24 + vrf: Test VRF + site: Test Site + status: "Active" state: present first_available: yes register: test_ten @@ -221,16 +228,16 @@ - test_ten['diff']['after']['state'] == "present" - test_ten['msg'] == "prefix 10.157.0.0/24 created" - test_ten['prefix']['prefix'] == "10.157.0.0/24" - - test_ten['prefix']['site'] == 1 - - test_ten['prefix']['vrf'] == 1 + - test_ten['prefix']['site'] == test_site['key'] + - test_ten['prefix']['vrf'] == vrf['key'] - name: "11 - Get a new /24 inside 10.156.0.0/19 within Nautobot" networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - parent: 10.156.0.0/19 - prefix_length: 24 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + parent: 10.156.0.0/19 + prefix_length: 24 + status: "Active" state: present first_available: yes register: test_eleven diff --git a/tests/integration/targets/latest/tasks/provider.yml b/tests/integration/targets/latest/tasks/provider.yml index 4c4ea2e8..73c0a475 100644 --- a/tests/integration/targets/latest/tasks/provider.yml +++ b/tests/integration/targets/latest/tasks/provider.yml @@ -6,10 +6,9 @@ ## - name: "PYNAUTOBOT_PROVIDER 1: Create provider within Nautobot with only required information" networktocode.nautobot.provider: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Provider One + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test Provider One state: present register: test_one @@ -25,10 +24,9 @@ - name: "PYNAUTOBOT_PROVIDER 2: Duplicate" networktocode.nautobot.provider: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Provider One + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test Provider One state: present register: test_two @@ -42,16 +40,15 @@ - name: "PYNAUTOBOT_PROVIDER 3: Update provider with other fields" networktocode.nautobot.provider: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Provider One - asn: 65001 - account: "200129104" - portal_url: http://provider.net - noc_contact: noc@provider.net - admin_contact: admin@provider.net - comments: "BAD PROVIDER" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test Provider One + asn: 65001 + account: "200129104" + portal_url: http://provider.net + noc_contact: noc@provider.net + admin_contact: admin@provider.net + comments: "BAD PROVIDER" state: present register: test_three @@ -77,10 +74,9 @@ - name: "PYNAUTOBOT_PROVIDER 4: Delete provider within nautobot" networktocode.nautobot.provider: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Provider One + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test Provider One state: absent register: test_four diff --git a/tests/integration/targets/latest/tasks/rack.yml b/tests/integration/targets/latest/tasks/rack.yml index 33ed4a1e..fd3cfc12 100644 --- a/tests/integration/targets/latest/tasks/rack.yml +++ b/tests/integration/targets/latest/tasks/rack.yml @@ -4,13 +4,20 @@ ### PYNAUTOBOT_RACK ## ## +- set_fact: + test_site: "{{ lookup('networktocode.nautobot.lookup', 'sites', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-site') }}" + tenant: "{{ lookup('networktocode.nautobot.lookup', 'tenants', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-tenant') }}" + tag_schnozzberry: "{{ lookup('networktocode.nautobot.lookup', 'tags', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=schnozzberry') }}" + rack_role: "{{ lookup('networktocode.nautobot.lookup', 'rack-roles', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-rack-role') }}" + rack_group: "{{ lookup('networktocode.nautobot.lookup', 'rack-groups', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-rack-group') }}" + - name: "1 - Test rack creation" networktocode.nautobot.rack: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test rack one" - site: "Test Site" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test rack one" + status: "Available" + site: "Test Site" register: test_one - name: "1 - ASSERT" @@ -20,14 +27,14 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['rack']['name'] == "Test rack one" - - test_one['rack']['site'] == 1 + - test_one['rack']['site'] == test_site['key'] - name: "Test duplicate rack" networktocode.nautobot.rack: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test rack one" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test rack one" + status: "Available" register: test_two - name: "2 - ASSERT" @@ -35,16 +42,16 @@ that: - not test_two['changed'] - test_two['rack']['name'] == "Test rack one" - - test_two['rack']['site'] == 1 + - test_two['rack']['site'] == test_site['key'] - test_two['msg'] == "rack Test rack one already exists" - name: "3 - Create new rack with similar name" networktocode.nautobot.rack: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test rack - Test Site - site: Test Site + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test rack - Test Site + site: Test Site + status: "Available" state: present register: test_three @@ -55,16 +62,16 @@ - test_three['diff']['before']['state'] == "absent" - test_three['diff']['after']['state'] == "present" - test_three['rack']['name'] == "Test rack - Test Site" - - test_three['rack']['site'] == 1 + - test_three['rack']['site'] == test_site['key'] - test_three['msg'] == "rack Test rack - Test Site created" - name: "4 - Attempt to create Test rack one again" networktocode.nautobot.rack: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test rack one - site: Test Site + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test rack one + site: Test Site + status: "Available" state: present register: test_four @@ -73,32 +80,31 @@ that: - not test_four['changed'] - test_four['rack']['name'] == "Test rack one" - - test_four['rack']['site'] == 1 + - test_four['rack']['site'] == test_site['key'] - test_four['msg'] == "rack Test rack one already exists" - name: "5 - Update Test rack one with more options" networktocode.nautobot.rack: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test rack one - site: Test Site - rack_role: "Test Rack Role" - rack_group: "Test Rack Group" - facility_id: "EQUI10291" - tenant: "Test Tenant" - status: Available - serial: "FXS10001" - asset_tag: "1234" - width: 23 - u_height: 48 - type: "2-post frame" - outer_width: 32 - outer_depth: 24 - outer_unit: "Inches" - comments: "Just testing rack module" - tags: - - "Schnozzberry" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test rack one + site: Test Site + rack_role: "Test Rack Role" + rack_group: "Test Rack Group" + facility_id: "EQUI10291" + tenant: "Test Tenant" + status: Available + serial: "FXS10001" + asset_tag: "1234" + width: 23 + u_height: 48 + type: "2-post frame" + outer_width: 32 + outer_depth: 24 + outer_unit: "Inches" + comments: "Just testing rack module" + tags: + - "Schnozzberry" state: present register: test_five @@ -109,32 +115,31 @@ - test_five['diff']['after']['asset_tag'] == "1234" - test_five['diff']['after']['comments'] == "Just testing rack module" - test_five['diff']['after']['facility_id'] == "EQUI10291" - - test_five['diff']['after']['group'] == 1 + - test_five['diff']['after']['group'] == rack_group['key'] - test_five['diff']['after']['outer_depth'] == 24 - test_five['diff']['after']['outer_unit'] == "in" - test_five['diff']['after']['outer_width'] == 32 - - test_five['diff']['after']['role'] == 1 + - test_five['diff']['after']['role'] == rack_role['key'] - test_five['diff']['after']['serial'] == "FXS10001" - - test_five['diff']['after']['status'] == "available" - - test_five['diff']['after']['tenant'] == 1 - - test_five['diff']['after']['tags'][0] == 4 + - test_five['diff']['after']['tenant'] == tenant['key'] + - test_five['diff']['after']['tags'][0] == tag_schnozzberry['key'] - test_five['diff']['after']['type'] == "2-post-frame" - test_five['diff']['after']['u_height'] == 48 - test_five['diff']['after']['width'] == 23 - test_five['rack']['name'] == "Test rack one" - - test_five['rack']['site'] == 1 + - test_five['rack']['site'] == test_site['key'] - test_five['rack']['asset_tag'] == "1234" - test_five['rack']['comments'] == "Just testing rack module" - test_five['rack']['facility_id'] == "EQUI10291" - - test_five['rack']['group'] == 1 + - test_five['rack']['group'] == rack_group['key'] - test_five['rack']['outer_depth'] == 24 - test_five['rack']['outer_unit'] == "in" - test_five['rack']['outer_width'] == 32 - - test_five['rack']['role'] == 1 + - test_five['rack']['role'] == rack_role['key'] - test_five['rack']['serial'] == "FXS10001" - test_five['rack']['status'] == "available" - - test_five['rack']['tenant'] == 1 - - test_five['rack']['tags'][0] == 4 + - test_five['rack']['tenant'] == tenant['key'] + - test_five['rack']['tags'][0] == tag_schnozzberry['key'] - test_five['rack']['type'] == "2-post-frame" - test_five['rack']['u_height'] == 48 - test_five['rack']['width'] == 23 @@ -142,27 +147,26 @@ - name: "6 - Update Test rack one with same options" networktocode.nautobot.rack: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test rack one - site: Test Site - rack_role: "Test Rack Role" - rack_group: "Test Rack Group" - facility_id: "EQUI10291" - tenant: "Test Tenant" - status: Available - serial: "FXS10001" - asset_tag: "1234" - width: 23 - u_height: 48 - type: "2-post frame" - outer_width: 32 - outer_depth: 24 - outer_unit: "Inches" - comments: "Just testing rack module" - tags: - - "Schnozzberry" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test rack one + site: Test Site + rack_role: "Test Rack Role" + rack_group: "Test Rack Group" + facility_id: "EQUI10291" + tenant: "Test Tenant" + status: Available + serial: "FXS10001" + asset_tag: "1234" + width: 23 + u_height: 48 + type: "2-post frame" + outer_width: 32 + outer_depth: 24 + outer_unit: "Inches" + comments: "Just testing rack module" + tags: + - "Schnozzberry" state: present register: test_six @@ -171,32 +175,32 @@ that: - test_six is not changed - test_six['rack']['name'] == "Test rack one" - - test_six['rack']['site'] == 1 + - test_six['rack']['site'] == test_site['key'] - test_six['rack']['asset_tag'] == "1234" - test_six['rack']['comments'] == "Just testing rack module" - test_six['rack']['facility_id'] == "EQUI10291" - - test_six['rack']['group'] == 1 + - test_six['rack']['group'] == rack_group['key'] - test_six['rack']['outer_depth'] == 24 - test_six['rack']['outer_unit'] == "in" - test_six['rack']['outer_width'] == 32 - - test_six['rack']['role'] == 1 + - test_six['rack']['role'] == rack_role['key'] - test_six['rack']['serial'] == "FXS10001" - test_six['rack']['status'] == "available" - - test_six['rack']['tenant'] == 1 - - test_six['rack']['tags'][0] == 4 + - test_six['rack']['tenant'] == tenant['key'] + - test_six['rack']['tags'][0] == tag_schnozzberry['key'] - test_six['rack']['type'] == "2-post-frame" - test_six['rack']['u_height'] == 48 - test_six['rack']['width'] == 23 - name: "7 - Create rack with same asset tag and serial number" networktocode.nautobot.rack: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test rack two - site: Test Site - serial: "FXS10001" - asset_tag: "1234" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test rack two + site: Test Site + serial: "FXS10001" + asset_tag: "1234" + status: Available state: present ignore_errors: yes register: test_seven @@ -209,10 +213,9 @@ - name: "8 - Test delete" networktocode.nautobot.rack: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test rack one" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test rack one" state: "absent" register: test_eight diff --git a/tests/integration/targets/latest/tasks/rack_group.yml b/tests/integration/targets/latest/tasks/rack_group.yml index c7bac243..ca79ed2f 100644 --- a/tests/integration/targets/latest/tasks/rack_group.yml +++ b/tests/integration/targets/latest/tasks/rack_group.yml @@ -4,13 +4,15 @@ ### PYNAUTOBOT_RACK_GROUP ## ## +- set_fact: + test_site: "{{ lookup('networktocode.nautobot.lookup', 'sites', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-site') }}" + - name: "RACK_GROUP 1: Necessary info creation" networktocode.nautobot.rack_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rack Group - site: Test Site + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rack Group + site: Test Site state: present register: test_one @@ -22,16 +24,15 @@ - test_one['diff']['after']['state'] == "present" - test_one['rack_group']['name'] == "Rack Group" - test_one['rack_group']['slug'] == "rack-group" - - test_one['rack_group']['site'] == 1 + - test_one['rack_group']['site'] == test_site['key'] - test_one['msg'] == "rack_group Rack Group created" - name: "RACK_GROUP 2: Create duplicate" networktocode.nautobot.rack_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rack Group - site: Test Site + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rack Group + site: Test Site state: present register: test_two @@ -41,15 +42,14 @@ - not test_two['changed'] - test_two['rack_group']['name'] == "Rack Group" - test_two['rack_group']['slug'] == "rack-group" - - test_two['rack_group']['site'] == 1 + - test_two['rack_group']['site'] == test_site['key'] - test_two['msg'] == "rack_group Rack Group already exists" - name: "RACK_GROUP 3: ASSERT - Delete" networktocode.nautobot.rack_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rack Group + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rack Group state: absent register: test_three diff --git a/tests/integration/targets/latest/tasks/rack_role.yml b/tests/integration/targets/latest/tasks/rack_role.yml index 446376ce..903cd647 100644 --- a/tests/integration/targets/latest/tasks/rack_role.yml +++ b/tests/integration/targets/latest/tasks/rack_role.yml @@ -6,11 +6,10 @@ ## - name: "RACK_ROLE 1: Necessary info creation" networktocode.nautobot.rack_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rack Role - color: "ffffff" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rack Role + color: "ffffff" state: present register: test_one @@ -27,10 +26,9 @@ - name: "RACK_ROLE 2: Create duplicate" networktocode.nautobot.rack_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rack Role + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rack Role state: present register: test_two @@ -45,11 +43,10 @@ - name: "RACK_ROLE 3: Update" networktocode.nautobot.rack_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rack Role - color: "003EFF" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rack Role + color: "003EFF" state: present register: test_three @@ -65,10 +62,9 @@ - name: "RACK_ROLE 4: Delete" networktocode.nautobot.rack_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rack Role + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rack Role state: absent register: test_four diff --git a/tests/integration/targets/latest/tasks/rear_port.yml b/tests/integration/targets/latest/tasks/rear_port.yml index 176691dc..24b0a353 100644 --- a/tests/integration/targets/latest/tasks/rear_port.yml +++ b/tests/integration/targets/latest/tasks/rear_port.yml @@ -7,14 +7,16 @@ ### PYNAUTOBOT_REAR_PORT ## ## +- set_fact: + test100: "{{ lookup('networktocode.nautobot.lookup', 'devices', api_endpoint=nautobot_url, token=nautobot_token, api_filter='name=test100') }}" + - name: "REAR_PORT 1: Necessary info creation" networktocode.nautobot.rear_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port - device: test100 - type: bnc + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rear Port + device: test100 + type: bnc state: present register: test_one @@ -25,18 +27,17 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['rear_port']['name'] == "Rear Port" - - test_one['rear_port']['device'] == 1 + - test_one['rear_port']['device'] == test100['key'] - test_one['rear_port']['type'] == "bnc" - test_one['msg'] == "rear_port Rear Port created" - name: "REAR_PORT 2: Create duplicate" networktocode.nautobot.rear_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port - device: test100 - type: bnc + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rear Port + device: test100 + type: bnc state: present register: test_two @@ -45,20 +46,19 @@ that: - not test_two['changed'] - test_two['rear_port']['name'] == "Rear Port" - - test_two['rear_port']['device'] == 1 + - test_two['rear_port']['device'] == test100['key'] - test_two['rear_port']['type'] == "bnc" - test_two['msg'] == "rear_port Rear Port already exists" - name: "REAR_PORT 3: Update Rear Port with other fields" networktocode.nautobot.rear_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port - device: test100 - type: bnc - positions: 5 - description: test description + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rear Port + device: test100 + type: bnc + positions: 5 + description: test description state: present register: test_three @@ -69,7 +69,7 @@ - test_three['diff']['after']['positions'] == 5 - test_three['diff']['after']['description'] == "test description" - test_three['rear_port']['name'] == "Rear Port" - - test_three['rear_port']['device'] == 1 + - test_three['rear_port']['device'] == test100['key'] - test_three['rear_port']['type'] == "bnc" - test_three['rear_port']['positions'] == 5 - test_three['rear_port']['description'] == "test description" @@ -77,12 +77,11 @@ - name: "REAR_PORT 4: Create Rear Port for Delete Test" networktocode.nautobot.rear_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port 2 - device: test100 - type: bnc + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rear Port 2 + device: test100 + type: bnc state: present register: test_four @@ -93,18 +92,17 @@ - test_four['diff']['before']['state'] == "absent" - test_four['diff']['after']['state'] == "present" - test_four['rear_port']['name'] == "Rear Port 2" - - test_four['rear_port']['device'] == 1 + - test_four['rear_port']['device'] == test100['key'] - test_four['rear_port']['type'] == "bnc" - test_four['msg'] == "rear_port Rear Port 2 created" - name: "REAR_PORT 5: Delete Rear Port" networktocode.nautobot.rear_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port 2 - device: test100 - type: bnc + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rear Port 2 + device: test100 + type: bnc state: absent register: test_five @@ -118,12 +116,11 @@ - name: "REAR_PORT 6: Create second Rear Port" networktocode.nautobot.rear_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port - device: Test Nexus One - type: bnc + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rear Port + device: Test Nexus One + type: bnc state: present register: test_six @@ -134,6 +131,8 @@ - test_six['diff']['before']['state'] == "absent" - test_six['diff']['after']['state'] == "present" - test_six['rear_port']['name'] == "Rear Port" - - test_six['rear_port']['device'] == 4 + - test_six['rear_port']['device'] == device['key'] - test_six['rear_port']['type'] == "bnc" - test_six['msg'] == "rear_port Rear Port created" + vars: + device: '{{ lookup(''networktocode.nautobot.lookup'', ''devices'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''name="Test Nexus One"'') }}' diff --git a/tests/integration/targets/latest/tasks/rear_port_template.yml b/tests/integration/targets/latest/tasks/rear_port_template.yml index b6e2fe20..77a4c566 100644 --- a/tests/integration/targets/latest/tasks/rear_port_template.yml +++ b/tests/integration/targets/latest/tasks/rear_port_template.yml @@ -7,14 +7,17 @@ ### PYNAUTOBOT_REAR_PORT_TEMPLATE ## ## +- set_fact: + cisco_test: "{{ lookup('networktocode.nautobot.lookup', 'device-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=cisco-test') }}" + arista_test: "{{ lookup('networktocode.nautobot.lookup', 'device-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=arista-test') }}" + - name: "REAR_PORT_TEMPLATE 1: Necessary info creation" networktocode.nautobot.rear_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port Template - device_type: Cisco Test - type: bnc + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rear Port Template + device_type: Cisco Test + type: bnc state: present register: test_one @@ -25,18 +28,17 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['rear_port_template']['name'] == "Rear Port Template" - - test_one['rear_port_template']['device_type'] == 1 + - test_one['rear_port_template']['device_type'] == cisco_test['key'] - test_one['rear_port_template']['type'] == "bnc" - test_one['msg'] == "rear_port_template Rear Port Template created" - name: "REAR_PORT_TEMPLATE 2: Create duplicate" networktocode.nautobot.rear_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port Template - device_type: Cisco Test - type: bnc + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rear Port Template + device_type: Cisco Test + type: bnc state: present register: test_two @@ -45,19 +47,18 @@ that: - not test_two['changed'] - test_two['rear_port_template']['name'] == "Rear Port Template" - - test_two['rear_port_template']['device_type'] == 1 + - test_two['rear_port_template']['device_type'] == cisco_test['key'] - test_two['rear_port_template']['type'] == "bnc" - test_two['msg'] == "rear_port_template Rear Port Template already exists" - name: "REAR_PORT_TEMPLATE 3: Update Rear Port Template with other fields" networktocode.nautobot.rear_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port Template - device_type: Cisco Test - type: bnc - positions: 5 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rear Port Template + device_type: Cisco Test + type: bnc + positions: 5 state: present register: test_three @@ -67,19 +68,18 @@ - test_three is changed - test_three['diff']['after']['positions'] == 5 - test_three['rear_port_template']['name'] == "Rear Port Template" - - test_three['rear_port_template']['device_type'] == 1 + - test_three['rear_port_template']['device_type'] == cisco_test['key'] - test_three['rear_port_template']['type'] == "bnc" - test_three['rear_port_template']['positions'] == 5 - test_three['msg'] == "rear_port_template Rear Port Template updated" - name: "REAR_PORT_TEMPLATE 4: Create Rear Port Template for Delete Test" networktocode.nautobot.rear_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port Template 2 - device_type: Cisco Test - type: bnc + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rear Port Template 2 + device_type: Cisco Test + type: bnc state: present register: test_four @@ -90,18 +90,17 @@ - test_four['diff']['before']['state'] == "absent" - test_four['diff']['after']['state'] == "present" - test_four['rear_port_template']['name'] == "Rear Port Template 2" - - test_four['rear_port_template']['device_type'] == 1 + - test_four['rear_port_template']['device_type'] == cisco_test['key'] - test_four['rear_port_template']['type'] == "bnc" - test_four['msg'] == "rear_port_template Rear Port Template 2 created" - name: "REAR_PORT_TEMPLATE 5: Delete Rear Port Template" networktocode.nautobot.rear_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port Template 2 - device_type: Cisco Test - type: bnc + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rear Port Template 2 + device_type: Cisco Test + type: bnc state: absent register: test_five @@ -115,12 +114,11 @@ - name: "REAR_PORT_TEMPLATE 6: Create second Rear Port Template" networktocode.nautobot.rear_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port Template 2 - device_type: Arista Test - type: bnc + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Rear Port Template 2 + device_type: Arista Test + type: bnc state: present register: test_six @@ -131,6 +129,6 @@ - test_six['diff']['before']['state'] == "absent" - test_six['diff']['after']['state'] == "present" - test_six['rear_port_template']['name'] == "Rear Port Template 2" - - test_six['rear_port_template']['device_type'] == 2 + - test_six['rear_port_template']['device_type'] == arista_test['key'] - test_six['rear_port_template']['type'] == "bnc" - test_six['msg'] == "rear_port_template Rear Port Template 2 created" diff --git a/tests/integration/targets/latest/tasks/region.yml b/tests/integration/targets/latest/tasks/region.yml index afd5db0a..0dab9f8f 100644 --- a/tests/integration/targets/latest/tasks/region.yml +++ b/tests/integration/targets/latest/tasks/region.yml @@ -4,12 +4,14 @@ ### PYNAUTOBOT_REGION ## ## +- set_fact: + region: "{{ lookup('networktocode.nautobot.lookup', 'regions', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-region') }}" + - name: "REGION 1: Necessary info creation" networktocode.nautobot.region: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Region One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Region One" state: present register: test_one @@ -25,10 +27,9 @@ - name: "REGION 2: Create duplicate" networktocode.nautobot.region: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Region One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Region One" state: present register: test_two @@ -42,11 +43,10 @@ - name: "REGION 3: ASSERT - Update" networktocode.nautobot.region: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Region One" - parent_region: "Test Region" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Region One" + parent_region: "Test Region" state: present register: test_three @@ -54,18 +54,17 @@ assert: that: - test_three is changed - - test_three['diff']['after']['parent'] == 1 + - test_three['diff']['after']['parent'] == region['key'] - test_three['region']['name'] == "Test Region One" - test_three['region']['slug'] == "test-region-one" - - test_three['region']['parent'] == 1 + - test_three['region']['parent'] == region['key'] - test_three['msg'] == "region Test Region One updated" - name: "REGION 4: ASSERT - Delete" networktocode.nautobot.region: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Region One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Region One" state: absent register: test_four @@ -75,5 +74,5 @@ - test_four is changed - test_four['region']['name'] == "Test Region One" - test_four['region']['slug'] == "test-region-one" - - test_four['region']['parent'] == 1 + - test_four['region']['parent'] == region['key'] - test_four['msg'] == "region Test Region One deleted" diff --git a/tests/integration/targets/latest/tasks/rir.yml b/tests/integration/targets/latest/tasks/rir.yml index 9be96af7..4f55baac 100644 --- a/tests/integration/targets/latest/tasks/rir.yml +++ b/tests/integration/targets/latest/tasks/rir.yml @@ -6,10 +6,9 @@ ## - name: "RIR 1: Necessary info creation" networktocode.nautobot.rir: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test RIR One + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test RIR One state: present register: test_one @@ -25,10 +24,9 @@ - name: "RIR 2: Create duplicate" networktocode.nautobot.rir: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test RIR One + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test RIR One state: present register: test_two @@ -42,11 +40,10 @@ - name: "RIR 3: ASSERT - Update" networktocode.nautobot.rir: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test RIR One" - is_private: true + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test RIR One" + is_private: true state: present register: test_three @@ -62,10 +59,9 @@ - name: "RIR 4: ASSERT - Delete" networktocode.nautobot.rir: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test RIR One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test RIR One" state: absent register: test_four diff --git a/tests/integration/targets/latest/tasks/route_target.yml b/tests/integration/targets/latest/tasks/route_target.yml index 7d64c097..7817027e 100644 --- a/tests/integration/targets/latest/tasks/route_target.yml +++ b/tests/integration/targets/latest/tasks/route_target.yml @@ -1,16 +1,18 @@ --- # # ADD (CHECK MODE) +- set_fact: + tenant: "{{ lookup('networktocode.nautobot.lookup', 'tenants', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-tenant') }}" + - name: "PYNAUTOBOT_ROUTE_TARGET_ADD: Check Mode - Add all fields except description" networktocode.nautobot.route_target: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "65000:65001" - tenant: "Test Tenant" - tags: - - first - - second + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "65000:65001" + tenant: "Test Tenant" + tags: + - first + - second check_mode: yes register: test_results @@ -19,7 +21,7 @@ that: - test_results is changed - test_results['route_target']['name'] == "65000:65001" - - test_results['route_target']['tenant'] == 1 + - test_results['route_target']['tenant'] == tenant['key'] - test_results['route_target']['tags'] | length == 2 - test_results['diff']['after']['state'] == "present" - test_results['diff']['before']['state'] == "absent" @@ -28,14 +30,13 @@ # ADD - name: "PYNAUTOBOT_ROUTE_TARGET_ADD: Add all fields except description" networktocode.nautobot.route_target: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "65000:65001" - tenant: "Test Tenant" - tags: - - first - - second + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "65000:65001" + tenant: "Test Tenant" + tags: + - first + - second register: test_results - name: "PYNAUTOBOT_ROUTE_TARGET_ADD: (ASSERT) Add all fields except description" @@ -43,7 +44,7 @@ that: - test_results is changed - test_results['route_target']['name'] == "65000:65001" - - test_results['route_target']['tenant'] == 1 + - test_results['route_target']['tenant'] == tenant['key'] - test_results['route_target']['tags'] | length == 2 - test_results['diff']['after']['state'] == "present" - test_results['diff']['before']['state'] == "absent" @@ -52,14 +53,13 @@ # ADD (IDEMPOTENT) - name: "PYNAUTOBOT_ROUTE_TARGET_ADD_IDEM: (IDEMPOTENT) Add all fields except description" networktocode.nautobot.route_target: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "65000:65001" - tenant: "Test Tenant" - tags: - - first - - second + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "65000:65001" + tenant: "Test Tenant" + tags: + - first + - second register: test_results - name: "PYNAUTOBOT_ROUTE_TARGET_ADD_IDEM: (IDEMPOTENT) Add all fields except description" @@ -67,7 +67,7 @@ that: - test_results is not changed - test_results['route_target']['name'] == "65000:65001" - - test_results['route_target']['tenant'] == 1 + - test_results['route_target']['tenant'] == tenant['key'] - test_results['route_target']['tags'] | length == 2 - test_results['msg'] == "route_target 65000:65001 already exists" @@ -75,15 +75,14 @@ # UPDATE (CHECK MODE) - name: "PYNAUTOBOT_ROUTE_TARGET_UPDATE: Check Mode - Update description" networktocode.nautobot.route_target: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "65000:65001" - description: "NEW DESCRIPTION" - tenant: "Test Tenant" - tags: - - first - - second + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "65000:65001" + description: "NEW DESCRIPTION" + tenant: "Test Tenant" + tags: + - first + - second check_mode: yes register: test_results @@ -92,7 +91,7 @@ that: - test_results is changed - test_results['route_target']['name'] == "65000:65001" - - test_results['route_target']['tenant'] == 1 + - test_results['route_target']['tenant'] == tenant['key'] - test_results['route_target']['tags'] | length == 2 - test_results['route_target']['description'] == "NEW DESCRIPTION" - test_results['diff']['after']['description'] == "NEW DESCRIPTION" @@ -102,15 +101,14 @@ # UPDATE - name: "PYNAUTOBOT_ROUTE_TARGET_UPDATE: Update description" networktocode.nautobot.route_target: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "65000:65001" - tenant: "Test Tenant" - description: "NEW DESCRIPTION" - tags: - - first - - second + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "65000:65001" + tenant: "Test Tenant" + description: "NEW DESCRIPTION" + tags: + - first + - second register: test_results - name: "PYNAUTOBOT_ROUTE_TARGET_UPDATE: (ASSERT) Update description" @@ -118,7 +116,7 @@ that: - test_results is changed - test_results['route_target']['name'] == "65000:65001" - - test_results['route_target']['tenant'] == 1 + - test_results['route_target']['tenant'] == tenant['key'] - test_results['route_target']['tags'] | length == 2 - test_results['route_target']['description'] == "NEW DESCRIPTION" - test_results['diff']['after']['description'] == "NEW DESCRIPTION" @@ -128,15 +126,14 @@ # UPDATE (IDEMPOTENT) - name: "PYNAUTOBOT_ROUTE_TARGET_UPDATE_IDEM: (IDEMPOTENT) Update description" networktocode.nautobot.route_target: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "65000:65001" - tenant: "Test Tenant" - description: "NEW DESCRIPTION" - tags: - - first - - second + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "65000:65001" + tenant: "Test Tenant" + description: "NEW DESCRIPTION" + tags: + - first + - second register: test_results - name: "PYNAUTOBOT_ROUTE_TARGET_UPDATE_IDEM: (IDEMPOTENT) Update description" @@ -144,7 +141,7 @@ that: - test_results is not changed - test_results['route_target']['name'] == "65000:65001" - - test_results['route_target']['tenant'] == 1 + - test_results['route_target']['tenant'] == tenant['key'] - test_results['route_target']['tags'] | length == 2 - test_results['route_target']['description'] == "NEW DESCRIPTION" - test_results['msg'] == "route_target 65000:65001 already exists" @@ -153,10 +150,9 @@ # DELETE (CHECK MODE) - name: "PYNAUTOBOT_ROUTE_TARGET_DELETE: Check Mode - Delete route target" networktocode.nautobot.route_target: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "65000:65001" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "65000:65001" state: absent check_mode: yes register: test_results @@ -172,10 +168,9 @@ # DELETE - name: "PYNAUTOBOT_ROUTE_TARGET_DELETE: Delete route target" networktocode.nautobot.route_target: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "65000:65001" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "65000:65001" state: absent register: test_results @@ -190,10 +185,9 @@ # DELETE (IDEMPOTENT) - name: "PYNAUTOBOT_ROUTE_TARGET_DELETE_IDEM: (IDEMPOTENT) Delete route target" networktocode.nautobot.route_target: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "65000:65001" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "65000:65001" state: absent register: test_results diff --git a/tests/integration/targets/latest/tasks/service.yml b/tests/integration/targets/latest/tasks/service.yml index 28233753..0f9e5e01 100644 --- a/tests/integration/targets/latest/tasks/service.yml +++ b/tests/integration/targets/latest/tasks/service.yml @@ -4,27 +4,29 @@ ### PYNAUTOBOT_SERVICE ## ## +- set_fact: + tag_schnozzberry: "{{ lookup('networktocode.nautobot.lookup', 'tags', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=schnozzberry') }}" + - name: "1 - Device with required information needs to add new service" networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "FOR_SERVICE" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "FOR_SERVICE" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" state: present - name: "PYNAUTOBOT_SERVICE: Create new service" networktocode.nautobot.service: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: "FOR_SERVICE" - name: "node-exporter" - port: 9100 - protocol: TCP + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: "FOR_SERVICE" + name: "node-exporter" + ports: + - 9100 + protocol: TCP state: present register: test_service_create @@ -41,13 +43,13 @@ - name: "PYNAUTOBOT_SERVICE: Test idempotence" networktocode.nautobot.service: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: "FOR_SERVICE" - name: "node-exporter" - port: 9100 - protocol: TCP + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: "FOR_SERVICE" + name: "node-exporter" + ports: + - 9100 + protocol: TCP state: present register: test_service_idempotence @@ -61,17 +63,16 @@ - name: "PYNAUTOBOT_SERVICE: Test update" networktocode.nautobot.service: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: "FOR_SERVICE" - name: "node-exporter" - ports: - - 9100 - - 9200 - protocol: TCP - tags: - - "Schnozzberry" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: "FOR_SERVICE" + name: "node-exporter" + ports: + - 9100 + - 9200 + protocol: TCP + tags: + - "Schnozzberry" state: present register: test_service_update @@ -79,19 +80,19 @@ assert: that: - test_service_update is changed - - test_service_update['diff']['after']['tags'][0] == 4 + - test_service_update['diff']['after']['tags'][0] == tag_schnozzberry['key'] - test_service_update['diff']['after']['ports'] == [9100, 9200] - test_service_update['msg'] == "services node-exporter updated" - name: "PYNAUTOBOT_SERVICE: Test same details, but different protocol - Create" networktocode.nautobot.service: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: "FOR_SERVICE" - name: "node-exporter" - port: 9100 - protocol: UDP + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: "FOR_SERVICE" + name: "node-exporter" + ports: + - 9100 + protocol: UDP state: present register: test_service_protocol @@ -108,13 +109,13 @@ - name: "PYNAUTOBOT_SERVICE: Test service deletion" networktocode.nautobot.service: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: "FOR_SERVICE" - name: "node-exporter" - port: 9100 - protocol: UDP + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: "FOR_SERVICE" + name: "node-exporter" + ports: + - 9100 + protocol: UDP state: absent register: test_service_delete @@ -128,15 +129,15 @@ - name: "PYNAUTOBOT_SERVICE: Test service IP addresses" networktocode.nautobot.service: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: "test100" - name: "node-exporter" - port: 9100 - protocol: UDP - ipaddresses: - - address: "172.16.180.1/24" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + device: "test100" + name: "node-exporter" + ports: + - 9100 + protocol: UDP + ipaddresses: + - address: "172.16.180.1/24" state: present register: test_service_ip_addresses @@ -154,14 +155,14 @@ - name: "PYNAUTOBOT_SERVICE: Missing both device & virtual_machine options - Tests required_one_of" networktocode.nautobot.service: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "node-exporter" - port: 9100 - protocol: UDP - ipaddresses: - - address: "172.16.180.1/24" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "node-exporter" + ports: + - 9100 + protocol: UDP + ipaddresses: + - address: "172.16.180.1/24" state: present ignore_errors: yes register: test_service_required_one_of @@ -174,13 +175,13 @@ - name: "PYNAUTOBOT_SERVICE: Create new service on virtual_machine" networktocode.nautobot.service: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - virtual_machine: "test100-vm" - name: "node-exporter" - port: 9100 - protocol: TCP + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + virtual_machine: "test100-vm" + name: "node-exporter" + ports: + - 9100 + protocol: TCP state: present register: test_service_create_vm diff --git a/tests/integration/targets/latest/tasks/site.yml b/tests/integration/targets/latest/tasks/site.yml index ce1e4578..856ddf68 100644 --- a/tests/integration/targets/latest/tasks/site.yml +++ b/tests/integration/targets/latest/tasks/site.yml @@ -4,12 +4,16 @@ ### PYNAUTOBOT_SITE ## ## +- set_fact: + region: "{{ lookup('networktocode.nautobot.lookup', 'regions', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-region') }}" + tenant: "{{ lookup('networktocode.nautobot.lookup', 'tenants', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-tenant') }}" + - name: "1 - Create site within Nautobot with only required information" networktocode.nautobot.site: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test - Colorado + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test - Colorado + status: "Active" state: present register: test_one @@ -24,10 +28,10 @@ - name: "2 - Duplicate" networktocode.nautobot.site: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test - Colorado + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test - Colorado + status: "Active" state: present register: test_two @@ -40,13 +44,12 @@ - name: "3 - Update Test - Colorado" networktocode.nautobot.site: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test - Colorado - status: Planned - region: Test Region - contact_name: Mikhail + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test - Colorado + status: Planned + region: Test Region + contact_name: Mikhail state: present register: test_three @@ -56,35 +59,34 @@ - test_three is changed - test_three['diff']['after']['status'] == "planned" - test_three['diff']['after']['contact_name'] == "Mikhail" - - test_three['diff']['after']['region'] == 1 + - test_three['diff']['after']['region'] == region['key'] - test_three['msg'] == "site Test - Colorado updated" - test_three['site']['name'] == "Test - Colorado" - test_three['site']['status'] == "planned" - test_three['site']['contact_name'] == "Mikhail" - - test_three['site']['region'] == 1 + - test_three['site']['region'] == region['key'] - name: "4 - Create site with all parameters" networktocode.nautobot.site: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test - California - status: Planned - region: Test Region - tenant: Test Tenant - facility: EquinoxCA7 - asn: 65001 - time_zone: America/Los Angeles - description: This is a test description - physical_address: Hollywood, CA, 90210 - shipping_address: Hollywood, CA, 90210 - latitude: "22.169141" - longitude: "-100.994041" - contact_name: Jenny - contact_phone: 867-5309 - contact_email: jenny@changednumber.com - comments: "### Placeholder" - slug: "test_california" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test - California + status: Planned + region: Test Region + tenant: Test Tenant + facility: EquinoxCA7 + asn: 65001 + time_zone: America/Los Angeles + description: This is a test description + physical_address: Hollywood, CA, 90210 + shipping_address: Hollywood, CA, 90210 + latitude: "22.169141" + longitude: "-100.994041" + contact_name: Jenny + contact_phone: 867-5309 + contact_email: jenny@changednumber.com + comments: "### Placeholder" + slug: "test_california" state: present register: test_four @@ -97,8 +99,8 @@ - test_four['site']['name'] == "Test - California" - test_four['msg'] == "site Test - California created" - test_four['site']['status'] == "planned" - - test_four['site']['region'] == 1 - - test_four['site']['tenant'] == 1 + - test_four['site']['region'] == region['key'] + - test_four['site']['tenant'] == tenant['key'] - test_four['site']['facility'] == "EquinoxCA7" - test_four['site']['asn'] == 65001 - test_four['site']['time_zone'] == "America/Los_Angeles" @@ -115,26 +117,25 @@ - name: "PYNAUTOBOT_SITE_IDEM: Idempotency - Create duplicate site with all parameters" networktocode.nautobot.site: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test - California - status: Planned - region: Test Region - tenant: Test Tenant - facility: EquinoxCA7 - asn: 65001 - time_zone: America/Los Angeles - description: This is a test description - physical_address: Hollywood, CA, 90210 - shipping_address: Hollywood, CA, 90210 - latitude: "22.169141" - longitude: "-100.994041" - contact_name: Jenny - contact_phone: 867-5309 - contact_email: jenny@changednumber.com - comments: "### Placeholder" - slug: "test_california" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test - California + status: Planned + region: Test Region + tenant: Test Tenant + facility: EquinoxCA7 + asn: 65001 + time_zone: America/Los Angeles + description: This is a test description + physical_address: Hollywood, CA, 90210 + shipping_address: Hollywood, CA, 90210 + latitude: "22.169141" + longitude: "-100.994041" + contact_name: Jenny + contact_phone: 867-5309 + contact_email: jenny@changednumber.com + comments: "### Placeholder" + slug: "test_california" state: present register: test_results @@ -145,8 +146,8 @@ - test_results['site']['name'] == "Test - California" - test_results['msg'] == "site Test - California already exists" - test_results['site']['status'] == "planned" - - test_results['site']['region'] == 1 - - test_results['site']['tenant'] == 1 + - test_results['site']['region'] == region['key'] + - test_results['site']['tenant'] == tenant['key'] - test_results['site']['facility'] == "EquinoxCA7" - test_results['site']['asn'] == 65001 - test_results['site']['time_zone'] == "America/Los_Angeles" @@ -163,10 +164,9 @@ - name: "5 - Delete site within nautobot" networktocode.nautobot.site: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test - Colorado + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test - Colorado state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/tag.yml b/tests/integration/targets/latest/tasks/tag.yml index 88f61a46..eb3a387c 100644 --- a/tests/integration/targets/latest/tasks/tag.yml +++ b/tests/integration/targets/latest/tasks/tag.yml @@ -6,12 +6,11 @@ ## - name: "TAG 1: ASSERT - Necessary info creation" networktocode.nautobot.tag: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tag 1" - description: "Tag 1 test" - color: "0000ff" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Tag 1" + description: "Tag 1 test" + color: "0000ff" state: present register: test_one @@ -29,12 +28,11 @@ - name: "TAG 2: Create duplicate" networktocode.nautobot.tag: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tag 1" - description: "Tag 1 test" - color: "0000ff" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Tag 1" + description: "Tag 1 test" + color: "0000ff" state: present register: test_two @@ -47,12 +45,11 @@ - name: "TAG 3: ASSERT - Update" networktocode.nautobot.tag: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tag 1" - description: "Tag 1 update test" - color: "00ff00" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Tag 1" + description: "Tag 1 update test" + color: "00ff00" state: present register: test_three @@ -69,10 +66,9 @@ - name: "TAG 4: ASSERT - Delete" networktocode.nautobot.tag: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tag 1" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Tag 1" state: absent register: test_four @@ -87,13 +83,12 @@ - name: "TAG 5: ASSERT - Necessary info creation" networktocode.nautobot.tag: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tag 5" - slug: "test-tag-five" - description: "Tag 5 test" - color: "0000ff" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Tag 5" + slug: "test-tag-five" + description: "Tag 5 test" + color: "0000ff" state: present register: test_five diff --git a/tests/integration/targets/latest/tasks/tenant.yml b/tests/integration/targets/latest/tasks/tenant.yml index 85646f58..304d6734 100644 --- a/tests/integration/targets/latest/tasks/tenant.yml +++ b/tests/integration/targets/latest/tasks/tenant.yml @@ -6,10 +6,9 @@ ## - name: "1 - Test tenant creation" networktocode.nautobot.tenant: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Tenant ABC" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Tenant ABC" register: test_one - name: "1 - ASSERT" @@ -24,10 +23,9 @@ - name: "Test duplicate tenant" networktocode.nautobot.tenant: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Tenant ABC" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Tenant ABC" register: test_two - name: "2 - ASSERT" @@ -40,11 +38,10 @@ - name: "3 - Test update" networktocode.nautobot.tenant: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Tenant ABC" - description: "Updated description" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Tenant ABC" + description: "Updated description" register: test_three - name: "3 - ASSERT" @@ -59,10 +56,9 @@ - name: "4 - Test delete" networktocode.nautobot.tenant: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Tenant ABC" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Tenant ABC" state: "absent" register: test_four @@ -76,18 +72,17 @@ - name: "5 - Create tenant with all parameters" networktocode.nautobot.tenant: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Tenant ABC" - description: "ABC Incorporated" - comments: "### This tenant is super cool" - tenant_group: "Test Tenant Group" - slug: "tenant_abc" - tags: - - "tagA" - - "tagB" - - "tagC" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Tenant ABC" + description: "ABC Incorporated" + comments: "### This tenant is super cool" + tenant_group: "Test Tenant Group" + slug: "tenant_abc" + tags: + - "tagA" + - "tagB" + - "tagC" state: present register: test_five @@ -101,6 +96,8 @@ - test_five['tenant']['slug'] == "tenant_abc" - test_five['tenant']['description'] == "ABC Incorporated" - test_five['tenant']['comments'] == "### This tenant is super cool" - - test_five['tenant']['group'] == 1 + - test_five['tenant']['group'] == group['key'] - test_five['tenant']['tags'] | length == 3 - test_five['msg'] == "tenant Tenant ABC created" + vars: + group: "{{ lookup('networktocode.nautobot.lookup', 'tenant-groups', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-tenant-group') }}" diff --git a/tests/integration/targets/latest/tasks/tenant_group.yml b/tests/integration/targets/latest/tasks/tenant_group.yml index 63bda776..3f7126ab 100644 --- a/tests/integration/targets/latest/tasks/tenant_group.yml +++ b/tests/integration/targets/latest/tasks/tenant_group.yml @@ -6,10 +6,9 @@ ## - name: "1 - Test tenant group creation" networktocode.nautobot.tenant_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tenant Group Two" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Tenant Group Two" register: test_one - name: "1 - ASSERT" @@ -24,10 +23,9 @@ - name: "Test duplicate tenant group" networktocode.nautobot.tenant_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tenant Group Two" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Tenant Group Two" register: test_two - name: "2 - ASSERT" @@ -40,10 +38,9 @@ - name: "3 - Test delete" networktocode.nautobot.tenant_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tenant Group Two" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Tenant Group Two" state: "absent" register: test_three @@ -57,11 +54,10 @@ - name: "4 - Test another tenant group creation" networktocode.nautobot.tenant_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tenant Group ABC" - slug: "test_tenant_group_four" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test Tenant Group ABC" + slug: "test_tenant_group_four" register: test_four - name: "4 - ASSERT" diff --git a/tests/integration/targets/latest/tasks/virtual_chassis.yml b/tests/integration/targets/latest/tasks/virtual_chassis.yml index aa2fddac..151e17d6 100644 --- a/tests/integration/targets/latest/tasks/virtual_chassis.yml +++ b/tests/integration/targets/latest/tasks/virtual_chassis.yml @@ -9,24 +9,26 @@ ## - name: "VIRTUAL_CHASSIS 0: Create device for testing virtual chassis" networktocode.nautobot.device: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Device Virtual Chassis Tests - device_type: Cisco Test - device_role: Core Switch - site: Test Site - vc_position: 1 - vc_priority: 1 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Device Virtual Chassis Tests + device_type: Cisco Test + device_role: Core Switch + site: Test Site + vc_position: 1 + vc_priority: 1 + status: "Active" state: present +- set_fact: + device: '{{ lookup(''networktocode.nautobot.lookup'', ''devices'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''name="Device Virtual Chassis Tests"'') }}' + - name: "VIRTUAL_CHASSIS 1: Necessary info creation" networktocode.nautobot.virtual_chassis: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "First VC" - master: Device Virtual Chassis Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "First VC" + master: Device Virtual Chassis Tests state: present register: test_one @@ -36,17 +38,16 @@ - test_one is changed - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - - test_one['virtual_chassis']['master'] == 11 + - test_one['virtual_chassis']['master'] == device['key'] - test_one['virtual_chassis']['name'] == "First VC" - test_one['msg'] == "virtual_chassis First VC created" - name: "VIRTUAL_CHASSIS 2: Create duplicate" networktocode.nautobot.virtual_chassis: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "First VC" - master: Device Virtual Chassis Tests + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "First VC" + master: Device Virtual Chassis Tests state: present register: test_two @@ -54,18 +55,17 @@ assert: that: - not test_two['changed'] - - test_two['virtual_chassis']['master'] == 11 + - test_two['virtual_chassis']['master'] == device['key'] - test_two['virtual_chassis']['name'] == "First VC" - test_two['msg'] == "virtual_chassis First VC already exists" - name: "POWER_FEED 3: Update virtual_chassis with other fields" networktocode.nautobot.virtual_chassis: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "First VC" - master: Device Virtual Chassis Tests - domain: Domain Text + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "First VC" + master: Device Virtual Chassis Tests + domain: Domain Text state: present register: test_three @@ -74,31 +74,33 @@ that: - test_three is changed - test_three['diff']['after']['domain'] == "Domain Text" - - test_three['virtual_chassis']['master'] == 11 + - test_three['virtual_chassis']['master'] == device['key'] - test_three['virtual_chassis']['domain'] == "Domain Text" - test_three['virtual_chassis']['name'] == "First VC" - test_three['msg'] == "virtual_chassis First VC updated" - name: "VIRTUAL_CHASSIS 4: Create device for testing virtual chassis deletion" networktocode.nautobot.device: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Device Virtual Chassis Tests 2 - device_type: Cisco Test - device_role: Core Switch - site: Test Site - vc_position: 1 - vc_priority: 15 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Device Virtual Chassis Tests 2 + device_type: Cisco Test + device_role: Core Switch + site: Test Site + vc_position: 1 + vc_priority: 15 + status: "Active" state: present +- set_fact: + device: '{{ lookup(''networktocode.nautobot.lookup'', ''devices'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''name="Device Virtual Chassis Tests 2"'') }}' + - name: "VIRTUAL_CHASSIS 4: Create Virtual Chassis for Delete Test" networktocode.nautobot.virtual_chassis: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Second VC" - master: Device Virtual Chassis Tests 2 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Second VC" + master: Device Virtual Chassis Tests 2 state: present register: test_four @@ -108,17 +110,16 @@ - test_four is changed - test_four['diff']['before']['state'] == "absent" - test_four['diff']['after']['state'] == "present" - - test_four['virtual_chassis']['master'] == 12 + - test_four['virtual_chassis']['master'] == device['key'] - test_four['virtual_chassis']['name'] == "Second VC" - test_four['msg'] == "virtual_chassis Second VC created" - name: "VIRTUAL_CHASSIS 5: Delete Virtual Chassis" networktocode.nautobot.virtual_chassis: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Second VC" - master: Device Virtual Chassis Tests 2 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Second VC" + master: Device Virtual Chassis Tests 2 state: absent register: test_five diff --git a/tests/integration/targets/latest/tasks/virtual_machine.yml b/tests/integration/targets/latest/tasks/virtual_machine.yml index 40f5f608..30a312c4 100644 --- a/tests/integration/targets/latest/tasks/virtual_machine.yml +++ b/tests/integration/targets/latest/tasks/virtual_machine.yml @@ -4,13 +4,19 @@ ### PYNAUTOBOT_VIRTUAL_MACHINES ## ## +- set_fact: + test_cluster: '{{ lookup(''networktocode.nautobot.lookup'', ''clusters'', api_endpoint=nautobot_url, token=nautobot_token, api_filter=''name="Test Cluster"'') }}' + manufacturer: "{{ lookup('networktocode.nautobot.lookup', 'manufacturers', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=cisco') }}" + tag_schnozzberry: "{{ lookup('networktocode.nautobot.lookup', 'tags', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=schnozzberry') }}" + role: "{{ lookup('networktocode.nautobot.lookup', 'device-roles', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-vm-role') }}" + - name: "VIRTUAL_MACHINE 1: Necessary info creation" networktocode.nautobot.virtual_machine: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VM One" - cluster: "Test Cluster" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test VM One" + cluster: "Test Cluster" + status: "Active" state: present register: test_one @@ -21,16 +27,16 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['virtual_machine']['name'] == "Test VM One" - - test_one['virtual_machine']['cluster'] == 1 + - test_one['virtual_machine']['cluster'] == test_cluster['key'] - test_one['msg'] == "virtual_machine Test VM One created" - name: "VIRTUAL_MACHINE 2: Create duplicate" networktocode.nautobot.virtual_machine: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VM One" - cluster: "Test Cluster" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test VM One" + cluster: "Test Cluster" + status: "Active" state: present register: test_two @@ -39,22 +45,21 @@ that: - not test_two['changed'] - test_two['virtual_machine']['name'] == "Test VM One" - - test_two['virtual_machine']['cluster'] == 1 + - test_two['virtual_machine']['cluster'] == test_cluster['key'] - test_two['msg'] == "virtual_machine Test VM One already exists" - name: "VIRTUAL_MACHINE 3: Update" networktocode.nautobot.virtual_machine: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VM One" - cluster: "Test Cluster" - vcpus: 8 - memory: 8 - status: "Planned" - virtual_machine_role: "Test VM Role" - tags: - - "Schnozzberry" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test VM One" + cluster: "Test Cluster" + vcpus: 8 + memory: 8 + status: "Planned" + virtual_machine_role: "Test VM Role" + tags: + - "Schnozzberry" state: present register: test_three @@ -65,23 +70,22 @@ - test_three['diff']['after']['vcpus'] == 8 - test_three['diff']['after']['memory'] == 8 - test_three['diff']['after']['status'] == "planned" - - test_three['diff']['after']['role'] == 2 - - test_three['diff']['after']['tags'][0] == 4 + - test_three['diff']['after']['role'] == role['key'] + - test_three['diff']['after']['tags'][0] == tag_schnozzberry['key'] - test_three['virtual_machine']['name'] == "Test VM One" - - test_three['virtual_machine']['cluster'] == 1 + - test_three['virtual_machine']['cluster'] == test_cluster['key'] - test_three['virtual_machine']['vcpus'] == 8 - test_three['virtual_machine']['memory'] == 8 - test_three['virtual_machine']['status'] == "planned" - - test_three['virtual_machine']['role'] == 2 - - test_three['virtual_machine']['tags'][0] == 4 + - test_three['virtual_machine']['role'] == role['key'] + - test_three['virtual_machine']['tags'][0] == tag_schnozzberry['key'] - test_three['msg'] == "virtual_machine Test VM One updated" - name: "VIRTUAL_MACHINE 4: ASSERT - Delete" networktocode.nautobot.virtual_machine: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VM One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test VM One" state: absent register: test_four @@ -90,10 +94,10 @@ that: - test_four is changed - test_four['virtual_machine']['name'] == "Test VM One" - - test_four['virtual_machine']['cluster'] == 1 + - test_four['virtual_machine']['cluster'] == test_cluster['key'] - test_four['virtual_machine']['vcpus'] == 8 - test_four['virtual_machine']['memory'] == 8 - test_four['virtual_machine']['status'] == "planned" - - test_four['virtual_machine']['role'] == 2 - - test_four['virtual_machine']['tags'][0] == 4 + - test_four['virtual_machine']['role'] == role['key'] + - test_four['virtual_machine']['tags'][0] == tag_schnozzberry['key'] - test_four['msg'] == "virtual_machine Test VM One deleted" diff --git a/tests/integration/targets/latest/tasks/vlan.yml b/tests/integration/targets/latest/tasks/vlan.yml index c7b2f084..ffe125c3 100644 --- a/tests/integration/targets/latest/tasks/vlan.yml +++ b/tests/integration/targets/latest/tasks/vlan.yml @@ -4,13 +4,20 @@ ### PYNAUTOBOT_VLAN ## ## +- set_fact: + test_site: "{{ lookup('networktocode.nautobot.lookup', 'sites', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-site') }}" + tenant: "{{ lookup('networktocode.nautobot.lookup', 'tenants', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-tenant') }}" + tag_schnozzberry: "{{ lookup('networktocode.nautobot.lookup', 'tags', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=schnozzberry') }}" + vlan_group: "{{ lookup('networktocode.nautobot.lookup', 'vlan-groups', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-vlan-group') }}" + vlan_role: "{{ lookup('networktocode.nautobot.lookup', 'roles', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=network-of-care') }}" + - name: "VLAN 1: Necessary info creation" networktocode.nautobot.vlan: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test VLAN 500 - vid: 500 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test VLAN 500 + vid: 500 + status: "Active" state: present register: test_one @@ -26,11 +33,11 @@ - name: "VLAN 2: Create duplicate" networktocode.nautobot.vlan: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test VLAN 500 - vid: 500 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test VLAN 500 + vid: 500 + status: "Active" state: present register: test_two @@ -44,14 +51,14 @@ - name: "VLAN 3: Create VLAN with same name, but different site" networktocode.nautobot.vlan: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test VLAN 500 - vid: 500 - site: Test Site - tenant: Test Tenant - vlan_group: "Test VLAN Group" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test VLAN 500 + vid: 500 + site: Test Site + tenant: Test Tenant + vlan_group: "Test VLAN Group" + status: "Active" state: present register: test_three @@ -63,25 +70,25 @@ - test_three['diff']['after']['state'] == "present" - test_three['vlan']['name'] == "Test VLAN 500" - test_three['vlan']['vid'] == 500 - - test_three['vlan']['site'] == 1 - - test_three['vlan']['group'] == 1 + - test_three['vlan']['site'] == test_site['key'] + - test_three['vlan']['group'] == vlan_group['key'] + - test_three['vlan']['tenant'] == tenant['key'] - test_three['msg'] == "vlan Test VLAN 500 created" - name: "VLAN 4: ASSERT - Update" networktocode.nautobot.vlan: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VLAN 500" - vid: 500 - tenant: "Test Tenant" - vlan_group: "Test VLAN Group" - status: Reserved - vlan_role: Network of care - description: Updated description - site: "Test Site" - tags: - - "Schnozzberry" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test VLAN 500" + vid: 500 + tenant: "Test Tenant" + vlan_group: "Test VLAN Group" + status: Reserved + vlan_role: Network of care + description: Updated description + site: "Test Site" + tags: + - "Schnozzberry" state: present register: test_four @@ -90,34 +97,33 @@ that: - test_four is changed - test_four['diff']['after']['status'] == "reserved" - - test_four['diff']['after']['role'] == 1 + - test_four['diff']['after']['role'] == vlan_role['key'] - test_four['diff']['after']['description'] == "Updated description" - - test_four['diff']['after']['tags'][0] == 4 + - test_four['diff']['after']['tags'][0] == tag_schnozzberry['key'] - test_four['vlan']['name'] == "Test VLAN 500" - - test_four['vlan']['tenant'] == 1 - - test_four['vlan']['site'] == 1 - - test_four['vlan']['group'] == 1 + - test_four['vlan']['tenant'] == tenant['key'] + - test_four['vlan']['site'] == test_site['key'] + - test_four['vlan']['group'] == vlan_group['key'] - test_four['vlan']['status'] == "reserved" - - test_four['vlan']['role'] == 1 + - test_four['vlan']['role'] == vlan_role['key'] - test_four['vlan']['description'] == "Updated description" - - test_four['vlan']['tags'][0] == 4 + - test_four['vlan']['tags'][0] == tag_schnozzberry['key'] - test_four['msg'] == "vlan Test VLAN 500 updated" - name: "VLAN: ASSERT - IDEMPOTENT WITH VLAN_GROUP" networktocode.nautobot.vlan: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VLAN 500" - vid: 500 - tenant: "Test Tenant" - vlan_group: "Test VLAN Group" - status: Reserved - vlan_role: Network of care - description: Updated description - site: "Test Site" - tags: - - "Schnozzberry" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test VLAN 500" + vid: 500 + tenant: "Test Tenant" + vlan_group: "Test VLAN Group" + status: Reserved + vlan_role: Network of care + description: Updated description + site: "Test Site" + tags: + - "Schnozzberry" state: present register: idempotent_vlan_group @@ -128,14 +134,14 @@ - name: "VLAN: Create VLAN with same name, but different vlan_group" networktocode.nautobot.vlan: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test VLAN 500 - vid: 500 - site: Test Site - tenant: Test Tenant - vlan_group: "Test VLAN Group 2" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test VLAN 500 + vid: 500 + site: Test Site + tenant: Test Tenant + status: "Active" + vlan_group: "Test VLAN Group 2" state: present register: new_vlan_group @@ -147,16 +153,18 @@ - new_vlan_group['diff']['after']['state'] == "present" - new_vlan_group['vlan']['name'] == "Test VLAN 500" - new_vlan_group['vlan']['vid'] == 500 - - new_vlan_group['vlan']['site'] == 1 - - new_vlan_group['vlan']['group'] == 2 + - new_vlan_group['vlan']['site'] == test_site['key'] + - new_vlan_group['vlan']['tenant'] == tenant['key'] + - new_vlan_group['vlan']['group'] == vlan_group2['key'] - new_vlan_group['msg'] == "vlan Test VLAN 500 created" + vars: + vlan_group2: "{{ lookup('networktocode.nautobot.lookup', 'vlan-groups', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-vlan-group-2') }}" - name: "VLAN 5: ASSERT - Delete more than one result" networktocode.nautobot.vlan: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VLAN 500" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test VLAN 500" state: absent ignore_errors: yes register: test_five @@ -169,12 +177,11 @@ - name: "VLAN 6: ASSERT - Delete" networktocode.nautobot.vlan: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VLAN 500" - site: Test Site - vlan_group: "Test VLAN Group" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test VLAN 500" + site: Test Site + vlan_group: "Test VLAN Group" state: absent register: test_six @@ -183,11 +190,11 @@ that: - test_six is changed - test_six['vlan']['name'] == "Test VLAN 500" - - test_six['vlan']['tenant'] == 1 - - test_six['vlan']['site'] == 1 - - test_six['vlan']['group'] == 1 + - test_six['vlan']['tenant'] == tenant['key'] + - test_six['vlan']['site'] == test_site['key'] + - test_six['vlan']['group'] == vlan_group['key'] - test_six['vlan']['status'] == "reserved" - - test_six['vlan']['role'] == 1 + - test_six['vlan']['role'] == vlan_role['key'] - test_six['vlan']['description'] == "Updated description" - - test_six['vlan']['tags'][0] == 4 + - test_six['vlan']['tags'][0] == tag_schnozzberry['key'] - test_six['msg'] == "vlan Test VLAN 500 deleted" diff --git a/tests/integration/targets/latest/tasks/vlan_group.yml b/tests/integration/targets/latest/tasks/vlan_group.yml index 38053297..a1d7a069 100644 --- a/tests/integration/targets/latest/tasks/vlan_group.yml +++ b/tests/integration/targets/latest/tasks/vlan_group.yml @@ -4,13 +4,16 @@ ### PYNAUTOBOT_VLAN_GROUP ## ## +- set_fact: + test_site: "{{ lookup('networktocode.nautobot.lookup', 'sites', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-site') }}" + test_site2: "{{ lookup('networktocode.nautobot.lookup', 'sites', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-site2') }}" + - name: "VLAN_GROUP 1: Necessary info creation" networktocode.nautobot.vlan_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "VLAN Group One" - site: Test Site + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "VLAN Group One" + site: Test Site state: present register: test_one @@ -22,16 +25,15 @@ - test_one['diff']['after']['state'] == "present" - test_one['vlan_group']['name'] == "VLAN Group One" - test_one['vlan_group']['slug'] == "vlan-group-one" - - test_one['vlan_group']['site'] == 1 + - test_one['vlan_group']['site'] == test_site['key'] - test_one['msg'] == "vlan_group VLAN Group One created" - name: "VLAN_GROUP 2: Create duplicate" networktocode.nautobot.vlan_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "VLAN Group One" - site: Test Site + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "VLAN Group One" + site: Test Site state: present register: test_two @@ -41,16 +43,15 @@ - not test_two['changed'] - test_two['vlan_group']['name'] == "VLAN Group One" - test_two['vlan_group']['slug'] == "vlan-group-one" - - test_two['vlan_group']['site'] == 1 + - test_two['vlan_group']['site'] == test_site['key'] - test_two['msg'] == "vlan_group VLAN Group One already exists" - name: "VLAN_GROUP 3: ASSERT - Create with same name, different site" networktocode.nautobot.vlan_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "VLAN Group One" - site: "Test Site2" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "VLAN Group One" + site: "Test Site2" state: present register: test_three @@ -60,15 +61,14 @@ - test_three is changed - test_three['vlan_group']['name'] == "VLAN Group One" - test_three['vlan_group']['slug'] == "vlan-group-one" - - test_three['vlan_group']['site'] == 2 + - test_three['vlan_group']['site'] == test_site2['key'] - test_three['msg'] == "vlan_group VLAN Group One created" - name: "VLAN_GROUP 4: ASSERT - Create vlan group, no site" networktocode.nautobot.vlan_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "VLAN Group One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "VLAN Group One" state: present ignore_errors: yes register: test_four @@ -81,11 +81,10 @@ - name: "VLAN_GROUP 5: ASSERT - Delete" networktocode.nautobot.vlan_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: VLAN Group One - site: Test Site2 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: VLAN Group One + site: Test Site2 state: absent register: test_five @@ -97,16 +96,15 @@ - test_five['diff']['after']['state'] == "absent" - test_five['vlan_group']['name'] == "VLAN Group One" - test_five['vlan_group']['slug'] == "vlan-group-one" - - test_five['vlan_group']['site'] == 2 + - test_five['vlan_group']['site'] == test_site2['key'] - test_five['msg'] == "vlan_group VLAN Group One deleted" - name: "VLAN_GROUP 6: ASSERT - Delete non existing" networktocode.nautobot.vlan_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: VLAN Group One - site: Test Site2 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: VLAN Group One + site: Test Site2 state: absent register: test_six diff --git a/tests/integration/targets/latest/tasks/vm_interface.yml b/tests/integration/targets/latest/tasks/vm_interface.yml index 4429ce05..70af71e1 100644 --- a/tests/integration/targets/latest/tasks/vm_interface.yml +++ b/tests/integration/targets/latest/tasks/vm_interface.yml @@ -4,13 +4,17 @@ ### PYNAUTOBOT_VM_INTERFACE ## ## +- set_fact: + vm100: "{{ lookup('networktocode.nautobot.lookup', 'virtual-machines', api_endpoint=nautobot_url, token=nautobot_token, api_filter='name=test100-vm') }}" + tag_schnozzberry: "{{ lookup('networktocode.nautobot.lookup', 'tags', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=schnozzberry') }}" + wireless: "{{ lookup('networktocode.nautobot.lookup', 'vlans', api_endpoint=nautobot_url, token=nautobot_token, api_filter='name=Wireless') }}" + - name: "PYNAUTOBOT_VM_INTERFACE 1: Necessary info creation" networktocode.nautobot.vm_interface: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - virtual_machine: "test100-vm" - name: "Eth10" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + virtual_machine: "test100-vm" + name: "Eth10" state: present register: test_one @@ -21,16 +25,15 @@ - test_one['diff']['before']['state'] == "absent" - test_one['diff']['after']['state'] == "present" - test_one['interface']['name'] == "Eth10" - - test_one['interface']['virtual_machine'] == 1 + - test_one['interface']['virtual_machine'] == vm100['key'] - test_one['msg'] == "interface Eth10 created" - name: "PYNAUTOBOT_VM_INTERFACE 2: Create duplicate" networktocode.nautobot.vm_interface: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - virtual_machine: "test100-vm" - name: "Eth10" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + virtual_machine: "test100-vm" + name: "Eth10" state: present register: test_two @@ -39,31 +42,30 @@ that: - not test_two['changed'] - test_two['interface']['name'] == "Eth10" - - test_two['interface']['virtual_machine'] == 1 + - test_two['interface']['virtual_machine'] == vm100['key'] - test_two['msg'] == "interface Eth10 already exists" - name: "PYNAUTOBOT_VM_INTERFACE 3: Updated" networktocode.nautobot.vm_interface: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - virtual_machine: "test100-vm" - name: "Eth10" - enabled: false - mtu: 9000 - mac_address: "00:00:00:AA:AA:01" - description: "Updated test100-vm" - mode: Tagged - untagged_vlan: - name: Wireless + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + virtual_machine: "test100-vm" + name: "Eth10" + enabled: false + mtu: 9000 + mac_address: "00:00:00:AA:AA:01" + description: "Updated test100-vm" + mode: Tagged + untagged_vlan: + name: Wireless + site: Test Site + tagged_vlans: + - name: Data + site: Test Site + - name: VoIP site: Test Site - tagged_vlans: - - name: Data - site: Test Site - - name: VoIP - site: Test Site - tags: - - "Schnozzberry" + tags: + - "Schnozzberry" state: present register: test_three @@ -76,28 +78,27 @@ - test_three['diff']['after']['mac_address'] == "00:00:00:AA:AA:01" - test_three['diff']['after']['description'] == "Updated test100-vm" - test_three['diff']['after']['mode'] == "tagged" - - test_three['diff']['after']['untagged_vlan'] == 1 - - test_three['diff']['after']['tagged_vlans'] == [2, 3] - - test_three['diff']['after']['tags'][0] == 4 + - test_three['diff']['after']['untagged_vlan'] == wireless['key'] + - test_three['diff']['after']['tagged_vlans']|length == 2 + - test_three['diff']['after']['tags'][0] == tag_schnozzberry['key'] - test_three['interface']['name'] == "Eth10" - - test_three['interface']['virtual_machine'] == 1 + - test_three['interface']['virtual_machine'] == vm100['key'] - test_three['interface']['enabled'] == false - test_three['interface']['mtu'] == 9000 - test_three['interface']['mac_address'] == "00:00:00:AA:AA:01" - test_three['interface']['description'] == "Updated test100-vm" - test_three['interface']['mode'] == "tagged" - - test_three['interface']['untagged_vlan'] == 1 - - test_three['interface']['tagged_vlans'] == [2, 3] - - test_three['interface']['tags'][0] == 4 + - test_three['interface']['untagged_vlan'] == wireless['key'] + - test_three['interface']['tagged_vlans']|length == 2 + - test_three['interface']['tags'][0] == tag_schnozzberry['key'] - test_three['msg'] == "interface Eth10 updated" - name: "PYNAUTOBOT_VM_INTERFACE 4: ASSERT - Delete" networktocode.nautobot.vm_interface: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Eth10" - virtual_machine: "test100-vm" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Eth10" + virtual_machine: "test100-vm" state: absent register: test_four @@ -106,31 +107,30 @@ that: - test_four is changed - test_four['interface']['name'] == "Eth10" - - test_four['interface']['virtual_machine'] == 1 + - test_four['interface']['virtual_machine'] == vm100['key'] - test_four['msg'] == "interface Eth10 deleted" - name: "PYNAUTOBOT_VM_INTERFACE 5: Attempt to update interface with same name on other VMs" networktocode.nautobot.vm_interface: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - virtual_machine: "test100-vm" - name: "Eth0" - enabled: false - mtu: 9000 - mac_address: "00:00:00:AA:AA:01" - description: "Updated test100-vm Eth0 intf" - mode: Tagged - untagged_vlan: - name: Wireless + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + virtual_machine: "test100-vm" + name: "Eth0" + enabled: false + mtu: 9000 + mac_address: "00:00:00:AA:AA:01" + description: "Updated test100-vm Eth0 intf" + mode: Tagged + untagged_vlan: + name: Wireless + site: Test Site + tagged_vlans: + - name: Data + site: Test Site + - name: VoIP site: Test Site - tagged_vlans: - - name: Data - site: Test Site - - name: VoIP - site: Test Site - tags: - - "Schnozzberry" + tags: + - "Schnozzberry" state: present register: test_five @@ -143,17 +143,17 @@ - test_five['diff']['after']['mac_address'] == "00:00:00:AA:AA:01" - test_five['diff']['after']['description'] == "Updated test100-vm Eth0 intf" - test_five['diff']['after']['mode'] == "tagged" - - test_five['diff']['after']['untagged_vlan'] == 1 - - test_five['diff']['after']['tagged_vlans'] == [2, 3] - - test_five['diff']['after']['tags'][0] == 4 + - test_five['diff']['after']['untagged_vlan'] == wireless['key'] + - test_five['diff']['after']['tagged_vlans']|length == 2 + - test_five['diff']['after']['tags'][0] == tag_schnozzberry['key'] - test_five['interface']['name'] == "Eth0" - - test_five['interface']['virtual_machine'] == 1 + - test_five['interface']['virtual_machine'] == vm100['key'] - test_five['interface']['enabled'] == false - test_five['interface']['mtu'] == 9000 - test_five['interface']['mac_address'] == "00:00:00:AA:AA:01" - test_five['interface']['description'] == "Updated test100-vm Eth0 intf" - test_five['interface']['mode'] == "tagged" - - test_five['interface']['untagged_vlan'] == 1 - - test_five['interface']['tagged_vlans'] == [2, 3] - - test_five['interface']['tags'][0] == 4 + - test_five['interface']['untagged_vlan'] == wireless['key'] + - test_five['interface']['tagged_vlans']|length == 2 + - test_five['interface']['tags'][0] == tag_schnozzberry['key'] - test_five['msg'] == "interface Eth0 updated" diff --git a/tests/integration/targets/latest/tasks/vrf.yml b/tests/integration/targets/latest/tasks/vrf.yml index 924c9001..b6bb1e65 100644 --- a/tests/integration/targets/latest/tasks/vrf.yml +++ b/tests/integration/targets/latest/tasks/vrf.yml @@ -4,12 +4,15 @@ ### PYNAUTOBOT_VRF ## ## +- set_fact: + tenant: "{{ lookup('networktocode.nautobot.lookup', 'tenants', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=test-tenant') }}" + tag_schnozzberry: "{{ lookup('networktocode.nautobot.lookup', 'tags', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=schnozzberry') }}" + - name: "VRF 1: Necessary info creation" networktocode.nautobot.vrf: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test VRF One + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test VRF One state: present register: test_one @@ -24,10 +27,9 @@ - name: "VRF 2: Create duplicate" networktocode.nautobot.vrf: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test VRF One + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test VRF One state: present register: test_two @@ -40,11 +42,10 @@ - name: "VRF 3: Create VRF with same name, but different tenant" networktocode.nautobot.vrf: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test VRF One - tenant: Test Tenant + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: Test VRF One + tenant: Test Tenant state: present register: test_three @@ -55,25 +56,24 @@ - test_three['diff']['before']['state'] == "absent" - test_three['diff']['after']['state'] == "present" - test_three['vrf']['name'] == "Test VRF One" - - test_three['vrf']['tenant'] == 1 + - test_three['vrf']['tenant'] == tenant['key'] - test_three['msg'] == "vrf Test VRF One created" - name: "VRF 4: ASSERT - Update" networktocode.nautobot.vrf: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VRF One" - rd: "65001:1" - enforce_unique: False - tenant: "Test Tenant" - description: Updated description - import_targets: - - "4000:4000" - export_targets: - - "5000:5000" - tags: - - "Schnozzberry" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test VRF One" + rd: "65001:1" + enforce_unique: False + tenant: "Test Tenant" + description: Updated description + import_targets: + - "4000:4000" + export_targets: + - "5000:5000" + tags: + - "Schnozzberry" state: present register: test_four @@ -84,25 +84,24 @@ - test_four['diff']['after']['rd'] == "65001:1" - test_four['diff']['after']['enforce_unique'] == false - test_four['diff']['after']['description'] == "Updated description" - - test_four['diff']['after']['tags'][0] == 4 + - test_four['diff']['after']['tags'][0] == tag_schnozzberry['key'] - test_four['diff']['after']['import_targets'] | length == 1 - test_four['diff']['after']['export_targets'] | length == 1 - test_four['vrf']['name'] == "Test VRF One" - - test_four['vrf']['tenant'] == 1 + - test_four['vrf']['tenant'] == tenant['key'] - test_four['vrf']['rd'] == "65001:1" - test_four['vrf']['enforce_unique'] == false - test_four['vrf']['description'] == "Updated description" - - test_four['vrf']['tags'][0] == 4 + - test_four['vrf']['tags'][0] == tag_schnozzberry['key'] - test_four['vrf']['import_targets'] | length == 1 - test_four['vrf']['export_targets'] | length == 1 - test_four['msg'] == "vrf Test VRF One updated" - name: "VRF 5: ASSERT - Delete more than one result" networktocode.nautobot.vrf: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VRF One" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test VRF One" state: absent ignore_errors: yes register: test_five @@ -115,11 +114,10 @@ - name: "VRF 6: ASSERT - Delete" networktocode.nautobot.vrf: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VRF One" - tenant: Test Tenant + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "Test VRF One" + tenant: Test Tenant state: absent register: test_six @@ -128,9 +126,9 @@ that: - test_six is changed - test_six['vrf']['name'] == "Test VRF One" - - test_six['vrf']['tenant'] == 1 + - test_six['vrf']['tenant'] == tenant['key'] - test_six['vrf']['rd'] == "65001:1" - test_six['vrf']['enforce_unique'] == false - test_six['vrf']['description'] == "Updated description" - - test_six['vrf']['tags'][0] == 4 + - test_six['vrf']['tags'][0] == tag_schnozzberry['key'] - test_six['msg'] == "vrf Test VRF One deleted" diff --git a/tests/integration/targets/regression-latest/tasks/main.yml b/tests/integration/targets/regression-latest/tasks/main.yml index b4cc8587..3d5b386f 100644 --- a/tests/integration/targets/regression-latest/tasks/main.yml +++ b/tests/integration/targets/regression-latest/tasks/main.yml @@ -10,13 +10,12 @@ - name: "1 - Device with required information" networktocode.nautobot.device: url: "http://some-random-invalid-URL" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "R1" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" + token: "{{ nautobot_token }}" + name: "R1" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" state: present register: test_one ignore_errors: yes @@ -29,12 +28,12 @@ - name: "2 - Check to see if prefix with parent defined will pass via check-mode" networktocode.nautobot.prefix: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - parent: "10.10.0.0/16" - prefix_length: 24 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + parent: "10.10.0.0/16" + prefix_length: 24 first_available: yes + status: "active" state: present register: test_two check_mode: yes @@ -47,31 +46,29 @@ - name: "3 - Add device with tags - Setup device to test #242" networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "issue-242" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" - tags: - - slug: first - - slug: second + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "issue-242" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + tags: + - slug: first + - slug: second - name: "4 - Add device with tags out of order - shouldn't change - Tests #242 is fixed" networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "issue-242" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" - tags: - - slug: second - - slug: first + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "issue-242" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + tags: + - slug: second + - slug: first register: test_four diff: yes @@ -82,19 +79,18 @@ - name: "5 - Add device with extra tag - Tests #242 is fixed" networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "issue-242" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" - asset_tag: "1234" - tags: - - slug: second - - slug: third - - slug: first + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "issue-242" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + asset_tag: "1234" + tags: + - slug: second + - slug: third + - slug: first register: test_five diff: yes @@ -107,12 +103,11 @@ - name: "6 - Loop through and add interface templates to different device interface templates - Fixes #282" networktocode.nautobot.device_interface_template: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "SFP+ (10GE)" - type: "SFP+ (10GE)" - device_type: "{{ item }}" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "SFP+ (10GE)" + type: "SFP+ (10GE)" + device_type: "{{ item }}" register: test_six loop: - "Cisco Test" @@ -125,33 +120,38 @@ that: - test_six.results[0]["diff"]["before"]["state"] == "absent" - test_six.results[0]["diff"]["after"]["state"] == "present" - - test_six.results[0]["interface_template"]["device_type"] == 1 + - test_six.results[0]["interface_template"]["device_type"] == cisco['key'] - test_six.results[1]["diff"]["before"]["state"] == "absent" - test_six.results[1]["diff"]["after"]["state"] == "present" - - test_six.results[1]["interface_template"]["device_type"] == 2 + - test_six.results[1]["interface_template"]["device_type"] == arista['key'] - test_six.results[2]["diff"]["before"]["state"] == "absent" - test_six.results[2]["diff"]["after"]["state"] == "present" - - test_six.results[2]["interface_template"]["device_type"] == 4 + - test_six.results[2]["interface_template"]["device_type"] == nexus_child['key'] - test_six.results[3]["diff"]["before"]["state"] == "absent" - test_six.results[3]["diff"]["after"]["state"] == "present" - - test_six.results[3]["interface_template"]["device_type"] == 3 + - test_six.results[3]["interface_template"]["device_type"] == nexus_parent['key'] + vars: + cisco: "{{ lookup('networktocode.nautobot.lookup', 'device-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=cisco-test') }}" + arista: "{{ lookup('networktocode.nautobot.lookup', 'device-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=arista-test') }}" + nexus_child: "{{ lookup('networktocode.nautobot.lookup', 'device-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=nexus-child') }}" + nexus_parent: "{{ lookup('networktocode.nautobot.lookup', 'device-types', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=nexus-parent') }}" + # Commented out due to not know the IDs, but I'm sure we can re-enable with lookup plugin - name: "7 - Don't prevent updates to other params if tags are specified" networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "issue-242" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" - asset_tag: "Null" - tags: - # Changed these for issue #407 to be IDs - - 2 - - 3 - - 1 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + name: "issue-242" + device_type: "Cisco Test" + device_role: "Core Switch" + site: "Test Site" + status: "Staged" + asset_tag: "Null" + tags: + # Changed these for issue #407 to be UUIDs + - "{{ lookup('networktocode.nautobot.lookup', 'tags', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=second')['key'] }}" + - "{{ lookup('networktocode.nautobot.lookup', 'tags', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=third')['key'] }}" + - "{{ lookup('networktocode.nautobot.lookup', 'tags', api_endpoint=nautobot_url, token=nautobot_token, api_filter='slug=first')['key'] }}" register: test_seven - name: "5 - Assert added tag - Tests #242 is fixed" @@ -163,10 +163,10 @@ - name: Add ip address to nautobot and don't assign it to a device (Issue 372) networktocode.nautobot.ip_address: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - address: 10.255.255.1/24 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + address: 10.255.255.1/24 + status: "active" query_params: - address - vrf @@ -174,13 +174,13 @@ - name: Update same ip address to attach to a device interface (Issue 372) networktocode.nautobot.ip_address: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - address: 10.255.255.1/24 - assigned_object: - device: test100 - name: GigabitEthernet1 + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + address: 10.255.255.1/24 + status: "active" + assigned_object: + device: test100 + name: GigabitEthernet1 query_params: - address - vrf @@ -192,22 +192,24 @@ that: - query_params_372 is changed - query_params_372['msg'] == 'ip_address 10.255.255.1/24 updated' - - query_params_372['diff']['after']['assigned_object'] == 3 - - query_params_372['diff']['after']['assigned_object_id'] == 3 + - query_params_372['diff']['after']['assigned_object'] == interface['key'] + - query_params_372['diff']['after']['assigned_object_id'] == interface['key'] - query_params_372['diff']['after']['assigned_object_type'] == 'dcim.interface' + vars: + interface: "{{ lookup('networktocode.nautobot.lookup', 'interfaces', api_endpoint=nautobot_url, token=nautobot_token, api_filter='device=test100 name=GigabitEthernet1') }}" - name: "Validate failure due to invalid child params provided by user" networktocode.nautobot.cable: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - termination_a_type: "dcim.interface" - termination_a: - device: "test100" - name: "GigabitEthernet1" - termination_b_type: "circuits.circuittermination" - termination_b: - name: "XYZ987" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + termination_a_type: "dcim.interface" + termination_a: + device: "test100" + name: "GigabitEthernet1" + termination_b_type: "circuits.circuittermination" + termination_b: + name: "XYZ987" + status: "connected" ignore_errors: "yes" register: "test_results" @@ -219,9 +221,14 @@ - name: "Issue #432 - Make sure same IPs get assigned to different device interfaces" networktocode.nautobot.ip_address: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: "{{ item }}" + url: "{{ nautobot_url }}" + token: "{{ nautobot_token }}" + address: "{{ item['address'] }}" + assigned_object: "{{ item['assigned_object'] }}" + description: "{{ item['description'] }}" + dns_name: "{{ item['dns_name'] }}" + role: "{{ item['role'] }}" + status: "{{ item['status'] }}" loop: "{{ data }}" register: "test_results" vars: @@ -233,7 +240,7 @@ description: ansible-nautobot-1.2.1 dns_name: ansible-nautobot-1.2.1 role: HSRP - status: Active + status: active - address: 121.121.121.121/32 assigned_object: device: "Test Nexus Child One" @@ -241,7 +248,7 @@ description: ansible-nautobot-1.2.1 dns_name: ansible-nautobot-1.2.1 role: HSRP - status: Active + status: active - address: 1.121.121.121/32 assigned_object: device: "Test Nexus One" @@ -249,7 +256,7 @@ description: ansible-nautobot-1.2.1 dns_name: ansible-nautobot-1.2.1 role: HSRP - status: Active + status: active - address: 1.121.121.121/32 assigned_object: device: "Test Nexus Child One" @@ -257,10 +264,10 @@ description: ansible-nautobot-1.2.1 dns_name: ansible-nautobot-1.2.1 role: HSRP - status: Active + status: active - name: "ASSERT Issue #432 changes reflect correct device" assert: that: - test_results | json_query('results[?ip_address.address==`1.121.121.121/32`]') | length == 2 - - test_results | json_query('results[?ip_address.address==`121.121.121.121/32`]') | length == 2 \ No newline at end of file + - test_results | json_query('results[?ip_address.address==`121.121.121.121/32`]') | length == 2 diff --git a/tests/integration/targets/regression-v2.9/tasks/main.yml b/tests/integration/targets/regression-v2.9/tasks/main.yml deleted file mode 100644 index 2fefc0eb..00000000 --- a/tests/integration/targets/regression-v2.9/tasks/main.yml +++ /dev/null @@ -1,218 +0,0 @@ ---- -## -## -### TEST PYNAUTOBOT CONNECTION FAILURE -## -## -- name: "TEST PYNAUTOBOT CONNECTION FAILURE" - connection: local - block: - - name: "1 - Device with required information" - networktocode.nautobot.device: - url: "http://some-random-invalid-URL" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "R1" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" - state: present - register: test_one - ignore_errors: yes - - - name: "1 - ASSERT" - assert: - that: - - test_one is failed - - test_one['msg'] == "Failed to establish connection to Nautobot API" - - - name: "2 - Check to see if prefix with parent defined will pass via check-mode" - networktocode.nautobot.prefix: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - parent: "10.10.0.0/16" - prefix_length: 24 - first_available: yes - state: present - register: test_two - check_mode: yes - - - name: "2 - ASSERT" - assert: - that: - - test_two is changed - - test_two['msg'] == "New prefix created within 10.10.0.0/16" - - - name: "3 - Add device with tags - Setup device to test #242" - networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "issue-242" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" - tags: - - slug: first - - slug: second - - - name: "4 - Add device with tags out of order - shouldn't change - Tests #242 is fixed" - networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "issue-242" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" - tags: - - slug: second - - slug: first - register: test_four - diff: yes - - - name: "4 - Assert not changed - Tests #242 is fixed" - assert: - that: - - not test_four["changed"] - - - name: "5 - Add device with extra tag - Tests #242 is fixed" - networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "issue-242" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" - asset_tag: "1234" - tags: - - slug: second - - slug: third - - slug: first - register: test_five - diff: yes - - - name: "5 - Assert added tag - Tests #242 is fixed" - assert: - that: - - test_five is changed - - test_five["diff"]["after"]["tags"] is defined - - test_five["device"]["tags"] is defined - - - name: "6 - Loop through and add interface templates to different device interface templates - Fixes #282" - networktocode.nautobot.device_interface_template: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "SFP+ (10GE)" - type: "SFP+ (10GE)" - device_type: "{{ item }}" - register: test_six - loop: - - "Cisco Test" - - "Arista Test" - - "Nexus Child" - - "Nexus Parent" - - - name: "6 - Assert device type is correct - Fixes #282" - assert: - that: - - test_six.results[0]["diff"]["before"]["state"] == "absent" - - test_six.results[0]["diff"]["after"]["state"] == "present" - - test_six.results[0]["interface_template"]["device_type"] == 1 - - test_six.results[1]["diff"]["before"]["state"] == "absent" - - test_six.results[1]["diff"]["after"]["state"] == "present" - - test_six.results[1]["interface_template"]["device_type"] == 2 - - test_six.results[2]["diff"]["before"]["state"] == "absent" - - test_six.results[2]["diff"]["after"]["state"] == "present" - - test_six.results[2]["interface_template"]["device_type"] == 4 - - test_six.results[3]["diff"]["before"]["state"] == "absent" - - test_six.results[3]["diff"]["after"]["state"] == "present" - - test_six.results[3]["interface_template"]["device_type"] == 3 - - - name: "7 - Don't prevent updates to other params if tags are specified" - networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "issue-242" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" - asset_tag: "Null" - tags: - # Changed these for issue #407 to be IDs - - 2 - - 3 - - 1 - register: test_seven - - - name: "5 - Assert added tag - Tests #242 is fixed" - assert: - that: - - test_seven is changed - - test_seven["diff"]["after"]["asset_tag"] == "Null" - - test_seven["device"]["asset_tag"] == "Null" - - - name: Add ip address to nautobot and don't assign it to a device (Issue 372) - networktocode.nautobot.ip_address: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - address: 10.255.255.1/24 - query_params: - - address - - vrf - state: present - - - name: Update same ip address to attach to a device interface (Issue 372) - networktocode.nautobot.ip_address: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - address: 10.255.255.1/24 - assigned_object: - device: test100 - name: GigabitEthernet1 - query_params: - - address - - vrf - state: present - register: query_params_372 - - - name: Assert ip address was updated and added to device interface - assert: - that: - - query_params_372 is changed - - query_params_372['msg'] == 'ip_address 10.255.255.1/24 updated' - - query_params_372['diff']['after']['assigned_object'] == 3 - - query_params_372['diff']['after']['assigned_object_id'] == 3 - - query_params_372['diff']['after']['assigned_object_type'] == 'dcim.interface' - - - name: "Validate failure due to invalid child params provided by user" - networktocode.nautobot.cable: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - termination_a_type: "dcim.interface" - termination_a: - device: "test100" - name: "GigabitEthernet1" - termination_b_type: "circuits.circuittermination" - termination_b: - name: "XYZ987" - ignore_errors: "yes" - register: "test_results" - - - name: "Issue #415 - Assert failure message shows the allowed params and what the user provided" - assert: - that: - - test_results is failed - - 'test_results["msg"] == "One or more of the kwargs provided are invalid for circuits.circuittermination, provided kwargs: name. Acceptable kwargs: circuit, term_side"' diff --git a/tests/integration/targets/v2.9/tasks/aggregate.yml b/tests/integration/targets/v2.9/tasks/aggregate.yml deleted file mode 100644 index b577a2ce..00000000 --- a/tests/integration/targets/v2.9/tasks/aggregate.yml +++ /dev/null @@ -1,115 +0,0 @@ ---- -## -## -### PYNAUTOBOT_AGGEGATE -## -## -- name: "AGGREGATE 1: Necessary info creation" - networktocode.nautobot.aggregate: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: "10.0.0.0/8" - rir: "Example RIR" - state: present - register: test_one - -- name: "AGGREGATE 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['aggregate']['prefix'] == "10.0.0.0/8" - - test_one['aggregate']['family'] == 4 - - test_one['aggregate']['rir'] == 1 - - test_one['msg'] == "aggregate 10.0.0.0/8 created" - -- name: "AGGREGATE 2: Create duplicate" - networktocode.nautobot.aggregate: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: "10.0.0.0/8" - state: present - register: test_two - -- name: "AGGREGATE 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['aggregate']['prefix'] == "10.0.0.0/8" - - test_two['aggregate']['family'] == 4 - - test_two['aggregate']['rir'] == 1 - - test_two['msg'] == "aggregate 10.0.0.0/8 already exists" - -- name: "AGGREGATE 3: ASSERT - Update" - networktocode.nautobot.aggregate: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: "10.0.0.0/8" - rir: "Example RIR" - date_added: "1989-01-18" - description: "Test Description" - tags: - - "Schnozzberry" - state: present - register: test_three - -- name: "AGGREGATE 3: ASSERT - Updated" - assert: - that: - - test_three is changed - - test_three['diff']['after']['date_added'] == "1989-01-18" - - test_three['diff']['after']['description'] == "Test Description" - - test_three['diff']['after']['tags'][0] == 4 - - test_three['aggregate']['prefix'] == "10.0.0.0/8" - - test_three['aggregate']['family'] == 4 - - test_three['aggregate']['rir'] == 1 - - test_three['aggregate']['date_added'] == "1989-01-18" - - test_three['aggregate']['description'] == "Test Description" - - test_three['aggregate']['tags'][0] == 4 - - test_three['msg'] == "aggregate 10.0.0.0/8 updated" - -- name: "AGGREGATE 4: ASSERT - Delete" - networktocode.nautobot.aggregate: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: "10.0.0.0/8" - state: absent - register: test_four - -- name: "AGGREGATE 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['aggregate']['prefix'] == "10.0.0.0/8" - - test_four['aggregate']['family'] == 4 - - test_four['aggregate']['rir'] == 1 - - test_four['aggregate']['date_added'] == "1989-01-18" - - test_four['aggregate']['description'] == "Test Description" - - test_four['aggregate']['tags'][0] == 4 - - test_four['msg'] == "aggregate 10.0.0.0/8 deleted" - -- name: "AGGREGATE 5: Necessary info creation" - networktocode.nautobot.aggregate: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: "2001::/32" - rir: "Example RIR" - state: present - register: test_five - -- name: "AGGREGATE 5: ASSERT - Necessary info creation" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "absent" - - test_five['diff']['after']['state'] == "present" - - test_five['aggregate']['prefix'] == "2001::/32" - - test_five['aggregate']['family'] == 6 - - test_five['aggregate']['rir'] == 1 - - test_five['msg'] == "aggregate 2001::/32 created" diff --git a/tests/integration/targets/v2.9/tasks/cable.yml b/tests/integration/targets/v2.9/tasks/cable.yml deleted file mode 100644 index 823c5a00..00000000 --- a/tests/integration/targets/v2.9/tasks/cable.yml +++ /dev/null @@ -1,186 +0,0 @@ ---- -# © 2020 Nokia -# Licensed under the GNU General Public License v3.0 only -# SPDX-License-Identifier: GPL-3.0-only -## -## -### PYNAUTOBOT_CABLE -## -## -- name: "CABLE 1: Necessary info creation" - networktocode.nautobot.cable: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - termination_a_type: dcim.interface - termination_a: - device: Test Nexus Child One - name: Ethernet2/2 - termination_b_type: dcim.interface - termination_b: - device: Test Nexus Child One - name: Ethernet2/1 - state: present - register: test_one - -- name: "CABLE 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['cable']['termination_a_type'] == "dcim.interface" - - test_one['cable']['termination_a_id'] == 13 - - test_one['cable']['termination_b_type'] == "dcim.interface" - - test_one['cable']['termination_b_id'] == 2 - - test_one['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 created" - -- name: "CABLE 2: Create duplicate" - networktocode.nautobot.cable: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - termination_a_type: dcim.interface - termination_a: - device: Test Nexus Child One - name: Ethernet2/2 - termination_b_type: dcim.interface - termination_b: - device: Test Nexus Child One - name: Ethernet2/1 - state: present - register: test_two - -- name: "CABLE 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['cable']['termination_a_type'] == "dcim.interface" - - test_two['cable']['termination_a_id'] == 13 - - test_two['cable']['termination_b_type'] == "dcim.interface" - - test_two['cable']['termination_b_id'] == 2 - - test_two['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 already exists" - -- name: "CABLE 3: Update Cable with other fields" - networktocode.nautobot.cable: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - termination_a_type: dcim.interface - termination_a: - device: Test Nexus Child One - name: Ethernet2/2 - termination_b_type: dcim.interface - termination_b: - device: Test Nexus Child One - name: Ethernet2/1 - type: mmf-om4 - status: planned - label: label123 - color: abcdef - length: 30 - length_unit: m - state: present - register: test_three - -- name: "CABLE 3: ASSERT - Update Cable with other fields" - assert: - that: - - test_three is changed - - test_three['diff']['after']['type'] == "mmf-om4" - - test_three['diff']['after']['status'] == "planned" - - test_three['diff']['after']['label'] == "label123" - - test_three['diff']['after']['color'] == "abcdef" - - test_three['diff']['after']['length'] == 30 - - test_three['diff']['after']['length_unit'] == "m" - - test_three['cable']['termination_a_type'] == "dcim.interface" - - test_three['cable']['termination_a_id'] == 13 - - test_three['cable']['termination_b_type'] == "dcim.interface" - - test_three['cable']['termination_b_id'] == 2 - - test_three['cable']['type'] == "mmf-om4" - - test_three['cable']['status'] == "planned" - - test_three['cable']['label'] == "label123" - - test_three['cable']['color'] == "abcdef" - - test_three['cable']['length'] == 30 - - test_three['cable']['length_unit'] == "m" - - test_three['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 updated" - -- name: "CABLE 4: ASSERT - Delete" - networktocode.nautobot.cable: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - termination_a_type: dcim.interface - termination_a: - device: Test Nexus Child One - name: Ethernet2/2 - termination_b_type: dcim.interface - termination_b: - device: Test Nexus Child One - name: Ethernet2/1 - state: absent - register: test_four - -- name: "CABLE 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "present" - - test_four['diff']['after']['state'] == "absent" - - test_four['msg'] == "cable dcim.interface Ethernet2/2 <> dcim.interface Ethernet2/1 deleted" - -- name: "CABLE 5: Connect Console Port and Console Server Port" - networktocode.nautobot.cable: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - termination_a_type: dcim.consoleserverport - termination_a: - name: Console Server Port - device: test100 - termination_b_type: dcim.consoleport - termination_b: - name: Console Port - device: test100 - state: present - register: test_five - -- name: "CABLE 5: ASSERT - Connect Console Port and Console Server Port" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "absent" - - test_five['diff']['after']['state'] == "present" - - test_five['cable']['termination_a_type'] == "dcim.consoleserverport" - - test_five['cable']['termination_a_id'] == 1 - - test_five['cable']['termination_b_type'] == "dcim.consoleport" - - test_five['cable']['termination_b_id'] == 1 - - test_five['msg'] == "cable dcim.consoleserverport Console Server Port <> dcim.consoleport Console Port created" - -- name: "CABLE 6: Circuits Termination as side A" - networktocode.nautobot.cable: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - termination_a_type: circuits.circuittermination - termination_a: - circuit: "Test Circuit Two" - term_side: "A" - termination_b_type: dcim.interface - termination_b: - device: "test100" - name: "GigabitEthernet2" - state: present - register: test_six - -- name: "CABLE 6: ASSERT - Circuits Termination as side A" - assert: - that: - - test_six is changed - - test_six['diff']['before']['state'] == "absent" - - test_six['diff']['after']['state'] == "present" - - test_six['cable']['termination_a_type'] == "circuits.circuittermination" - - test_six['cable']['termination_a_id'] == 1 - - test_six['cable']['termination_b_type'] == "dcim.interface" - - test_six['cable']['termination_b_id'] == 4 - - test_six['msg'] == "cable circuits.circuittermination 1 <> dcim.interface GigabitEthernet2 created" diff --git a/tests/integration/targets/v2.9/tasks/circuit.yml b/tests/integration/targets/v2.9/tasks/circuit.yml deleted file mode 100644 index 46d3d316..00000000 --- a/tests/integration/targets/v2.9/tasks/circuit.yml +++ /dev/null @@ -1,109 +0,0 @@ ---- -## -## -### PYNAUTOBOT_CIRCUIT -## -## -- name: "PYNAUTOBOT_CIRCUIT 1: Create provider within Nautobot with only required information" - networktocode.nautobot.circuit: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - cid: Test Circuit One - provider: Test Provider - circuit_type: Test Circuit Type - state: present - register: test_one - -- name: "PYNAUTOBOT_CIRCUIT 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['circuit']['cid'] == "Test Circuit One" - - test_one['circuit']['provider'] == 1 - - test_one['circuit']['type'] == 1 - - test_one['msg'] == "circuit Test Circuit One created" - -- name: "PYNAUTOBOT_CIRCUIT 2: Duplicate" - networktocode.nautobot.circuit: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - cid: Test Circuit One - provider: Test Provider - circuit_type: Test Circuit Type - state: present - register: test_two - -- name: "PYNAUTOBOT_CIRCUIT 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['circuit']['cid'] == "Test Circuit One" - - test_two['circuit']['provider'] == 1 - - test_two['circuit']['type'] == 1 - - test_two['msg'] == "circuit Test Circuit One already exists" - -- name: "PYNAUTOBOT_CIRCUIT 3: Update provider with other fields" - networktocode.nautobot.circuit: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - cid: Test Circuit One - provider: Test Provider - circuit_type: Test Circuit Type - status: Planned - tenant: Test Tenant - install_date: "2018-12-25" - commit_rate: 10000 - description: "Test circuit " - comments: "FAST CIRCUIT" - state: present - register: test_three - -- name: "PYNAUTOBOT_CIRCUIT 3: ASSERT - Updated" - assert: - that: - - test_three is changed - - test_three['diff']['after']['status'] == "planned" - - test_three['diff']['after']['tenant'] == 1 - - test_three['diff']['after']['install_date'] == "2018-12-25" - - test_three['diff']['after']['commit_rate'] == 10000 - - test_three['diff']['after']['description'] == "Test circuit" - - test_three['diff']['after']['comments'] == "FAST CIRCUIT" - - test_three['circuit']['cid'] == "Test Circuit One" - - test_three['circuit']['provider'] == 1 - - test_three['circuit']['type'] == 1 - - test_three['circuit']['status'] == "planned" - - test_three['circuit']['tenant'] == 1 - - test_three['circuit']['install_date'] == "2018-12-25" - - test_three['circuit']['commit_rate'] == 10000 - - test_three['circuit']['description'] == "Test circuit" - - test_three['circuit']['comments'] == "FAST CIRCUIT" - - test_three['msg'] == "circuit Test Circuit One updated" - -- name: "PYNAUTOBOT_CIRCUIT 4: Delete provider within nautobot" - networktocode.nautobot.circuit: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - cid: Test Circuit One - state: absent - register: test_four - -- name: "PYNAUTOBOT_CIRCUIT 4 : ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['circuit']['cid'] == "Test Circuit One" - - test_four['circuit']['provider'] == 1 - - test_four['circuit']['type'] == 1 - - test_four['circuit']['status'] == "planned" - - test_four['circuit']['tenant'] == 1 - - test_four['circuit']['install_date'] == "2018-12-25" - - test_four['circuit']['commit_rate'] == 10000 - - test_four['circuit']['description'] == "Test circuit" - - test_four['circuit']['comments'] == "FAST CIRCUIT" - - test_four['msg'] == "circuit Test Circuit One deleted" diff --git a/tests/integration/targets/v2.9/tasks/circuit_termination.yml b/tests/integration/targets/v2.9/tasks/circuit_termination.yml deleted file mode 100644 index 3a270f61..00000000 --- a/tests/integration/targets/v2.9/tasks/circuit_termination.yml +++ /dev/null @@ -1,129 +0,0 @@ ---- -## -## -### PYNAUTOBOT_CIRCUIT_TERMINATION -## -## -- name: "PYNAUTOBOT_CIRCUIT_TERMINATION 1: Create provider within Nautobot with only required information" - networktocode.nautobot.circuit_termination: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - circuit: Test Circuit - term_side: A - site: "Test Site" - port_speed: 10000 - state: present - register: test_one - -- name: "PYNAUTOBOT_CIRCUIT_TERMINATION 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['circuit_termination']['circuit'] == 1 - - test_one['circuit_termination']['term_side'] == "A" - - test_one['circuit_termination']['site'] == 1 - - test_one['circuit_termination']['port_speed'] == 10000 - - test_one['msg'] == "circuit_termination test_circuit_a created" - -- name: "PYNAUTOBOT_CIRCUIT_TERMINATION 2: Duplicate" - networktocode.nautobot.circuit_termination: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - circuit: Test Circuit - term_side: A - state: present - register: test_two - -- name: "PYNAUTOBOT_CIRCUIT_TERMINATION 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['circuit_termination']['circuit'] == 1 - - test_two['circuit_termination']['term_side'] == "A" - - test_two['circuit_termination']['site'] == 1 - - test_two['circuit_termination']['port_speed'] == 10000 - - test_two['msg'] == "circuit_termination test_circuit_a already exists" - -- name: "PYNAUTOBOT_CIRCUIT_TERMINATION 3: Update provider with other fields" - networktocode.nautobot.circuit_termination: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - circuit: Test Circuit - term_side: A - upstream_speed: 1000 - xconnect_id: 10X100 - pp_info: PP10-24 - description: "Test description" - state: present - register: test_three - -- name: "PYNAUTOBOT_CIRCUIT_TERMINATION 3: ASSERT - Updated" - assert: - that: - - test_three is changed - - test_three['diff']['after']['upstream_speed'] == 1000 - - test_three['diff']['after']['xconnect_id'] == "10X100" - - test_three['diff']['after']['pp_info'] == "PP10-24" - - test_three['diff']['after']['description'] == "Test description" - - test_three['circuit_termination']['circuit'] == 1 - - test_three['circuit_termination']['term_side'] == "A" - - test_three['circuit_termination']['site'] == 1 - - test_three['circuit_termination']['port_speed'] == 10000 - - test_three['circuit_termination']['upstream_speed'] == 1000 - - test_three['circuit_termination']['xconnect_id'] == "10X100" - - test_three['circuit_termination']['pp_info'] == "PP10-24" - - test_three['circuit_termination']['description'] == "Test description" - - test_three['msg'] == "circuit_termination test_circuit_a updated" - -- name: "PYNAUTOBOT_CIRCUIT_TERMINATION 4: Create Z Side" - networktocode.nautobot.circuit_termination: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - circuit: Test Circuit - term_side: Z - site: "Test Site" - port_speed: 10000 - state: present - register: test_four - -- name: "PYNAUTOBOT_CIRCUIT_TERMINATION 4: ASSERT - Create Z Side" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['circuit_termination']['circuit'] == 1 - - test_four['circuit_termination']['term_side'] == "Z" - - test_four['circuit_termination']['site'] == 1 - - test_four['circuit_termination']['port_speed'] == 10000 - - test_four['msg'] == "circuit_termination test_circuit_z created" - -- name: "PYNAUTOBOT_CIRCUIT_TERMINATION 5: Delete provider within nautobot" - networktocode.nautobot.circuit_termination: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - circuit: Test Circuit - term_side: A - state: absent - register: test_five - -- name: "PYNAUTOBOT_CIRCUIT_TERMINATION 5: ASSERT - Delete" - assert: - that: - - test_five is changed - - test_five['circuit_termination']['circuit'] == 1 - - test_five['circuit_termination']['term_side'] == "A" - - test_five['circuit_termination']['site'] == 1 - - test_five['circuit_termination']['port_speed'] == 10000 - - test_five['circuit_termination']['upstream_speed'] == 1000 - - test_five['circuit_termination']['xconnect_id'] == "10X100" - - test_five['circuit_termination']['pp_info'] == "PP10-24" - - test_five['circuit_termination']['description'] == "Test description" - - test_five['msg'] == "circuit_termination test_circuit_a deleted" diff --git a/tests/integration/targets/v2.9/tasks/circuit_type.yml b/tests/integration/targets/v2.9/tasks/circuit_type.yml deleted file mode 100644 index a3e861e1..00000000 --- a/tests/integration/targets/v2.9/tasks/circuit_type.yml +++ /dev/null @@ -1,96 +0,0 @@ ---- -## -## -### PYNAUTOBOT_CIRCUIT_TYPE -## -## -- name: "CIRCUIT_TYPE 1: Necessary info creation" - networktocode.nautobot.circuit_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Circuit Type One" - state: present - register: test_one - -- name: "CIRCUIT_TYPE 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['circuit_type']['name'] == "Test Circuit Type One" - - test_one['circuit_type']['slug'] == "test-circuit-type-one" - - test_one['msg'] == "circuit_type Test Circuit Type One created" - -- name: "CIRCUIT_TYPE 2: Create duplicate" - networktocode.nautobot.circuit_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Circuit Type One" - state: present - register: test_two - -- name: "CIRCUIT_TYPE 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['circuit_type']['name'] == "Test Circuit Type One" - - test_two['circuit_type']['slug'] == "test-circuit-type-one" - - test_two['msg'] == "circuit_type Test Circuit Type One already exists" - -- name: "CIRCUIT_TYPE 3: User specified slug" - networktocode.nautobot.circuit_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Circuit Type Two" - slug: "test-circuit-type-2" - state: present - register: test_three - -- name: "CIRCUIT_TYPE 3: ASSERT - User specified slug" - assert: - that: - - test_three is changed - - test_three['diff']['before']['state'] == "absent" - - test_three['diff']['after']['state'] == "present" - - test_three['circuit_type']['name'] == "Test Circuit Type Two" - - test_three['circuit_type']['slug'] == "test-circuit-type-2" - - test_three['msg'] == "circuit_type Test Circuit Type Two created" - -- name: "CIRCUIT_TYPE 4: ASSERT - Delete" - networktocode.nautobot.circuit_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Circuit Type One" - state: absent - register: test_four - -- name: "CIRCUIT_TYPE 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['circuit_type']['name'] == "Test Circuit Type One" - - test_four['circuit_type']['slug'] == "test-circuit-type-one" - - test_four['msg'] == "circuit_type Test Circuit Type One deleted" - -- name: "CIRCUIT_TYPE 5: ASSERT - Delete" - networktocode.nautobot.circuit_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Circuit Type Two" - slug: "test-circuit-type-2" - state: absent - register: test_five - -- name: "CIRCUIT_TYPE 5: ASSERT - Delete" - assert: - that: - - test_five is changed - - test_five['circuit_type']['name'] == "Test Circuit Type Two" - - test_five['circuit_type']['slug'] == "test-circuit-type-2" - - test_five['msg'] == "circuit_type Test Circuit Type Two deleted" diff --git a/tests/integration/targets/v2.9/tasks/cluster.yml b/tests/integration/targets/v2.9/tasks/cluster.yml deleted file mode 100644 index e3b661ca..00000000 --- a/tests/integration/targets/v2.9/tasks/cluster.yml +++ /dev/null @@ -1,98 +0,0 @@ ---- -## -## -### PYNAUTOBOT_CLUSTER -## -## -- name: "CLUSTER 1: Necessary info creation" - networktocode.nautobot.cluster: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster One" - cluster_type: "Test Cluster Type" - state: present - register: test_one - -- name: "CLUSTER 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['cluster']['name'] == "Test Cluster One" - - test_one['cluster']['type'] == 1 - - test_one['msg'] == "cluster Test Cluster One created" - -- name: "CLUSTER 2: Create duplicate" - networktocode.nautobot.cluster: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster One" - cluster_type: "Test Cluster Type" - state: present - register: test_two - -- name: "CLUSTER 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['cluster']['name'] == "Test Cluster One" - - test_two['cluster']['type'] == 1 - - test_two['msg'] == "cluster Test Cluster One already exists" - -- name: "CLUSTER 3: Update" - networktocode.nautobot.cluster: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster One" - cluster_type: "Test Cluster Type" - cluster_group: "Test Cluster Group" - site: "Test Site" - comments: "Updated cluster" - tenant: "Test Tenant" - tags: - - "Schnozzberry" - state: present - register: test_three - -- name: "CLUSTER 3: ASSERT - Updated" - assert: - that: - - test_three is changed - - test_three['diff']['after']['group'] == 1 - - test_three['diff']['after']['site'] == 1 - - test_three['diff']['after']['comments'] == "Updated cluster" - - test_three['diff']['after']['tags'][0] == 4 - - test_three['diff']['after']['tenant'] == 1 - - test_three['cluster']['name'] == "Test Cluster One" - - test_three['cluster']['type'] == 1 - - test_three['cluster']['group'] == 1 - - test_three['cluster']['site'] == 1 - - test_three['cluster']['comments'] == "Updated cluster" - - test_three['cluster']['tags'][0] == 4 - - test_three['cluster']['tenant'] == 1 - - test_three['msg'] == "cluster Test Cluster One updated" - -- name: "CLUSTER 4: ASSERT - Delete" - networktocode.nautobot.cluster: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster One" - state: absent - register: test_four - -- name: "CLUSTER 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['cluster']['name'] == "Test Cluster One" - - test_four['cluster']['type'] == 1 - - test_four['cluster']['group'] == 1 - - test_four['cluster']['site'] == 1 - - test_four['cluster']['comments'] == "Updated cluster" - - test_four['cluster']['tags'][0] == 4 - - test_four['msg'] == "cluster Test Cluster One deleted" diff --git a/tests/integration/targets/v2.9/tasks/cluster_group.yml b/tests/integration/targets/v2.9/tasks/cluster_group.yml deleted file mode 100644 index 1ce28771..00000000 --- a/tests/integration/targets/v2.9/tasks/cluster_group.yml +++ /dev/null @@ -1,96 +0,0 @@ ---- -## -## -### PYNAUTOBOT_CLUSTER_GROUP -## -## -- name: "CLUSTER_GROUP 1: Necessary info creation" - networktocode.nautobot.cluster_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Group One" - state: present - register: test_one - -- name: "CLUSTER_GROUP 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['cluster_group']['name'] == "Test Cluster Group One" - - test_one['cluster_group']['slug'] == "test-cluster-group-one" - - test_one['msg'] == "cluster_group Test Cluster Group One created" - -- name: "CLUSTER_GROUP 2: Create duplicate" - networktocode.nautobot.cluster_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Group One" - state: present - register: test_two - -- name: "CLUSTER_GROUP 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['cluster_group']['name'] == "Test Cluster Group One" - - test_two['cluster_group']['slug'] == "test-cluster-group-one" - - test_two['msg'] == "cluster_group Test Cluster Group One already exists" - -- name: "CLUSTER_GROUP 3: User specified slug" - networktocode.nautobot.cluster_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Group Two" - slug: "test-cluster-group-2" - state: present - register: test_three - -- name: "CLUSTER_GROUP 3: ASSERT - User specified slug" - assert: - that: - - test_three is changed - - test_three['diff']['before']['state'] == "absent" - - test_three['diff']['after']['state'] == "present" - - test_three['cluster_group']['name'] == "Test Cluster Group Two" - - test_three['cluster_group']['slug'] == "test-cluster-group-2" - - test_three['msg'] == "cluster_group Test Cluster Group Two created" - -- name: "CLUSTER_GROUP 4: ASSERT - Delete" - networktocode.nautobot.cluster_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Group One" - state: absent - register: test_four - -- name: "CLUSTER_GROUP 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['cluster_group']['name'] == "Test Cluster Group One" - - test_four['cluster_group']['slug'] == "test-cluster-group-one" - - test_four['msg'] == "cluster_group Test Cluster Group One deleted" - -- name: "CLUSTER_GROUP 5: ASSERT - Delete" - networktocode.nautobot.cluster_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Group Two" - slug: "test-cluster-group-2" - state: absent - register: test_five - -- name: "CLUSTER_GROUP 5: ASSERT - Delete" - assert: - that: - - test_five is changed - - test_five['cluster_group']['name'] == "Test Cluster Group Two" - - test_five['cluster_group']['slug'] == "test-cluster-group-2" - - test_five['msg'] == "cluster_group Test Cluster Group Two deleted" diff --git a/tests/integration/targets/v2.9/tasks/cluster_type.yml b/tests/integration/targets/v2.9/tasks/cluster_type.yml deleted file mode 100644 index 1f4e01fb..00000000 --- a/tests/integration/targets/v2.9/tasks/cluster_type.yml +++ /dev/null @@ -1,95 +0,0 @@ -## -## -### PYNAUTOBOT_CLUSTER_TYPE -## -## -- name: "CLUSTER_TYPE 1: Necessary info creation" - networktocode.nautobot.cluster_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Type One" - state: present - register: test_one - -- name: "CLUSTER_TYPE 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['cluster_type']['name'] == "Test Cluster Type One" - - test_one['cluster_type']['slug'] == "test-cluster-type-one" - - test_one['msg'] == "cluster_type Test Cluster Type One created" - -- name: "CLUSTER_TYPE 2: Create duplicate" - networktocode.nautobot.cluster_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Type One" - state: present - register: test_two - -- name: "CLUSTER_TYPE 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['cluster_type']['name'] == "Test Cluster Type One" - - test_two['cluster_type']['slug'] == "test-cluster-type-one" - - test_two['msg'] == "cluster_type Test Cluster Type One already exists" - -- name: "CLUSTER_TYPE 3: User specified slug" - networktocode.nautobot.cluster_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Type Two" - slug: "test-cluster-type-2" - state: present - register: test_three - -- name: "CLUSTER_TYPE 3: ASSERT - User specified slug" - assert: - that: - - test_three is changed - - test_three['diff']['before']['state'] == "absent" - - test_three['diff']['after']['state'] == "present" - - test_three['cluster_type']['name'] == "Test Cluster Type Two" - - test_three['cluster_type']['slug'] == "test-cluster-type-2" - - test_three['msg'] == "cluster_type Test Cluster Type Two created" - -- name: "CLUSTER_TYPE 4: ASSERT - Delete" - networktocode.nautobot.cluster_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Type One" - state: absent - register: test_four - -- name: "CLUSTER_TYPE 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['cluster_type']['name'] == "Test Cluster Type One" - - test_four['cluster_type']['slug'] == "test-cluster-type-one" - - test_four['msg'] == "cluster_type Test Cluster Type One deleted" - -- name: "CLUSTER_TYPE 5: ASSERT - Delete" - networktocode.nautobot.cluster_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Cluster Type Two" - slug: "test-cluster-type-2" - state: absent - register: test_five - -- name: "CLUSTER_TYPE 5: ASSERT - Delete" - assert: - that: - - test_five is changed - - test_five['cluster_type']['name'] == "Test Cluster Type Two" - - test_five['cluster_type']['slug'] == "test-cluster-type-2" - - test_five['msg'] == "cluster_type Test Cluster Type Two deleted" diff --git a/tests/integration/targets/v2.9/tasks/console_port.yml b/tests/integration/targets/v2.9/tasks/console_port.yml deleted file mode 100644 index 1939ee63..00000000 --- a/tests/integration/targets/v2.9/tasks/console_port.yml +++ /dev/null @@ -1,108 +0,0 @@ ---- -# © 2020 Nokia -# Licensed under the GNU General Public License v3.0 only -# SPDX-License-Identifier: GPL-3.0-only -## -## -### PYNAUTOBOT_CONSOLE_PORT -## -## -- name: "CONSOLE_PORT 1: Necessary info creation" - networktocode.nautobot.console_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port - device: test100 - state: present - register: test_one - -- name: "CONSOLE_PORT 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['console_port']['name'] == "Console Port" - - test_one['console_port']['device'] == 1 - - test_one['msg'] == "console_port Console Port created" - -- name: "CONSOLE_PORT 2: Create duplicate" - networktocode.nautobot.console_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port - device: test100 - state: present - register: test_two - -- name: "CONSOLE_PORT 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['console_port']['name'] == "Console Port" - - test_two['console_port']['device'] == 1 - - test_two['msg'] == "console_port Console Port already exists" - -- name: "CONSOLE_PORT 3: Update Console Port with other fields" - networktocode.nautobot.console_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port - device: test100 - type: usb-a - description: test description - state: present - register: test_three - -- name: "CONSOLE_PORT 3: ASSERT - Update Console Port with other fields" - assert: - that: - - test_three is changed - - test_three['diff']['after']['type'] == "usb-a" - - test_three['diff']['after']['description'] == "test description" - - test_three['console_port']['name'] == "Console Port" - - test_three['console_port']['device'] == 1 - - test_three['console_port']['type'] == "usb-a" - - test_three['console_port']['description'] == "test description" - - test_three['msg'] == "console_port Console Port updated" - -- name: "CONSOLE_PORT 4: Create Console Port for Delete Test" - networktocode.nautobot.console_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port 2 - device: test100 - state: present - register: test_four - -- name: "CONSOLE_PORT 4: ASSERT - Create Console Port for Delete Test" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['console_port']['name'] == "Console Port 2" - - test_four['console_port']['device'] == 1 - - test_four['msg'] == "console_port Console Port 2 created" - -- name: "CONSOLE_PORT 5: Delete Console Port" - networktocode.nautobot.console_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port 2 - device: test100 - state: absent - register: test_five - -- name: "CONSOLE_PORT 5: ASSERT - Delete Console Port" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['msg'] == "console_port Console Port 2 deleted" diff --git a/tests/integration/targets/v2.9/tasks/console_port_template.yml b/tests/integration/targets/v2.9/tasks/console_port_template.yml deleted file mode 100644 index 49ead67e..00000000 --- a/tests/integration/targets/v2.9/tasks/console_port_template.yml +++ /dev/null @@ -1,105 +0,0 @@ ---- -# © 2020 Nokia -# Licensed under the GNU General Public License v3.0 only -# SPDX-License-Identifier: GPL-3.0-only -## -## -### PYNAUTOBOT_CONSOLE_PORT_TEMPLATE -## -## -- name: "CONSOLE_PORT_TEMPLATE 1: Necessary info creation" - networktocode.nautobot.console_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port Template - device_type: Cisco Test - state: present - register: test_one - -- name: "CONSOLE_PORT_TEMPLATE 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['console_port_template']['name'] == "Console Port Template" - - test_one['console_port_template']['device_type'] == 1 - - test_one['msg'] == "console_port_template Console Port Template created" - -- name: "CONSOLE_PORT_TEMPLATE 2: Create duplicate" - networktocode.nautobot.console_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port Template - device_type: Cisco Test - state: present - register: test_two - -- name: "CONSOLE_PORT_TEMPLATE 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['console_port_template']['name'] == "Console Port Template" - - test_two['console_port_template']['device_type'] == 1 - - test_two['msg'] == "console_port_template Console Port Template already exists" - -- name: "CONSOLE_PORT_TEMPLATE 3: Update Console Port Template with other fields" - networktocode.nautobot.console_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port Template - device_type: Cisco Test - type: usb-a - state: present - register: test_three - -- name: "CONSOLE_PORT_TEMPLATE 3: ASSERT - Update Console Port Template with other fields" - assert: - that: - - test_three is changed - - test_three['diff']['after']['type'] == "usb-a" - - test_three['console_port_template']['name'] == "Console Port Template" - - test_three['console_port_template']['device_type'] == 1 - - test_three['console_port_template']['type'] == "usb-a" - - test_three['msg'] == "console_port_template Console Port Template updated" - -- name: "CONSOLE_PORT_TEMPLATE 4: Create Console Port Template for Delete Test" - networktocode.nautobot.console_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port Template 2 - device_type: Cisco Test - state: present - register: test_four - -- name: "CONSOLE_PORT_TEMPLATE 4: ASSERT - Create Console Port Template for Delete Test" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['console_port_template']['name'] == "Console Port Template 2" - - test_four['console_port_template']['device_type'] == 1 - - test_four['msg'] == "console_port_template Console Port Template 2 created" - -- name: "CONSOLE_PORT_TEMPLATE 5: Delete Console Port Template" - networktocode.nautobot.console_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Port Template 2 - device_type: Cisco Test - state: absent - register: test_five - -- name: "CONSOLE_PORT_TEMPLATE 5: ASSERT - Delete Console Port Template" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['msg'] == "console_port_template Console Port Template 2 deleted" diff --git a/tests/integration/targets/v2.9/tasks/console_server_port.yml b/tests/integration/targets/v2.9/tasks/console_server_port.yml deleted file mode 100644 index 98c11690..00000000 --- a/tests/integration/targets/v2.9/tasks/console_server_port.yml +++ /dev/null @@ -1,108 +0,0 @@ ---- -# © 2020 Nokia -# Licensed under the GNU General Public License v3.0 only -# SPDX-License-Identifier: GPL-3.0-only -## -## -### PYNAUTOBOT_CONSOLE_SERVER_PORT -## -## -- name: "CONSOLE_SERVER_PORT 1: Necessary info creation" - networktocode.nautobot.console_server_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port - device: test100 - state: present - register: test_one - -- name: "CONSOLE_SERVER_PORT 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['console_server_port']['name'] == "Console Server Port" - - test_one['console_server_port']['device'] == 1 - - test_one['msg'] == "console_server_port Console Server Port created" - -- name: "CONSOLE_SERVER_PORT 2: Create duplicate" - networktocode.nautobot.console_server_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port - device: test100 - state: present - register: test_two - -- name: "CONSOLE_SERVER_PORT 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['console_server_port']['name'] == "Console Server Port" - - test_two['console_server_port']['device'] == 1 - - test_two['msg'] == "console_server_port Console Server Port already exists" - -- name: "CONSOLE_SERVER_PORT 3: Update Console Server Port with other fields" - networktocode.nautobot.console_server_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port - device: test100 - type: usb-a - description: test description - state: present - register: test_three - -- name: "CONSOLE_SERVER_PORT 3: ASSERT - Update Console Server Port with other fields" - assert: - that: - - test_three is changed - - test_three['diff']['after']['type'] == "usb-a" - - test_three['diff']['after']['description'] == "test description" - - test_three['console_server_port']['name'] == "Console Server Port" - - test_three['console_server_port']['device'] == 1 - - test_three['console_server_port']['type'] == "usb-a" - - test_three['console_server_port']['description'] == "test description" - - test_three['msg'] == "console_server_port Console Server Port updated" - -- name: "CONSOLE_SERVER_PORT 4: Create Console Server Port for Delete Test" - networktocode.nautobot.console_server_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port 2 - device: test100 - state: present - register: test_four - -- name: "CONSOLE_SERVER_PORT 4: ASSERT - Create Console Server Port for Delete Test" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['console_server_port']['name'] == "Console Server Port 2" - - test_four['console_server_port']['device'] == 1 - - test_four['msg'] == "console_server_port Console Server Port 2 created" - -- name: "CONSOLE_SERVER_PORT 5: Delete Console Server Port" - networktocode.nautobot.console_server_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port 2 - device: test100 - state: absent - register: test_five - -- name: "CONSOLE_SERVER_PORT 5: ASSERT - Delete Console Server Port" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['msg'] == "console_server_port Console Server Port 2 deleted" diff --git a/tests/integration/targets/v2.9/tasks/console_server_port_template.yml b/tests/integration/targets/v2.9/tasks/console_server_port_template.yml deleted file mode 100644 index 9420cb3d..00000000 --- a/tests/integration/targets/v2.9/tasks/console_server_port_template.yml +++ /dev/null @@ -1,105 +0,0 @@ ---- -# © 2020 Nokia -# Licensed under the GNU General Public License v3.0 only -# SPDX-License-Identifier: GPL-3.0-only -## -## -### PYNAUTOBOT_CONSOLE_SERVER_PORT_TEMPLATE -## -## -- name: "CONSOLE_SERVER_PORT_TEMPLATE 1: Necessary info creation" - networktocode.nautobot.console_server_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port Template - device_type: Cisco Test - state: present - register: test_one - -- name: "CONSOLE_SERVER_PORT_TEMPLATE 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['console_server_port_template']['name'] == "Console Server Port Template" - - test_one['console_server_port_template']['device_type'] == 1 - - test_one['msg'] == "console_server_port_template Console Server Port Template created" - -- name: "CONSOLE_SERVER_PORT_TEMPLATE 2: Create duplicate" - networktocode.nautobot.console_server_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port Template - device_type: Cisco Test - state: present - register: test_two - -- name: "CONSOLE_SERVER_PORT_TEMPLATE 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['console_server_port_template']['name'] == "Console Server Port Template" - - test_two['console_server_port_template']['device_type'] == 1 - - test_two['msg'] == "console_server_port_template Console Server Port Template already exists" - -- name: "CONSOLE_SERVER_PORT_TEMPLATE 3: Update Console Server Port Template with other fields" - networktocode.nautobot.console_server_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port Template - device_type: Cisco Test - type: usb-a - state: present - register: test_three - -- name: "CONSOLE_SERVER_PORT_TEMPLATE 3: ASSERT - Update Console Server Port Template with other fields" - assert: - that: - - test_three is changed - - test_three['diff']['after']['type'] == "usb-a" - - test_three['console_server_port_template']['name'] == "Console Server Port Template" - - test_three['console_server_port_template']['device_type'] == 1 - - test_three['console_server_port_template']['type'] == "usb-a" - - test_three['msg'] == "console_server_port_template Console Server Port Template updated" - -- name: "CONSOLE_SERVER_PORT_TEMPLATE 4: Create Console Server Port Template for Delete Test" - networktocode.nautobot.console_server_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port Template 2 - device_type: Cisco Test - state: present - register: test_four - -- name: "CONSOLE_SERVER_PORT_TEMPLATE 4: ASSERT - Create Console Server Port Template for Delete Test" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['console_server_port_template']['name'] == "Console Server Port Template 2" - - test_four['console_server_port_template']['device_type'] == 1 - - test_four['msg'] == "console_server_port_template Console Server Port Template 2 created" - -- name: "CONSOLE_SERVER_PORT_TEMPLATE 5: Delete Console Server Port Template" - networktocode.nautobot.console_server_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Console Server Port Template 2 - device_type: Cisco Test - state: absent - register: test_five - -- name: "CONSOLE_SERVER_PORT_TEMPLATE 5: ASSERT - Delete Console Server Port Template" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['msg'] == "console_server_port_template Console Server Port Template 2 deleted" diff --git a/tests/integration/targets/v2.9/tasks/device.yml b/tests/integration/targets/v2.9/tasks/device.yml deleted file mode 100644 index f5bf2258..00000000 --- a/tests/integration/targets/v2.9/tasks/device.yml +++ /dev/null @@ -1,241 +0,0 @@ ---- -## -## -### PYNAUTOBOT_DEVICE -## -## -- name: "1 - Device with required information" - networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "R1" - device_type: - id: "1" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" - state: present - register: test_one - -- name: "1 - ASSERT" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == 'absent' - - test_one['diff']['after']['state'] == 'present' - - test_one['device']['name'] == "R1" - - test_one['device']['device_role'] == 1 - - test_one['device']['device_type'] == 1 - - test_one['device']['site'] == 1 - - test_one['device']['status'] == "staged" - - test_one['device']['name'] == "R1" - - test_one['msg'] == "device R1 created" - -- name: "2 - Duplicate device" - networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "R1" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" - state: present - register: test_two - -- name: "2 - ASSERT" - assert: - that: - - not test_two['changed'] - - test_two['device']['name'] == "R1" - - test_two['device']['device_role'] == 1 - - test_two['device']['device_type'] == 1 - - test_two['device']['site'] == 1 - - test_two['device']['status'] == "staged" - - test_two['msg'] == "device R1 already exists" - -- name: "3 - Update device" - networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "R1" - serial: "FXS1001" - local_context_data: - bgp_as: "65412" - virtual_chassis: "Test Nexus One" - vc_position: 3 - vc_priority: 15 - state: present - register: test_three - -- name: "3 - ASSERT" - assert: - that: - - test_three is changed - - test_three['diff']['after']['serial'] == "FXS1001" - - test_three['diff']['after']['local_context_data']["bgp_as"] == "65412" - - test_three['diff']['after']['virtual_chassis'] == 1 - - test_three['diff']['after']['vc_position'] == 3 - - test_three['diff']['after']['vc_priority'] == 15 - - test_three['device']['name'] == "R1" - - test_three['device']['device_role'] == 1 - - test_three['device']['device_type'] == 1 - - test_three['device']['site'] == 1 - - test_three['device']['status'] == "staged" - - test_three['device']['serial'] == "FXS1001" - - test_three['device']['local_context_data']["bgp_as"] == "65412" - - test_three['device']['virtual_chassis'] == 1 - - test_three['device']['vc_position'] == 3 - - test_three['device']['vc_priority'] == 15 - - test_three['msg'] == "device R1 updated" - -- name: "3.1 - Update device name using query_params" - networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "R1-changed-name" - serial: "FXS1001" - query_params: - - serial - state: present - register: test_three_dot_one - -- name: "3.1 - ASSERT" - assert: - that: - - test_three_dot_one is changed - - test_three_dot_one['diff']['after']['name'] == "R1-changed-name" - - test_three_dot_one['device']['device_role'] == 1 - - test_three_dot_one['device']['device_type'] == 1 - - test_three_dot_one['device']['site'] == 1 - - test_three_dot_one['device']['status'] == "staged" - - test_three_dot_one['device']['serial'] == "FXS1001" - - test_three_dot_one['device']['local_context_data']["bgp_as"] == "65412" - - test_three_dot_one['msg'] == "device R1-changed-name updated" - -- name: "4 - Create device with tags and assign to rack" - networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "TestR1" - device_type: "1841" - device_role: "Core Switch" - site: "Test Site2" - rack: "Test Rack Site 2" - position: 35 - face: "Front" - tags: - - "schnozzberry" - tenant: "Test Tenant" - asset_tag: "1234" - state: present - register: test_four - -- name: "4 - ASSERT" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['device']['name'] == "TestR1" - - test_four['device']['device_role'] == 1 - - test_four['device']['device_type'] == 5 - - test_four['device']['site'] == 2 - - test_four['device']['status'] == "active" - - test_four['device']['rack'] == 1 - - test_four['device']['tags'][0] == 4 - - test_four['device']['tenant'] == 1 - - test_four['device']['asset_tag'] == '1234' - - test_four['msg'] == "device TestR1 created" - -- name: "5 - Delete previous device" - networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "TestR1" - state: absent - register: test_five - -- name: "5 - ASSERT" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['msg'] == "device TestR1 deleted" - -- name: "6 - Delete R1" - networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "R1-changed-name" - state: absent - register: test_six - -- name: "6 - ASSERT" - assert: - that: - - test_six is changed - - test_six['diff']['before']['state'] == "present" - - test_six['diff']['after']['state'] == "absent" - - test_six['msg'] == "device R1-changed-name deleted" - -- name: "7 - Add primary_ip4/6 to test100" - networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "test100" - primary_ip4: "172.16.180.1/24" - primary_ip6: "2001::1:1/64" - state: present - register: test_seven - -- name: "7 - ASSERT" - assert: - that: - - test_seven is changed - - test_seven['diff']['after']['primary_ip4'] == 1 - - test_seven['diff']['after']['primary_ip6'] == 2 - - test_seven['device']['name'] == "test100" - - test_seven['device']['device_role'] == 1 - - test_seven['device']['device_type'] == 1 - - test_seven['device']['site'] == 1 - - test_seven['device']['status'] == "active" - - test_seven['device']['primary_ip4'] == 1 - - test_seven['device']['primary_ip6'] == 2 - - test_seven['msg'] == "device test100 updated" - -- name: "8 - Device with empty string name" - networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "" - device_type: - id: 1 - device_role: "Core Switch" - site: "Test Site" - status: "Staged" - state: present - register: test_eight - -- name: "8 - ASSERT" - assert: - that: - - test_eight is changed - - test_eight['diff']['before']['state'] == 'absent' - - test_eight['diff']['after']['state'] == 'present' - - test_eight['device']['device_role'] == 1 - - test_eight['device']['device_type'] == 1 - - test_eight['device']['site'] == 1 - - test_eight['device']['status'] == "staged" - - "'-' in test_eight['device']['name']" - - "test_eight['device']['name'] | length == 36" diff --git a/tests/integration/targets/v2.9/tasks/device_bay.yml b/tests/integration/targets/v2.9/tasks/device_bay.yml deleted file mode 100644 index 9e11ad9d..00000000 --- a/tests/integration/targets/v2.9/tasks/device_bay.yml +++ /dev/null @@ -1,87 +0,0 @@ ---- -## -## -### PYNAUTOBOT_DEVICE_BAY -## -## -- name: "DEVICE_BAY 1: Necessary info creation" - networktocode.nautobot.device_bay: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device: "Test Nexus One" - name: "Device Bay One" - state: present - register: test_one - -- name: "DEVICE_BAY 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['device_bay']['name'] == "Device Bay One" - - test_one['device_bay']['device'] == 4 - - test_one['msg'] == "device_bay Device Bay One created" - -- name: "DEVICE_BAY 2: Create duplicate" - networktocode.nautobot.device_bay: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device: "Test Nexus One" - name: "Device Bay One" - state: present - register: test_two - -- name: "DEVICE_BAY 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['device_bay']['name'] == "Device Bay One" - - test_two['device_bay']['device'] == 4 - - test_two['msg'] == "device_bay Device Bay One already exists" - -- name: "DEVICE_BAY 3: ASSERT - Update" - networktocode.nautobot.device_bay: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device: "Test Nexus One" - name: "Device Bay One" - installed_device: "Test Nexus Child One" - tags: - - "Schnozzberry" - state: present - register: test_three - -- name: "DEVICE_BAY 3: ASSERT - Updated" - assert: - that: - - test_three is changed - - test_three['diff']['after']['installed_device'] == 5 - - test_three['diff']['after']['tags'][0] == 4 - - test_three['device_bay']['name'] == "Device Bay One" - - test_three['device_bay']['device'] == 4 - - test_three['device_bay']['installed_device'] == 5 - - test_three['device_bay']['tags'][0] == 4 - - test_three['msg'] == "device_bay Device Bay One updated" - -- name: "DEVICE_BAY 4: ASSERT - Delete" - networktocode.nautobot.device_bay: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Device Bay One" - state: absent - register: test_four - -- name: "DEVICE_BAY 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['device_bay']['name'] == "Device Bay One" - - test_four['device_bay']['device'] == 4 - - test_four['device_bay']['installed_device'] == 5 - - test_four['device_bay']['tags'][0] == 4 - - test_four['msg'] == "device_bay Device Bay One deleted" diff --git a/tests/integration/targets/v2.9/tasks/device_bay_template.yml b/tests/integration/targets/v2.9/tasks/device_bay_template.yml deleted file mode 100644 index 2aeefe48..00000000 --- a/tests/integration/targets/v2.9/tasks/device_bay_template.yml +++ /dev/null @@ -1,81 +0,0 @@ ---- -## -## -### PYNAUTOBOT_DEVICE_BAY_TEMPLATE -## -## -- name: "DEVICE_BAY_TEMPLATE 1: Necessary info creation" - networktocode.nautobot.device_bay_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device_type: WS Test 3850 - name: Device Bay Template One - state: present - register: test_one - -- name: "DEVICE_BAY_TEMPLATE 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['device_bay_template']['name'] == "Device Bay Template One" - - test_one['device_bay_template']['device_type'] == 7 - - test_one['msg'] == "device_bay_template Device Bay Template One created" - -- name: "DEVICE_BAY_TEMPLATE 2: Create duplicate" - networktocode.nautobot.device_bay_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device_type: WS Test 3850 - name: Device Bay Template One - state: present - register: test_two - -- name: "DEVICE_BAY_TEMPLATE 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['device_bay_template']['name'] == "Device Bay Template One" - - test_two['device_bay_template']['device_type'] == 7 - - test_two['msg'] == "device_bay_template Device Bay Template One already exists" - -- name: "DEVICE_BAY_TEMPLATE 3: ASSERT - Create Device Bay Template for Delete Test" - networktocode.nautobot.device_bay_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device_type: WS Test 3850 - name: Device Bay Template Two - state: present - register: test_three - -- name: "DEVICE_BAY_TEMPLATE 3: ASSERT - Updated" - assert: - that: - - test_three is changed - - test_three['diff']['before']['state'] == "absent" - - test_three['diff']['after']['state'] == "present" - - test_three['device_bay_template']['name'] == "Device Bay Template Two" - - test_three['device_bay_template']['device_type'] == 7 - - test_three['msg'] == "device_bay_template Device Bay Template Two created" - -- name: "DEVICE_BAY_TEMPLATE 4: ASSERT - Delete" - networktocode.nautobot.device_bay_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Device Bay Template Two - device_type: WS Test 3850 - state: absent - register: test_four - -- name: "DEVICE_BAY_TEMPLATE 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['device_bay_template']['name'] == "Device Bay Template Two" - - test_four['device_bay_template']['device_type'] == 7 - - test_four['msg'] == "device_bay_template Device Bay Template Two deleted" diff --git a/tests/integration/targets/v2.9/tasks/device_interface.yml b/tests/integration/targets/v2.9/tasks/device_interface.yml deleted file mode 100644 index 4a167cab..00000000 --- a/tests/integration/targets/v2.9/tasks/device_interface.yml +++ /dev/null @@ -1,291 +0,0 @@ ---- -## -## -### PYNAUTOBOT_DEVICE_INTERFACE -## -## -- name: "1 - Interface with required information" - networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: test100 - name: GigabitEthernet3 - type: "1000Base-T (1GE)" - register: test_one - -- name: "1 - ASSERT" - assert: - that: - - test_one is changed - - test_one['msg'] == "interface GigabitEthernet3 created" - - test_one['diff']['before']['state'] == 'absent' - - test_one['diff']['after']['state'] == 'present' - - test_one['interface']['name'] == "GigabitEthernet3" - - test_one['interface']['device'] == 1 - -- name: "2 - Update test100 - GigabitEthernet3" - networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: test100 - name: GigabitEthernet3 - mtu: 1600 - enabled: false - register: test_two - -- name: "2 - ASSERT" - assert: - that: - - test_two is changed - - test_two['msg'] == "interface GigabitEthernet3 updated" - - test_two['diff']['after']['enabled'] == false - - test_two['diff']['after']['mtu'] == 1600 - - test_two['interface']['name'] == "GigabitEthernet3" - - test_two['interface']['device'] == 1 - - test_two['interface']['enabled'] == false - - test_two['interface']['mtu'] == 1600 - -- name: "3 - Delete interface test100 - GigabitEthernet3" - networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: test100 - name: GigabitEthernet3 - state: absent - register: test_three - -- name: "3 - ASSERT" - assert: - that: - - test_three is changed - - test_three['msg'] == "interface GigabitEthernet3 deleted" - - test_three['diff']['before']['state'] == "present" - - test_three['diff']['after']['state'] == "absent" - -- name: "4 - Create LAG with several specified options" - networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: test100 - name: port-channel1 - type: Link Aggregation Group (LAG) - mtu: 1600 - mgmt_only: false - mode: Access - state: present - register: test_four - -- name: "4 - ASSERT" - assert: - that: - - test_four is changed - - test_four['msg'] == "interface port-channel1 created" - - test_four['diff']['before']['state'] == 'absent' - - test_four['diff']['after']['state'] == 'present' - - test_four['interface']['name'] == "port-channel1" - - test_four['interface']['device'] == 1 - - test_four['interface']['enabled'] == true - - test_four['interface']['type'] == "lag" - - test_four['interface']['mgmt_only'] == false - - test_four['interface']['mode'] == "access" - - test_four['interface']['mtu'] == 1600 - -- name: "5 - Create interface and assign it to parent LAG" - networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: test100 - name: GigabitEthernet3 - enabled: false - type: 1000Base-T (1GE) - lag: - name: port-channel1 - mtu: 1600 - mgmt_only: false - mode: Access - state: present - register: test_five - -- name: "5 - ASSERT" - assert: - that: - - test_five is changed - - test_five['msg'] == "interface GigabitEthernet3 created" - - test_five['diff']['before']['state'] == 'absent' - - test_five['diff']['after']['state'] == 'present' - - test_five['interface']['name'] == "GigabitEthernet3" - - test_five['interface']['device'] == 1 - - test_five['interface']['enabled'] == false - - test_five['interface']['type'] == "1000base-t" - - test_five['interface']['mgmt_only'] == false - - test_five['interface']['lag'] == 8 - - test_five['interface']['mode'] == "access" - - test_five['interface']['mtu'] == 1600 - -- name: "6 - Create interface as trunk port" - networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: test100 - name: GigabitEthernet21 - enabled: false - type: 1000Base-T (1GE) - untagged_vlan: - name: Wireless - site: Test Site - tagged_vlans: - - name: Data - site: Test Site - - name: VoIP - site: Test Site - mtu: 1600 - mgmt_only: true - mode: Tagged - state: present - register: test_six - -- name: "6 - ASSERT" - assert: - that: - - test_six is changed - - test_six['msg'] == "interface GigabitEthernet21 created" - - test_six['diff']['before']['state'] == 'absent' - - test_six['diff']['after']['state'] == 'present' - - test_six['interface']['name'] == "GigabitEthernet21" - - test_six['interface']['device'] == 1 - - test_six['interface']['enabled'] == false - - test_six['interface']['type'] == "1000base-t" - - test_six['interface']['mgmt_only'] == true - - test_six['interface']['mode'] == "tagged" - - test_six['interface']['mtu'] == 1600 - - test_six['interface']['tagged_vlans'] == [2, 3] - - test_six['interface']['untagged_vlan'] == 1 - -- name: "7 - Duplicate Interface" - networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: test100 - name: GigabitEthernet1 - register: test_seven - -- name: "7 - ASSERT" - assert: - that: - - not test_seven['changed'] - - test_seven['msg'] == "interface GigabitEthernet1 already exists" - - test_seven['interface']['name'] == "GigabitEthernet1" - - test_seven['interface']['device'] == 1 - -- name: "Add port-channel1 to R1 to test finding proper port-channel1" - networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: "R1-Device" - name: "port-channel1" - type: "Link Aggregation Group (LAG)" - -- name: "8 - Create interface and assign it to parent LAG - non dict" - networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: test100 - name: GigabitEthernet4 - enabled: false - type: 1000Base-T (1GE) - lag: "port-channel1" - mtu: 1600 - mgmt_only: false - mode: Access - state: present - register: test_eight - -- name: "8 - ASSERT" - assert: - that: - - test_eight is changed - - test_eight['msg'] == "interface GigabitEthernet4 created" - - test_eight['diff']['before']['state'] == 'absent' - - test_eight['diff']['after']['state'] == 'present' - - test_eight['interface']['name'] == "GigabitEthernet4" - - test_eight['interface']['device'] == 1 - - test_eight['interface']['enabled'] == false - - test_eight['interface']['type'] == "1000base-t" - - test_eight['interface']['mgmt_only'] == false - - test_eight['interface']['lag'] == 8 - - test_eight['interface']['mode'] == "access" - - test_eight['interface']['mtu'] == 1600 - -- name: "9 - Create interface on VC child" - networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: Test Nexus Child One - name: Ethernet2/2 - type: 1000Base-T (1GE) - state: present - register: test_nine - -- name: "9 - ASSERT" - assert: - that: - - test_nine is changed - - test_nine['msg'] == "interface Ethernet2/2 created" - - test_nine['diff']['before']['state'] == 'absent' - - test_nine['diff']['after']['state'] == 'present' - - test_nine['interface']['name'] == "Ethernet2/2" - - test_nine['interface']['device'] == 5 - - test_nine['interface']['enabled'] == true - - test_nine['interface']['type'] == "1000base-t" - -- name: "10 - Update interface on VC child" - networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: Test Nexus One - name: Ethernet2/2 - description: "Updated child interface from parent device" - update_vc_child: True - state: present - register: test_ten - -- name: "10 - ASSERT" - assert: - that: - - test_ten is changed - - test_ten['msg'] == "interface Ethernet2/2 updated" - - test_ten['diff']['after']['description'] == 'Updated child interface from parent device' - - test_ten['interface']['name'] == "Ethernet2/2" - - test_ten['interface']['device'] == 5 - - test_ten['interface']['enabled'] == true - - test_ten['interface']['type'] == "1000base-t" - - test_ten['interface']['description'] == 'Updated child interface from parent device' - -- name: "11 - Update interface on VC child w/o update_vc_child" - networktocode.nautobot.device_interface: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: Test Nexus One - name: Ethernet2/2 - description: "Updated child interface from parent device - test" - state: present - ignore_errors: yes - register: test_eleven - -- name: "11 - ASSERT" - assert: - that: - - test_eleven is failed - - test_eleven['msg'] == "Must set update_vc_child to True to allow child device interface modification" diff --git a/tests/integration/targets/v2.9/tasks/device_interface_template.yml b/tests/integration/targets/v2.9/tasks/device_interface_template.yml deleted file mode 100644 index fe148d4b..00000000 --- a/tests/integration/targets/v2.9/tasks/device_interface_template.yml +++ /dev/null @@ -1,109 +0,0 @@ ---- -## -## -### PYNAUTOBOT_DEVICE_INTERFACE_TEMPLATE -## -## -- name: "1 - Interface with required information" - networktocode.nautobot.device_interface_template: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device_type: Arista Test - name: 10GBASE-T (10GE) - type: 10gbase-t - register: test_one - -- name: "1 - ASSERT" - assert: - that: - - test_one is changed - - test_one['msg'] == "interface_template 10GBASE-T (10GE) created" - - test_one['diff']['before']['state'] == 'absent' - - test_one['diff']['after']['state'] == 'present' - - test_one['interface_template']['name'] == "10GBASE-T (10GE)" - - test_one['interface_template']['device_type'] == 2 - - test_one['interface_template']['type'] == '10gbase-t' - -- name: "2 - Update 10GBASE-T (10GE)" - networktocode.nautobot.device_interface_template: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device_type: Arista Test - name: 10GBASE-T (10GE) - type: 10gbase-t - mgmt_only: true - register: test_two - -- name: "2 - ASSERT" - assert: - that: - - test_two is changed - - test_two['msg'] == "interface_template 10GBASE-T (10GE) updated" - - test_two['diff']['after']['mgmt_only'] == true - - test_two['interface_template']['name'] == "10GBASE-T (10GE)" - - test_two['interface_template']['device_type'] == 2 - - test_two['interface_template']['mgmt_only'] == true - -- name: "3 - Delete interface template 10GBASE-T (10GE)" - networktocode.nautobot.device_interface_template: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device_type: Arista Test - name: 10GBASE-T (10GE) - type: 10gbase-t - state: absent - register: test_three - -- name: "3 - ASSERT" - assert: - that: - - test_three is changed - - test_three['msg'] == "interface_template 10GBASE-T (10GE) deleted" - - test_three['diff']['before']['state'] == "present" - - test_three['diff']['after']['state'] == "absent" - -- name: "4 - Create LAG with several specified options" - networktocode.nautobot.device_interface_template: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device_type: Arista Test - name: port channel template - type: lag - mgmt_only: false - state: present - register: test_four - -- name: "4 - ASSERT" - assert: - that: - - test_four is changed - - test_four['msg'] == "interface_template port channel template created" - - test_four['diff']['before']['state'] == 'absent' - - test_four['diff']['after']['state'] == 'present' - - test_four['interface_template']['name'] == "port channel template" - - test_four['interface_template']['device_type'] == 2 - - test_four['interface_template']['type'] == "lag" - - test_four['interface_template']['mgmt_only'] == false - -- name: "5 - Duplicate Interface Template port channel template" - networktocode.nautobot.device_interface_template: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device_type: Arista Test - name: port channel template - type: lag - register: test_five - -- name: "5 - ASSERT" - assert: - that: - - not test_five['changed'] - - test_five['msg'] == "interface_template port channel template already exists" - - test_five['interface_template']['name'] == "port channel template" - - test_five['interface_template']['device_type'] == 2 - - test_five['interface_template']['type'] == "lag" diff --git a/tests/integration/targets/v2.9/tasks/device_role.yml b/tests/integration/targets/v2.9/tasks/device_role.yml deleted file mode 100644 index fdcc0ca5..00000000 --- a/tests/integration/targets/v2.9/tasks/device_role.yml +++ /dev/null @@ -1,101 +0,0 @@ ---- -## -## -### PYNAUTOBOT_DEVICE_ROLE -## -## -- name: "DEVICE_ROLE 1: Necessary info creation" - networktocode.nautobot.device_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Device Role" - color: "FFFFFF" - state: present - register: test_one - -- name: "DEVICE_ROLE 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['device_role']['name'] == "Test Device Role" - - test_one['device_role']['slug'] == "test-device-role" - - test_one['device_role']['color'] == "ffffff" - - test_one['msg'] == "device_role Test Device Role created" - -- name: "DEVICE_ROLE 2: Create duplicate" - networktocode.nautobot.device_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Device Role" - color: "FFFFFF" - state: present - register: test_two - -- name: "DEVICE_ROLE 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['device_role']['name'] == "Test Device Role" - - test_two['device_role']['slug'] == "test-device-role" - - test_two['device_role']['color'] == "ffffff" - - test_two['msg'] == "device_role Test Device Role already exists" - -- name: "DEVICE_ROLE 3: ASSERT - Update" - networktocode.nautobot.device_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Device Role" - color: "003EFF" - vm_role: false - state: present - register: test_three - -- name: "DEVICE_ROLE 3: ASSERT - Update" - assert: - that: - - test_three is changed - - test_three['diff']['after']['color'] == "003eff" - - test_three['diff']['after']['vm_role'] == false - - test_three['device_role']['name'] == "Test Device Role" - - test_three['device_role']['slug'] == "test-device-role" - - test_three['device_role']['color'] == "003eff" - - test_three['device_role']['vm_role'] == false - - test_three['msg'] == "device_role Test Device Role updated" - -- name: "DEVICE_ROLE 4: ASSERT - Delete" - networktocode.nautobot.device_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Device Role - state: absent - register: test_four - -- name: "DEVICE_ROLE 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "present" - - test_four['diff']['after']['state'] == "absent" - - test_four['msg'] == "device_role Test Device Role deleted" - -- name: "DEVICE_ROLE 5: ASSERT - Delete non existing" - networktocode.nautobot.device_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Device Role - state: absent - register: test_five - -- name: "DEVICE_ROLE 5: ASSERT - Delete non existing`" - assert: - that: - - not test_five['changed'] - - test_five['device_role'] == None - - test_five['msg'] == "device_role Test Device Role already absent" diff --git a/tests/integration/targets/v2.9/tasks/device_type.yml b/tests/integration/targets/v2.9/tasks/device_type.yml deleted file mode 100644 index 8ad92e7a..00000000 --- a/tests/integration/targets/v2.9/tasks/device_type.yml +++ /dev/null @@ -1,131 +0,0 @@ ---- -## -## -### PYNAUTOBOT_DEVICE_TYPE -## -## -- name: "DEVICE_TYPE 1: Necessary info creation" - networktocode.nautobot.device_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - slug: test-device-type - model: ws-test-3750 - manufacturer: Test Manufacturer - state: present - register: test_one - -- name: "DEVICE_TYPE 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['device_type']['slug'] == "test-device-type" - - test_one['device_type']['model'] == "ws-test-3750" - - test_one['device_type']['manufacturer'] == 3 - - test_one['msg'] == "device_type test-device-type created" - -- name: "DEVICE_TYPE 2: Create duplicate" - networktocode.nautobot.device_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - slug: test-device-type - model: "ws-test-3750" - manufacturer: Test Manufacturer - state: present - register: test_two - -- name: "DEVICE_TYPE 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_one['device_type']['slug'] == "test-device-type" - - test_one['device_type']['model'] == "ws-test-3750" - - test_one['device_type']['manufacturer'] == 3 - - test_two['msg'] == "device_type test-device-type already exists" - -- name: "DEVICE_TYPE 3: ASSERT - Update" - networktocode.nautobot.device_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - slug: test-device-type - model: ws-test-3750 - manufacturer: Test Manufacturer - part_number: ws-3750g-v2 - u_height: 1 - is_full_depth: false - subdevice_role: parent - state: present - register: test_three - -- name: "DEVICE_TYPE 3: ASSERT - Update" - assert: - that: - - test_three is changed - - test_three['diff']['after']['is_full_depth'] == false - - test_three['diff']['after']['part_number'] == "ws-3750g-v2" - - test_three['diff']['after']['subdevice_role'] == "parent" - - test_three['device_type']['slug'] == "test-device-type" - - test_three['device_type']['model'] == "ws-test-3750" - - test_three['device_type']['manufacturer'] == 3 - - test_three['device_type']['is_full_depth'] == false - - test_three['device_type']['part_number'] == "ws-3750g-v2" - - test_three['device_type']['subdevice_role'] == "parent" - - test_three['msg'] == "device_type test-device-type updated" - -- name: "DEVICE_TYPE 4: ASSERT - Delete" - networktocode.nautobot.device_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - model: test-device-type - state: absent - register: test_four - -- name: "DEVICE_TYPE 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "present" - - test_four['diff']['after']['state'] == "absent" - - test_four['msg'] == "device_type test-device-type deleted" - -- name: "DEVICE_TYPE 5: ASSERT - Delete non existing" - networktocode.nautobot.device_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - model: "Test Device Type" - state: absent - register: test_five - -- name: "DEVICE_TYPE 5: ASSERT - Delete non existing`" - assert: - that: - - not test_five['changed'] - - test_five['device_type'] == None - - test_five['msg'] == "device_type Test Device Type already absent" - -- name: "DEVICE_TYPE 6: Without Slug" - networktocode.nautobot.device_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - model: "WS Test 3850" - manufacturer: Test Manufacturer - state: present - register: test_six - -- name: "DEVICE_TYPE 6: ASSERT - Without Slug" - assert: - that: - - test_six is changed - - test_six['diff']['before']['state'] == "absent" - - test_six['diff']['after']['state'] == "present" - - test_six['device_type']['slug'] == "ws-test-3850" - - test_six['device_type']['model'] == "WS Test 3850" - - test_six['device_type']['manufacturer'] == 3 - - test_six['msg'] == "device_type WS Test 3850 created" diff --git a/tests/integration/targets/v2.9/tasks/front_port.yml b/tests/integration/targets/v2.9/tasks/front_port.yml deleted file mode 100644 index 9d44a2b8..00000000 --- a/tests/integration/targets/v2.9/tasks/front_port.yml +++ /dev/null @@ -1,150 +0,0 @@ ---- -# © 2020 Nokia -# Licensed under the GNU General Public License v3.0 only -# SPDX-License-Identifier: GPL-3.0-only -## -## -### PYNAUTOBOT_FRONT_PORT -## -## -- name: "FRONT_PORT 1: Necessary info creation" - networktocode.nautobot.front_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port - device: test100 - type: bnc - rear_port: Rear Port - state: present - register: test_one - -- name: "FRONT_PORT 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['front_port']['name'] == "Front Port" - - test_one['front_port']['device'] == 1 - - test_one['front_port']['type'] == "bnc" - - test_one['front_port']['rear_port'] == 1 - - test_one['msg'] == "front_port Front Port created" - -- name: "FRONT_PORT 2: Create duplicate" - networktocode.nautobot.front_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port - device: test100 - type: bnc - rear_port: Rear Port - state: present - register: test_two - -- name: "FRONT_PORT 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['front_port']['name'] == "Front Port" - - test_two['front_port']['device'] == 1 - - test_two['front_port']['type'] == "bnc" - - test_two['front_port']['rear_port'] == 1 - - test_two['msg'] == "front_port Front Port already exists" - -- name: "FRONT_PORT 3: Update Front Port with other fields" - networktocode.nautobot.front_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port - device: test100 - type: bnc - rear_port: Rear Port - rear_port_position: 5 - description: test description - state: present - register: test_three - -- name: "FRONT_PORT 3: ASSERT - Update Front Port with other fields" - assert: - that: - - test_three is changed - - test_three['diff']['after']['rear_port_position'] == 5 - - test_three['diff']['after']['description'] == "test description" - - test_three['front_port']['name'] == "Front Port" - - test_three['front_port']['device'] == 1 - - test_three['front_port']['type'] == "bnc" - - test_three['front_port']['rear_port'] == 1 - - test_three['front_port']['rear_port_position'] == 5 - - test_three['front_port']['description'] == "test description" - - test_three['msg'] == "front_port Front Port updated" - -- name: "FRONT_PORT 4: Create Front Port for Delete Test" - networktocode.nautobot.front_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port 2 - device: test100 - type: bnc - rear_port: Rear Port - state: present - register: test_four - -- name: "FRONT_PORT 4: ASSERT - Create Front Port for Delete Test" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['front_port']['name'] == "Front Port 2" - - test_four['front_port']['device'] == 1 - - test_four['front_port']['type'] == "bnc" - - test_four['front_port']['rear_port'] == 1 - - test_four['msg'] == "front_port Front Port 2 created" - -- name: "FRONT_PORT 5: Delete Front Port" - networktocode.nautobot.front_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port 2 - device: test100 - type: bnc - rear_port: Rear Port - state: absent - register: test_five - -- name: "FRONT_PORT 5: ASSERT - Delete Front Port" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['msg'] == "front_port Front Port 2 deleted" - -- name: "FRONT_PORT 6: Create duplicate with rear_port dictionary" - networktocode.nautobot.front_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port - device: test100 - type: bnc - rear_port: - device: test100 - name: Rear Port - state: present - register: test_six - -- name: "FRONT_PORT 6: ASSERT - Create duplicate with rear_port dictionary" - assert: - that: - - not test_six['changed'] - - test_six['front_port']['name'] == "Front Port" - - test_six['front_port']['device'] == 1 - - test_six['front_port']['type'] == "bnc" - - test_six['front_port']['rear_port'] == 1 - - test_six['msg'] == "front_port Front Port already exists" diff --git a/tests/integration/targets/v2.9/tasks/front_port_template.yml b/tests/integration/targets/v2.9/tasks/front_port_template.yml deleted file mode 100644 index 88c3754d..00000000 --- a/tests/integration/targets/v2.9/tasks/front_port_template.yml +++ /dev/null @@ -1,147 +0,0 @@ ---- -# © 2020 Nokia -# Licensed under the GNU General Public License v3.0 only -# SPDX-License-Identifier: GPL-3.0-only -## -## -### PYNAUTOBOT_FRONT_PORT_TEMPLATE -## -## -- name: "FRONT_PORT_TEMPLATE 1: Necessary info creation" - networktocode.nautobot.front_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port Template - device_type: Cisco Test - type: bnc - rear_port_template: Rear Port Template - state: present - register: test_one - -- name: "FRONT_PORT_TEMPLATE 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['front_port_template']['name'] == "Front Port Template" - - test_one['front_port_template']['device_type'] == 1 - - test_one['front_port_template']['type'] == "bnc" - - test_one['front_port_template']['rear_port'] == 1 - - test_one['msg'] == "front_port_template Front Port Template created" - -- name: "FRONT_PORT_TEMPLATE 2: Create duplicate" - networktocode.nautobot.front_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port Template - device_type: Cisco Test - type: bnc - rear_port_template: Rear Port Template - state: present - register: test_two - -- name: "FRONT_PORT_TEMPLATE 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['front_port_template']['name'] == "Front Port Template" - - test_two['front_port_template']['device_type'] == 1 - - test_two['front_port_template']['type'] == "bnc" - - test_two['front_port_template']['rear_port'] == 1 - - test_two['msg'] == "front_port_template Front Port Template already exists" - -- name: "FRONT_PORT_TEMPLATE 3: Update Front Port Template with other fields" - networktocode.nautobot.front_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port Template - device_type: Cisco Test - type: bnc - rear_port_template: Rear Port Template - rear_port_template_position: 5 - state: present - register: test_three - -- name: "FRONT_PORT_TEMPLATE 3: ASSERT - Update Front Port Template with other fields" - assert: - that: - - test_three is changed - - test_three['diff']['after']['rear_port_position'] == 5 - - test_three['front_port_template']['name'] == "Front Port Template" - - test_three['front_port_template']['device_type'] == 1 - - test_three['front_port_template']['type'] == "bnc" - - test_three['front_port_template']['rear_port_position'] == 5 - - test_three['front_port_template']['rear_port'] == 1 - - test_three['msg'] == "front_port_template Front Port Template updated" - -- name: "FRONT_PORT_TEMPLATE 4: Create Front Port Template for Delete Test" - networktocode.nautobot.front_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port Template 2 - device_type: Cisco Test - type: bnc - rear_port_template: Rear Port Template - state: present - register: test_four - -- name: "FRONT_PORT_TEMPLATE 4: ASSERT - Create Front Port Template for Delete Test" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['front_port_template']['name'] == "Front Port Template 2" - - test_four['front_port_template']['device_type'] == 1 - - test_four['front_port_template']['type'] == "bnc" - - test_four['front_port_template']['rear_port'] == 1 - - test_four['msg'] == "front_port_template Front Port Template 2 created" - -- name: "FRONT_PORT_TEMPLATE 5: Delete Front Port Template" - networktocode.nautobot.front_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port Template 2 - device_type: Cisco Test - type: bnc - rear_port_template: Rear Port Template - state: absent - register: test_five - -- name: "FRONT_PORT_TEMPLATE 5: ASSERT - Delete Front Port Template" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['msg'] == "front_port_template Front Port Template 2 deleted" - -- name: "FRONT_PORT 6: Create duplicate with rear_port_template dictionary" - networktocode.nautobot.front_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Front Port Template - device_type: Cisco Test - type: bnc - rear_port_template: - device: Cisco Test - name: Rear Port Template - state: present - register: test_six - -- name: "FRONT_PORT 6: ASSERT - Create duplicate with rear_port_template dictionary" - assert: - that: - - not test_six['changed'] - - test_six['front_port_template']['name'] == "Front Port Template" - - test_six['front_port_template']['device_type'] == 1 - - test_six['front_port_template']['type'] == "bnc" - - test_six['front_port_template']['rear_port'] == 1 - - test_six['msg'] == "front_port_template Front Port Template already exists" diff --git a/tests/integration/targets/v2.9/tasks/inventory_item.yml b/tests/integration/targets/v2.9/tasks/inventory_item.yml deleted file mode 100644 index 4cdee971..00000000 --- a/tests/integration/targets/v2.9/tasks/inventory_item.yml +++ /dev/null @@ -1,107 +0,0 @@ ---- -## -## -### PYNAUTOBOT_INVENTORY_ITEM -## -## -- name: "INVENTORY_ITEM 1: Necessary info creation" - networktocode.nautobot.inventory_item: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device: "test100" - name: "10G-SFP+" - state: present - register: test_one - -- name: "INVENTORY_ITEM 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['inventory_item']['name'] == "10G-SFP+" - - test_one['inventory_item']['device'] == 1 - - test_one['msg'] == "inventory_item 10G-SFP+ created" - -- name: "INVENTORY_ITEM 2: Create duplicate" - networktocode.nautobot.inventory_item: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device: "test100" - name: "10G-SFP+" - state: present - register: test_two - -- name: "INVENTORY_ITEM 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['inventory_item']['name'] == "10G-SFP+" - - test_two['inventory_item']['device'] == 1 - - test_two['msg'] == "inventory_item 10G-SFP+ already exists" - -- name: "INVENTORY_ITEM 3: ASSERT - Update" - networktocode.nautobot.inventory_item: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device: "test100" - name: "10G-SFP+" - manufacturer: "Cisco" - part_id: "10G-SFP+" - serial: "1234" - asset_tag: "1234" - description: "New SFP" - discovered: True - tags: - - "Schnozzberry" - state: present - register: test_three - -- name: "INVENTORY_ITEM 3: ASSERT - Updated" - assert: - that: - - test_three is changed - - test_three['diff']['after']['asset_tag'] == "1234" - - test_three['diff']['after']['serial'] == "1234" - - test_three['diff']['after']['description'] == "New SFP" - - test_three['diff']['after']['manufacturer'] == 1 - - test_three['diff']['after']['part_id'] == "10G-SFP+" - - test_three['diff']['after']['tags'][0] == 4 - - test_three['diff']['after']['discovered'] == True - - test_three['inventory_item']['name'] == "10G-SFP+" - - test_three['inventory_item']['device'] == 1 - - test_three['inventory_item']['asset_tag'] == "1234" - - test_three['inventory_item']['serial'] == "1234" - - test_three['inventory_item']['description'] == "New SFP" - - test_three['inventory_item']['manufacturer'] == 1 - - test_three['inventory_item']['part_id'] == "10G-SFP+" - - test_three['inventory_item']['tags'][0] == 4 - - test_three['inventory_item']['discovered'] == True - - test_three['msg'] == "inventory_item 10G-SFP+ updated" - -- name: "INVENTORY_ITEM 4: ASSERT - Delete" - networktocode.nautobot.inventory_item: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - device: "test100" - name: "10G-SFP+" - state: absent - register: test_four - -- name: "INVENTORY_ITEM 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['inventory_item']['name'] == "10G-SFP+" - - test_four['inventory_item']['device'] == 1 - - test_four['inventory_item']['asset_tag'] == "1234" - - test_four['inventory_item']['serial'] == "1234" - - test_four['inventory_item']['description'] == "New SFP" - - test_four['inventory_item']['manufacturer'] == 1 - - test_four['inventory_item']['part_id'] == "10G-SFP+" - - test_four['inventory_item']['tags'][0] == 4 - - test_four['msg'] == "inventory_item 10G-SFP+ deleted" diff --git a/tests/integration/targets/v2.9/tasks/ip_address.yml b/tests/integration/targets/v2.9/tasks/ip_address.yml deleted file mode 100644 index 652c1d02..00000000 --- a/tests/integration/targets/v2.9/tasks/ip_address.yml +++ /dev/null @@ -1,350 +0,0 @@ ---- -## -## -### PYNAUTOBOT_IP_ADDRESS -## -## -- name: "1 - Create IP address within Nautobot with only required information - State: Present" - networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - address: 192.168.1.10/30 - state: present - register: test_one - -- name: "1 - ASSERT" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['msg'] == "ip_address 192.168.1.10/30 created" - - test_one['ip_address']['address'] == "192.168.1.10/30" - -- name: "2 - Update 192.168.1.10/30" - networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - address: 192.168.1.10/30 - description: "Updated ip address" - tags: - - "Updated" - state: present - register: test_two - -- name: "2 - ASSERT" - assert: - that: - - test_two is changed - - test_two['diff']['after']['description'] == "Updated ip address" - - test_two['diff']['after']['tags'][0] == 10 - - test_two['msg'] == "ip_address 192.168.1.10/30 updated" - - test_two['ip_address']['address'] == "192.168.1.10/30" - - test_two['ip_address']['tags'][0] == 10 - - test_two['ip_address']['description'] == "Updated ip address" - -- name: "3 - Delete IP - 192.168.1.10 - State: Absent" - networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - address: 192.168.1.10/30 - state: absent - register: test_three - -- name: "3 - ASSERT" - assert: - that: - - test_three is changed - - test_three['diff']['before']['state'] == "present" - - test_three['diff']['after']['state'] == "absent" - - test_three['msg'] == "ip_address 192.168.1.10/30 deleted" - -- name: "4 - Create IP in global VRF - 192.168.1.20/30 - State: Present" - networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - address: 192.168.1.20/30 - state: present - register: test_four - -- name: "4 - ASSERT" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['msg'] == "ip_address 192.168.1.20/30 created" - - test_four['ip_address']['address'] == "192.168.1.20/30" - -- name: "5 - Create IP in global VRF - 192.168.1.20/30 - State: New" - networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - address: 192.168.1.20/30 - state: new - register: test_five - -- name: "5 - ASSERT" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "absent" - - test_five['diff']['after']['state'] == "present" - - test_five['msg'] == "ip_address 192.168.1.20/30 created" - - test_five['ip_address']['address'] == "192.168.1.20/30" - -- name: "6 - Create new address with only prefix specified - State: new" - networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: 192.168.100.0/24 - state: new - register: test_six - -- name: "6 - ASSERT" - assert: - that: - - test_six is changed - - test_six['diff']['before']['state'] == "absent" - - test_six['diff']['after']['state'] == "present" - - test_six['msg'] == "ip_address 192.168.100.1/24 created" - - test_six['ip_address']['address'] == "192.168.100.1/24" - -- name: "7 - Create IP address with several specified" - networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - family: 4 - address: 172.16.1.20/24 - vrf: Test VRF - tenant: Test Tenant - status: Reserved - role: Loopback - description: Test description - tags: - - "Schnozzberry" - state: present - register: test_seven - -- name: "7 - ASSERT" - assert: - that: - - test_seven is changed - - test_seven['diff']['before']['state'] == "absent" - - test_seven['diff']['after']['state'] == "present" - - test_seven['msg'] == "ip_address 172.16.1.20/24 created" - - test_seven['ip_address']['address'] == "172.16.1.20/24" - - test_seven['ip_address']['description'] == "Test description" - - test_seven['ip_address']['family'] == 4 - - test_seven['ip_address']['role'] == "loopback" - - test_seven['ip_address']['status'] == "reserved" - - test_seven['ip_address']['tags'][0] == 4 - - test_seven['ip_address']['tenant'] == 1 - - test_seven['ip_address']['vrf'] == 1 - -- name: "8 - Create IP address and assign a nat_inside IP" - networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - family: 4 - address: 10.10.1.30/16 - vrf: Test VRF - nat_inside: - address: 172.16.1.20 - vrf: Test VRF - register: test_eight - -- name: "8 - ASSERT" - assert: - that: - - test_eight is changed - - test_eight['diff']['before']['state'] == "absent" - - test_eight['diff']['after']['state'] == "present" - - test_eight['msg'] == "ip_address 10.10.1.30/16 created" - - test_eight['ip_address']['address'] == "10.10.1.30/16" - - test_eight['ip_address']['family'] == 4 - - test_eight['ip_address']['nat_inside'] == 11 - - test_eight['ip_address']['vrf'] == 1 - -- name: "9 - Create IP address on GigabitEthernet2 - test100 - State: present" - networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - family: 4 - address: 10.10.200.30/16 - assigned_object: - name: GigabitEthernet2 - device: test100 - register: test_nine - -- name: "9 - ASSERT" - assert: - that: - - test_nine is changed - - test_nine['diff']['before']['state'] == "absent" - - test_nine['diff']['after']['state'] == "present" - - test_nine['msg'] == "ip_address 10.10.200.30/16 created" - - test_nine['ip_address']['address'] == "10.10.200.30/16" - - test_nine['ip_address']['family'] == 4 - - test_nine['ip_address']['assigned_object_type'] == "dcim.interface" - - test_nine['ip_address']['assigned_object_id'] == 4 - -- name: "10 - Create IP address on GigabitEthernet2 - test100 - State: new" - networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - family: 4 - prefix: 10.10.0.0/16 - assigned_object: - name: GigabitEthernet2 - device: test100 - state: new - register: test_ten - -- name: "10 - ASSERT" - assert: - that: - - test_ten is changed - - test_ten['diff']['before']['state'] == "absent" - - test_ten['diff']['after']['state'] == "present" - - test_ten['msg'] == "ip_address 10.10.0.1/16 created" - - test_ten['ip_address']['address'] == "10.10.0.1/16" - - test_ten['ip_address']['family'] == 4 - - test_ten['ip_address']['assigned_object_type'] == "dcim.interface" - - test_ten['ip_address']['assigned_object_id'] == 4 - -- name: "11 - Create IP address on GigabitEthernet2 - test100 - State: present" - networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - family: 4 - prefix: 192.168.100.0/24 - assigned_object: - name: GigabitEthernet2 - device: test100 - state: present - register: test_eleven - -- name: "11 - ASSERT" - assert: - that: - - test_eleven is changed - - test_eleven['diff']['before']['state'] == "absent" - - test_eleven['diff']['after']['state'] == "present" - - test_eleven['msg'] == "ip_address 192.168.100.2/24 created" - - test_eleven['ip_address']['address'] == "192.168.100.2/24" - -- name: "12 - Duplicate - 192.168.100.2/24 on interface" - networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - address: 192.168.100.2/24 - assigned_object: - name: GigabitEthernet2 - device: test100 - state: present - register: test_twelve - -- name: "12 - ASSERT" - assert: - that: - - not test_twelve['changed'] - - test_twelve['msg'] == "ip_address 192.168.100.2/24 already exists" - - test_twelve['ip_address']['address'] == "192.168.100.2/24" - - test_twelve['ip_address']['assigned_object_type'] == "dcim.interface" - - test_twelve['ip_address']['assigned_object_id'] == 4 - -- name: "13 - Duplicate - 192.168.100.2/24" - networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - address: 192.168.100.2/24 - state: present - register: test_thirteen - -- name: "13 - ASSERT" - assert: - that: - - not test_thirteen['changed'] - - test_thirteen['msg'] == "ip_address 192.168.100.2/24 already exists" - - test_thirteen['ip_address']['address'] == "192.168.100.2/24" - -- name: "14 - Create IP address on Eth0 - test100-vm - State: present" - networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - family: 4 - address: 10.188.1.100/24 - assigned_object: - name: Eth0 - virtual_machine: test100-vm - register: test_fourteen - -- name: "14 - ASSERT" - assert: - that: - - test_fourteen is changed - - test_fourteen['diff']['before']['state'] == "absent" - - test_fourteen['diff']['after']['state'] == "present" - - test_fourteen['msg'] == "ip_address 10.188.1.100/24 created" - - test_fourteen['ip_address']['address'] == "10.188.1.100/24" - - test_fourteen['ip_address']['family'] == 4 - - test_fourteen['ip_address']['assigned_object_type'] == "virtualization.vminterface" - - test_fourteen['ip_address']['assigned_object_id'] == 1 - -- name: "15 - Create same IP address on Eth0 - test101-vm - State: present" - networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - family: 4 - address: 10.188.1.100/24 - assigned_object: - name: Eth0 - virtual_machine: test101-vm - state: "present" - register: test_fifteen - -- name: "15 - ASSERT" - assert: - that: - - test_fifteen is changed - - test_fifteen['diff']['before']['state'] == "absent" - - test_fifteen['diff']['after']['state'] == "present" - - test_fifteen['msg'] == "ip_address 10.188.1.100/24 created" - - test_fifteen['ip_address']['address'] == "10.188.1.100/24" - - test_fifteen['ip_address']['family'] == 4 - - test_fifteen['ip_address']['assigned_object_type'] == "virtualization.vminterface" - - test_fifteen['ip_address']['assigned_object_id'] == 6 - -- name: "16 - Create IP address with no mask - State: Present" - networktocode.nautobot.ip_address: - url: http://localhost.org:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - address: 10.120.10.1 - state: present - register: test_sixteen - -- name: "16 - ASSERT" - assert: - that: - - test_sixteen is changed - - test_sixteen['diff']['before']['state'] == "absent" - - test_sixteen['diff']['after']['state'] == "present" - - test_sixteen['msg'] == "ip_address 10.120.10.1/32 created" - - test_sixteen['ip_address']['address'] == "10.120.10.1/32" diff --git a/tests/integration/targets/v2.9/tasks/ipam_role.yml b/tests/integration/targets/v2.9/tasks/ipam_role.yml deleted file mode 100644 index f2a7d023..00000000 --- a/tests/integration/targets/v2.9/tasks/ipam_role.yml +++ /dev/null @@ -1,94 +0,0 @@ ---- -## -## -### PYNAUTOBOT_IPAM_ROLE -## -## -- name: "IPAM_ROLE 1: Necessary info creation" - networktocode.nautobot.ipam_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test IPAM Role" - state: present - register: test_one - -- name: "IPAM_ROLE 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['role']['name'] == "Test IPAM Role" - - test_one['role']['slug'] == "test-ipam-role" - - test_one['msg'] == "role Test IPAM Role created" - -- name: "IPAM_ROLE 2: Create duplicate" - networktocode.nautobot.ipam_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test IPAM Role" - state: present - register: test_two - -- name: "IPAM_ROLE 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['role']['name'] == "Test IPAM Role" - - test_two['role']['slug'] == "test-ipam-role" - - test_two['msg'] == "role Test IPAM Role already exists" - -- name: "IPAM_ROLE 3: ASSERT - Update" - networktocode.nautobot.ipam_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test IPAM Role" - weight: 4096 - state: present - register: test_three - -- name: "IPAM_ROLE 3: ASSERT - Update" - assert: - that: - - test_three is changed - - test_three['diff']['after']['weight'] == 4096 - - test_three['role']['name'] == "Test IPAM Role" - - test_three['role']['slug'] == "test-ipam-role" - - test_three['role']['weight'] == 4096 - - test_three['msg'] == "role Test IPAM Role updated" - -- name: "IPAM_ROLE 4: ASSERT - Delete" - networktocode.nautobot.ipam_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test IPAM Role - state: absent - register: test_four - -- name: "IPAM_ROLE 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "present" - - test_four['diff']['after']['state'] == "absent" - - test_four['msg'] == "role Test IPAM Role deleted" - -- name: "IPAM_ROLE 5: ASSERT - Delete non existing" - networktocode.nautobot.ipam_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test IPAM Role - state: absent - register: test_five - -- name: "IPAM_ROLE 5: ASSERT - Delete non existing`" - assert: - that: - - not test_five['changed'] - - test_five['role'] == None - - test_five['msg'] == "role Test IPAM Role already absent" diff --git a/tests/integration/targets/v2.9/tasks/lookup.yml b/tests/integration/targets/v2.9/tasks/lookup.yml deleted file mode 100644 index 08ff2f12..00000000 --- a/tests/integration/targets/v2.9/tasks/lookup.yml +++ /dev/null @@ -1,82 +0,0 @@ ---- -## -## -### PYNAUTOBOT_LOOKUP -## -## -- name: "PYNAUTOBOT_LOOKUP 1: Lookup returns exactly two sites" - assert: - that: "{{ query_result|count }} == 3" - vars: - query_result: "{{ query('networktocode.nautobot.lookup', 'sites', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" - -- name: "PYNAUTOBOT_LOOKUP 2: Query doesn't return Wibble (sanity check json_query)" - assert: - that: "{{ query_result|json_query('[?value.display==`Wibble`]')|count }} == 0" - vars: - query_result: "{{ query('networktocode.nautobot.lookup', 'devices', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" - -- name: "PYNAUTOBOT_LOOKUP 3: Device query returns exactly one TestDeviceR1" - assert: - that: "{{ query_result|json_query('[?value.display==`TestDeviceR1`]')|count }} == 1" - vars: - query_result: "{{ query('networktocode.nautobot.lookup', 'devices', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" - -- name: "PYNAUTOBOT_LOOKUP 4: VLAN ID 400 can be queried and is named 'Test VLAN'" - assert: - that: "{{ (query_result|json_query('[?value.vid==`400`].value.name'))[0] == 'Test VLAN' }}" - vars: - query_result: "{{ query('networktocode.nautobot.lookup', 'vlans', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" - -- name: "PYNAUTOBOT_LOOKUP 5: Add one of two devices for lookup filter test." - networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "L1" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" - tags: - - "nolookup" - state: present - -- name: "PYNAUTOBOT_LOOKUP 6: Add two of two devices for lookup filter test." - networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "L2" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site2" - status: "Staged" - tags: - - "lookup" - state: present - -- name: "PYNAUTOBOT_LOOKUP 7: Device query returns exactly the L2 device" - assert: - that: "{{ query_result|json_query('[?value.display==`L2`]')|count }} == 1" - vars: - query_result: "{{ query('networktocode.nautobot.lookup', 'devices', api_filter='role=core-switch tag=lookup', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" - -- name: "PYNAUTOBOT_LOOKUP 8: Device query specifying raw data returns payload without key/value dict" - assert: - that: "{{ query_result|json_query('[?display==`L2`]')|count }} == 1" - vars: - query_result: "{{ query('networktocode.nautobot.lookup', 'devices', api_filter='role=core-switch tag=lookup', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567', raw_data=True) }}" - -- name: "PYNAUTOBOT_LOOKUP 9: Device query specifying multiple sites, Make sure L1 and L2 are in the results" - assert: - that: - - "'L1' in {{ query_result |json_query('[*].display') }}" - - "'L2' in {{ query_result |json_query('[*].display') }}" - vars: - query_result: "{{ query('networktocode.nautobot.lookup', 'devices', api_filter='role=core-switch site=test-site site=test-site2', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567', raw_data=True) }}" - -- name: "PYNAUTOBOT_LOOKUP 10: Device query by ID" - assert: - that: - - "{{ query('networktocode.nautobot.lookup', 'devices', api_filter='id=1', api_endpoint='http://localhost:32768', token='0123456789abcdef0123456789abcdef01234567') }}" diff --git a/tests/integration/targets/v2.9/tasks/main.yml b/tests/integration/targets/v2.9/tasks/main.yml deleted file mode 100644 index 589685ea..00000000 --- a/tests/integration/targets/v2.9/tasks/main.yml +++ /dev/null @@ -1,159 +0,0 @@ ---- -- name: "PYNAUTOBOT_DEVICE TESTS" - include_tasks: "device.yml" - -- name: "PYNAUTOBOT_DEVICE_INTERFACE TESTS" - include_tasks: "device_interface.yml" - -- name: "PYNAUTOBOT_DEVICE_INTERFACE_TEMPLATE TESTS" - include_tasks: "device_interface_template.yml" - -- name: "PYNAUTOBOT_IP_ADDRESS TESTS" - include_tasks: "ip_address.yml" - -- name: "PYNAUTOBOT_PREFIX TESTS" - include_tasks: "prefix.yml" - -- name: "PYNAUTOBOT_SITE TESTS" - include_tasks: "site.yml" - -- name: "PYNAUTOBOT_TENTANT TESTS" - include_tasks: "tenant.yml" - -- name: "PYNAUTOBOT_TENTANT_GROUP TESTS" - include_tasks: "tenant_group.yml" - -- name: "PYNAUTOBOT_RACK TESTS" - include_tasks: "rack.yml" - -- name: "PYNAUTOBOT_RACK_ROLE TESTS" - include_tasks: "rack_role.yml" - -- name: "PYNAUTOBOT_RACK_GROUP TESTS" - include_tasks: "rack_group.yml" - -- name: "PYNAUTOBOT_MANUFACTURER TESTS" - include_tasks: "manufacturer.yml" - -- name: "PYNAUTOBOT_PLATFORM TESTS" - include_tasks: "platform.yml" - -- name: "PYNAUTOBOT_DEVICE_TYPE TESTS" - include_tasks: "device_type.yml" - -- name: "PYNAUTOBOT_DEVICE_ROLE TESTS" - include_tasks: "device_role.yml" - -- name: "PYNAUTOBOT_IPAM_ROLE TESTS" - include_tasks: "ipam_role.yml" - -- name: "PYNAUTOBOT_VLAN_GROUP TESTS" - include_tasks: "vlan_group.yml" - -- name: "PYNAUTOBOT_VLAN TESTS" - include_tasks: "vlan.yml" - -- name: "PYNAUTOBOT_VRF TESTS" - include_tasks: "vrf.yml" - -- name: "PYNAUTOBOT_RIR TESTS" - include_tasks: "rir.yml" - -- name: "PYNAUTOBOT_AGGREGATE TESTS" - include_tasks: "aggregate.yml" - -- name: "PYNAUTOBOT_REGION TESTS" - include_tasks: "region.yml" - -- name: "PYNAUTOBOT_DEVICE_BAY TESTS" - include_tasks: "device_bay.yml" - -- name: "PYNAUTOBOT_DEVICE_BAY_TEMPLATE TESTS" - include_tasks: "device_bay_template.yml" - -- name: "PYNAUTOBOT_INVENTORY_ITEM TESTS" - include_tasks: "inventory_item.yml" - -- name: "PYNAUTOBOT_VIRTUAL_MACHINE TESTS" - include_tasks: "virtual_machine.yml" - -- name: "PYNAUTOBOT_CLUSTER TESTS" - include_tasks: "cluster.yml" - -- name: "PYNAUTOBOT_CLUSTER_GROUP TESTS" - include_tasks: "cluster_group.yml" - -- name: "PYNAUTOBOT_CLUSTER_TYPE TESTS" - include_tasks: "cluster_type.yml" - -- name: "PYNAUTOBOT_VM_INTERFACE TESTS" - include_tasks: "vm_interface.yml" - -- name: "PYNAUTOBOT_PROVIDER TESTS" - include_tasks: "provider.yml" - -- name: "PYNAUTOBOT_CIRCUIT_TYPE TESTS" - include_tasks: "circuit_type.yml" - -- name: "PYNAUTOBOT_CIRCUIT TESTS" - include_tasks: "circuit.yml" - -- name: "PYNAUTOBOT_CIRCUIT_TERMINATION TESTS" - include_tasks: "circuit_termination.yml" - -- name: "PYNAUTOBOT_REAR_PORT TESTS" - include_tasks: "rear_port.yml" - -- name: "PYNAUTOBOT_REAR_PORT_TEMPLATE TESTS" - include_tasks: "rear_port_template.yml" - -- name: "PYNAUTOBOT_FRONT_PORT TESTS" - include_tasks: "front_port.yml" - -- name: "PYNAUTOBOT_FRONT_PORT_TEMPLATE TESTS" - include_tasks: "front_port_template.yml" - -- name: "PYNAUTOBOT_CONSOLE_PORT TESTS" - include_tasks: "console_port.yml" - -- name: "PYNAUTOBOT_CONSOLE_PORT_TEMPLATE TESTS" - include_tasks: "console_port_template.yml" - -- name: "PYNAUTOBOT_CONSOLE_SERVER_PORT TESTS" - include_tasks: "console_server_port.yml" - -- name: "PYNAUTOBOT_CONSOLE_SERVER_PORT_TEMPLATE TESTS" - include_tasks: "console_server_port_template.yml" - -- name: "PYNAUTOBOT_POWER_PANEL TESTS" - include_tasks: "power_panel.yml" - -- name: "PYNAUTOBOT_POWER_FEED TESTS" - include_tasks: "power_feed.yml" - -- name: "PYNAUTOBOT_POWER_PORT TESTS" - include_tasks: "power_port.yml" - -- name: "PYNAUTOBOT_POWER_PORT_TEMPLATE TESTS" - include_tasks: "power_port_template.yml" - -- name: "PYNAUTOBOT_POWER_OUTLET TESTS" - include_tasks: "power_outlet.yml" - -- name: "PYNAUTOBOT_POWER_OUTLET_TEMPLATE TESTS" - include_tasks: "power_outlet_template.yml" - -- name: "PYNAUTOBOT_VIRTUAL_CHASSIS TESTS" - include_tasks: "virtual_chassis.yml" - -- name: "PYNAUTOBOT_CABLE TESTS" - include_tasks: "cable.yml" - -- name: "PYNAUTOBOT_SERVICE TESTS" - include_tasks: "service.yml" - -- name: "PYNAUTOBOT_LOOKUP TESTS" - include_tasks: "lookup.yml" - -- name: "PYNAUTOBOT_TAG_TESTS" - include_tasks: "tag.yml" diff --git a/tests/integration/targets/v2.9/tasks/manufacturer.yml b/tests/integration/targets/v2.9/tasks/manufacturer.yml deleted file mode 100644 index 1199683c..00000000 --- a/tests/integration/targets/v2.9/tasks/manufacturer.yml +++ /dev/null @@ -1,91 +0,0 @@ ---- -## -## -### PYNAUTOBOT_MANUFACTURER -## -## -- name: "MANUFACTURER 1: Necessary info creation" - networktocode.nautobot.manufacturer: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Manufacturer Two - state: present - register: test_one - -- name: "MANUFACTURER 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['manufacturer']['name'] == "Test Manufacturer Two" - - test_one['manufacturer']['slug'] == "test-manufacturer-two" - - test_one['msg'] == "manufacturer Test Manufacturer Two created" - -- name: "MANUFACTURER 2: Create duplicate" - networktocode.nautobot.manufacturer: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Manufacturer Two - state: present - register: test_two - -- name: "MANUFACTURER 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['manufacturer']['name'] == "Test Manufacturer Two" - - test_two['manufacturer']['slug'] == "test-manufacturer-two" - - test_two['msg'] == "manufacturer Test Manufacturer Two already exists" - -- name: "MANUFACTURER 3: Update" - networktocode.nautobot.manufacturer: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: test manufacturer two - state: present - register: test_three - -- name: "MANUFACTURER 3: ASSERT - Update" - assert: - that: - - test_three['changed'] - - test_three['manufacturer']['name'] == "test manufacturer two" - - test_three['manufacturer']['slug'] == "test-manufacturer-two" - - test_three['msg'] == "manufacturer test manufacturer two updated" - -- name: "MANUFACTURER 4: ASSERT - Delete" - networktocode.nautobot.manufacturer: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: test manufacturer two - state: absent - register: test_four - -- name: "MANUFACTURER 3: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "present" - - test_four['diff']['after']['state'] == "absent" - - test_four['msg'] == "manufacturer test manufacturer two deleted" - -- name: "MANUFACTURER 5: ASSERT - Delete non existing" - networktocode.nautobot.manufacturer: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Manufacturer Two - state: absent - register: test_five - -- name: "MANUFACTURER 5: ASSERT - Delete non existing" - assert: - that: - - not test_five['changed'] - - test_five['manufacturer'] == None - - test_five['msg'] == "manufacturer Test Manufacturer Two already absent" diff --git a/tests/integration/targets/v2.9/tasks/platform.yml b/tests/integration/targets/v2.9/tasks/platform.yml deleted file mode 100644 index 5e9c84ec..00000000 --- a/tests/integration/targets/v2.9/tasks/platform.yml +++ /dev/null @@ -1,99 +0,0 @@ ---- -## -## -### PYNAUTOBOT_PLATFORM -## -## -- name: "PLATFORM 1: Necessary info creation" - networktocode.nautobot.platform: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Platform - state: present - register: test_one - -- name: "PLATFORM 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['platform']['name'] == "Test Platform" - - test_one['platform']['slug'] == "test-platform" - - test_one['msg'] == "platform Test Platform created" - -- name: "PLATFORM 2: Create duplicate" - networktocode.nautobot.platform: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Platform - state: present - register: test_two - -- name: "PLATFORM 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['platform']['name'] == "Test Platform" - - test_two['platform']['slug'] == "test-platform" - - test_two['msg'] == "platform Test Platform already exists" - -- name: "PLATFORM 3: ASSERT - Update" - networktocode.nautobot.platform: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Platform - manufacturer: Test Manufacturer - napalm_driver: ios - napalm_args: - global_delay_factor: 2 - state: present - register: test_three - -- name: "PLATFORM 3: ASSERT - Update" - assert: - that: - - test_three is changed - - test_three['diff']['after']['manufacturer'] == 3 - - test_three['diff']['after']['napalm_args']['global_delay_factor'] == 2 - - test_three['diff']['after']['napalm_driver'] == "ios" - - test_three['platform']['manufacturer'] == 3 - - test_three['platform']['napalm_args']['global_delay_factor'] == 2 - - test_three['platform']['napalm_driver'] == "ios" - - test_three['msg'] == "platform Test Platform updated" - -- name: "PLATFORM 4: ASSERT - Delete" - networktocode.nautobot.platform: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Platform - state: absent - register: test_four - -- name: "PLATFORM 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "present" - - test_four['diff']['after']['state'] == "absent" - - test_four['msg'] == "platform Test Platform deleted" - -- name: "PLATFORM 5: ASSERT - Delete non existing" - networktocode.nautobot.platform: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Platform - state: absent - register: test_five - -- name: "PLATFORM 5: ASSERT - Delete non existing`" - assert: - that: - - not test_five['changed'] - - test_five['platform'] == None - - test_five['msg'] == "platform Test Platform already absent" diff --git a/tests/integration/targets/v2.9/tasks/power_feed.yml b/tests/integration/targets/v2.9/tasks/power_feed.yml deleted file mode 100644 index 3014756c..00000000 --- a/tests/integration/targets/v2.9/tasks/power_feed.yml +++ /dev/null @@ -1,127 +0,0 @@ ---- -# © 2020 Nokia -# Licensed under the GNU General Public License v3.0 only -# SPDX-License-Identifier: GPL-3.0-only -## -## -### PYNAUTOBOT_POWER_FEED -## -## -- name: "POWER_FEED 1: Necessary info creation" - networktocode.nautobot.power_feed: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Feed - power_panel: Power Panel - state: present - register: test_one - -- name: "POWER_FEED 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['power_feed']['name'] == "Power Feed" - - test_one['power_feed']['power_panel'] == 1 - - test_one['msg'] == "power_feed Power Feed created" - -- name: "POWER_FEED 2: Create duplicate" - networktocode.nautobot.power_feed: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Feed - power_panel: Power Panel - state: present - register: test_two - -- name: "POWER_FEED 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['power_feed']['name'] == "Power Feed" - - test_two['power_feed']['power_panel'] == 1 - - test_two['msg'] == "power_feed Power Feed already exists" - -- name: "POWER_FEED 3: Update power_feed with other fields" - networktocode.nautobot.power_feed: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Feed - power_panel: Power Panel - status: offline - type: redundant - supply: dc - phase: three-phase - voltage: 400 - amperage: 32 - max_utilization: 25 - comments: totally normal power feed - state: present - register: test_three - -- name: "POWER_FEED 3: ASSERT - Update power_feed with other fields" - assert: - that: - - test_three is changed - - test_three['diff']['after']['status'] == "offline" - - test_three['diff']['after']['type'] == "redundant" - - test_three['diff']['after']['supply'] == "dc" - - test_three['diff']['after']['phase'] == "three-phase" - - test_three['diff']['after']['voltage'] == 400 - - test_three['diff']['after']['amperage'] == 32 - - test_three['diff']['after']['max_utilization'] == 25 - - test_three['diff']['after']['comments'] == "totally normal power feed" - - test_three['power_feed']['name'] == "Power Feed" - - test_three['power_feed']['power_panel'] == 1 - - test_three['power_feed']['status'] == "offline" - - test_three['power_feed']['type'] == "redundant" - - test_three['power_feed']['supply'] == "dc" - - test_three['power_feed']['phase'] == "three-phase" - - test_three['power_feed']['voltage'] == 400 - - test_three['power_feed']['amperage'] == 32 - - test_three['power_feed']['max_utilization'] == 25 - - test_three['power_feed']['comments'] == "totally normal power feed" - - test_three['msg'] == "power_feed Power Feed updated" - -- name: "POWER_FEED 4: Create Power Feed for Delete Test" - networktocode.nautobot.power_feed: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Feed 2 - power_panel: Power Panel - state: present - register: test_four - -- name: "POWER_FEED 4: ASSERT - Create Power Feed for Delete Test" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['power_feed']['name'] == "Power Feed 2" - - test_four['power_feed']['power_panel'] == 1 - - test_four['msg'] == "power_feed Power Feed 2 created" - - -- name: "POWER_FEED 5: Delete Power Feed" - networktocode.nautobot.power_feed: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Feed 2 - power_panel: Power Panel - state: absent - register: test_five - -- name: "POWER_FEED 5: ASSERT - Delete Power Feed" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['msg'] == "power_feed Power Feed 2 deleted" diff --git a/tests/integration/targets/v2.9/tasks/power_outlet.yml b/tests/integration/targets/v2.9/tasks/power_outlet.yml deleted file mode 100644 index 32ab2cf7..00000000 --- a/tests/integration/targets/v2.9/tasks/power_outlet.yml +++ /dev/null @@ -1,114 +0,0 @@ ---- -# © 2020 Nokia -# Licensed under the GNU General Public License v3.0 only -# SPDX-License-Identifier: GPL-3.0-only -## -## -### PYNAUTOBOT_POWER_OUTLET -## -## -- name: "POWER_OUTLET 1: Necessary info creation" - networktocode.nautobot.power_outlet: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet - device: Device Power Tests - state: present - register: test_one - -- name: "POWER_OUTLET 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['power_outlet']['name'] == "Power Outlet" - - test_one['power_outlet']['device'] == 10 - - test_one['msg'] == "power_outlet Power Outlet created" - -- name: "POWER_OUTLET 2: Create duplicate" - networktocode.nautobot.power_outlet: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet - device: Device Power Tests - state: present - register: test_two - -- name: "POWER_OUTLET 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['power_outlet']['name'] == "Power Outlet" - - test_two['power_outlet']['device'] == 10 - - test_two['msg'] == "power_outlet Power Outlet already exists" - -- name: "POWER_OUTLET 3: Update power_outlet with other fields" - networktocode.nautobot.power_outlet: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet - device: Device Power Tests - type: ita-e - power_port: Power Port - feed_leg: B - description: test description - state: present - register: test_three - -- name: "POWER_OUTLET 3: ASSERT - Update power_outlet with other fields" - assert: - that: - - test_three is changed - - test_three['diff']['after']['type'] == "ita-e" - - test_three['diff']['after']['power_port'] == 1 - - test_three['diff']['after']['feed_leg'] == "B" - - test_three['diff']['after']['description'] == "test description" - - test_three['power_outlet']['name'] == "Power Outlet" - - test_three['power_outlet']['device'] == 10 - - test_three['power_outlet']['type'] == "ita-e" - - test_three['power_outlet']['power_port'] == 1 - - test_three['power_outlet']['feed_leg'] == "B" - - test_three['power_outlet']['description'] == "test description" - - test_three['msg'] == "power_outlet Power Outlet updated" - -- name: "POWER_OUTLET 4: Create Power Outlet for Delete Test" - networktocode.nautobot.power_outlet: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet 2 - device: Device Power Tests - state: present - register: test_four - -- name: "POWER_OUTLET 4: ASSERT - Create Power Outlet for Delete Test" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['power_outlet']['name'] == "Power Outlet 2" - - test_four['power_outlet']['device'] == 10 - - test_four['msg'] == "power_outlet Power Outlet 2 created" - -- name: "POWER_OUTLET 5: Delete Power Outlet" - networktocode.nautobot.power_outlet: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet 2 - device: Device Power Tests - state: absent - register: test_five - -- name: "POWER_OUTLET 5: ASSERT - Delete Power Outlet" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['msg'] == "power_outlet Power Outlet 2 deleted" diff --git a/tests/integration/targets/v2.9/tasks/power_outlet_template.yml b/tests/integration/targets/v2.9/tasks/power_outlet_template.yml deleted file mode 100644 index ae196e74..00000000 --- a/tests/integration/targets/v2.9/tasks/power_outlet_template.yml +++ /dev/null @@ -1,111 +0,0 @@ ---- -# © 2020 Nokia -# Licensed under the GNU General Public License v3.0 only -# SPDX-License-Identifier: GPL-3.0-only -## -## -### PYNAUTOBOT_POWER_OUTLET_TEMPLATE -## -## -- name: "POWER_OUTLET_TEMPLATE 1: Necessary info creation" - networktocode.nautobot.power_outlet_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet Template - device_type: Device Type Power Tests - state: present - register: test_one - -- name: "POWER_OUTLET_TEMPLATE 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['power_outlet_template']['name'] == "Power Outlet Template" - - test_one['power_outlet_template']['device_type'] == 8 - - test_one['msg'] == "power_outlet_template Power Outlet Template created" - -- name: "POWER_OUTLET_TEMPLATE 2: Create duplicate" - networktocode.nautobot.power_outlet_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet Template - device_type: Device Type Power Tests - state: present - register: test_two - -- name: "POWER_OUTLET_TEMPLATE 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['power_outlet_template']['name'] == "Power Outlet Template" - - test_two['power_outlet_template']['device_type'] == 8 - - test_two['msg'] == "power_outlet_template Power Outlet Template already exists" - -- name: "POWER_OUTLET_TEMPLATE 3: Update power_outlet_template with other fields" - networktocode.nautobot.power_outlet_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet Template - device_type: Device Type Power Tests - type: ita-e - power_port: Power Port - feed_leg: B - state: present - register: test_three - -- name: "POWER_OUTLET_TEMPLATE 3: ASSERT - Update power_outlet_template with other fields" - assert: - that: - - test_three is changed - - test_three['diff']['after']['type'] == "ita-e" - - test_three['diff']['after']['power_port'] == 1 - - test_three['diff']['after']['feed_leg'] == "B" - - test_three['power_outlet_template']['name'] == "Power Outlet Template" - - test_three['power_outlet_template']['device_type'] == 8 - - test_three['power_outlet_template']['type'] == "ita-e" - - test_three['power_outlet_template']['power_port'] == 1 - - test_three['power_outlet_template']['feed_leg'] == "B" - - test_three['msg'] == "power_outlet_template Power Outlet Template updated" - -- name: "POWER_OUTLET_TEMPLATE 4: Create Power Outlet Template for Delete Test" - networktocode.nautobot.power_outlet_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet Template 2 - device_type: Device Type Power Tests - state: present - register: test_four - -- name: "POWER_OUTLET_TEMPLATE 4: ASSERT - Create Power Outlet Template for Delete Test" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['power_outlet_template']['name'] == "Power Outlet Template 2" - - test_four['power_outlet_template']['device_type'] == 8 - - test_four['msg'] == "power_outlet_template Power Outlet Template 2 created" - -- name: "POWER_OUTLET_TEMPLATE 5: Delete Power Outlet Template" - networktocode.nautobot.power_outlet_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Outlet Template 2 - device_type: Device Type Power Tests - state: absent - register: test_five - -- name: "POWER_OUTLET_TEMPLATE 5: ASSERT - Delete Power Outlet Template" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['msg'] == "power_outlet_template Power Outlet Template 2 deleted" diff --git a/tests/integration/targets/v2.9/tasks/power_panel.yml b/tests/integration/targets/v2.9/tasks/power_panel.yml deleted file mode 100644 index 184cdcb4..00000000 --- a/tests/integration/targets/v2.9/tasks/power_panel.yml +++ /dev/null @@ -1,106 +0,0 @@ ---- -# © 2020 Nokia -# Licensed under the GNU General Public License v3.0 only -# SPDX-License-Identifier: GPL-3.0-only -## -## -### PYNAUTOBOT_POWER_PANEL -## -## -- name: "POWER_PANEL 1: Necessary info creation" - networktocode.nautobot.power_panel: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Panel - site: Test Site - state: present - register: test_one - -- name: "POWER_PANEL 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['power_panel']['name'] == "Power Panel" - - test_one['power_panel']['site'] == 1 - - test_one['msg'] == "power_panel Power Panel created" - -- name: "POWER_PANEL 2: Create duplicate" - networktocode.nautobot.power_panel: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Panel - site: Test Site - state: present - register: test_two - -- name: "POWER_PANEL 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['power_panel']['name'] == "Power Panel" - - test_two['power_panel']['site'] == 1 - - test_two['msg'] == "power_panel Power Panel already exists" - -- name: "POWER_PANEL 3: Update power_panel with other fields" - networktocode.nautobot.power_panel: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Panel - site: Test Site - rack_group: Test Rack Group - state: present - register: test_three - -- name: "POWER_PANEL 3: ASSERT - Update power_panel with other fields" - assert: - that: - - test_three is changed - - test_three['diff']['after']['rack_group'] == 1 - - test_three['power_panel']['name'] == "Power Panel" - - test_three['power_panel']['site'] == 1 - - test_three['power_panel']['rack_group'] == 1 - - test_three['msg'] == "power_panel Power Panel updated" - -- name: "POWER_PANEL 4: Create Power Panel for Delete Test" - networktocode.nautobot.power_panel: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Panel 2 - site: Test Site - state: present - register: test_four - -- name: "POWER_PANEL 4: ASSERT - Create Power Panel for Delete Test" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['power_panel']['name'] == "Power Panel 2" - - test_four['power_panel']['site'] == 1 - - test_four['msg'] == "power_panel Power Panel 2 created" - - -- name: "POWER_PANEL 5: Delete Power Panel" - networktocode.nautobot.power_panel: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Panel 2 - site: Test Site - state: absent - register: test_five - -- name: "POWER_PANEL 5: ASSERT - Delete Power Panel" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['msg'] == "power_panel Power Panel 2 deleted" diff --git a/tests/integration/targets/v2.9/tasks/power_port.yml b/tests/integration/targets/v2.9/tasks/power_port.yml deleted file mode 100644 index 3583361b..00000000 --- a/tests/integration/targets/v2.9/tasks/power_port.yml +++ /dev/null @@ -1,125 +0,0 @@ ---- -# © 2020 Nokia -# Licensed under the GNU General Public License v3.0 only -# SPDX-License-Identifier: GPL-3.0-only -## -## -### PYNAUTOBOT_POWER_PORT -## -## -- name: "POWER_PORT 0: Create device for testing power ports" - networktocode.nautobot.device: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Device Power Tests - device_type: Cisco Test - device_role: Core Switch - site: Test Site - state: present - -- name: "POWER_PORT 1: Necessary info creation" - networktocode.nautobot.power_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port - device: Device Power Tests - state: present - register: test_one - -- name: "POWER_PORT 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['power_port']['name'] == "Power Port" - - test_one['power_port']['device'] == 10 - - test_one['msg'] == "power_port Power Port created" - -- name: "POWER_PORT 2: Create duplicate" - networktocode.nautobot.power_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port - device: Device Power Tests - state: present - register: test_two - -- name: "POWER_PORT 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['power_port']['name'] == "Power Port" - - test_two['power_port']['device'] == 10 - - test_two['msg'] == "power_port Power Port already exists" - -- name: "POWER_FEED 3: Update power_port with other fields" - networktocode.nautobot.power_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port - device: Device Power Tests - type: ita-e - allocated_draw: 10 - maximum_draw: 20 - description: test description - state: present - register: test_three - -- name: "POWER_FEED 3: ASSERT - Update power_port with other fields" - assert: - that: - - test_three is changed - - test_three['diff']['after']['type'] == "ita-e" - - test_three['diff']['after']['allocated_draw'] == 10 - - test_three['diff']['after']['maximum_draw'] == 20 - - test_three['diff']['after']['description'] == "test description" - - test_three['power_port']['name'] == "Power Port" - - test_three['power_port']['device'] == 10 - - test_three['power_port']['type'] == "ita-e" - - test_three['power_port']['allocated_draw'] == 10 - - test_three['power_port']['maximum_draw'] == 20 - - test_three['power_port']['description'] == "test description" - - test_three['msg'] == "power_port Power Port updated" - -- name: "POWER_PORT 4: Create Power Port for Delete Test" - networktocode.nautobot.power_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port 2 - device: Device Power Tests - state: present - register: test_four - -- name: "POWER_PORT 4: ASSERT - Create Power Port for Delete Test" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['power_port']['name'] == "Power Port 2" - - test_four['power_port']['device'] == 10 - - test_four['msg'] == "power_port Power Port 2 created" - -- name: "POWER_PORT 5: Delete Power Port" - networktocode.nautobot.power_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port 2 - device: Device Power Tests - state: absent - register: test_five - -- name: "POWER_PORT 5: ASSERT - Delete Power Port" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['msg'] == "power_port Power Port 2 deleted" diff --git a/tests/integration/targets/v2.9/tasks/power_port_template.yml b/tests/integration/targets/v2.9/tasks/power_port_template.yml deleted file mode 100644 index e6a4407d..00000000 --- a/tests/integration/targets/v2.9/tasks/power_port_template.yml +++ /dev/null @@ -1,120 +0,0 @@ ---- -# © 2020 Nokia -# Licensed under the GNU General Public License v3.0 only -# SPDX-License-Identifier: GPL-3.0-only -## -## -### PYNAUTOBOT_POWER_PORT_TEMPLATE -## -## -- name: "POWER_PORT_TEMPLATE 0: Create device type for testing power ports" - networktocode.nautobot.device_type: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - model: Device Type Power Tests - manufacturer: Test Manufacturer - state: present - -- name: "POWER_PORT_TEMPLATE 1: Necessary info creation" - networktocode.nautobot.power_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port Template - device_type: Device Type Power Tests - state: present - register: test_one - -- name: "POWER_PORT_TEMPLATE 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['power_port_template']['name'] == "Power Port Template" - - test_one['power_port_template']['device_type'] == 8 - - test_one['msg'] == "power_port_template Power Port Template created" - -- name: "POWER_PORT_TEMPLATE 2: Create duplicate" - networktocode.nautobot.power_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port Template - device_type: Device Type Power Tests - state: present - register: test_two - -- name: "POWER_PORT_TEMPLATE 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['power_port_template']['name'] == "Power Port Template" - - test_two['power_port_template']['device_type'] == 8 - - test_two['msg'] == "power_port_template Power Port Template already exists" - -- name: "POWER_PORT_TEMPLATE 3: Update power_port_template with other fields" - networktocode.nautobot.power_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port Template - device_type: Device Type Power Tests - type: ita-e - allocated_draw: 10 - maximum_draw: 20 - state: present - register: test_three - -- name: "POWER_PORT_TEMPLATE 3: ASSERT - Update power_port_template with other fields" - assert: - that: - - test_three is changed - - test_three['diff']['after']['type'] == "ita-e" - - test_three['diff']['after']['allocated_draw'] == 10 - - test_three['diff']['after']['maximum_draw'] == 20 - - test_three['power_port_template']['name'] == "Power Port Template" - - test_three['power_port_template']['device_type'] == 8 - - test_three['power_port_template']['type'] == "ita-e" - - test_three['power_port_template']['allocated_draw'] == 10 - - test_three['power_port_template']['maximum_draw'] == 20 - - test_three['msg'] == "power_port_template Power Port Template updated" - -- name: "POWER_PORT_TEMPLATE 4: Create Power Port Template for Delete Test" - networktocode.nautobot.power_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port Template 2 - device_type: Device Type Power Tests - state: present - register: test_four - -- name: "POWER_PORT_TEMPLATE 4: ASSERT - Create Power Port Template for Delete Test" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['power_port_template']['name'] == "Power Port Template 2" - - test_four['power_port_template']['device_type'] == 8 - - test_four['msg'] == "power_port_template Power Port Template 2 created" - -- name: "POWER_PORT_TEMPLATE 5: Delete Power Port Template" - networktocode.nautobot.power_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Power Port Template 2 - device_type: Device Type Power Tests - state: absent - register: test_five - -- name: "POWER_PORT_TEMPLATE 5: ASSERT - Delete Power Port Template" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['msg'] == "power_port_template Power Port Template 2 deleted" diff --git a/tests/integration/targets/v2.9/tasks/prefix.yml b/tests/integration/targets/v2.9/tasks/prefix.yml deleted file mode 100644 index 71fdbd00..00000000 --- a/tests/integration/targets/v2.9/tasks/prefix.yml +++ /dev/null @@ -1,245 +0,0 @@ ---- -## -## -### PYNAUTOBOT_PREFIX -## -## -- name: "1 - Create prefix within Nautobot with only required information" - networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: 10.156.0.0/19 - state: present - register: test_one - -- name: "1 - ASSERT" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['msg'] == "prefix 10.156.0.0/19 created" - - test_one['prefix']['prefix'] == "10.156.0.0/19" - -- name: "2 - Duplicate" - networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: 10.156.0.0/19 - state: present - register: test_two - -- name: "2 - ASSERT" - assert: - that: - - not test_two['changed'] - - test_two['msg'] == "prefix 10.156.0.0/19 already exists" - - test_two['prefix']['prefix'] == "10.156.0.0/19" - -- name: "3 - Update 10.156.0.0/19" - networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: 10.156.0.0/19 - site: Test Site - status: Reserved - description: "This prefix has been updated" - state: present - register: test_three - -- name: "3 - ASSERT" - assert: - that: - - test_three is changed - - test_three['diff']['after']['site'] == 1 - - test_three['diff']['after']['status'] == "reserved" - - test_three['diff']['after']['description'] == "This prefix has been updated" - - test_three['msg'] == "prefix 10.156.0.0/19 updated" - - test_three['prefix']['prefix'] == "10.156.0.0/19" - - test_three['prefix']['site'] == 1 - - test_three['prefix']['status'] == "reserved" - - test_three['prefix']['description'] == "This prefix has been updated" - -- name: "4 - Delete prefix within nautobot" - networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: 10.156.0.0/19 - state: absent - register: test_four - -- name: "4 - ASSERT" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "present" - - test_four['diff']['after']['state'] == "absent" - - test_four['msg'] == "prefix 10.156.0.0/19 deleted" - -- name: "5 - Create prefix with several specified options" - networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - family: 4 - prefix: 10.156.32.0/19 - site: Test Site - vrf: Test VRF - tenant: Test Tenant - vlan: - name: Test VLAN - site: Test Site - tenant: Test Tenant - vlan_group: Test Vlan Group - status: Reserved - prefix_role: Network of care - description: Test description - is_pool: true - tags: - - "Schnozzberry" - state: present - register: test_five - -- name: "5 - ASSERT" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "absent" - - test_five['diff']['after']['state'] == "present" - - test_five['msg'] == "prefix 10.156.32.0/19 created" - - test_five['prefix']['prefix'] == "10.156.32.0/19" - - test_five['prefix']['family'] == 4 - - test_five['prefix']['site'] == 1 - - test_five['prefix']['vrf'] == 1 - - test_five['prefix']['tenant'] == 1 - - test_five['prefix']['vlan'] == 4 - - test_five['prefix']['status'] == "reserved" - - test_five['prefix']['role'] == 1 - - test_five['prefix']['description'] == "Test description" - - test_five['prefix']['is_pool'] == true - - test_five['prefix']['tags'][0] == 4 - -- name: "6 - Get a new /24 inside 10.156.0.0/19 within Nautobot - Parent doesn't exist" - networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - parent: 10.156.0.0/19 - prefix_length: 24 - state: present - first_available: yes - register: test_six - -- name: "6 - ASSERT" - assert: - that: - - not test_six['changed'] - - test_six['msg'] == "Parent prefix does not exist - 10.156.0.0/19" - -- name: "7 - Create prefix within Nautobot with only required information" - networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: 10.156.0.0/19 - state: present - register: test_seven - -- name: "7 - ASSERT" - assert: - that: - - test_seven is changed - - test_seven['diff']['before']['state'] == "absent" - - test_seven['diff']['after']['state'] == "present" - - test_seven['msg'] == "prefix 10.156.0.0/19 created" - - test_seven['prefix']['prefix'] == "10.156.0.0/19" - -- name: "8 - Get a new /24 inside 10.156.0.0/19 within Nautobot" - networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - parent: 10.156.0.0/19 - prefix_length: 24 - state: present - first_available: yes - register: test_eight - -- name: "8 - ASSERT" - assert: - that: - - test_eight is changed - - test_eight['diff']['before']['state'] == "absent" - - test_eight['diff']['after']['state'] == "present" - - test_eight['msg'] == "prefix 10.156.0.0/24 created" - - test_eight['prefix']['prefix'] == "10.156.0.0/24" - -- name: "9 - Create 10.157.0.0/19" - networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - prefix: 10.157.0.0/19 - vrf: Test VRF - site: Test Site - state: present - register: test_nine - -- name: "9 - ASSERT" - assert: - that: - - test_nine is changed - - test_nine['diff']['before']['state'] == "absent" - - test_nine['diff']['after']['state'] == "present" - - test_nine['msg'] == "prefix 10.157.0.0/19 created" - - test_nine['prefix']['prefix'] == "10.157.0.0/19" - - test_nine['prefix']['site'] == 1 - - test_nine['prefix']['vrf'] == 1 - -- name: "10 - Get a new /24 inside 10.157.0.0/19 within Nautobot with additional values" - networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - parent: 10.157.0.0/19 - prefix_length: 24 - vrf: Test VRF - site: Test Site - state: present - first_available: yes - register: test_ten - -- name: "10 - ASSERT" - assert: - that: - - test_ten is changed - - test_ten['diff']['before']['state'] == "absent" - - test_ten['diff']['after']['state'] == "present" - - test_ten['msg'] == "prefix 10.157.0.0/24 created" - - test_ten['prefix']['prefix'] == "10.157.0.0/24" - - test_ten['prefix']['site'] == 1 - - test_ten['prefix']['vrf'] == 1 - -- name: "11 - Get a new /24 inside 10.156.0.0/19 within Nautobot" - networktocode.nautobot.prefix: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - parent: 10.156.0.0/19 - prefix_length: 24 - state: present - first_available: yes - register: test_eleven - -- name: "11 - ASSERT" - assert: - that: - - test_eleven is changed - - test_eleven['diff']['before']['state'] == "absent" - - test_eleven['diff']['after']['state'] == "present" - - test_eleven['msg'] == "prefix 10.156.1.0/24 created" - - test_eleven['prefix']['prefix'] == "10.156.1.0/24" diff --git a/tests/integration/targets/v2.9/tasks/provider.yml b/tests/integration/targets/v2.9/tasks/provider.yml deleted file mode 100644 index 4c4ea2e8..00000000 --- a/tests/integration/targets/v2.9/tasks/provider.yml +++ /dev/null @@ -1,99 +0,0 @@ ---- -## -## -### PYNAUTOBOT_PROVIDER -## -## -- name: "PYNAUTOBOT_PROVIDER 1: Create provider within Nautobot with only required information" - networktocode.nautobot.provider: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Provider One - state: present - register: test_one - -- name: "PYNAUTOBOT_PROVIDER 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['provider']['name'] == "Test Provider One" - - test_one['provider']['slug'] == "test-provider-one" - - test_one['msg'] == "provider Test Provider One created" - -- name: "PYNAUTOBOT_PROVIDER 2: Duplicate" - networktocode.nautobot.provider: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Provider One - state: present - register: test_two - -- name: "PYNAUTOBOT_PROVIDER 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['provider']['name'] == "Test Provider One" - - test_two['provider']['slug'] == "test-provider-one" - - test_two['msg'] == "provider Test Provider One already exists" - -- name: "PYNAUTOBOT_PROVIDER 3: Update provider with other fields" - networktocode.nautobot.provider: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Provider One - asn: 65001 - account: "200129104" - portal_url: http://provider.net - noc_contact: noc@provider.net - admin_contact: admin@provider.net - comments: "BAD PROVIDER" - state: present - register: test_three - -- name: "PYNAUTOBOT_PROVIDER 3: ASSERT - Updated" - assert: - that: - - test_three is changed - - test_three['diff']['after']['asn'] == 65001 - - test_three['diff']['after']['account'] == "200129104" - - test_three['diff']['after']['portal_url'] == "http://provider.net" - - test_three['diff']['after']['noc_contact'] == "noc@provider.net" - - test_three['diff']['after']['admin_contact'] == "admin@provider.net" - - test_three['diff']['after']['comments'] == "BAD PROVIDER" - - test_three['provider']['name'] == "Test Provider One" - - test_three['provider']['slug'] == "test-provider-one" - - test_three['provider']['asn'] == 65001 - - test_three['provider']['account'] == "200129104" - - test_three['provider']['portal_url'] == "http://provider.net" - - test_three['provider']['noc_contact'] == "noc@provider.net" - - test_three['provider']['admin_contact'] == "admin@provider.net" - - test_three['provider']['comments'] == "BAD PROVIDER" - - test_three['msg'] == "provider Test Provider One updated" - -- name: "PYNAUTOBOT_PROVIDER 4: Delete provider within nautobot" - networktocode.nautobot.provider: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test Provider One - state: absent - register: test_four - -- name: "PYNAUTOBOT_PROVIDER 4 : ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['provider']['name'] == "Test Provider One" - - test_four['provider']['slug'] == "test-provider-one" - - test_four['provider']['asn'] == 65001 - - test_four['provider']['account'] == "200129104" - - test_four['provider']['portal_url'] == "http://provider.net" - - test_four['provider']['noc_contact'] == "noc@provider.net" - - test_four['provider']['admin_contact'] == "admin@provider.net" - - test_four['provider']['comments'] == "BAD PROVIDER" - - test_four['msg'] == "provider Test Provider One deleted" diff --git a/tests/integration/targets/v2.9/tasks/rack.yml b/tests/integration/targets/v2.9/tasks/rack.yml deleted file mode 100644 index 33ed4a1e..00000000 --- a/tests/integration/targets/v2.9/tasks/rack.yml +++ /dev/null @@ -1,225 +0,0 @@ ---- -## -## -### PYNAUTOBOT_RACK -## -## -- name: "1 - Test rack creation" - networktocode.nautobot.rack: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test rack one" - site: "Test Site" - register: test_one - -- name: "1 - ASSERT" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['rack']['name'] == "Test rack one" - - test_one['rack']['site'] == 1 - -- name: "Test duplicate rack" - networktocode.nautobot.rack: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test rack one" - register: test_two - -- name: "2 - ASSERT" - assert: - that: - - not test_two['changed'] - - test_two['rack']['name'] == "Test rack one" - - test_two['rack']['site'] == 1 - - test_two['msg'] == "rack Test rack one already exists" - -- name: "3 - Create new rack with similar name" - networktocode.nautobot.rack: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test rack - Test Site - site: Test Site - state: present - register: test_three - -- name: "3 - ASSERT" - assert: - that: - - test_three is changed - - test_three['diff']['before']['state'] == "absent" - - test_three['diff']['after']['state'] == "present" - - test_three['rack']['name'] == "Test rack - Test Site" - - test_three['rack']['site'] == 1 - - test_three['msg'] == "rack Test rack - Test Site created" - -- name: "4 - Attempt to create Test rack one again" - networktocode.nautobot.rack: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test rack one - site: Test Site - state: present - register: test_four - -- name: "4 - ASSERT" - assert: - that: - - not test_four['changed'] - - test_four['rack']['name'] == "Test rack one" - - test_four['rack']['site'] == 1 - - test_four['msg'] == "rack Test rack one already exists" - -- name: "5 - Update Test rack one with more options" - networktocode.nautobot.rack: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test rack one - site: Test Site - rack_role: "Test Rack Role" - rack_group: "Test Rack Group" - facility_id: "EQUI10291" - tenant: "Test Tenant" - status: Available - serial: "FXS10001" - asset_tag: "1234" - width: 23 - u_height: 48 - type: "2-post frame" - outer_width: 32 - outer_depth: 24 - outer_unit: "Inches" - comments: "Just testing rack module" - tags: - - "Schnozzberry" - state: present - register: test_five - -- name: "5 - ASSERT" - assert: - that: - - test_five is changed - - test_five['diff']['after']['asset_tag'] == "1234" - - test_five['diff']['after']['comments'] == "Just testing rack module" - - test_five['diff']['after']['facility_id'] == "EQUI10291" - - test_five['diff']['after']['group'] == 1 - - test_five['diff']['after']['outer_depth'] == 24 - - test_five['diff']['after']['outer_unit'] == "in" - - test_five['diff']['after']['outer_width'] == 32 - - test_five['diff']['after']['role'] == 1 - - test_five['diff']['after']['serial'] == "FXS10001" - - test_five['diff']['after']['status'] == "available" - - test_five['diff']['after']['tenant'] == 1 - - test_five['diff']['after']['tags'][0] == 4 - - test_five['diff']['after']['type'] == "2-post-frame" - - test_five['diff']['after']['u_height'] == 48 - - test_five['diff']['after']['width'] == 23 - - test_five['rack']['name'] == "Test rack one" - - test_five['rack']['site'] == 1 - - test_five['rack']['asset_tag'] == "1234" - - test_five['rack']['comments'] == "Just testing rack module" - - test_five['rack']['facility_id'] == "EQUI10291" - - test_five['rack']['group'] == 1 - - test_five['rack']['outer_depth'] == 24 - - test_five['rack']['outer_unit'] == "in" - - test_five['rack']['outer_width'] == 32 - - test_five['rack']['role'] == 1 - - test_five['rack']['serial'] == "FXS10001" - - test_five['rack']['status'] == "available" - - test_five['rack']['tenant'] == 1 - - test_five['rack']['tags'][0] == 4 - - test_five['rack']['type'] == "2-post-frame" - - test_five['rack']['u_height'] == 48 - - test_five['rack']['width'] == 23 - - test_five['msg'] == "rack Test rack one updated" - -- name: "6 - Update Test rack one with same options" - networktocode.nautobot.rack: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test rack one - site: Test Site - rack_role: "Test Rack Role" - rack_group: "Test Rack Group" - facility_id: "EQUI10291" - tenant: "Test Tenant" - status: Available - serial: "FXS10001" - asset_tag: "1234" - width: 23 - u_height: 48 - type: "2-post frame" - outer_width: 32 - outer_depth: 24 - outer_unit: "Inches" - comments: "Just testing rack module" - tags: - - "Schnozzberry" - state: present - register: test_six - -- name: "6 - ASSERT" - assert: - that: - - test_six is not changed - - test_six['rack']['name'] == "Test rack one" - - test_six['rack']['site'] == 1 - - test_six['rack']['asset_tag'] == "1234" - - test_six['rack']['comments'] == "Just testing rack module" - - test_six['rack']['facility_id'] == "EQUI10291" - - test_six['rack']['group'] == 1 - - test_six['rack']['outer_depth'] == 24 - - test_six['rack']['outer_unit'] == "in" - - test_six['rack']['outer_width'] == 32 - - test_six['rack']['role'] == 1 - - test_six['rack']['serial'] == "FXS10001" - - test_six['rack']['status'] == "available" - - test_six['rack']['tenant'] == 1 - - test_six['rack']['tags'][0] == 4 - - test_six['rack']['type'] == "2-post-frame" - - test_six['rack']['u_height'] == 48 - - test_six['rack']['width'] == 23 - -- name: "7 - Create rack with same asset tag and serial number" - networktocode.nautobot.rack: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test rack two - site: Test Site - serial: "FXS10001" - asset_tag: "1234" - state: present - ignore_errors: yes - register: test_seven - -- name: "7 - ASSERT" - assert: - that: - - test_seven is failed - - "'Asset tag already exists' in test_seven['msg']" - -- name: "8 - Test delete" - networktocode.nautobot.rack: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test rack one" - state: "absent" - register: test_eight - -- name: "8 - ASSERT" - assert: - that: - - test_eight is changed - - test_eight['diff']['before']['state'] == "present" - - test_eight['diff']['after']['state'] == "absent" - - test_eight['msg'] == "rack Test rack one deleted" diff --git a/tests/integration/targets/v2.9/tasks/rack_group.yml b/tests/integration/targets/v2.9/tasks/rack_group.yml deleted file mode 100644 index c7bac243..00000000 --- a/tests/integration/targets/v2.9/tasks/rack_group.yml +++ /dev/null @@ -1,62 +0,0 @@ ---- -## -## -### PYNAUTOBOT_RACK_GROUP -## -## -- name: "RACK_GROUP 1: Necessary info creation" - networktocode.nautobot.rack_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rack Group - site: Test Site - state: present - register: test_one - -- name: "RACK_GROUP 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['rack_group']['name'] == "Rack Group" - - test_one['rack_group']['slug'] == "rack-group" - - test_one['rack_group']['site'] == 1 - - test_one['msg'] == "rack_group Rack Group created" - -- name: "RACK_GROUP 2: Create duplicate" - networktocode.nautobot.rack_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rack Group - site: Test Site - state: present - register: test_two - -- name: "RACK_GROUP 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['rack_group']['name'] == "Rack Group" - - test_two['rack_group']['slug'] == "rack-group" - - test_two['rack_group']['site'] == 1 - - test_two['msg'] == "rack_group Rack Group already exists" - -- name: "RACK_GROUP 3: ASSERT - Delete" - networktocode.nautobot.rack_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rack Group - state: absent - register: test_three - -- name: "RACK_GROUP 3: ASSERT - Update" - assert: - that: - - test_three is changed - - test_three['diff']['before']['state'] == "present" - - test_three['diff']['after']['state'] == "absent" - - test_three['msg'] == "rack_group Rack Group deleted" diff --git a/tests/integration/targets/v2.9/tasks/rack_role.yml b/tests/integration/targets/v2.9/tasks/rack_role.yml deleted file mode 100644 index 446376ce..00000000 --- a/tests/integration/targets/v2.9/tasks/rack_role.yml +++ /dev/null @@ -1,81 +0,0 @@ ---- -## -## -### PYNAUTOBOT_RACK_ROLE -## -## -- name: "RACK_ROLE 1: Necessary info creation" - networktocode.nautobot.rack_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rack Role - color: "ffffff" - state: present - register: test_one - -- name: "RACK_ROLE 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['rack_role']['name'] == "Rack Role" - - test_one['rack_role']['slug'] == "rack-role" - - test_one['rack_role']['color'] == "ffffff" - - test_one['msg'] == "rack_role Rack Role created" - -- name: "RACK_ROLE 2: Create duplicate" - networktocode.nautobot.rack_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rack Role - state: present - register: test_two - -- name: "RACK_ROLE 1: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['rack_role']['name'] == "Rack Role" - - test_two['rack_role']['slug'] == "rack-role" - - test_two['rack_role']['color'] == "ffffff" - - test_two['msg'] == "rack_role Rack Role already exists" - -- name: "RACK_ROLE 3: Update" - networktocode.nautobot.rack_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rack Role - color: "003EFF" - state: present - register: test_three - -- name: "RACK_ROLE 3: ASSERT - Update" - assert: - that: - - test_three is changed - - test_three['diff']['after']['color'] == "003eff" - - test_three['rack_role']['name'] == "Rack Role" - - test_three['rack_role']['slug'] == "rack-role" - - test_three['rack_role']['color'] == "003eff" - - test_three['msg'] == "rack_role Rack Role updated" - -- name: "RACK_ROLE 4: Delete" - networktocode.nautobot.rack_role: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rack Role - state: absent - register: test_four - -- name: "RACK_ROLE 4: ASSERT - Update" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "present" - - test_four['diff']['after']['state'] == "absent" - - test_four['msg'] == "rack_role Rack Role deleted" diff --git a/tests/integration/targets/v2.9/tasks/rear_port.yml b/tests/integration/targets/v2.9/tasks/rear_port.yml deleted file mode 100644 index 176691dc..00000000 --- a/tests/integration/targets/v2.9/tasks/rear_port.yml +++ /dev/null @@ -1,139 +0,0 @@ ---- -# © 2020 Nokia -# Licensed under the GNU General Public License v3.0 only -# SPDX-License-Identifier: GPL-3.0-only -## -## -### PYNAUTOBOT_REAR_PORT -## -## -- name: "REAR_PORT 1: Necessary info creation" - networktocode.nautobot.rear_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port - device: test100 - type: bnc - state: present - register: test_one - -- name: "REAR_PORT 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['rear_port']['name'] == "Rear Port" - - test_one['rear_port']['device'] == 1 - - test_one['rear_port']['type'] == "bnc" - - test_one['msg'] == "rear_port Rear Port created" - -- name: "REAR_PORT 2: Create duplicate" - networktocode.nautobot.rear_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port - device: test100 - type: bnc - state: present - register: test_two - -- name: "REAR_PORT 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['rear_port']['name'] == "Rear Port" - - test_two['rear_port']['device'] == 1 - - test_two['rear_port']['type'] == "bnc" - - test_two['msg'] == "rear_port Rear Port already exists" - -- name: "REAR_PORT 3: Update Rear Port with other fields" - networktocode.nautobot.rear_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port - device: test100 - type: bnc - positions: 5 - description: test description - state: present - register: test_three - -- name: "REAR_PORT 3: ASSERT - Update Rear Port with other fields" - assert: - that: - - test_three is changed - - test_three['diff']['after']['positions'] == 5 - - test_three['diff']['after']['description'] == "test description" - - test_three['rear_port']['name'] == "Rear Port" - - test_three['rear_port']['device'] == 1 - - test_three['rear_port']['type'] == "bnc" - - test_three['rear_port']['positions'] == 5 - - test_three['rear_port']['description'] == "test description" - - test_three['msg'] == "rear_port Rear Port updated" - -- name: "REAR_PORT 4: Create Rear Port for Delete Test" - networktocode.nautobot.rear_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port 2 - device: test100 - type: bnc - state: present - register: test_four - -- name: "REAR_PORT 4: ASSERT - Create Rear Port for Delete Test" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['rear_port']['name'] == "Rear Port 2" - - test_four['rear_port']['device'] == 1 - - test_four['rear_port']['type'] == "bnc" - - test_four['msg'] == "rear_port Rear Port 2 created" - -- name: "REAR_PORT 5: Delete Rear Port" - networktocode.nautobot.rear_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port 2 - device: test100 - type: bnc - state: absent - register: test_five - -- name: "REAR_PORT 5: ASSERT - Delete Rear Port" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['msg'] == "rear_port Rear Port 2 deleted" - -- name: "REAR_PORT 6: Create second Rear Port" - networktocode.nautobot.rear_port: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port - device: Test Nexus One - type: bnc - state: present - register: test_six - -- name: "REAR_PORT 6: ASSERT - Create second Rear Port" - assert: - that: - - test_six is changed - - test_six['diff']['before']['state'] == "absent" - - test_six['diff']['after']['state'] == "present" - - test_six['rear_port']['name'] == "Rear Port" - - test_six['rear_port']['device'] == 4 - - test_six['rear_port']['type'] == "bnc" - - test_six['msg'] == "rear_port Rear Port created" diff --git a/tests/integration/targets/v2.9/tasks/rear_port_template.yml b/tests/integration/targets/v2.9/tasks/rear_port_template.yml deleted file mode 100644 index b6e2fe20..00000000 --- a/tests/integration/targets/v2.9/tasks/rear_port_template.yml +++ /dev/null @@ -1,136 +0,0 @@ ---- -# © 2020 Nokia -# Licensed under the GNU General Public License v3.0 only -# SPDX-License-Identifier: GPL-3.0-only -## -## -### PYNAUTOBOT_REAR_PORT_TEMPLATE -## -## -- name: "REAR_PORT_TEMPLATE 1: Necessary info creation" - networktocode.nautobot.rear_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port Template - device_type: Cisco Test - type: bnc - state: present - register: test_one - -- name: "REAR_PORT_TEMPLATE 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['rear_port_template']['name'] == "Rear Port Template" - - test_one['rear_port_template']['device_type'] == 1 - - test_one['rear_port_template']['type'] == "bnc" - - test_one['msg'] == "rear_port_template Rear Port Template created" - -- name: "REAR_PORT_TEMPLATE 2: Create duplicate" - networktocode.nautobot.rear_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port Template - device_type: Cisco Test - type: bnc - state: present - register: test_two - -- name: "REAR_PORT_TEMPLATE 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['rear_port_template']['name'] == "Rear Port Template" - - test_two['rear_port_template']['device_type'] == 1 - - test_two['rear_port_template']['type'] == "bnc" - - test_two['msg'] == "rear_port_template Rear Port Template already exists" - -- name: "REAR_PORT_TEMPLATE 3: Update Rear Port Template with other fields" - networktocode.nautobot.rear_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port Template - device_type: Cisco Test - type: bnc - positions: 5 - state: present - register: test_three - -- name: "REAR_PORT_TEMPLATE 3: ASSERT - Update Rear Port Template with other fields" - assert: - that: - - test_three is changed - - test_three['diff']['after']['positions'] == 5 - - test_three['rear_port_template']['name'] == "Rear Port Template" - - test_three['rear_port_template']['device_type'] == 1 - - test_three['rear_port_template']['type'] == "bnc" - - test_three['rear_port_template']['positions'] == 5 - - test_three['msg'] == "rear_port_template Rear Port Template updated" - -- name: "REAR_PORT_TEMPLATE 4: Create Rear Port Template for Delete Test" - networktocode.nautobot.rear_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port Template 2 - device_type: Cisco Test - type: bnc - state: present - register: test_four - -- name: "REAR_PORT_TEMPLATE 4: ASSERT - Create Rear Port Template for Delete Test" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['rear_port_template']['name'] == "Rear Port Template 2" - - test_four['rear_port_template']['device_type'] == 1 - - test_four['rear_port_template']['type'] == "bnc" - - test_four['msg'] == "rear_port_template Rear Port Template 2 created" - -- name: "REAR_PORT_TEMPLATE 5: Delete Rear Port Template" - networktocode.nautobot.rear_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port Template 2 - device_type: Cisco Test - type: bnc - state: absent - register: test_five - -- name: "REAR_PORT_TEMPLATE 5: ASSERT - Delete Rear Port Template" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['msg'] == "rear_port_template Rear Port Template 2 deleted" - -- name: "REAR_PORT_TEMPLATE 6: Create second Rear Port Template" - networktocode.nautobot.rear_port_template: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Rear Port Template 2 - device_type: Arista Test - type: bnc - state: present - register: test_six - -- name: "REAR_PORT_TEMPLATE 6: ASSERT - Create second Rear Port Template" - assert: - that: - - test_six is changed - - test_six['diff']['before']['state'] == "absent" - - test_six['diff']['after']['state'] == "present" - - test_six['rear_port_template']['name'] == "Rear Port Template 2" - - test_six['rear_port_template']['device_type'] == 2 - - test_six['rear_port_template']['type'] == "bnc" - - test_six['msg'] == "rear_port_template Rear Port Template 2 created" diff --git a/tests/integration/targets/v2.9/tasks/region.yml b/tests/integration/targets/v2.9/tasks/region.yml deleted file mode 100644 index afd5db0a..00000000 --- a/tests/integration/targets/v2.9/tasks/region.yml +++ /dev/null @@ -1,79 +0,0 @@ ---- -## -## -### PYNAUTOBOT_REGION -## -## -- name: "REGION 1: Necessary info creation" - networktocode.nautobot.region: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Region One" - state: present - register: test_one - -- name: "REGION 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['region']['name'] == "Test Region One" - - test_one['region']['slug'] == "test-region-one" - - test_one['msg'] == "region Test Region One created" - -- name: "REGION 2: Create duplicate" - networktocode.nautobot.region: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Region One" - state: present - register: test_two - -- name: "REGION 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['region']['name'] == "Test Region One" - - test_two['region']['slug'] == "test-region-one" - - test_two['msg'] == "region Test Region One already exists" - -- name: "REGION 3: ASSERT - Update" - networktocode.nautobot.region: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Region One" - parent_region: "Test Region" - state: present - register: test_three - -- name: "REGION 3: ASSERT - Updated" - assert: - that: - - test_three is changed - - test_three['diff']['after']['parent'] == 1 - - test_three['region']['name'] == "Test Region One" - - test_three['region']['slug'] == "test-region-one" - - test_three['region']['parent'] == 1 - - test_three['msg'] == "region Test Region One updated" - -- name: "REGION 4: ASSERT - Delete" - networktocode.nautobot.region: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Region One" - state: absent - register: test_four - -- name: "REGION 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['region']['name'] == "Test Region One" - - test_four['region']['slug'] == "test-region-one" - - test_four['region']['parent'] == 1 - - test_four['msg'] == "region Test Region One deleted" diff --git a/tests/integration/targets/v2.9/tasks/rir.yml b/tests/integration/targets/v2.9/tasks/rir.yml deleted file mode 100644 index 9be96af7..00000000 --- a/tests/integration/targets/v2.9/tasks/rir.yml +++ /dev/null @@ -1,79 +0,0 @@ ---- -## -## -### PYNAUTOBOT_RIR -## -## -- name: "RIR 1: Necessary info creation" - networktocode.nautobot.rir: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test RIR One - state: present - register: test_one - -- name: "RIR 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['rir']['name'] == "Test RIR One" - - test_one['rir']['slug'] == "test-rir-one" - - test_one['msg'] == "rir Test RIR One created" - -- name: "RIR 2: Create duplicate" - networktocode.nautobot.rir: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test RIR One - state: present - register: test_two - -- name: "RIR 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['rir']['name'] == "Test RIR One" - - test_two['rir']['slug'] == "test-rir-one" - - test_two['msg'] == "rir Test RIR One already exists" - -- name: "RIR 3: ASSERT - Update" - networktocode.nautobot.rir: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test RIR One" - is_private: true - state: present - register: test_three - -- name: "RIR 3: ASSERT - Updated" - assert: - that: - - test_three is changed - - test_three['diff']['after']['is_private'] == true - - test_three['rir']['name'] == "Test RIR One" - - test_three['rir']['slug'] == "test-rir-one" - - test_three['rir']['is_private'] == true - - test_three['msg'] == "rir Test RIR One updated" - -- name: "RIR 4: ASSERT - Delete" - networktocode.nautobot.rir: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test RIR One" - state: absent - register: test_four - -- name: "RIR 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['rir']['name'] == "Test RIR One" - - test_four['rir']['slug'] == "test-rir-one" - - test_four['rir']['is_private'] == true - - test_four['msg'] == "rir Test RIR One deleted" diff --git a/tests/integration/targets/v2.9/tasks/service.yml b/tests/integration/targets/v2.9/tasks/service.yml deleted file mode 100644 index 9fc64b26..00000000 --- a/tests/integration/targets/v2.9/tasks/service.yml +++ /dev/null @@ -1,193 +0,0 @@ ---- -## -## -### PYNAUTOBOT_SERVICE -## -## -- name: "1 - Device with required information needs to add new service" - networktocode.nautobot.device: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "FOR_SERVICE" - device_type: "Cisco Test" - device_role: "Core Switch" - site: "Test Site" - status: "Staged" - state: present - -- name: "PYNAUTOBOT_SERVICE: Create new service" - networktocode.nautobot.service: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: "FOR_SERVICE" - name: "node-exporter" - port: 9100 - protocol: TCP - state: present - register: test_service_create - -- name: "PYNAUTOBOT_SERVICE ASSERT - Create" - assert: - that: - - test_service_create is changed - - test_service_create['services']['name'] == "node-exporter" - - test_service_create['services']['port'] == 9100 - - test_service_create['services']['protocol'] == "tcp" - - test_service_create['diff']['after']['state'] == "present" - - test_service_create['diff']['before']['state'] == "absent" - - test_service_create['msg'] == "services node-exporter created" - -- name: "PYNAUTOBOT_SERVICE: Test idempotence" - networktocode.nautobot.service: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: "FOR_SERVICE" - name: "node-exporter" - port: 9100 - protocol: TCP - state: present - register: test_service_idempotence - -- name: "PYNAUTOBOT_SERVICE ASSERT - Not changed" - assert: - that: - - test_service_idempotence['services']['name'] == "node-exporter" - - test_service_idempotence['services']['port'] == 9100 - - test_service_idempotence['services']['protocol'] == "tcp" - - test_service_idempotence['msg'] == "services node-exporter already exists" - -- name: "PYNAUTOBOT_SERVICE: Test update" - networktocode.nautobot.service: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: "FOR_SERVICE" - name: "node-exporter" - port: 9100 - protocol: TCP - tags: - - "Schnozzberry" - state: present - register: test_service_update - -- name: "PYNAUTOBOT_SERVICE ASSERT - Service has been updated" - assert: - that: - - test_service_update is changed - - test_service_update['diff']['after']['tags'][0] == 4 - - test_service_update['msg'] == "services node-exporter updated" - -- name: "PYNAUTOBOT_SERVICE: Test same details, but different protocol - Create" - networktocode.nautobot.service: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: "FOR_SERVICE" - name: "node-exporter" - port: 9100 - protocol: UDP - state: present - register: test_service_protocol - -- name: "PYNAUTOBOT_SERVICE ASSERT - Different protocol - Create" - assert: - that: - - test_service_protocol is changed - - test_service_protocol['diff']['after']['state'] == "present" - - test_service_protocol['diff']['before']['state'] == "absent" - - test_service_protocol['services']['name'] == "node-exporter" - - test_service_protocol['services']['port'] == 9100 - - test_service_protocol['services']['protocol'] == "udp" - - test_service_protocol['msg'] == "services node-exporter created" - -- name: "PYNAUTOBOT_SERVICE: Test service deletion" - networktocode.nautobot.service: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: "FOR_SERVICE" - name: "node-exporter" - port: 9100 - protocol: UDP - state: absent - register: test_service_delete - -- name: "PYNAUTOBOT_SERVICE ASSERT - Service has been deleted" - assert: - that: - - test_service_delete is changed - - test_service_delete['diff']['after']['state'] == "absent" - - test_service_delete['diff']['before']['state'] == "present" - - test_service_delete['msg'] == "services node-exporter deleted" - -- name: "PYNAUTOBOT_SERVICE: Test service IP addresses" - networktocode.nautobot.service: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - device: "test100" - name: "node-exporter" - port: 9100 - protocol: UDP - ipaddresses: - - address: "172.16.180.1/24" - state: present - register: test_service_ip_addresses - -- name: "PYNAUTOBOT_SERVICE ASSERT - Service has been created with IP address" - assert: - that: - - test_service_ip_addresses is changed - - test_service_ip_addresses['diff']['after']['state'] == "present" - - test_service_ip_addresses['diff']['before']['state'] == "absent" - - test_service_ip_addresses['services']['name'] == "node-exporter" - - test_service_ip_addresses['services']['port'] == 9100 - - test_service_ip_addresses['services']['protocol'] == "udp" - - test_service_ip_addresses['services']['ipaddresses'] is defined - - test_service_ip_addresses['msg'] == "services node-exporter created" - -- name: "PYNAUTOBOT_SERVICE: Missing both device & virtual_machine options - Tests required_one_of" - networktocode.nautobot.service: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - name: "node-exporter" - port: 9100 - protocol: UDP - ipaddresses: - - address: "172.16.180.1/24" - state: present - ignore_errors: yes - register: test_service_required_one_of - -- name: "PYNAUTOBOT_SERVICE ASSERT - Failed due to missing arguments" - assert: - that: - - test_service_required_one_of is failed - - 'test_service_required_one_of["msg"] == "one of the following is required: device, virtual_machine"' - -- name: "PYNAUTOBOT_SERVICE: Create new service on virtual_machine" - networktocode.nautobot.service: - url: "http://localhost:32768" - token: "0123456789abcdef0123456789abcdef01234567" - data: - virtual_machine: "test100-vm" - name: "node-exporter" - port: 9100 - protocol: TCP - state: present - register: test_service_create_vm - -- name: "PYNAUTOBOT_SERVICE ASSERT - Create" - assert: - that: - - test_service_create_vm is changed - - test_service_create_vm['services']['name'] == "node-exporter" - - test_service_create_vm['services']['port'] == 9100 - - test_service_create_vm['services']['protocol'] == "tcp" - - test_service_create_vm['diff']['after']['state'] == "present" - - test_service_create_vm['diff']['before']['state'] == "absent" - - test_service_create_vm['msg'] == "services node-exporter created" diff --git a/tests/integration/targets/v2.9/tasks/site.yml b/tests/integration/targets/v2.9/tasks/site.yml deleted file mode 100644 index ce1e4578..00000000 --- a/tests/integration/targets/v2.9/tasks/site.yml +++ /dev/null @@ -1,180 +0,0 @@ ---- -## -## -### PYNAUTOBOT_SITE -## -## -- name: "1 - Create site within Nautobot with only required information" - networktocode.nautobot.site: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test - Colorado - state: present - register: test_one - -- name: "1 - ASSERT" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['site']['name'] == "Test - Colorado" - - test_one['msg'] == "site Test - Colorado created" - -- name: "2 - Duplicate" - networktocode.nautobot.site: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test - Colorado - state: present - register: test_two - -- name: "2 - ASSERT" - assert: - that: - - not test_two['changed'] - - test_two['msg'] == "site Test - Colorado already exists" - - test_two['site']['name'] == "Test - Colorado" - -- name: "3 - Update Test - Colorado" - networktocode.nautobot.site: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test - Colorado - status: Planned - region: Test Region - contact_name: Mikhail - state: present - register: test_three - -- name: "3 - ASSERT" - assert: - that: - - test_three is changed - - test_three['diff']['after']['status'] == "planned" - - test_three['diff']['after']['contact_name'] == "Mikhail" - - test_three['diff']['after']['region'] == 1 - - test_three['msg'] == "site Test - Colorado updated" - - test_three['site']['name'] == "Test - Colorado" - - test_three['site']['status'] == "planned" - - test_three['site']['contact_name'] == "Mikhail" - - test_three['site']['region'] == 1 - -- name: "4 - Create site with all parameters" - networktocode.nautobot.site: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test - California - status: Planned - region: Test Region - tenant: Test Tenant - facility: EquinoxCA7 - asn: 65001 - time_zone: America/Los Angeles - description: This is a test description - physical_address: Hollywood, CA, 90210 - shipping_address: Hollywood, CA, 90210 - latitude: "22.169141" - longitude: "-100.994041" - contact_name: Jenny - contact_phone: 867-5309 - contact_email: jenny@changednumber.com - comments: "### Placeholder" - slug: "test_california" - state: present - register: test_four - -- name: "4 - ASSERT" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['site']['name'] == "Test - California" - - test_four['msg'] == "site Test - California created" - - test_four['site']['status'] == "planned" - - test_four['site']['region'] == 1 - - test_four['site']['tenant'] == 1 - - test_four['site']['facility'] == "EquinoxCA7" - - test_four['site']['asn'] == 65001 - - test_four['site']['time_zone'] == "America/Los_Angeles" - - test_four['site']['description'] == "This is a test description" - - test_four['site']['physical_address'] == "Hollywood, CA, 90210" - - test_four['site']['shipping_address'] == "Hollywood, CA, 90210" - - test_four['site']['latitude'] == "22.169141" - - test_four['site']['longitude'] == "-100.994041" - - test_four['site']['contact_name'] == "Jenny" - - test_four['site']['contact_phone'] == "867-5309" - - test_four['site']['contact_email'] == "jenny@changednumber.com" - - test_four['site']['comments'] == "### Placeholder" - - test_four['site']['slug'] == "test_california" - -- name: "PYNAUTOBOT_SITE_IDEM: Idempotency - Create duplicate site with all parameters" - networktocode.nautobot.site: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test - California - status: Planned - region: Test Region - tenant: Test Tenant - facility: EquinoxCA7 - asn: 65001 - time_zone: America/Los Angeles - description: This is a test description - physical_address: Hollywood, CA, 90210 - shipping_address: Hollywood, CA, 90210 - latitude: "22.169141" - longitude: "-100.994041" - contact_name: Jenny - contact_phone: 867-5309 - contact_email: jenny@changednumber.com - comments: "### Placeholder" - slug: "test_california" - state: present - register: test_results - -- name: "PYNAUTOBOT_SITE_IDEM: (ASSERT) Idempotency - Duplicate device site with all parameters" - assert: - that: - - test_results is not changed - - test_results['site']['name'] == "Test - California" - - test_results['msg'] == "site Test - California already exists" - - test_results['site']['status'] == "planned" - - test_results['site']['region'] == 1 - - test_results['site']['tenant'] == 1 - - test_results['site']['facility'] == "EquinoxCA7" - - test_results['site']['asn'] == 65001 - - test_results['site']['time_zone'] == "America/Los_Angeles" - - test_results['site']['description'] == "This is a test description" - - test_results['site']['physical_address'] == "Hollywood, CA, 90210" - - test_results['site']['shipping_address'] == "Hollywood, CA, 90210" - - test_results['site']['latitude'] == "22.169141" - - test_results['site']['longitude'] == "-100.994041" - - test_results['site']['contact_name'] == "Jenny" - - test_results['site']['contact_phone'] == "867-5309" - - test_results['site']['contact_email'] == "jenny@changednumber.com" - - test_results['site']['comments'] == "### Placeholder" - - test_results['site']['slug'] == "test_california" - -- name: "5 - Delete site within nautobot" - networktocode.nautobot.site: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test - Colorado - state: absent - register: test_five - -- name: "5 - ASSERT" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['site']['name'] == "Test - Colorado" - - test_five['msg'] == "site Test - Colorado deleted" diff --git a/tests/integration/targets/v2.9/tasks/tag.yml b/tests/integration/targets/v2.9/tasks/tag.yml deleted file mode 100644 index 88f61a46..00000000 --- a/tests/integration/targets/v2.9/tasks/tag.yml +++ /dev/null @@ -1,110 +0,0 @@ ---- -## -## -### PYNAUTOBOT_TAGS -## -## -- name: "TAG 1: ASSERT - Necessary info creation" - networktocode.nautobot.tag: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tag 1" - description: "Tag 1 test" - color: "0000ff" - state: present - register: test_one - -- name: "TAG 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['tags']['color'] == "0000ff" - - test_one['tags']['description'] == "Tag 1 test" - - test_one['tags']['name'] == "Test Tag 1" - - test_one['tags']['slug'] == "test-tag-1" - - test_one['msg'] == "tags Test Tag 1 created" - -- name: "TAG 2: Create duplicate" - networktocode.nautobot.tag: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tag 1" - description: "Tag 1 test" - color: "0000ff" - state: present - register: test_two - -- name: "TAG 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['tags']['name'] == "Test Tag 1" - - test_two['msg'] == "tags Test Tag 1 already exists" - -- name: "TAG 3: ASSERT - Update" - networktocode.nautobot.tag: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tag 1" - description: "Tag 1 update test" - color: "00ff00" - state: present - register: test_three - -- name: "TAG 3: ASSERT - Updated" - assert: - that: - - test_three is changed - - test_three['diff']['after']['color'] == "00ff00" - - test_three['diff']['after']['description'] == "Tag 1 update test" - - test_three['tags']['name'] == "Test Tag 1" - - test_three['tags']['description'] == "Tag 1 update test" - - test_three['tags']['color'] == "00ff00" - - test_three['msg'] == "tags Test Tag 1 updated" - -- name: "TAG 4: ASSERT - Delete" - networktocode.nautobot.tag: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tag 1" - state: absent - register: test_four - -- name: "TAG 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['diff']['after']['state'] == "absent" - - test_four['tags']['name'] == "Test Tag 1" - - test_four['tags']['slug'] == "test-tag-1" - - test_four['msg'] == "tags Test Tag 1 deleted" - -- name: "TAG 5: ASSERT - Necessary info creation" - networktocode.nautobot.tag: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tag 5" - slug: "test-tag-five" - description: "Tag 5 test" - color: "0000ff" - state: present - register: test_five - -- name: "TAG 5: ASSERT - Necessary info creation" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "absent" - - test_five['diff']['after']['state'] == "present" - - test_five['tags']['color'] == "0000ff" - - test_five['tags']['description'] == "Tag 5 test" - - test_five['tags']['name'] == "Test Tag 5" - - test_five['tags']['slug'] == "test-tag-five" - - test_five['msg'] == "tags Test Tag 5 created" diff --git a/tests/integration/targets/v2.9/tasks/tenant.yml b/tests/integration/targets/v2.9/tasks/tenant.yml deleted file mode 100644 index 85646f58..00000000 --- a/tests/integration/targets/v2.9/tasks/tenant.yml +++ /dev/null @@ -1,106 +0,0 @@ ---- -## -## -### PYNAUTOBOT_TENANT -## -## -- name: "1 - Test tenant creation" - networktocode.nautobot.tenant: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Tenant ABC" - register: test_one - -- name: "1 - ASSERT" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['tenant']['name'] == "Tenant ABC" - - test_one['tenant']['slug'] == "tenant-abc" - - test_one['msg'] == "tenant Tenant ABC created" - -- name: "Test duplicate tenant" - networktocode.nautobot.tenant: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Tenant ABC" - register: test_two - -- name: "2 - ASSERT" - assert: - that: - - not test_two['changed'] - - test_two['tenant']['name'] == "Tenant ABC" - - test_two['tenant']['slug'] == "tenant-abc" - - test_two['msg'] == "tenant Tenant ABC already exists" - -- name: "3 - Test update" - networktocode.nautobot.tenant: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Tenant ABC" - description: "Updated description" - register: test_three - -- name: "3 - ASSERT" - assert: - that: - - test_three is changed - - test_three['diff']['after']['description'] == "Updated description" - - test_three['tenant']['name'] == "Tenant ABC" - - test_three['tenant']['slug'] == "tenant-abc" - - test_three['tenant']['description'] == "Updated description" - - test_three['msg'] == "tenant Tenant ABC updated" - -- name: "4 - Test delete" - networktocode.nautobot.tenant: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Tenant ABC" - state: "absent" - register: test_four - -- name: "4 - ASSERT" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "present" - - test_four['diff']['after']['state'] == "absent" - - test_four['msg'] == "tenant Tenant ABC deleted" - -- name: "5 - Create tenant with all parameters" - networktocode.nautobot.tenant: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Tenant ABC" - description: "ABC Incorporated" - comments: "### This tenant is super cool" - tenant_group: "Test Tenant Group" - slug: "tenant_abc" - tags: - - "tagA" - - "tagB" - - "tagC" - state: present - register: test_five - -- name: "5 - ASSERT" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "absent" - - test_five['diff']['after']['state'] == "present" - - test_five['tenant']['name'] == "Tenant ABC" - - test_five['tenant']['slug'] == "tenant_abc" - - test_five['tenant']['description'] == "ABC Incorporated" - - test_five['tenant']['comments'] == "### This tenant is super cool" - - test_five['tenant']['group'] == 1 - - test_five['tenant']['tags'] | length == 3 - - test_five['msg'] == "tenant Tenant ABC created" diff --git a/tests/integration/targets/v2.9/tasks/tenant_group.yml b/tests/integration/targets/v2.9/tasks/tenant_group.yml deleted file mode 100644 index 63bda776..00000000 --- a/tests/integration/targets/v2.9/tasks/tenant_group.yml +++ /dev/null @@ -1,75 +0,0 @@ ---- -## -## -### PYNAUTOBOT_TENANT_GROUP -## -## -- name: "1 - Test tenant group creation" - networktocode.nautobot.tenant_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tenant Group Two" - register: test_one - -- name: "1 - ASSERT" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['tenant_group']['name'] == "Test Tenant Group Two" - - test_one['tenant_group']['slug'] == "test-tenant-group-two" - - test_one['msg'] == "tenant_group Test Tenant Group Two created" - -- name: "Test duplicate tenant group" - networktocode.nautobot.tenant_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tenant Group Two" - register: test_two - -- name: "2 - ASSERT" - assert: - that: - - not test_two['changed'] - - test_two['tenant_group']['name'] == "Test Tenant Group Two" - - test_two['tenant_group']['slug'] == "test-tenant-group-two" - - test_two['msg'] == "tenant_group Test Tenant Group Two already exists" - -- name: "3 - Test delete" - networktocode.nautobot.tenant_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tenant Group Two" - state: "absent" - register: test_three - -- name: "3 - ASSERT" - assert: - that: - - test_three is changed - - test_three['diff']['before']['state'] == "present" - - test_three['diff']['after']['state'] == "absent" - - test_three['msg'] == "tenant_group Test Tenant Group Two deleted" - -- name: "4 - Test another tenant group creation" - networktocode.nautobot.tenant_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test Tenant Group ABC" - slug: "test_tenant_group_four" - register: test_four - -- name: "4 - ASSERT" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['tenant_group']['name'] == "Test Tenant Group ABC" - - test_four['tenant_group']['slug'] == "test_tenant_group_four" - - test_four['msg'] == "tenant_group Test Tenant Group ABC created" diff --git a/tests/integration/targets/v2.9/tasks/virtual_chassis.yml b/tests/integration/targets/v2.9/tasks/virtual_chassis.yml deleted file mode 100644 index aa2fddac..00000000 --- a/tests/integration/targets/v2.9/tasks/virtual_chassis.yml +++ /dev/null @@ -1,131 +0,0 @@ ---- -# © 2020 Nokia -# Licensed under the GNU General Public License v3.0 only -# SPDX-License-Identifier: GPL-3.0-only -## -## -### PYNAUTOBOT_VIRTUAL_CHASSIS -## -## -- name: "VIRTUAL_CHASSIS 0: Create device for testing virtual chassis" - networktocode.nautobot.device: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Device Virtual Chassis Tests - device_type: Cisco Test - device_role: Core Switch - site: Test Site - vc_position: 1 - vc_priority: 1 - state: present - -- name: "VIRTUAL_CHASSIS 1: Necessary info creation" - networktocode.nautobot.virtual_chassis: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "First VC" - master: Device Virtual Chassis Tests - state: present - register: test_one - -- name: "VIRTUAL_CHASSIS 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['virtual_chassis']['master'] == 11 - - test_one['virtual_chassis']['name'] == "First VC" - - test_one['msg'] == "virtual_chassis First VC created" - -- name: "VIRTUAL_CHASSIS 2: Create duplicate" - networktocode.nautobot.virtual_chassis: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "First VC" - master: Device Virtual Chassis Tests - state: present - register: test_two - -- name: "VIRTUAL_CHASSIS 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['virtual_chassis']['master'] == 11 - - test_two['virtual_chassis']['name'] == "First VC" - - test_two['msg'] == "virtual_chassis First VC already exists" - -- name: "POWER_FEED 3: Update virtual_chassis with other fields" - networktocode.nautobot.virtual_chassis: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "First VC" - master: Device Virtual Chassis Tests - domain: Domain Text - state: present - register: test_three - -- name: "POWER_FEED 3: ASSERT - Update virtual_chassis with other fields" - assert: - that: - - test_three is changed - - test_three['diff']['after']['domain'] == "Domain Text" - - test_three['virtual_chassis']['master'] == 11 - - test_three['virtual_chassis']['domain'] == "Domain Text" - - test_three['virtual_chassis']['name'] == "First VC" - - test_three['msg'] == "virtual_chassis First VC updated" - -- name: "VIRTUAL_CHASSIS 4: Create device for testing virtual chassis deletion" - networktocode.nautobot.device: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Device Virtual Chassis Tests 2 - device_type: Cisco Test - device_role: Core Switch - site: Test Site - vc_position: 1 - vc_priority: 15 - state: present - -- name: "VIRTUAL_CHASSIS 4: Create Virtual Chassis for Delete Test" - networktocode.nautobot.virtual_chassis: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Second VC" - master: Device Virtual Chassis Tests 2 - state: present - register: test_four - -- name: "VIRTUAL_CHASSIS 4: ASSERT - Create Virtual Chassis for Delete Test" - assert: - that: - - test_four is changed - - test_four['diff']['before']['state'] == "absent" - - test_four['diff']['after']['state'] == "present" - - test_four['virtual_chassis']['master'] == 12 - - test_four['virtual_chassis']['name'] == "Second VC" - - test_four['msg'] == "virtual_chassis Second VC created" - -- name: "VIRTUAL_CHASSIS 5: Delete Virtual Chassis" - networktocode.nautobot.virtual_chassis: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Second VC" - master: Device Virtual Chassis Tests 2 - state: absent - register: test_five - -- name: "VIRTUAL_CHASSIS 5: ASSERT - Delete Virtual Chassis" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['msg'] == "virtual_chassis Second VC deleted" diff --git a/tests/integration/targets/v2.9/tasks/virtual_machine.yml b/tests/integration/targets/v2.9/tasks/virtual_machine.yml deleted file mode 100644 index 40f5f608..00000000 --- a/tests/integration/targets/v2.9/tasks/virtual_machine.yml +++ /dev/null @@ -1,99 +0,0 @@ ---- -## -## -### PYNAUTOBOT_VIRTUAL_MACHINES -## -## -- name: "VIRTUAL_MACHINE 1: Necessary info creation" - networktocode.nautobot.virtual_machine: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VM One" - cluster: "Test Cluster" - state: present - register: test_one - -- name: "VIRTUAL_MACHINE 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['virtual_machine']['name'] == "Test VM One" - - test_one['virtual_machine']['cluster'] == 1 - - test_one['msg'] == "virtual_machine Test VM One created" - -- name: "VIRTUAL_MACHINE 2: Create duplicate" - networktocode.nautobot.virtual_machine: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VM One" - cluster: "Test Cluster" - state: present - register: test_two - -- name: "VIRTUAL_MACHINE 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['virtual_machine']['name'] == "Test VM One" - - test_two['virtual_machine']['cluster'] == 1 - - test_two['msg'] == "virtual_machine Test VM One already exists" - -- name: "VIRTUAL_MACHINE 3: Update" - networktocode.nautobot.virtual_machine: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VM One" - cluster: "Test Cluster" - vcpus: 8 - memory: 8 - status: "Planned" - virtual_machine_role: "Test VM Role" - tags: - - "Schnozzberry" - state: present - register: test_three - -- name: "VIRTUAL_MACHINE 3: ASSERT - Updated" - assert: - that: - - test_three is changed - - test_three['diff']['after']['vcpus'] == 8 - - test_three['diff']['after']['memory'] == 8 - - test_three['diff']['after']['status'] == "planned" - - test_three['diff']['after']['role'] == 2 - - test_three['diff']['after']['tags'][0] == 4 - - test_three['virtual_machine']['name'] == "Test VM One" - - test_three['virtual_machine']['cluster'] == 1 - - test_three['virtual_machine']['vcpus'] == 8 - - test_three['virtual_machine']['memory'] == 8 - - test_three['virtual_machine']['status'] == "planned" - - test_three['virtual_machine']['role'] == 2 - - test_three['virtual_machine']['tags'][0] == 4 - - test_three['msg'] == "virtual_machine Test VM One updated" - -- name: "VIRTUAL_MACHINE 4: ASSERT - Delete" - networktocode.nautobot.virtual_machine: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VM One" - state: absent - register: test_four - -- name: "VIRTUAL_MACHINE 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['virtual_machine']['name'] == "Test VM One" - - test_four['virtual_machine']['cluster'] == 1 - - test_four['virtual_machine']['vcpus'] == 8 - - test_four['virtual_machine']['memory'] == 8 - - test_four['virtual_machine']['status'] == "planned" - - test_four['virtual_machine']['role'] == 2 - - test_four['virtual_machine']['tags'][0] == 4 - - test_four['msg'] == "virtual_machine Test VM One deleted" diff --git a/tests/integration/targets/v2.9/tasks/vlan.yml b/tests/integration/targets/v2.9/tasks/vlan.yml deleted file mode 100644 index c7b2f084..00000000 --- a/tests/integration/targets/v2.9/tasks/vlan.yml +++ /dev/null @@ -1,193 +0,0 @@ ---- -## -## -### PYNAUTOBOT_VLAN -## -## -- name: "VLAN 1: Necessary info creation" - networktocode.nautobot.vlan: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test VLAN 500 - vid: 500 - state: present - register: test_one - -- name: "VLAN 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['vlan']['name'] == "Test VLAN 500" - - test_one['vlan']['vid'] == 500 - - test_one['msg'] == "vlan Test VLAN 500 created" - -- name: "VLAN 2: Create duplicate" - networktocode.nautobot.vlan: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test VLAN 500 - vid: 500 - state: present - register: test_two - -- name: "VLAN 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['vlan']['name'] == "Test VLAN 500" - - test_two['vlan']['vid'] == 500 - - test_two['msg'] == "vlan Test VLAN 500 already exists" - -- name: "VLAN 3: Create VLAN with same name, but different site" - networktocode.nautobot.vlan: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test VLAN 500 - vid: 500 - site: Test Site - tenant: Test Tenant - vlan_group: "Test VLAN Group" - state: present - register: test_three - -- name: "VLAN 3: ASSERT - Create VLAN with same name, but different site" - assert: - that: - - test_three is changed - - test_three['diff']['before']['state'] == "absent" - - test_three['diff']['after']['state'] == "present" - - test_three['vlan']['name'] == "Test VLAN 500" - - test_three['vlan']['vid'] == 500 - - test_three['vlan']['site'] == 1 - - test_three['vlan']['group'] == 1 - - test_three['msg'] == "vlan Test VLAN 500 created" - -- name: "VLAN 4: ASSERT - Update" - networktocode.nautobot.vlan: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VLAN 500" - vid: 500 - tenant: "Test Tenant" - vlan_group: "Test VLAN Group" - status: Reserved - vlan_role: Network of care - description: Updated description - site: "Test Site" - tags: - - "Schnozzberry" - state: present - register: test_four - -- name: "VLAN 4: ASSERT - Updated" - assert: - that: - - test_four is changed - - test_four['diff']['after']['status'] == "reserved" - - test_four['diff']['after']['role'] == 1 - - test_four['diff']['after']['description'] == "Updated description" - - test_four['diff']['after']['tags'][0] == 4 - - test_four['vlan']['name'] == "Test VLAN 500" - - test_four['vlan']['tenant'] == 1 - - test_four['vlan']['site'] == 1 - - test_four['vlan']['group'] == 1 - - test_four['vlan']['status'] == "reserved" - - test_four['vlan']['role'] == 1 - - test_four['vlan']['description'] == "Updated description" - - test_four['vlan']['tags'][0] == 4 - - test_four['msg'] == "vlan Test VLAN 500 updated" - -- name: "VLAN: ASSERT - IDEMPOTENT WITH VLAN_GROUP" - networktocode.nautobot.vlan: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VLAN 500" - vid: 500 - tenant: "Test Tenant" - vlan_group: "Test VLAN Group" - status: Reserved - vlan_role: Network of care - description: Updated description - site: "Test Site" - tags: - - "Schnozzberry" - state: present - register: idempotent_vlan_group - -- name: "VLAN: ASSERT - IDEMPOTENT WITH VLAN_GROUP" - assert: - that: - - idempotent_vlan_group is not changed - -- name: "VLAN: Create VLAN with same name, but different vlan_group" - networktocode.nautobot.vlan: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test VLAN 500 - vid: 500 - site: Test Site - tenant: Test Tenant - vlan_group: "Test VLAN Group 2" - state: present - register: new_vlan_group - -- name: "VLAN: ASSERT - Create VLAN with same name, but different vlan_group" - assert: - that: - - new_vlan_group is changed - - new_vlan_group['diff']['before']['state'] == "absent" - - new_vlan_group['diff']['after']['state'] == "present" - - new_vlan_group['vlan']['name'] == "Test VLAN 500" - - new_vlan_group['vlan']['vid'] == 500 - - new_vlan_group['vlan']['site'] == 1 - - new_vlan_group['vlan']['group'] == 2 - - new_vlan_group['msg'] == "vlan Test VLAN 500 created" - -- name: "VLAN 5: ASSERT - Delete more than one result" - networktocode.nautobot.vlan: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VLAN 500" - state: absent - ignore_errors: yes - register: test_five - -- name: "VLAN 5: ASSERT - Delete more than one result" - assert: - that: - - test_five is failed - - test_five['msg'] == "More than one result returned for Test VLAN 500" - -- name: "VLAN 6: ASSERT - Delete" - networktocode.nautobot.vlan: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VLAN 500" - site: Test Site - vlan_group: "Test VLAN Group" - state: absent - register: test_six - -- name: "VLAN 6: ASSERT - Delete" - assert: - that: - - test_six is changed - - test_six['vlan']['name'] == "Test VLAN 500" - - test_six['vlan']['tenant'] == 1 - - test_six['vlan']['site'] == 1 - - test_six['vlan']['group'] == 1 - - test_six['vlan']['status'] == "reserved" - - test_six['vlan']['role'] == 1 - - test_six['vlan']['description'] == "Updated description" - - test_six['vlan']['tags'][0] == 4 - - test_six['msg'] == "vlan Test VLAN 500 deleted" diff --git a/tests/integration/targets/v2.9/tasks/vlan_group.yml b/tests/integration/targets/v2.9/tasks/vlan_group.yml deleted file mode 100644 index 38053297..00000000 --- a/tests/integration/targets/v2.9/tasks/vlan_group.yml +++ /dev/null @@ -1,118 +0,0 @@ ---- -## -## -### PYNAUTOBOT_VLAN_GROUP -## -## -- name: "VLAN_GROUP 1: Necessary info creation" - networktocode.nautobot.vlan_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "VLAN Group One" - site: Test Site - state: present - register: test_one - -- name: "VLAN_GROUP 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['vlan_group']['name'] == "VLAN Group One" - - test_one['vlan_group']['slug'] == "vlan-group-one" - - test_one['vlan_group']['site'] == 1 - - test_one['msg'] == "vlan_group VLAN Group One created" - -- name: "VLAN_GROUP 2: Create duplicate" - networktocode.nautobot.vlan_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "VLAN Group One" - site: Test Site - state: present - register: test_two - -- name: "VLAN_GROUP 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['vlan_group']['name'] == "VLAN Group One" - - test_two['vlan_group']['slug'] == "vlan-group-one" - - test_two['vlan_group']['site'] == 1 - - test_two['msg'] == "vlan_group VLAN Group One already exists" - -- name: "VLAN_GROUP 3: ASSERT - Create with same name, different site" - networktocode.nautobot.vlan_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "VLAN Group One" - site: "Test Site2" - state: present - register: test_three - -- name: "VLAN_GROUP 3: ASSERT - Create with same name, different site" - assert: - that: - - test_three is changed - - test_three['vlan_group']['name'] == "VLAN Group One" - - test_three['vlan_group']['slug'] == "vlan-group-one" - - test_three['vlan_group']['site'] == 2 - - test_three['msg'] == "vlan_group VLAN Group One created" - -- name: "VLAN_GROUP 4: ASSERT - Create vlan group, no site" - networktocode.nautobot.vlan_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "VLAN Group One" - state: present - ignore_errors: yes - register: test_four - -- name: "VLAN_GROUP 4: ASSERT - Create with same name, different site" - assert: - that: - - test_four is failed - - test_four['msg'] == "More than one result returned for VLAN Group One" - -- name: "VLAN_GROUP 5: ASSERT - Delete" - networktocode.nautobot.vlan_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: VLAN Group One - site: Test Site2 - state: absent - register: test_five - -- name: "VLAN_GROUP 5: ASSERT - Delete" - assert: - that: - - test_five is changed - - test_five['diff']['before']['state'] == "present" - - test_five['diff']['after']['state'] == "absent" - - test_five['vlan_group']['name'] == "VLAN Group One" - - test_five['vlan_group']['slug'] == "vlan-group-one" - - test_five['vlan_group']['site'] == 2 - - test_five['msg'] == "vlan_group VLAN Group One deleted" - -- name: "VLAN_GROUP 6: ASSERT - Delete non existing" - networktocode.nautobot.vlan_group: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: VLAN Group One - site: Test Site2 - state: absent - register: test_six - -- name: "VLAN_GROUP 6: ASSERT - Delete non existing`" - assert: - that: - - not test_six['changed'] - - test_six['vlan_group'] == None - - test_six['msg'] == "vlan_group VLAN Group One already absent" diff --git a/tests/integration/targets/v2.9/tasks/vm_interface.yml b/tests/integration/targets/v2.9/tasks/vm_interface.yml deleted file mode 100644 index 4429ce05..00000000 --- a/tests/integration/targets/v2.9/tasks/vm_interface.yml +++ /dev/null @@ -1,159 +0,0 @@ ---- -## -## -### PYNAUTOBOT_VM_INTERFACE -## -## -- name: "PYNAUTOBOT_VM_INTERFACE 1: Necessary info creation" - networktocode.nautobot.vm_interface: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - virtual_machine: "test100-vm" - name: "Eth10" - state: present - register: test_one - -- name: "PYNAUTOBOT_VM_INTERFACE 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['interface']['name'] == "Eth10" - - test_one['interface']['virtual_machine'] == 1 - - test_one['msg'] == "interface Eth10 created" - -- name: "PYNAUTOBOT_VM_INTERFACE 2: Create duplicate" - networktocode.nautobot.vm_interface: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - virtual_machine: "test100-vm" - name: "Eth10" - state: present - register: test_two - -- name: "PYNAUTOBOT_VM_INTERFACE 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['interface']['name'] == "Eth10" - - test_two['interface']['virtual_machine'] == 1 - - test_two['msg'] == "interface Eth10 already exists" - -- name: "PYNAUTOBOT_VM_INTERFACE 3: Updated" - networktocode.nautobot.vm_interface: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - virtual_machine: "test100-vm" - name: "Eth10" - enabled: false - mtu: 9000 - mac_address: "00:00:00:AA:AA:01" - description: "Updated test100-vm" - mode: Tagged - untagged_vlan: - name: Wireless - site: Test Site - tagged_vlans: - - name: Data - site: Test Site - - name: VoIP - site: Test Site - tags: - - "Schnozzberry" - state: present - register: test_three - -- name: "PYNAUTOBOT_VM_INTERFACE 4: ASSERT - Updated" - assert: - that: - - test_three is changed - - test_three['diff']['after']['enabled'] == false - - test_three['diff']['after']['mtu'] == 9000 - - test_three['diff']['after']['mac_address'] == "00:00:00:AA:AA:01" - - test_three['diff']['after']['description'] == "Updated test100-vm" - - test_three['diff']['after']['mode'] == "tagged" - - test_three['diff']['after']['untagged_vlan'] == 1 - - test_three['diff']['after']['tagged_vlans'] == [2, 3] - - test_three['diff']['after']['tags'][0] == 4 - - test_three['interface']['name'] == "Eth10" - - test_three['interface']['virtual_machine'] == 1 - - test_three['interface']['enabled'] == false - - test_three['interface']['mtu'] == 9000 - - test_three['interface']['mac_address'] == "00:00:00:AA:AA:01" - - test_three['interface']['description'] == "Updated test100-vm" - - test_three['interface']['mode'] == "tagged" - - test_three['interface']['untagged_vlan'] == 1 - - test_three['interface']['tagged_vlans'] == [2, 3] - - test_three['interface']['tags'][0] == 4 - - test_three['msg'] == "interface Eth10 updated" - -- name: "PYNAUTOBOT_VM_INTERFACE 4: ASSERT - Delete" - networktocode.nautobot.vm_interface: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Eth10" - virtual_machine: "test100-vm" - state: absent - register: test_four - -- name: "PYNAUTOBOT_VM_INTERFACE 4: ASSERT - Delete" - assert: - that: - - test_four is changed - - test_four['interface']['name'] == "Eth10" - - test_four['interface']['virtual_machine'] == 1 - - test_four['msg'] == "interface Eth10 deleted" - -- name: "PYNAUTOBOT_VM_INTERFACE 5: Attempt to update interface with same name on other VMs" - networktocode.nautobot.vm_interface: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - virtual_machine: "test100-vm" - name: "Eth0" - enabled: false - mtu: 9000 - mac_address: "00:00:00:AA:AA:01" - description: "Updated test100-vm Eth0 intf" - mode: Tagged - untagged_vlan: - name: Wireless - site: Test Site - tagged_vlans: - - name: Data - site: Test Site - - name: VoIP - site: Test Site - tags: - - "Schnozzberry" - state: present - register: test_five - -- name: "PYNAUTOBOT_VM_INTERFACE 5: ASSERT - Updated" - assert: - that: - - test_five is changed - - test_five['diff']['after']['enabled'] == false - - test_five['diff']['after']['mtu'] == 9000 - - test_five['diff']['after']['mac_address'] == "00:00:00:AA:AA:01" - - test_five['diff']['after']['description'] == "Updated test100-vm Eth0 intf" - - test_five['diff']['after']['mode'] == "tagged" - - test_five['diff']['after']['untagged_vlan'] == 1 - - test_five['diff']['after']['tagged_vlans'] == [2, 3] - - test_five['diff']['after']['tags'][0] == 4 - - test_five['interface']['name'] == "Eth0" - - test_five['interface']['virtual_machine'] == 1 - - test_five['interface']['enabled'] == false - - test_five['interface']['mtu'] == 9000 - - test_five['interface']['mac_address'] == "00:00:00:AA:AA:01" - - test_five['interface']['description'] == "Updated test100-vm Eth0 intf" - - test_five['interface']['mode'] == "tagged" - - test_five['interface']['untagged_vlan'] == 1 - - test_five['interface']['tagged_vlans'] == [2, 3] - - test_five['interface']['tags'][0] == 4 - - test_five['msg'] == "interface Eth0 updated" diff --git a/tests/integration/targets/v2.9/tasks/vrf.yml b/tests/integration/targets/v2.9/tasks/vrf.yml deleted file mode 100644 index c395806f..00000000 --- a/tests/integration/targets/v2.9/tasks/vrf.yml +++ /dev/null @@ -1,128 +0,0 @@ ---- -## -## -### PYNAUTOBOT_VRF -## -## -- name: "VRF 1: Necessary info creation" - networktocode.nautobot.vrf: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test VRF One - state: present - register: test_one - -- name: "VRF 1: ASSERT - Necessary info creation" - assert: - that: - - test_one is changed - - test_one['diff']['before']['state'] == "absent" - - test_one['diff']['after']['state'] == "present" - - test_one['vrf']['name'] == "Test VRF One" - - test_one['msg'] == "vrf Test VRF One created" - -- name: "VRF 2: Create duplicate" - networktocode.nautobot.vrf: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test VRF One - state: present - register: test_two - -- name: "VRF 2: ASSERT - Create duplicate" - assert: - that: - - not test_two['changed'] - - test_two['vrf']['name'] == "Test VRF One" - - test_two['msg'] == "vrf Test VRF One already exists" - -- name: "VRF 3: Create VRF with same name, but different tenant" - networktocode.nautobot.vrf: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: Test VRF One - tenant: Test Tenant - state: present - register: test_three - -- name: "VRF 3: ASSERT - Create VRF with same name, but different site" - assert: - that: - - test_three is changed - - test_three['diff']['before']['state'] == "absent" - - test_three['diff']['after']['state'] == "present" - - test_three['vrf']['name'] == "Test VRF One" - - test_three['vrf']['tenant'] == 1 - - test_three['msg'] == "vrf Test VRF One created" - -- name: "VRF 4: ASSERT - Update" - networktocode.nautobot.vrf: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VRF One" - rd: "65001:1" - enforce_unique: False - tenant: "Test Tenant" - description: Updated description - tags: - - "Schnozzberry" - state: present - register: test_four - -- name: "VRF 4: ASSERT - Updated" - assert: - that: - - test_four is changed - - test_four['diff']['after']['rd'] == "65001:1" - - test_four['diff']['after']['enforce_unique'] == false - - test_four['diff']['after']['description'] == "Updated description" - - test_four['diff']['after']['tags'][0] == 4 - - test_four['vrf']['name'] == "Test VRF One" - - test_four['vrf']['tenant'] == 1 - - test_four['vrf']['rd'] == "65001:1" - - test_four['vrf']['enforce_unique'] == false - - test_four['vrf']['description'] == "Updated description" - - test_four['vrf']['tags'][0] == 4 - - test_four['msg'] == "vrf Test VRF One updated" - -- name: "VRF 5: ASSERT - Delete more than one result" - networktocode.nautobot.vrf: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VRF One" - state: absent - ignore_errors: yes - register: test_five - -- name: "VRF 5: ASSERT - Delete more than one result" - assert: - that: - - test_five is failed - - test_five['msg'] == "More than one result returned for Test VRF One" - -- name: "VRF 6: ASSERT - Delete" - networktocode.nautobot.vrf: - url: http://localhost:32768 - token: 0123456789abcdef0123456789abcdef01234567 - data: - name: "Test VRF One" - tenant: Test Tenant - state: absent - register: test_six - -- name: "VRF 6: ASSERT - Delete" - assert: - that: - - test_six is changed - - test_six['vrf']['name'] == "Test VRF One" - - test_six['vrf']['tenant'] == 1 - - test_six['vrf']['rd'] == "65001:1" - - test_six['vrf']['enforce_unique'] == false - - test_six['vrf']['description'] == "Updated description" - - test_six['vrf']['tags'][0] == 4 - - test_six['msg'] == "vrf Test VRF One deleted" diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt deleted file mode 100644 index a01ceacf..00000000 --- a/tests/sanity/ignore-2.10.txt +++ /dev/null @@ -1,27 +0,0 @@ -plugins/modules/aggregate.py validate-modules:parameter-list-no-elements -plugins/modules/circuit.py validate-modules:parameter-list-no-elements -plugins/modules/cluster.py validate-modules:parameter-list-no-elements -plugins/modules/console_port.py validate-modules:parameter-list-no-elements -plugins/modules/console_server_port.py validate-modules:parameter-list-no-elements -plugins/modules/device_bay.py validate-modules:parameter-list-no-elements -plugins/modules/device_interface.py validate-modules:parameter-list-no-elements -plugins/modules/device_type.py validate-modules:parameter-list-no-elements -plugins/modules/front_port.py validate-modules:parameter-list-no-elements -plugins/modules/inventory_item.py validate-modules:parameter-list-no-elements -plugins/modules/ip_address.py validate-modules:parameter-list-no-elements -plugins/modules/power_feed.py validate-modules:parameter-list-no-elements -plugins/modules/power_outlet.py validate-modules:parameter-list-no-elements -plugins/modules/power_port.py validate-modules:parameter-list-no-elements -plugins/modules/prefix.py validate-modules:parameter-list-no-elements -plugins/modules/provider.py validate-modules:parameter-list-no-elements -plugins/modules/rack.py validate-modules:parameter-list-no-elements -plugins/modules/rear_port.py validate-modules:parameter-list-no-elements -plugins/modules/route_target.py validate-modules:parameter-list-no-elements -plugins/modules/service.py validate-modules:parameter-list-no-elements -plugins/modules/site.py validate-modules:parameter-list-no-elements -plugins/modules/tenant.py validate-modules:parameter-list-no-elements -plugins/modules/virtual_chassis.py validate-modules:parameter-list-no-elements -plugins/modules/virtual_machine.py validate-modules:parameter-list-no-elements -plugins/modules/vlan.py validate-modules:parameter-list-no-elements -plugins/modules/vm_interface.py validate-modules:parameter-list-no-elements -plugins/modules/vrf.py validate-modules:parameter-list-no-elements diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt new file mode 100644 index 00000000..66fe44ae --- /dev/null +++ b/tests/sanity/ignore-2.11.txt @@ -0,0 +1 @@ +plugins/inventory/inventory.py pylint:isinstance-second-argument-not-valid-type # Bug that requires newer version (2.7.5) of pylint: https://github.com/PyCQA/pylint/issues/3507 \ No newline at end of file diff --git a/tests/unit/module_utils/test_data/normalize_data/data.json b/tests/unit/module_utils/test_data/normalize_data/data.json index be7f861d..2e4cf376 100644 --- a/tests/unit/module_utils/test_data/normalize_data/data.json +++ b/tests/unit/module_utils/test_data/normalize_data/data.json @@ -298,11 +298,11 @@ { "before": { "interface": { - "id": "123" + "id": "112232fb-b7b2-4375-ac1f-322bb88c0b76" } }, "after": { - "interface": 123 + "interface": "112232fb-b7b2-4375-ac1f-322bb88c0b76" } }, {