diff --git a/plugins/inventory/nb_inventory.py b/plugins/inventory/nb_inventory.py index da9f5ed72..e9ce3af23 100644 --- a/plugins/inventory/nb_inventory.py +++ b/plugins/inventory/nb_inventory.py @@ -537,6 +537,7 @@ def group_extractors(self): "custom_fields": self.extract_custom_fields, "region": self.extract_regions, "cluster": self.extract_cluster, + "cluster_device": self.extract_cluster_device, "cluster_group": self.extract_cluster_group, "cluster_type": self.extract_cluster_type, "is_virtual": self.extract_is_virtual, @@ -943,6 +944,16 @@ def extract_cluster(self, host): except Exception: return + def extract_cluster_device(self, host): + try: + # cluster device does not have a slug + if host.get("device") is None: + return + else: + return host["device"].get("name") + except TypeError: + return + def extract_cluster_group(self, host): try: return self.clusters_group_lookup[host["cluster"]["id"]] diff --git a/tests/integration/netbox-deploy.py b/tests/integration/netbox-deploy.py index 90cff633c..13009df50 100755 --- a/tests/integration/netbox-deploy.py +++ b/tests/integration/netbox-deploy.py @@ -296,6 +296,37 @@ def make_netbox_calls(endpoint, payload): test_rack = nb.dcim.racks.get(name="Test Rack") # racks don't have slugs test_rack_site2 = nb.dcim.racks.get(name="Test Rack Site 2") +## Create Cluster Group +cluster_groups = [{"name": "Test Cluster Group", "slug": "test-cluster-group"}] +created_cluster_groups = make_netbox_calls( + nb.virtualization.cluster_groups, cluster_groups +) +test_cluster_group = nb.virtualization.cluster_groups.get(slug="test-cluster-group") + +## Create Cluster Type +cluster_types = [{"name": "Test Cluster Type", "slug": "test-cluster-type"}] +created_cluster_types = make_netbox_calls( + nb.virtualization.cluster_types, cluster_types +) +test_cluster_type = nb.virtualization.cluster_types.get(slug="test-cluster-type") + +## Create Cluster +clusters = [ + { + "name": "Test Cluster", + "type": test_cluster_type.id, + "group": test_cluster_group.id, + "site": test_site.id, + }, + { + "name": "Test Cluster 2", + "type": test_cluster_type.id, + }, +] +created_clusters = make_netbox_calls(nb.virtualization.clusters, clusters) +test_cluster = nb.virtualization.clusters.get(name="Test Cluster") +test_cluster2 = nb.virtualization.clusters.get(name="Test Cluster 2") + ## Create Devices devices = [ @@ -307,6 +338,7 @@ def make_netbox_calls(endpoint, payload): "local_context_data": {"ntp_servers": ["pool.ntp.org"]}, "serial": "FAB01234567", "asset_tag": "123456789", + "cluster": test_cluster.id, }, { "name": "TestDeviceR1", @@ -419,40 +451,9 @@ def make_netbox_calls(endpoint, payload): rirs = [{"name": "Example RIR", "slug": "example-rir"}] created_rirs = make_netbox_calls(nb.ipam.rirs, rirs) -## Create Cluster Group -cluster_groups = [{"name": "Test Cluster Group", "slug": "test-cluster-group"}] -created_cluster_groups = make_netbox_calls( - nb.virtualization.cluster_groups, cluster_groups -) -test_cluster_group = nb.virtualization.cluster_groups.get(slug="test-cluster-group") - -## Create Cluster Type -cluster_types = [{"name": "Test Cluster Type", "slug": "test-cluster-type"}] -created_cluster_types = make_netbox_calls( - nb.virtualization.cluster_types, cluster_types -) -test_cluster_type = nb.virtualization.cluster_types.get(slug="test-cluster-type") - -## Create Cluster -clusters = [ - { - "name": "Test Cluster", - "type": test_cluster_type.id, - "group": test_cluster_group.id, - "site": test_site.id, - }, - { - "name": "Test Cluster 2", - "type": test_cluster_type.id, - }, -] -created_clusters = make_netbox_calls(nb.virtualization.clusters, clusters) -test_cluster = nb.virtualization.clusters.get(name="Test Cluster") -test_cluster2 = nb.virtualization.clusters.get(name="Test Cluster 2") - ## Create Virtual Machine virtual_machines = [ - {"name": "test100-vm", "cluster": test_cluster.id}, + {"name": "test100-vm", "cluster": test_cluster.id, "device": test100.id}, {"name": "test101-vm", "cluster": test_cluster.id}, {"name": "test102-vm", "cluster": test_cluster.id}, {"name": "test103-vm", "cluster": test_cluster.id}, diff --git a/tests/integration/targets/inventory-v3.5/files/test-inventory-bearer-token.json b/tests/integration/targets/inventory-v3.5/files/test-inventory-bearer-token.json index 360a7ac33..2b0dde241 100644 --- a/tests/integration/targets/inventory-v3.5/files/test-inventory-bearer-token.json +++ b/tests/integration/targets/inventory-v3.5/files/test-inventory-bearer-token.json @@ -44,27 +44,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" + "display": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" }, - "display": "Ethernet1/1", + "display": "Ethernet2/1", "duplex": null, "enabled": true, - "id": 1, + "id": 2, "ip_addresses": [ { - "address": "172.16.180.11/24", + "address": "172.16.180.12/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.11/24", - "dns_name": "", + "display": "172.16.180.12/24", + "dns_name": "nexus.example.com", "family": { "label": "IPv4", "value": 4 }, - "id": 3, + "id": 4, "nat_inside": null, "nat_outside": [], "role": null, @@ -88,7 +88,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet1/1", + "name": "Ethernet2/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -124,27 +124,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" + "display": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" }, - "display": "Ethernet2/1", + "display": "Ethernet1/1", "duplex": null, "enabled": true, - "id": 2, + "id": 1, "ip_addresses": [ { - "address": "172.16.180.12/24", + "address": "172.16.180.11/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.12/24", - "dns_name": "nexus.example.com", + "display": "172.16.180.11/24", + "dns_name": "", "family": { "label": "IPv4", "value": 4 }, - "id": 4, + "id": 3, "nat_inside": null, "nat_outside": [], "role": null, @@ -168,7 +168,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet2/1", + "name": "Ethernet1/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -417,6 +417,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "config_context": { "ntp_servers": [ "pool.ntp.org" @@ -730,6 +733,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "config_context": {}, @@ -1125,6 +1129,7 @@ }, "cluster_Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1139,6 +1144,7 @@ }, "cluster_group_test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1148,6 +1154,7 @@ "cluster_type_test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.5/files/test-inventory-jinja2-filter.json b/tests/integration/targets/inventory-v3.5/files/test-inventory-jinja2-filter.json index 6d7249836..f0693bd1c 100644 --- a/tests/integration/targets/inventory-v3.5/files/test-inventory-jinja2-filter.json +++ b/tests/integration/targets/inventory-v3.5/files/test-inventory-jinja2-filter.json @@ -300,6 +300,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "config_context": { "ntp_servers": [ "pool.ntp.org" @@ -613,6 +616,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "config_context": {}, @@ -988,6 +992,7 @@ }, "cluster_Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -996,6 +1001,7 @@ }, "cluster_group_test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1004,6 +1010,7 @@ }, "cluster_type_test_cluster_type": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.5/files/test-inventory-jinja2.json b/tests/integration/targets/inventory-v3.5/files/test-inventory-jinja2.json index 119e5633d..a0bfd8b5e 100644 --- a/tests/integration/targets/inventory-v3.5/files/test-inventory-jinja2.json +++ b/tests/integration/targets/inventory-v3.5/files/test-inventory-jinja2.json @@ -1,6 +1,7 @@ { "Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -113,6 +114,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "custom_fields": {}, "device_type": "cisco-test", "is_virtual": false, @@ -142,6 +146,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "custom_fields": {}, @@ -331,6 +336,7 @@ }, "test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -340,6 +346,7 @@ "test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.5/files/test-inventory-legacy.json b/tests/integration/targets/inventory-v3.5/files/test-inventory-legacy.json index 6df5dbf2b..fed907d3a 100644 --- a/tests/integration/targets/inventory-v3.5/files/test-inventory-legacy.json +++ b/tests/integration/targets/inventory-v3.5/files/test-inventory-legacy.json @@ -178,6 +178,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "custom_fields": {}, "device_roles": [ "core-switch" @@ -278,6 +281,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "custom_fields": {}, diff --git a/tests/integration/targets/inventory-v3.5/files/test-inventory-noracks.json b/tests/integration/targets/inventory-v3.5/files/test-inventory-noracks.json index b61454e00..0054b9570 100644 --- a/tests/integration/targets/inventory-v3.5/files/test-inventory-noracks.json +++ b/tests/integration/targets/inventory-v3.5/files/test-inventory-noracks.json @@ -61,27 +61,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" + "display": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" }, - "display": "Ethernet1/1", + "display": "Ethernet2/1", "duplex": null, "enabled": true, - "id": 1, + "id": 2, "ip_addresses": [ { - "address": "172.16.180.11/24", + "address": "172.16.180.12/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.11/24", - "dns_name": "", + "display": "172.16.180.12/24", + "dns_name": "nexus.example.com", "family": { "label": "IPv4", "value": 4 }, - "id": 3, + "id": 4, "nat_inside": null, "nat_outside": [], "role": null, @@ -105,7 +105,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet1/1", + "name": "Ethernet2/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -141,27 +141,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" + "display": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" }, - "display": "Ethernet2/1", + "display": "Ethernet1/1", "duplex": null, "enabled": true, - "id": 2, + "id": 1, "ip_addresses": [ { - "address": "172.16.180.12/24", + "address": "172.16.180.11/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.12/24", - "dns_name": "nexus.example.com", + "display": "172.16.180.11/24", + "dns_name": "", "family": { "label": "IPv4", "value": 4 }, - "id": 4, + "id": 3, "nat_inside": null, "nat_outside": [], "role": null, @@ -185,7 +185,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet2/1", + "name": "Ethernet1/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -448,6 +448,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "config_context": [ { "ntp_servers": [ @@ -769,6 +772,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "config_context": [ @@ -1186,6 +1190,7 @@ }, "cluster_Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1200,6 +1205,7 @@ }, "cluster_group_test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1209,6 +1215,7 @@ "cluster_type_test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.5/files/test-inventory-options-flatten.json b/tests/integration/targets/inventory-v3.5/files/test-inventory-options-flatten.json index 8e019bd84..d16ef269d 100644 --- a/tests/integration/targets/inventory-v3.5/files/test-inventory-options-flatten.json +++ b/tests/integration/targets/inventory-v3.5/files/test-inventory-options-flatten.json @@ -1,6 +1,7 @@ { "Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -64,27 +65,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" + "display": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" }, - "display": "Ethernet1/1", + "display": "Ethernet2/1", "duplex": null, "enabled": true, - "id": 1, + "id": 2, "ip_addresses": [ { - "address": "172.16.180.11/24", + "address": "172.16.180.12/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.11/24", - "dns_name": "", + "display": "172.16.180.12/24", + "dns_name": "nexus.example.com", "family": { "label": "IPv4", "value": 4 }, - "id": 3, + "id": 4, "nat_inside": null, "nat_outside": [], "role": null, @@ -108,7 +109,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet1/1", + "name": "Ethernet2/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -144,27 +145,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" + "display": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" }, - "display": "Ethernet2/1", + "display": "Ethernet1/1", "duplex": null, "enabled": true, - "id": 2, + "id": 1, "ip_addresses": [ { - "address": "172.16.180.12/24", + "address": "172.16.180.11/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.12/24", - "dns_name": "nexus.example.com", + "display": "172.16.180.11/24", + "dns_name": "", "family": { "label": "IPv4", "value": 4 }, - "id": 4, + "id": 3, "nat_inside": null, "nat_outside": [], "role": null, @@ -188,7 +189,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet2/1", + "name": "Ethernet1/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -433,6 +434,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "device_type": "cisco-test", "interfaces": [ { @@ -738,6 +742,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "interfaces": [ @@ -1187,6 +1192,7 @@ }, "test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1196,6 +1202,7 @@ "test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.5/files/test-inventory-options.json b/tests/integration/targets/inventory-v3.5/files/test-inventory-options.json index 119e5633d..a0bfd8b5e 100644 --- a/tests/integration/targets/inventory-v3.5/files/test-inventory-options.json +++ b/tests/integration/targets/inventory-v3.5/files/test-inventory-options.json @@ -1,6 +1,7 @@ { "Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -113,6 +114,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "custom_fields": {}, "device_type": "cisco-test", "is_virtual": false, @@ -142,6 +146,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "custom_fields": {}, @@ -331,6 +336,7 @@ }, "test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -340,6 +346,7 @@ "test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.5/files/test-inventory-plurals-flatten.json b/tests/integration/targets/inventory-v3.5/files/test-inventory-plurals-flatten.json index bf84ee743..6b587653f 100644 --- a/tests/integration/targets/inventory-v3.5/files/test-inventory-plurals-flatten.json +++ b/tests/integration/targets/inventory-v3.5/files/test-inventory-plurals-flatten.json @@ -1,6 +1,7 @@ { "Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -146,6 +147,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "device_roles": [ "core-switch" ], @@ -187,6 +191,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "is_virtual": true, @@ -387,6 +392,7 @@ }, "test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -396,6 +402,7 @@ "test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.5/files/test-inventory-plurals.json b/tests/integration/targets/inventory-v3.5/files/test-inventory-plurals.json index 22f9d4e5f..7246c683b 100644 --- a/tests/integration/targets/inventory-v3.5/files/test-inventory-plurals.json +++ b/tests/integration/targets/inventory-v3.5/files/test-inventory-plurals.json @@ -66,27 +66,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" + "display": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" }, - "display": "Ethernet1/1", + "display": "Ethernet2/1", "duplex": null, "enabled": true, - "id": 1, + "id": 2, "ip_addresses": [ { - "address": "172.16.180.11/24", + "address": "172.16.180.12/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.11/24", - "dns_name": "", + "display": "172.16.180.12/24", + "dns_name": "nexus.example.com", "family": { "label": "IPv4", "value": 4 }, - "id": 3, + "id": 4, "nat_inside": null, "nat_outside": [], "role": null, @@ -110,7 +110,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet1/1", + "name": "Ethernet2/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -146,27 +146,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" + "display": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" }, - "display": "Ethernet2/1", + "display": "Ethernet1/1", "duplex": null, "enabled": true, - "id": 2, + "id": 1, "ip_addresses": [ { - "address": "172.16.180.12/24", + "address": "172.16.180.11/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.12/24", - "dns_name": "nexus.example.com", + "display": "172.16.180.11/24", + "dns_name": "", "family": { "label": "IPv4", "value": 4 }, - "id": 4, + "id": 3, "nat_inside": null, "nat_outside": [], "role": null, @@ -190,7 +190,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet2/1", + "name": "Ethernet1/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -465,6 +465,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "config_context": [ { "ntp_servers": [ @@ -790,6 +793,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "config_context": [ @@ -1215,6 +1219,7 @@ }, "cluster_Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1229,6 +1234,7 @@ }, "cluster_group_test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1238,6 +1244,7 @@ "cluster_type_test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.5/files/test-inventory.json b/tests/integration/targets/inventory-v3.5/files/test-inventory.json index 360a7ac33..2b0dde241 100644 --- a/tests/integration/targets/inventory-v3.5/files/test-inventory.json +++ b/tests/integration/targets/inventory-v3.5/files/test-inventory.json @@ -44,27 +44,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" + "display": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" }, - "display": "Ethernet1/1", + "display": "Ethernet2/1", "duplex": null, "enabled": true, - "id": 1, + "id": 2, "ip_addresses": [ { - "address": "172.16.180.11/24", + "address": "172.16.180.12/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.11/24", - "dns_name": "", + "display": "172.16.180.12/24", + "dns_name": "nexus.example.com", "family": { "label": "IPv4", "value": 4 }, - "id": 3, + "id": 4, "nat_inside": null, "nat_outside": [], "role": null, @@ -88,7 +88,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet1/1", + "name": "Ethernet2/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -124,27 +124,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" + "display": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" }, - "display": "Ethernet2/1", + "display": "Ethernet1/1", "duplex": null, "enabled": true, - "id": 2, + "id": 1, "ip_addresses": [ { - "address": "172.16.180.12/24", + "address": "172.16.180.11/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.12/24", - "dns_name": "nexus.example.com", + "display": "172.16.180.11/24", + "dns_name": "", "family": { "label": "IPv4", "value": 4 }, - "id": 4, + "id": 3, "nat_inside": null, "nat_outside": [], "role": null, @@ -168,7 +168,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet2/1", + "name": "Ethernet1/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -417,6 +417,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "config_context": { "ntp_servers": [ "pool.ntp.org" @@ -730,6 +733,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "config_context": {}, @@ -1125,6 +1129,7 @@ }, "cluster_Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1139,6 +1144,7 @@ }, "cluster_group_test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1148,6 +1154,7 @@ "cluster_type_test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.6/files/test-inventory-bearer-token.json b/tests/integration/targets/inventory-v3.6/files/test-inventory-bearer-token.json index 360a7ac33..2b0dde241 100644 --- a/tests/integration/targets/inventory-v3.6/files/test-inventory-bearer-token.json +++ b/tests/integration/targets/inventory-v3.6/files/test-inventory-bearer-token.json @@ -44,27 +44,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" + "display": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" }, - "display": "Ethernet1/1", + "display": "Ethernet2/1", "duplex": null, "enabled": true, - "id": 1, + "id": 2, "ip_addresses": [ { - "address": "172.16.180.11/24", + "address": "172.16.180.12/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.11/24", - "dns_name": "", + "display": "172.16.180.12/24", + "dns_name": "nexus.example.com", "family": { "label": "IPv4", "value": 4 }, - "id": 3, + "id": 4, "nat_inside": null, "nat_outside": [], "role": null, @@ -88,7 +88,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet1/1", + "name": "Ethernet2/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -124,27 +124,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" + "display": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" }, - "display": "Ethernet2/1", + "display": "Ethernet1/1", "duplex": null, "enabled": true, - "id": 2, + "id": 1, "ip_addresses": [ { - "address": "172.16.180.12/24", + "address": "172.16.180.11/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.12/24", - "dns_name": "nexus.example.com", + "display": "172.16.180.11/24", + "dns_name": "", "family": { "label": "IPv4", "value": 4 }, - "id": 4, + "id": 3, "nat_inside": null, "nat_outside": [], "role": null, @@ -168,7 +168,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet2/1", + "name": "Ethernet1/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -417,6 +417,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "config_context": { "ntp_servers": [ "pool.ntp.org" @@ -730,6 +733,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "config_context": {}, @@ -1125,6 +1129,7 @@ }, "cluster_Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1139,6 +1144,7 @@ }, "cluster_group_test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1148,6 +1154,7 @@ "cluster_type_test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.6/files/test-inventory-jinja2-filter.json b/tests/integration/targets/inventory-v3.6/files/test-inventory-jinja2-filter.json index 6d7249836..9f959ebd9 100644 --- a/tests/integration/targets/inventory-v3.6/files/test-inventory-jinja2-filter.json +++ b/tests/integration/targets/inventory-v3.6/files/test-inventory-jinja2-filter.json @@ -613,6 +613,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "config_context": {}, diff --git a/tests/integration/targets/inventory-v3.6/files/test-inventory-jinja2.json b/tests/integration/targets/inventory-v3.6/files/test-inventory-jinja2.json index 119e5633d..0a347d7ee 100644 --- a/tests/integration/targets/inventory-v3.6/files/test-inventory-jinja2.json +++ b/tests/integration/targets/inventory-v3.6/files/test-inventory-jinja2.json @@ -1,6 +1,7 @@ { "Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -142,6 +143,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "custom_fields": {}, diff --git a/tests/integration/targets/inventory-v3.6/files/test-inventory-legacy.json b/tests/integration/targets/inventory-v3.6/files/test-inventory-legacy.json index 6df5dbf2b..fed907d3a 100644 --- a/tests/integration/targets/inventory-v3.6/files/test-inventory-legacy.json +++ b/tests/integration/targets/inventory-v3.6/files/test-inventory-legacy.json @@ -178,6 +178,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "custom_fields": {}, "device_roles": [ "core-switch" @@ -278,6 +281,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "custom_fields": {}, diff --git a/tests/integration/targets/inventory-v3.6/files/test-inventory-noracks.json b/tests/integration/targets/inventory-v3.6/files/test-inventory-noracks.json index b61454e00..0054b9570 100644 --- a/tests/integration/targets/inventory-v3.6/files/test-inventory-noracks.json +++ b/tests/integration/targets/inventory-v3.6/files/test-inventory-noracks.json @@ -61,27 +61,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" + "display": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" }, - "display": "Ethernet1/1", + "display": "Ethernet2/1", "duplex": null, "enabled": true, - "id": 1, + "id": 2, "ip_addresses": [ { - "address": "172.16.180.11/24", + "address": "172.16.180.12/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.11/24", - "dns_name": "", + "display": "172.16.180.12/24", + "dns_name": "nexus.example.com", "family": { "label": "IPv4", "value": 4 }, - "id": 3, + "id": 4, "nat_inside": null, "nat_outside": [], "role": null, @@ -105,7 +105,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet1/1", + "name": "Ethernet2/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -141,27 +141,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" + "display": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" }, - "display": "Ethernet2/1", + "display": "Ethernet1/1", "duplex": null, "enabled": true, - "id": 2, + "id": 1, "ip_addresses": [ { - "address": "172.16.180.12/24", + "address": "172.16.180.11/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.12/24", - "dns_name": "nexus.example.com", + "display": "172.16.180.11/24", + "dns_name": "", "family": { "label": "IPv4", "value": 4 }, - "id": 4, + "id": 3, "nat_inside": null, "nat_outside": [], "role": null, @@ -185,7 +185,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet2/1", + "name": "Ethernet1/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -448,6 +448,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "config_context": [ { "ntp_servers": [ @@ -769,6 +772,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "config_context": [ @@ -1186,6 +1190,7 @@ }, "cluster_Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1200,6 +1205,7 @@ }, "cluster_group_test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1209,6 +1215,7 @@ "cluster_type_test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.6/files/test-inventory-options-flatten.json b/tests/integration/targets/inventory-v3.6/files/test-inventory-options-flatten.json index 8e019bd84..72d3127f3 100644 --- a/tests/integration/targets/inventory-v3.6/files/test-inventory-options-flatten.json +++ b/tests/integration/targets/inventory-v3.6/files/test-inventory-options-flatten.json @@ -1,6 +1,7 @@ { "Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -64,27 +65,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" + "display": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" }, - "display": "Ethernet1/1", + "display": "Ethernet2/1", "duplex": null, "enabled": true, - "id": 1, + "id": 2, "ip_addresses": [ { - "address": "172.16.180.11/24", + "address": "172.16.180.12/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.11/24", - "dns_name": "", + "display": "172.16.180.12/24", + "dns_name": "nexus.example.com", "family": { "label": "IPv4", "value": 4 }, - "id": 3, + "id": 4, "nat_inside": null, "nat_outside": [], "role": null, @@ -108,7 +109,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet1/1", + "name": "Ethernet2/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -144,27 +145,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" + "display": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" }, - "display": "Ethernet2/1", + "display": "Ethernet1/1", "duplex": null, "enabled": true, - "id": 2, + "id": 1, "ip_addresses": [ { - "address": "172.16.180.12/24", + "address": "172.16.180.11/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.12/24", - "dns_name": "nexus.example.com", + "display": "172.16.180.11/24", + "dns_name": "", "family": { "label": "IPv4", "value": 4 }, - "id": 4, + "id": 3, "nat_inside": null, "nat_outside": [], "role": null, @@ -188,7 +189,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet2/1", + "name": "Ethernet1/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -738,6 +739,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "interfaces": [ @@ -1187,6 +1189,7 @@ }, "test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1196,6 +1199,7 @@ "test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.6/files/test-inventory-options.json b/tests/integration/targets/inventory-v3.6/files/test-inventory-options.json index 119e5633d..a0bfd8b5e 100644 --- a/tests/integration/targets/inventory-v3.6/files/test-inventory-options.json +++ b/tests/integration/targets/inventory-v3.6/files/test-inventory-options.json @@ -1,6 +1,7 @@ { "Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -113,6 +114,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "custom_fields": {}, "device_type": "cisco-test", "is_virtual": false, @@ -142,6 +146,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "custom_fields": {}, @@ -331,6 +336,7 @@ }, "test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -340,6 +346,7 @@ "test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.6/files/test-inventory-plurals-flatten.json b/tests/integration/targets/inventory-v3.6/files/test-inventory-plurals-flatten.json index bf84ee743..93acd4348 100644 --- a/tests/integration/targets/inventory-v3.6/files/test-inventory-plurals-flatten.json +++ b/tests/integration/targets/inventory-v3.6/files/test-inventory-plurals-flatten.json @@ -1,6 +1,7 @@ { "Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -187,6 +188,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "is_virtual": true, diff --git a/tests/integration/targets/inventory-v3.6/files/test-inventory-plurals.json b/tests/integration/targets/inventory-v3.6/files/test-inventory-plurals.json index 22f9d4e5f..7246c683b 100644 --- a/tests/integration/targets/inventory-v3.6/files/test-inventory-plurals.json +++ b/tests/integration/targets/inventory-v3.6/files/test-inventory-plurals.json @@ -66,27 +66,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" + "display": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" }, - "display": "Ethernet1/1", + "display": "Ethernet2/1", "duplex": null, "enabled": true, - "id": 1, + "id": 2, "ip_addresses": [ { - "address": "172.16.180.11/24", + "address": "172.16.180.12/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.11/24", - "dns_name": "", + "display": "172.16.180.12/24", + "dns_name": "nexus.example.com", "family": { "label": "IPv4", "value": 4 }, - "id": 3, + "id": 4, "nat_inside": null, "nat_outside": [], "role": null, @@ -110,7 +110,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet1/1", + "name": "Ethernet2/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -146,27 +146,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" + "display": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" }, - "display": "Ethernet2/1", + "display": "Ethernet1/1", "duplex": null, "enabled": true, - "id": 2, + "id": 1, "ip_addresses": [ { - "address": "172.16.180.12/24", + "address": "172.16.180.11/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.12/24", - "dns_name": "nexus.example.com", + "display": "172.16.180.11/24", + "dns_name": "", "family": { "label": "IPv4", "value": 4 }, - "id": 4, + "id": 3, "nat_inside": null, "nat_outside": [], "role": null, @@ -190,7 +190,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet2/1", + "name": "Ethernet1/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -465,6 +465,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "config_context": [ { "ntp_servers": [ @@ -790,6 +793,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "config_context": [ @@ -1215,6 +1219,7 @@ }, "cluster_Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1229,6 +1234,7 @@ }, "cluster_group_test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1238,6 +1244,7 @@ "cluster_type_test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.6/files/test-inventory.json b/tests/integration/targets/inventory-v3.6/files/test-inventory.json index 360a7ac33..2b0dde241 100644 --- a/tests/integration/targets/inventory-v3.6/files/test-inventory.json +++ b/tests/integration/targets/inventory-v3.6/files/test-inventory.json @@ -44,27 +44,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" + "display": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" }, - "display": "Ethernet1/1", + "display": "Ethernet2/1", "duplex": null, "enabled": true, - "id": 1, + "id": 2, "ip_addresses": [ { - "address": "172.16.180.11/24", + "address": "172.16.180.12/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.11/24", - "dns_name": "", + "display": "172.16.180.12/24", + "dns_name": "nexus.example.com", "family": { "label": "IPv4", "value": 4 }, - "id": 3, + "id": 4, "nat_inside": null, "nat_outside": [], "role": null, @@ -88,7 +88,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet1/1", + "name": "Ethernet2/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -124,27 +124,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" + "display": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" }, - "display": "Ethernet2/1", + "display": "Ethernet1/1", "duplex": null, "enabled": true, - "id": 2, + "id": 1, "ip_addresses": [ { - "address": "172.16.180.12/24", + "address": "172.16.180.11/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.12/24", - "dns_name": "nexus.example.com", + "display": "172.16.180.11/24", + "dns_name": "", "family": { "label": "IPv4", "value": 4 }, - "id": 4, + "id": 3, "nat_inside": null, "nat_outside": [], "role": null, @@ -168,7 +168,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet2/1", + "name": "Ethernet1/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -417,6 +417,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "config_context": { "ntp_servers": [ "pool.ntp.org" @@ -730,6 +733,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "config_context": {}, @@ -1125,6 +1129,7 @@ }, "cluster_Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1139,6 +1144,7 @@ }, "cluster_group_test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1148,6 +1154,7 @@ "cluster_type_test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.7/files/test-inventory-bearer-token.json b/tests/integration/targets/inventory-v3.7/files/test-inventory-bearer-token.json index 360a7ac33..53c512bc9 100644 --- a/tests/integration/targets/inventory-v3.7/files/test-inventory-bearer-token.json +++ b/tests/integration/targets/inventory-v3.7/files/test-inventory-bearer-token.json @@ -48,23 +48,23 @@ "id": 4, "name": "Test Nexus One" }, - "display": "Ethernet1/1", + "display": "Ethernet2/1", "duplex": null, "enabled": true, - "id": 1, + "id": 2, "ip_addresses": [ { - "address": "172.16.180.11/24", + "address": "172.16.180.12/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.11/24", - "dns_name": "", + "display": "172.16.180.12/24", + "dns_name": "nexus.example.com", "family": { "label": "IPv4", "value": 4 }, - "id": 3, + "id": 4, "nat_inside": null, "nat_outside": [], "role": null, @@ -88,7 +88,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet1/1", + "name": "Ethernet2/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -124,27 +124,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" + "display": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" }, - "display": "Ethernet2/1", + "display": "Ethernet1/1", "duplex": null, "enabled": true, - "id": 2, + "id": 1, "ip_addresses": [ { - "address": "172.16.180.12/24", + "address": "172.16.180.11/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.12/24", - "dns_name": "nexus.example.com", + "display": "172.16.180.11/24", + "dns_name": "", "family": { "label": "IPv4", "value": 4 }, - "id": 4, + "id": 3, "nat_inside": null, "nat_outside": [], "role": null, @@ -168,7 +168,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet2/1", + "name": "Ethernet1/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -730,6 +730,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "config_context": {}, @@ -1125,6 +1126,7 @@ }, "cluster_Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1139,6 +1141,7 @@ }, "cluster_group_test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1148,6 +1151,7 @@ "cluster_type_test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.7/files/test-inventory-jinja2-filter.json b/tests/integration/targets/inventory-v3.7/files/test-inventory-jinja2-filter.json index 6d7249836..9f959ebd9 100644 --- a/tests/integration/targets/inventory-v3.7/files/test-inventory-jinja2-filter.json +++ b/tests/integration/targets/inventory-v3.7/files/test-inventory-jinja2-filter.json @@ -613,6 +613,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "config_context": {}, diff --git a/tests/integration/targets/inventory-v3.7/files/test-inventory-jinja2.json b/tests/integration/targets/inventory-v3.7/files/test-inventory-jinja2.json index 119e5633d..0a347d7ee 100644 --- a/tests/integration/targets/inventory-v3.7/files/test-inventory-jinja2.json +++ b/tests/integration/targets/inventory-v3.7/files/test-inventory-jinja2.json @@ -1,6 +1,7 @@ { "Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -142,6 +143,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "custom_fields": {}, diff --git a/tests/integration/targets/inventory-v3.7/files/test-inventory-legacy.json b/tests/integration/targets/inventory-v3.7/files/test-inventory-legacy.json index 6df5dbf2b..fed907d3a 100644 --- a/tests/integration/targets/inventory-v3.7/files/test-inventory-legacy.json +++ b/tests/integration/targets/inventory-v3.7/files/test-inventory-legacy.json @@ -178,6 +178,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "custom_fields": {}, "device_roles": [ "core-switch" @@ -278,6 +281,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "custom_fields": {}, diff --git a/tests/integration/targets/inventory-v3.7/files/test-inventory-noracks.json b/tests/integration/targets/inventory-v3.7/files/test-inventory-noracks.json index b61454e00..0054b9570 100644 --- a/tests/integration/targets/inventory-v3.7/files/test-inventory-noracks.json +++ b/tests/integration/targets/inventory-v3.7/files/test-inventory-noracks.json @@ -61,27 +61,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" + "display": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" }, - "display": "Ethernet1/1", + "display": "Ethernet2/1", "duplex": null, "enabled": true, - "id": 1, + "id": 2, "ip_addresses": [ { - "address": "172.16.180.11/24", + "address": "172.16.180.12/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.11/24", - "dns_name": "", + "display": "172.16.180.12/24", + "dns_name": "nexus.example.com", "family": { "label": "IPv4", "value": 4 }, - "id": 3, + "id": 4, "nat_inside": null, "nat_outside": [], "role": null, @@ -105,7 +105,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet1/1", + "name": "Ethernet2/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -141,27 +141,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" + "display": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" }, - "display": "Ethernet2/1", + "display": "Ethernet1/1", "duplex": null, "enabled": true, - "id": 2, + "id": 1, "ip_addresses": [ { - "address": "172.16.180.12/24", + "address": "172.16.180.11/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.12/24", - "dns_name": "nexus.example.com", + "display": "172.16.180.11/24", + "dns_name": "", "family": { "label": "IPv4", "value": 4 }, - "id": 4, + "id": 3, "nat_inside": null, "nat_outside": [], "role": null, @@ -185,7 +185,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet2/1", + "name": "Ethernet1/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -448,6 +448,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "config_context": [ { "ntp_servers": [ @@ -769,6 +772,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "config_context": [ @@ -1186,6 +1190,7 @@ }, "cluster_Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1200,6 +1205,7 @@ }, "cluster_group_test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1209,6 +1215,7 @@ "cluster_type_test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.7/files/test-inventory-options-flatten.json b/tests/integration/targets/inventory-v3.7/files/test-inventory-options-flatten.json index 8e019bd84..d0474539b 100644 --- a/tests/integration/targets/inventory-v3.7/files/test-inventory-options-flatten.json +++ b/tests/integration/targets/inventory-v3.7/files/test-inventory-options-flatten.json @@ -1,6 +1,7 @@ { "Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -64,27 +65,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" + "display": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" }, - "display": "Ethernet1/1", + "display": "Ethernet2/1", "duplex": null, "enabled": true, - "id": 1, + "id": 2, "ip_addresses": [ { - "address": "172.16.180.11/24", + "address": "172.16.180.12/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.11/24", - "dns_name": "", + "display": "172.16.180.12/24", + "dns_name": "nexus.example.com", "family": { "label": "IPv4", "value": 4 }, - "id": 3, + "id": 4, "nat_inside": null, "nat_outside": [], "role": null, @@ -108,7 +109,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet1/1", + "name": "Ethernet2/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -144,27 +145,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" + "display": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" }, - "display": "Ethernet2/1", + "display": "Ethernet1/1", "duplex": null, "enabled": true, - "id": 2, + "id": 1, "ip_addresses": [ { - "address": "172.16.180.12/24", + "address": "172.16.180.11/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.12/24", - "dns_name": "nexus.example.com", + "display": "172.16.180.11/24", + "dns_name": "", "family": { "label": "IPv4", "value": 4 }, - "id": 4, + "id": 3, "nat_inside": null, "nat_outside": [], "role": null, @@ -188,7 +189,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet2/1", + "name": "Ethernet1/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -738,6 +739,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "interfaces": [ @@ -1196,6 +1198,7 @@ "test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.7/files/test-inventory-options.json b/tests/integration/targets/inventory-v3.7/files/test-inventory-options.json index 119e5633d..a0bfd8b5e 100644 --- a/tests/integration/targets/inventory-v3.7/files/test-inventory-options.json +++ b/tests/integration/targets/inventory-v3.7/files/test-inventory-options.json @@ -1,6 +1,7 @@ { "Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -113,6 +114,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "custom_fields": {}, "device_type": "cisco-test", "is_virtual": false, @@ -142,6 +146,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "custom_fields": {}, @@ -331,6 +336,7 @@ }, "test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -340,6 +346,7 @@ "test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.7/files/test-inventory-plurals-flatten.json b/tests/integration/targets/inventory-v3.7/files/test-inventory-plurals-flatten.json index bf84ee743..6b587653f 100644 --- a/tests/integration/targets/inventory-v3.7/files/test-inventory-plurals-flatten.json +++ b/tests/integration/targets/inventory-v3.7/files/test-inventory-plurals-flatten.json @@ -1,6 +1,7 @@ { "Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -146,6 +147,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "device_roles": [ "core-switch" ], @@ -187,6 +191,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "is_virtual": true, @@ -387,6 +392,7 @@ }, "test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -396,6 +402,7 @@ "test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.7/files/test-inventory-plurals.json b/tests/integration/targets/inventory-v3.7/files/test-inventory-plurals.json index 22f9d4e5f..7246c683b 100644 --- a/tests/integration/targets/inventory-v3.7/files/test-inventory-plurals.json +++ b/tests/integration/targets/inventory-v3.7/files/test-inventory-plurals.json @@ -66,27 +66,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" + "display": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" }, - "display": "Ethernet1/1", + "display": "Ethernet2/1", "duplex": null, "enabled": true, - "id": 1, + "id": 2, "ip_addresses": [ { - "address": "172.16.180.11/24", + "address": "172.16.180.12/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.11/24", - "dns_name": "", + "display": "172.16.180.12/24", + "dns_name": "nexus.example.com", "family": { "label": "IPv4", "value": 4 }, - "id": 3, + "id": 4, "nat_inside": null, "nat_outside": [], "role": null, @@ -110,7 +110,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet1/1", + "name": "Ethernet2/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -146,27 +146,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" + "display": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" }, - "display": "Ethernet2/1", + "display": "Ethernet1/1", "duplex": null, "enabled": true, - "id": 2, + "id": 1, "ip_addresses": [ { - "address": "172.16.180.12/24", + "address": "172.16.180.11/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.12/24", - "dns_name": "nexus.example.com", + "display": "172.16.180.11/24", + "dns_name": "", "family": { "label": "IPv4", "value": 4 }, - "id": 4, + "id": 3, "nat_inside": null, "nat_outside": [], "role": null, @@ -190,7 +190,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet2/1", + "name": "Ethernet1/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -465,6 +465,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "config_context": [ { "ntp_servers": [ @@ -790,6 +793,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "config_context": [ @@ -1215,6 +1219,7 @@ }, "cluster_Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1229,6 +1234,7 @@ }, "cluster_group_test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1238,6 +1244,7 @@ "cluster_type_test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/integration/targets/inventory-v3.7/files/test-inventory.json b/tests/integration/targets/inventory-v3.7/files/test-inventory.json index 360a7ac33..2b0dde241 100644 --- a/tests/integration/targets/inventory-v3.7/files/test-inventory.json +++ b/tests/integration/targets/inventory-v3.7/files/test-inventory.json @@ -44,27 +44,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus One", - "id": 4, - "name": "Test Nexus One" + "display": "Test Nexus Child One", + "id": 5, + "name": "Test Nexus Child One" }, - "display": "Ethernet1/1", + "display": "Ethernet2/1", "duplex": null, "enabled": true, - "id": 1, + "id": 2, "ip_addresses": [ { - "address": "172.16.180.11/24", + "address": "172.16.180.12/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.11/24", - "dns_name": "", + "display": "172.16.180.12/24", + "dns_name": "nexus.example.com", "family": { "label": "IPv4", "value": 4 }, - "id": 3, + "id": 4, "nat_inside": null, "nat_outside": [], "role": null, @@ -88,7 +88,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet1/1", + "name": "Ethernet2/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -124,27 +124,27 @@ "custom_fields": {}, "description": "", "device": { - "display": "Test Nexus Child One", - "id": 5, - "name": "Test Nexus Child One" + "display": "Test Nexus One", + "id": 4, + "name": "Test Nexus One" }, - "display": "Ethernet2/1", + "display": "Ethernet1/1", "duplex": null, "enabled": true, - "id": 2, + "id": 1, "ip_addresses": [ { - "address": "172.16.180.12/24", + "address": "172.16.180.11/24", "comments": "", "custom_fields": {}, "description": "", - "display": "172.16.180.12/24", - "dns_name": "nexus.example.com", + "display": "172.16.180.11/24", + "dns_name": "", "family": { "label": "IPv4", "value": 4 }, - "id": 4, + "id": 3, "nat_inside": null, "nat_outside": [], "role": null, @@ -168,7 +168,7 @@ "mode": null, "module": null, "mtu": null, - "name": "Ethernet2/1", + "name": "Ethernet1/1", "parent": null, "poe_mode": null, "poe_type": null, @@ -417,6 +417,9 @@ }, "test100": { "asset_tag": "123456789", + "cluster": "Test Cluster", + "cluster_group": "test-cluster-group", + "cluster_type": "test-cluster-type", "config_context": { "ntp_servers": [ "pool.ntp.org" @@ -730,6 +733,7 @@ }, "test100-vm": { "cluster": "Test Cluster", + "cluster_device": "test100", "cluster_group": "test-cluster-group", "cluster_type": "test-cluster-type", "config_context": {}, @@ -1125,6 +1129,7 @@ }, "cluster_Test_Cluster": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1139,6 +1144,7 @@ }, "cluster_group_test_cluster_group": { "hosts": [ + "test100", "test100-vm", "test101-vm", "test102-vm", @@ -1148,6 +1154,7 @@ "cluster_type_test_cluster_type": { "hosts": [ "Test VM With Spaces", + "test100", "test100-vm", "test101-vm", "test102-vm", diff --git a/tests/unit/inventory/test_data/group_extractors/data.json b/tests/unit/inventory/test_data/group_extractors/data.json index a0a39ffe1..de4506462 100644 --- a/tests/unit/inventory/test_data/group_extractors/data.json +++ b/tests/unit/inventory/test_data/group_extractors/data.json @@ -14,6 +14,7 @@ "custom_fields", "region", "cluster", + "cluster_device", "cluster_group", "cluster_type", "is_virtual", @@ -56,6 +57,7 @@ "custom_fields", "region", "cluster", + "cluster_device", "cluster_group", "cluster_type", "is_virtual", @@ -97,6 +99,7 @@ "custom_fields", "region", "cluster", + "cluster_device", "cluster_group", "cluster_type", "is_virtual",