Skip to content

Commit a6825ce

Browse files
committed
Inventory: Add another inventory to test against that explores more non-default options
Includes testing the Constructed inherited options. Also added the same inventory from the past v0.2.0 release. I compared its output to the output of the actualy v0.2.0 release and can confirm nothing has changed - only added new host_vars (config_context, regions) since then, and changed the test data slightly. (ie. there should be no breaking change for existing users of this collection)
1 parent 6e8beba commit a6825ce

File tree

8 files changed

+495
-20
lines changed

8 files changed

+495
-20
lines changed

tests/integration/netbox-deploy.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@
160160
## Create Racks
161161
racks = [{"name": "Test Rack", "slug": "test-rack", "site": test_site2.id}]
162162
created_racks = nb.dcim.racks.create(racks)
163+
test_rack = nb.dcim.racks.get(slug="test-rack")
163164

164165

165166
## Create Rack Groups
@@ -193,7 +194,8 @@
193194
"name": "R1-Device",
194195
"device_type": cisco_test.id,
195196
"device_role": core_switch.id,
196-
"site": test_site.id,
197+
"site": test_site2.id,
198+
"rack": test_rack.id,
197199
},
198200
{
199201
"name": "Test Nexus One",
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
{
2+
"_meta": {
3+
"hostvars": {
4+
"R1-Device": {
5+
"custom_fields": {},
6+
"device_roles": [
7+
"core-switch"
8+
],
9+
"device_types": [
10+
"cisco-test"
11+
],
12+
"manufacturers": [
13+
"cisco"
14+
],
15+
"racks": [
16+
"Test Rack"
17+
],
18+
"regions": [],
19+
"services": [],
20+
"sites": [
21+
"test-site2"
22+
],
23+
"tags": []
24+
},
25+
"Test Nexus Child One": {
26+
"custom_fields": {},
27+
"device_roles": [
28+
"core-switch"
29+
],
30+
"device_types": [
31+
"nexus-child"
32+
],
33+
"manufacturers": [
34+
"cisco"
35+
],
36+
"regions": [
37+
"test-region",
38+
"parent-region"
39+
],
40+
"sites": [
41+
"test-site"
42+
],
43+
"tags": []
44+
},
45+
"Test Nexus One": {
46+
"custom_fields": {},
47+
"device_roles": [
48+
"core-switch"
49+
],
50+
"device_types": [
51+
"nexus-parent"
52+
],
53+
"manufacturers": [
54+
"cisco"
55+
],
56+
"regions": [
57+
"test-region",
58+
"parent-region"
59+
],
60+
"sites": [
61+
"test-site"
62+
],
63+
"tags": []
64+
},
65+
"TestDeviceR1": {
66+
"custom_fields": {},
67+
"device_roles": [
68+
"core-switch"
69+
],
70+
"device_types": [
71+
"cisco-test"
72+
],
73+
"manufacturers": [
74+
"cisco"
75+
],
76+
"regions": [
77+
"test-region",
78+
"parent-region"
79+
],
80+
"services": [],
81+
"sites": [
82+
"test-site"
83+
],
84+
"tags": []
85+
},
86+
"test100": {
87+
"custom_fields": {},
88+
"device_roles": [
89+
"core-switch"
90+
],
91+
"device_types": [
92+
"cisco-test"
93+
],
94+
"manufacturers": [
95+
"cisco"
96+
],
97+
"regions": [
98+
"test-region",
99+
"parent-region"
100+
],
101+
"services": [],
102+
"sites": [
103+
"test-site"
104+
],
105+
"tags": []
106+
},
107+
"test100-vm": {
108+
"custom_fields": {},
109+
"regions": [
110+
"test-region",
111+
"parent-region"
112+
],
113+
"sites": [
114+
"test-site"
115+
],
116+
"tags": []
117+
},
118+
"test101-vm": {
119+
"custom_fields": {},
120+
"regions": [
121+
"test-region",
122+
"parent-region"
123+
],
124+
"sites": [
125+
"test-site"
126+
],
127+
"tags": []
128+
},
129+
"test102-vm": {
130+
"custom_fields": {},
131+
"regions": [
132+
"test-region",
133+
"parent-region"
134+
],
135+
"sites": [
136+
"test-site"
137+
],
138+
"tags": []
139+
},
140+
"test103-vm": {
141+
"custom_fields": {},
142+
"regions": [
143+
"test-region",
144+
"parent-region"
145+
],
146+
"sites": [
147+
"test-site"
148+
],
149+
"tags": []
150+
},
151+
"test104-vm": {
152+
"custom_fields": {},
153+
"regions": [
154+
"test-region",
155+
"parent-region"
156+
],
157+
"sites": [
158+
"test-site"
159+
],
160+
"tags": []
161+
}
162+
}
163+
},
164+
"all": {
165+
"children": [
166+
"ungrouped"
167+
]
168+
},
169+
"ungrouped": {
170+
"hosts": [
171+
"R1-Device",
172+
"Test Nexus Child One",
173+
"Test Nexus One",
174+
"TestDeviceR1",
175+
"test100",
176+
"test100-vm",
177+
"test101-vm",
178+
"test102-vm",
179+
"test103-vm",
180+
"test104-vm"
181+
]
182+
}
183+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# To generate the json result, I checked out nb_inventory.yml from the v0.2.0 release 2d6894b,
2+
# and then ran it against this inventory with the latest test data.
3+
4+
# Checks that substantial work on the inventory does not diverge from what existing users are using by default.
5+
6+
plugin: netbox.netbox.nb_inventory
7+
api_endpoint: "http://localhost:32768"
8+
token: "0123456789abcdef0123456789abcdef01234567"
9+
validate_certs: false

0 commit comments

Comments
 (0)