diff --git a/inventory_provider/config.py b/inventory_provider/config.py index 8b9d0a6ddf94da9f1ebc79db75d828a232a6ed6d..4636d131f1a47e105dc980450ef067436fd3b57c 100644 --- a/inventory_provider/config.py +++ b/inventory_provider/config.py @@ -111,6 +111,7 @@ CONFIG_SCHEMA = { 'gws-direct-interface': { 'type': 'object', 'properties': { + 'info': {'type': 'string'}, 'tag': {'type': 'string'}, 'counters': {'$ref': '#/definitions/gws-direct-counters'} }, diff --git a/inventory_provider/routes/poller.py b/inventory_provider/routes/poller.py index f4fa2897c37f676b7d89c049703998745b348ba7..da22e4026d123334e55f2bf28e00f2a560c6d300 100644 --- a/inventory_provider/routes/poller.py +++ b/inventory_provider/routes/poller.py @@ -309,7 +309,8 @@ GWS_DIRECT_DATA_SCHEMA = { 'type': 'array', 'items': {'$ref': '#/definitions/counter'}, 'minItems': 1 - } + }, + 'info': {'type': 'string'} }, 'required': [ 'nren', 'isp', 'hostname', 'tag', 'counters'], @@ -1003,7 +1004,7 @@ def gws_direct(): snmp_params['priv'] = host['priv'] for ifc in host['interfaces']: - yield { + ifc_data = { 'nren': nren_isp['nren'], 'isp': nren_isp['isp'], 'hostname': host['hostname'], @@ -1016,6 +1017,8 @@ def gws_direct(): } for k, v in ifc['counters'].items()] } + if 'info' in ifc: + ifc_data['info'] = ifc['info'] result = json.dumps(list(_interfaces()))