Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:nautobot/nautobot-ansible into v…
Browse files Browse the repository at this point in the history
…minterface_role
  • Loading branch information
joewesch committed Sep 3, 2024
2 parents b09b641 + 56575f9 commit 775d597
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 37 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/trigger_manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: "Manual Tests"
on: # yamllint disable
workflow_dispatch:
inputs:
full-integration:
description: "Run full integration tests"
required: true
default: false
type: boolean

jobs:
tests:
uses: ./.github/workflows/tests.yml
with:
full-integration: "${{ inputs.full-integration }}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ docs/_build/*
pb.*.yml
.DS_Store
.env
invoke.yml

# https://github.com/ansible/ansible/issues/68499
# ansible_collections/
Expand Down
10 changes: 10 additions & 0 deletions invoke.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
# Copy this file to invoke.yml and update the variables to override the defaults from tasks.py
# nautobot_ansible:
# nautobot_ver: "2.3.0"
# project_name: "nautobot_ansible"
# python_ver: "3.11"
# local: False
# compose_dir: "/full/path/to/nautobot-ansible/development"
# compose_files:
# - "docker-compose.yml"
2 changes: 2 additions & 0 deletions plugins/module_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
installed_device="name",
import_targets="name",
location="name",
location_type="name",
manufacturer="name",
master="name",
nat_inside="address",
Expand Down Expand Up @@ -175,6 +176,7 @@
"ipaddresses": "ip_addresses",
"lag": "interfaces",
"location": "locations",
"location_type": "location_types",
"manufacturer": "manufacturers",
"master": "devices",
"nat_inside": "ip_addresses",
Expand Down
70 changes: 38 additions & 32 deletions tests/integration/nautobot-populate.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,37 +45,40 @@ def make_nautobot_calls(endpoint, payload):


# Create tags used in future tests
create_tags = make_nautobot_calls(
nb.extras.tags,
[
{"name": "First", "content_types": ["dcim.device", "ipam.routetarget", "dcim.controller"]},
{"name": "Second", "content_types": ["dcim.device", "ipam.routetarget"]},
{"name": "Third", "content_types": ["dcim.device"]},
{
"name": "Schnozzberry",
"content_types": [
"dcim.device",
"dcim.rack",
"ipam.ipaddress",
"ipam.prefix",
"ipam.service",
"ipam.vlan",
"ipam.vrf",
"dcim.devicebay",
"dcim.inventoryitem",
"virtualization.virtualmachine",
"virtualization.cluster",
"virtualization.vminterface",
],
},
{"name": "Lookup", "content_types": ["dcim.device"]},
{"name": "Nolookup", "content_types": ["dcim.device"]},
{"name": "tagA", "content_types": ["dcim.device", "tenancy.tenant"]},
{"name": "tagB", "content_types": ["dcim.device", "tenancy.tenant"]},
{"name": "tagC", "content_types": ["dcim.device", "tenancy.tenant"]},
{"name": "Updated", "content_types": ["dcim.device", "ipam.ipaddress"]},
],
)
tags = [
{"name": "First", "content_types": ["dcim.device", "ipam.routetarget"]},
{"name": "Second", "content_types": ["dcim.device", "ipam.routetarget"]},
{"name": "Third", "content_types": ["dcim.device"]},
{
"name": "Schnozzberry",
"content_types": [
"dcim.device",
"dcim.rack",
"ipam.ipaddress",
"ipam.prefix",
"ipam.service",
"ipam.vlan",
"ipam.vrf",
"dcim.devicebay",
"dcim.inventoryitem",
"virtualization.virtualmachine",
"virtualization.cluster",
"virtualization.vminterface",
],
},
{"name": "Lookup", "content_types": ["dcim.device"]},
{"name": "Nolookup", "content_types": ["dcim.device"]},
{"name": "tagA", "content_types": ["dcim.device", "tenancy.tenant"]},
{"name": "tagB", "content_types": ["dcim.device", "tenancy.tenant"]},
{"name": "tagC", "content_types": ["dcim.device", "tenancy.tenant"]},
{"name": "Updated", "content_types": ["dcim.device", "ipam.ipaddress"]},
]

if nautobot_version >= version.parse("2.2"):
tags.append({"name": "Controller Tag", "content_types": ["dcim.controller"]})

create_tags = make_nautobot_calls(nb.extras.tags, tags)


# ORDER OF OPERATIONS FOR THE MOST PART
# Create TENANT GROUPS
Expand Down Expand Up @@ -248,8 +251,11 @@ def make_nautobot_calls(endpoint, payload):
{"name": "Core Switch", "color": "aa1409", "vm_role": False, "content_types": ["dcim.device"]},
{"name": "Test VM Role", "color": "e91e63", "vm_role": True, "content_types": ["virtualization.virtualmachine"]},
{"name": "Test VM Role 1", "color": "e91e65", "vm_role": True, "content_types": ["dcim.device", "virtualization.virtualmachine"]},
{"name": "Test Controller Role", "color": "e91e65", "vm_role": False, "content_types": ["dcim.controller"]},
]

if nautobot_version >= version.parse("2.2"):
device_roles.append({"name": "Test Controller Role", "color": "e91e65", "vm_role": False, "content_types": ["dcim.controller"]})

created_device_roles = make_nautobot_calls(nb.extras.roles, device_roles)

# Device role variables to be used later on
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/latest/tasks/controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
tenant: "Test Tenant"
controller_device_redundancy_group: "My Device Redundancy Group"
tags:
- First
- Controller Tag
register: test_six_controller

- name: "CONTROLLER 7: ASSERT - As Much As Possible Info creation"
Expand Down
7 changes: 3 additions & 4 deletions tests/integration/targets/latest/tasks/location.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
url: "{{ nautobot_url }}"
token: "{{ nautobot_token }}"
name: Test Location
location_type: "{{ parent_location_type['key'] }}"
location_type: "{{ parent_location_type['value']['name'] }}"
description: Test Location Description
register: test_update

Expand All @@ -68,7 +68,7 @@
name: Test Location 2
status: Active
description: Test Location 2 Description
location_type: "{{ child_location_type['key'] }}"
location_type: "{{ child_location_type['value']['name'] }}"
parent_location: "{{ test_create_min['location']['id'] }}"
tenant: Test Tenant
facility: EquinoxCA7
Expand Down Expand Up @@ -105,7 +105,7 @@
name: Test Location 2
status: Active
description: Test Location 2 Description
location_type: "{{ child_location_type['key'] }}"
location_type: "{{ child_location_type['value']['name'] }}"
parent: "{{ test_create_min['location']['id'] }}"
tenant: Test Tenant
facility: EquinoxCA7
Expand Down Expand Up @@ -166,7 +166,6 @@
- set_fact:
fist_location: "{{ lookup('networktocode.nautobot.lookup', 'locations', api_endpoint=nautobot_url, token=nautobot_token, api_filter='name=\"Test Location\" location_type=\"My Parent Location Type\"') }}"


- name: "8 - Delete location"
networktocode.nautobot.location:
url: "{{ nautobot_url }}"
Expand Down

0 comments on commit 775d597

Please sign in to comment.