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

pep8

parent e82a9a57
No related branches found
No related tags found
No related merge requests found
......@@ -160,7 +160,10 @@ def _redis_client_proc(key_queue, value_queue, config_params, doc_type):
def _load_redis_docs(
config_params, key_pattern, num_threads=10, doc_type=_DECODE_TYPE_JSON):
config_params,
key_pattern,
num_threads=10,
doc_type=_DECODE_TYPE_JSON):
"""
load all docs from redis and decode as `doc_type`
......
......@@ -2,7 +2,7 @@ import json
import logging
import re
from flask import Blueprint, Response, jsonify, current_app
from flask import Blueprint, Response, current_app
from inventory_provider import juniper
from inventory_provider.routes import common
......@@ -73,7 +73,7 @@ def _load_services(hostname=None):
m = re.match(r'^opsdb:interface_services:([^:]+):(.+)', doc['key'])
if not m:
logger.warning(f'can''t parse redis service key {doc["key"]}')
logger.warning(f'can\'t parse redis service key {doc["key"]}')
# there are some weird records (dtn*, dp1*)
continue
......@@ -84,6 +84,7 @@ def _load_services(hostname=None):
return result
def _load_interfaces(hostname):
key_pattern = f'netconf:{hostname}*' if hostname else 'netconf:*'
for doc in common.load_xml_docs(
......@@ -111,7 +112,7 @@ def _load_poller_interfaces(hostname=None):
snmp_indexes = _load_snmp_indexes(hostname)
bundles = _load_interface_bundles(hostname)
services= _load_services(hostname)
services = _load_services(hostname)
for ifc in _load_interfaces(hostname):
......
......@@ -32,7 +32,7 @@ INTERFACE_LIST_SCHEMA = {
'minimum': 1
},
'bundle': {
'type' : 'array',
'type': 'array',
'items': {'type': 'string'}
},
'bundle-parents': {
......@@ -59,7 +59,7 @@ INTERFACE_LIST_SCHEMA = {
def test_router_interfaces(router, client):
rv = client.post(
"/poller/interfaces/" + router,
f'/poller/interfaces/{router}',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
......
......@@ -59,7 +59,7 @@ INTERFACE_LIST_SCHEMA = {
'minimum': 1
},
'bundle': {
'type' : 'array',
'type': 'array',
'items': {'type': 'string'}
},
'bundle-parents': {
......@@ -83,6 +83,7 @@ INTERFACE_LIST_SCHEMA = {
'items': {'$ref': '#/definitions/interface'}
}
@pytest.mark.parametrize('category', ['mdvpn', 'lhcone', 'MDVpn', 'LHCONE'])
def test_service_category(client, mocked_worker_module, category):
worker._build_service_category_interface_list()
......@@ -107,7 +108,7 @@ def test_service_category_not_found(client, mocked_worker_module, category):
def test_get_all_interfaces(client):
rv = client.get(
f'/poller/interfaces',
'/poller/interfaces',
headers=DEFAULT_REQUEST_HEADERS)
assert rv.status_code == 200
assert rv.is_json
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment