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

pep8

parent 7aa587fd
No related branches found
No related tags found
No related merge requests found
from inventory_provider.db import db
geant_lambda_sql = """SELECT
absid AS id,
name,
......@@ -297,6 +294,21 @@ SELECT
def _fields2rsp(row):
def _pop(r, suffix):
return {
'name': r['equipment_name' + suffix],
'card id': r['card_id' + suffix],
'port number': r['port' + suffix],
'pop': {
'absid': r['pop_absid' + suffix],
'name': r['pop_name' + suffix],
'city': r['pop_city' + suffix],
'country': r['pop_country' + suffix],
'abbreviation': r['pop_abbreviation' + suffix],
'longitude': r['pop_longitude' + suffix],
'latitude': r['pop_latitude' + suffix]
}
}
return {
'absid': row['absid'],
......@@ -306,34 +318,8 @@ SELECT
'peering_type': row['peering_type'],
'status': row['status'],
'name': row['name'],
'a': {
'name': row['equipment_name_a'],
'card id': row['card_id_a'],
'port number': row['port_a'],
'pop': {
'absid': row['pop_absid_a'],
'name': row['pop_name_a'],
'city': row['pop_city_a'],
'country': row['pop_country_a'],
'abbreviation': row['pop_abbreviation_a'],
'longitude': row['pop_longitude_a'],
'latitude': row['pop_latitude_a']
}
},
'b': {
'name': row['equipment_name_b'],
'card id': row['card_id_b'],
'port number': row['port_b'],
'pop': {
'absid': row['pop_absid_b'],
'name': row['pop_name_b'],
'city': row['pop_city_b'],
'country': row['pop_country_b'],
'abbreviation': row['pop_abbreviation_b'],
'longitude': row['pop_longitude_b'],
'latitude': row['pop_latitude_b']
}
}
'a': _pop(row, '_a'),
'b': _pop(row, '_b'),
}
circuit_query = base_query + """
......
......@@ -56,7 +56,3 @@ def equipment_location(equipment_name):
mimetype="text/html")
return jsonify(result)
from flask import Blueprint, Response, current_app, jsonify
from flask import Blueprint, current_app, jsonify
from inventory_provider.tasks import worker
from inventory_provider.routes import common
......
import contextlib
import json
import jsonschema
import pytest
from inventory_provider.db import db
DEFAULT_REQUEST_HEADERS = {
"Content-type": "application/json",
......
......@@ -39,7 +39,6 @@ def connection(db_params):
EQUIPMENT_LOCATION_METADATA = {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"definitions": {
"pop-info": {
......@@ -85,7 +84,6 @@ EQUIPMENT_LOCATION_METADATA = {
CORIANT_PATH_METADATA = {
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"definitions": {
"pop-info": {
......@@ -149,9 +147,9 @@ CORIANT_PATH_METADATA = {
@pytest.mark.parametrize('equipment', [
'mx1.cbg.uk.geant.net',
'grv3.lon.uk.geant.net',
'mx1.gen.ch.geant.net'
'mx1.cbg.uk.geant.net',
'grv3.lon.uk.geant.net',
'mx1.gen.ch.geant.net'
])
def test_equipment_location(connection, equipment):
circuit = opsdb.lookup_pop_info(connection, equipment)
......
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