diff --git a/inventory_provider/routes/data.py b/inventory_provider/routes/data.py index c364e4d1920e6792fac4a9557fac36592c15fc29..56e381b5cc580e0b40aa1fa9445cd3bcd8b01bef 100644 --- a/inventory_provider/routes/data.py +++ b/inventory_provider/routes/data.py @@ -111,7 +111,7 @@ def snmp_ids(hostname): ifc_data = json.loads(ifc_data_string.decode('utf-8')) result = [ - { 'index': i['index'], 'name': _ifc_name(i)} + {'index': i['index'], 'name': _ifc_name(i)} for i in ifc_data] return Response( json.dumps(result), diff --git a/test/test_alarmdb_routes.py b/test/test_alarmdb_routes.py index ae6b2b3b31a04b38f2a48dbac257cf392535a43d..e6f1ed7c3e494d60cdfac4680ad6e7446d860336 100644 --- a/test/test_alarmdb_routes.py +++ b/test/test_alarmdb_routes.py @@ -104,4 +104,3 @@ def test_get_interface_status(mocker, client): response = json.loads(rv.data.decode("utf-8")) jsonschema.validate(response, interfaces_list_schema) assert response == {"status": "up"} - diff --git a/test/test_data_routes.py b/test/test_data_routes.py index 9c7e52a0b9f8ccf74e5b81285625b7c84cd7535e..20ddf5327cb6a2ab79ca2265cd34bbd6b833aa37 100644 --- a/test/test_data_routes.py +++ b/test/test_data_routes.py @@ -278,7 +278,6 @@ def test_snmp_ids(client_with_mocked_data): } } - for hostname in _routers(client_with_mocked_data): rv = client_with_mocked_data.post( "/data/snmp/" + hostname, diff --git a/test/test_snmp_handling.py b/test/test_snmp_handling.py index 08e8d7a4f7e93f0a624d3bf6ce2752b79d7b915e..f6794197056e2b5eaa8813429ae61e811181499e 100644 --- a/test/test_snmp_handling.py +++ b/test/test_snmp_handling.py @@ -8,51 +8,6 @@ import pytest from inventory_provider import snmp from inventory_provider import config - - - -# CACHE_SCHEMA = { -# "$schema": "http://json-schema.org/draft-07/schema#", -# "type": "object", -# "patternProperties": { -# "^.*\\.geant\\.net$": { -# "type": "object", -# "properties": { -# "bgp": {"type": "object"}, -# "vrr": {"type": "object"}, -# "interfaces": {"type": "object"}, -# "snmp-interfaces": { -# "type": "array", -# "items": { -# "type": "object", -# "properties": { -# "v4Address": {"type": "string"}, -# "v4Mask": {"type": "string"}, -# "v4InterfaceName": {"type": "string"}, -# "v6Address": {"type": "string"}, -# "v6Mask": {"type": "string"}, -# "v6InterfaceName": {"type": "string"}, -# }, -# "additionalProperties": False -# } -# } -# }, -# "required": ["bgp", "vrr", "interfaces", "snmp-interfaces"], -# "additionalProperties": False -# } -# }, -# "additionalProperties": False -# } -# -# def mocked_walk(agent_hostname, community, base_oid): -# return [e for e in SNMP_WALK_DATA if e['oid'].startswith(base_oid)] -# # for e in SNMP_WALK_DATA: -# # if e['oid'].startswith(base_oid): -# # yield e -# # json.dumps -# # {"oid": ".1.3.6.1.2.1.55.1.5.1.2.1442", "value": "ae15.112"} - - OID_TEST_CONFIG = """# # This file is located in dbupdates/conf and is used by scripts under dbupdates/scripts. # It holds OID values for retrieving details of a router. @@ -66,7 +21,9 @@ v4Mask=.1.3.6.1.2.1.4.20.1.3 ## IPv6 v6AddressAndMask=.1.3.6.1.2.1.55.1.8.1.2 -v6InterfaceName=.1.3.6.1.2.1.55.1.5.1.2""" +v6InterfaceName=.1.3.6.1.2.1.55.1.5.1.2 +""" # noqa E501 + @pytest.fixture def snmp_walk_responses(): @@ -127,4 +84,3 @@ def test_snmp_interfaces(mocker, oid_config, snmp_walk_responses): and 'v6InterfaceName' in ifc: continue assert False, "address details not found in interface dict" -