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

pep8

parent 07906555
No related branches found
No related tags found
No related merge requests found
import json
import logging
import re
import jsonschema
......
......@@ -146,6 +146,7 @@ JUNOSSPACE_DEVICES_SCHEMA = """<?xml version="1.1" encoding="UTF-8" ?>
</xs:schema>
""" # noqa: E501
def _rpc(hostname, ssh):
dev = Device(
host=hostname,
......@@ -264,6 +265,7 @@ def list_bgp_routes(netconf_config):
# return _loads(output[1]) if output[1] else {}
#
def load_routers_from_junosspace(config):
"""
query junosspace for configured devices
......
import json
import re
from flask import Blueprint, Response, current_app, jsonify
......@@ -50,11 +49,11 @@ def get_trap_metadata(source_equipment, interface):
if result:
result = result.decode('utf-8')
else:
# todo - Change this to a call to the yet-to-be-created one source of all
# relevant information
# This could be different calls dependant on vendor, in which case we may
# need to check the trap type, or it could be a case of a key check for
# each possible data source
# TODO: Change this to a call to the yet-to-be-created one source of
# call relevant information
# This could be different calls dependant on vendor, in which case
# we may need to check the trap type, or it could be a case of a key
# check for each possible data source
interface_info = r.get(
'opsdb:interface_services:%s:%s' % (source_equipment, interface))
......@@ -67,8 +66,8 @@ def get_trap_metadata(source_equipment, interface):
interface_info = json.loads(interface_info.decode('utf-8'))
# todo - refactor once structure of new source is decided, currently this
# is just a list of services
# TODO: refactor once structure of new source is decided,
# currently this is just a list of services
vendor = interface_info[0]['manufacturer']
hostname = interface_info[0]['equipment']
# TODO: don't copy unecessary data into response (let client do this)
......@@ -83,4 +82,3 @@ def get_trap_metadata(source_equipment, interface):
r.set(cache_key, result.encode('utf-8'))
return Response(result, mimetype="application/json")
import logging
from flask import Blueprint, Response, current_app
from flask import Blueprint, Response
from inventory_provider.tasks.app import app
from inventory_provider.constants import TASK_LOGGER_NAME
routes = Blueprint("inventory-data-job-routes", __name__)
......
......@@ -269,7 +269,7 @@ def refresh_cache_all():
task_logger = logging.getLogger(constants.TASK_LOGGER_NAME)
task_logger.debug('starting update_junosspace_device_list,'
'update_inventory_system_cache')
'update_inventory_system_cache')
g = group([
update_junosspace_device_list.s(),
update_inventory_system_cache.s()
......@@ -300,4 +300,3 @@ def refresh_cache_all():
args=[hostname, '0pBiFbD'])
return "OK"
......@@ -165,4 +165,3 @@ def mocked_redis(mocker):
mocker.patch(
'inventory_provider.routes.common.redis.StrictRedis',
MockedRedis)
......@@ -24,7 +24,7 @@ def _load_devices_xml(api_url, username, password):
r = requests.get(
api_url + 'device-management/devices',
auth=HTTPBasicAuth(username, password),
# config={'verbose': sys.stderr})
# config={'verbose': sys.stderr})
verify=False,
)
assert r.status_code == 200
......
import glob
import os
import re
from lxml import etree
from inventory_provider import config
import inventory_provider
TEST_DATA_DIRNAME = os.path.realpath(os.path.join(
......
......@@ -21,7 +21,8 @@ def test_junosspace_devices_parsing(data_config):
with open(TEST_DATA_FILENAME) as f:
responses.add(
method=responses.GET,
url = data_config['junosspace']['api'] + '/device-management/devices',
url=data_config['junosspace']['api'] +
'/device-management/devices',
body=f.read())
routers = juniper.load_routers_from_junosspace(data_config['junosspace'])
......
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