Skip to content
Snippets Groups Projects
Commit 5b5712bb authored by Erik Reid's avatar Erik Reid
Browse files

pep8

parent c046f888
No related branches found
No related tags found
No related merge requests found
......@@ -259,6 +259,7 @@ def load_xml_docs(config_params, key_pattern, num_threads=10):
yield from _load_redis_docs(
config_params, key_pattern, num_threads, doc_type=_DECODE_TYPE_XML)
@functools.lru_cache
def load_snmp_indexes(hostname=None):
result = dict()
......
......@@ -28,8 +28,7 @@ These endpoints are used for monitoring running jobs.
import json
import logging
from distutils.util import strtobool
from flask import Blueprint, current_app, jsonify, Response, request
from flask import Blueprint, current_app, jsonify, Response
from inventory_provider.tasks import monitor
from inventory_provider.tasks import worker
......
......@@ -49,7 +49,6 @@ These endpoints are intended for use by BRIAN.
"""
import functools
import json
import logging
import re
......@@ -732,7 +731,6 @@ def gws_direct():
return Response(result, mimetype="application/json")
def _get_services_internal(service_type=None):
"""
Performs the lookup and caching done for calls to
......@@ -820,6 +818,7 @@ def _get_services_internal(service_type=None):
return result
@routes.route('/services', methods=['GET', 'POST'])
@routes.route('/services/<service_type>', methods=['GET', 'POST'])
@common.require_accepts_json
......@@ -902,7 +901,7 @@ def get_service_types():
inventory_provider.routes.poller.STRING_LIST_SCHEMA
"""
cache_key = f'classifier-cache:poller:service-types'
cache_key = 'classifier-cache:poller:service-types'
return_all = common.get_bool_request_arg('all', False)
if return_all:
......
......@@ -225,7 +225,7 @@ def ims_sorted_service_type_key(service_type):
"""
special-purpose function used for mapping IMS service type strings
to the key used in redis ('ims:services:*')
this method is only used by
:meth:`inventory_provider:tasks:worker.update_circuit_hierarchy_and_port_id_services
and :meth:`inventory_provider:routes.poller.get_service_types
......
......@@ -104,9 +104,10 @@ def test_all_services_all(client):
assert any(s['status'] != 'operational' for s in response_data)
assert all('snmp' not in s for s in response_data)
@pytest.mark.parametrize('service_type',
@pytest.mark.parametrize('service_type', [
# services with these types should all have snmp configs
['gws_indirect', 'geant_ip', 'l3_vpn'])
'gws_indirect', 'geant_ip', 'l3_vpn'])
def test_services_snmp(client, service_type):
rv = client.get(
......@@ -148,7 +149,7 @@ def test_all_services_by_type(client, uri_type, expected_type):
def test_get_service_types(client):
rv = client.get(
f'/poller/service-types',
'/poller/service-types',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
assert rv.is_json
......@@ -159,4 +160,3 @@ def test_get_service_types(client):
# some hard-coded values we expect to see from the test data ...
assert 'gws_indirect' in response_data
assert 'geant_ip' in response_data
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment