Skip to content

Commit f4d2c65

Browse files
Added services lookup, no doctoring just raw data from API (#96)
1 parent c215f91 commit f4d2c65

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

plugins/inventory/netbox.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ def group_extractors(self):
248248
"device_roles": self.extract_device_role,
249249
"platforms": self.extract_platform,
250250
"device_types": self.extract_device_type,
251+
"services": self.extract_services,
251252
"config_context": self.extract_config_context,
252253
"manufacturers": self.extract_manufacturer,
253254
}
@@ -267,6 +268,14 @@ def extract_platform(self, host):
267268
except Exception:
268269
return
269270

271+
def extract_services(self, host):
272+
try:
273+
url = self.api_endpoint + "/api/ipam/services/?device=" + str(host["name"])
274+
device_lookup = self._fetch_information(url)
275+
return device_lookup["results"]
276+
except Exception:
277+
return
278+
270279
def extract_device_type(self, host):
271280
try:
272281
return [self.device_types_lookup[host["device_type"]["id"]]]

0 commit comments

Comments
 (0)