From d97b4a2222b72f818fd529471e36194e5e118f45 Mon Sep 17 00:00:00 2001 From: Erik Reid <erik.reid@geant.org> Date: Wed, 9 Jun 2021 16:04:15 +0200 Subject: [PATCH] was supposed to be in previous feature --- inventory_provider/routes/poller.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/inventory_provider/routes/poller.py b/inventory_provider/routes/poller.py index 899ab82e..4be62cbf 100644 --- a/inventory_provider/routes/poller.py +++ b/inventory_provider/routes/poller.py @@ -170,9 +170,10 @@ GWS_DIRECT_DATA_SCHEMA = { 'traffic_out' ] }, - 'oid': {'$ref': '#/definitions/oid'} + 'oid': {'$ref': '#/definitions/oid'}, + 'community': {'type': 'string'} }, - 'required': ['field', 'oid'], + 'required': ['field', 'oid', 'community'], 'additionalProperties': False }, 'interface-counters': { @@ -184,7 +185,6 @@ GWS_DIRECT_DATA_SCHEMA = { 'enum': ['Cogent', 'Telia', 'Century Link'] }, 'hostname': {'type': 'string'}, - 'community': {'type': 'string'}, 'tag': {'type': 'string'}, 'counters': { 'type': 'array', @@ -193,7 +193,7 @@ GWS_DIRECT_DATA_SCHEMA = { } }, 'required': [ - 'nren', 'isp', 'hostname', 'community', 'tag', 'counters'], + 'nren', 'isp', 'hostname', 'tag', 'counters'], 'additionalProperties': False } }, @@ -622,8 +622,10 @@ def gws_direct(): .. asjson:: inventory_provider.routes.poller.GWS_DIRECT_DATA_SCHEMA - This method returns essentially hard-coded data, - based on the information in POL1-422. + WARNING: interface tags in the `gws-direct` section of the config data + should be unique for each nren/isp/hostname combination. i.e. if there + are multiple community strings in use for a particular host, then please + keep the interface tags unique. :return: """ @@ -645,11 +647,13 @@ def gws_direct(): 'nren': nren_isp['nren'], 'isp': nren_isp['isp'], 'hostname': host['hostname'], - 'community': host['community'], 'tag': ifc['tag'], 'counters': [ - {'field': k, 'oid': v} - for k, v in ifc['counters'].items()] + { + 'field': k, + 'oid': v, + 'community': host['community'] + } for k, v in ifc['counters'].items()] } result = json.dumps(list(_interfaces())) -- GitLab