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

update visibility per LGR-73

parent 8ef2eb61
No related branches found
No related tags found
No related merge requests found
......@@ -400,27 +400,33 @@ SELECT
g.longitude AS pop_longitude,
p.country_code AS pop_country_code,
g.country AS pop_country,
g.city AS pop_city
e.model AS equipment_model
FROM
opsdb.equipment e
LEFT JOIN opsdb.pop p ON p.absid = e.PTR_pop
LEFT JOIN opsdb.geocoding g ON g.absid = p.PTR_geocoding
LEFT JOIN opsdb.organisation o ON o.absid = e.PTR_owner
WHERE
e.model LIKE 'mx%'
e.manufacturer = 'Juniper'
AND e.status = 'Operational'
AND o.name = 'DANTE / GEANT'
AND NOT (e.name REGEXP 'vpn-proxy|vrr|taas')
"""
def _public(row):
if row['pop_name'] in INTERNAL_POP_NAMES:
return False
if row['router_name'].startswith('sw'):
return False
if row['pop_city'].lower() == 'slough' \
and row['equipment_model'].upper().startswith('MX'):
return False
return True
def _row2rsp(row):
print(row)
return {
'equipment name': row['router_name'],
'type':
'INTERNAL'
if row['pop_name'] in INTERNAL_POP_NAMES
else 'CORE',
'type': 'CORE' if _public(row) else 'INTERNAL',
'pop': {
'name': row['pop_name'],
'city': row['pop_city'],
......
......@@ -281,6 +281,16 @@ def test_lookup_lg_routers(connection, cached_test_data):
jsonschema.validate(routers, LG_ROUTERS_SCHEMA)
assert routers # shouldn't be empty
# LGR-73
assert any(
r['equipment name'].startswith('sw2.am.office') for r in routers)
assert any(
r['equipment name'].startswith('sw3.am.office') for r in routers)
switches = filter(
lambda r: r['equipment name'].startswith('sw'), routers)
assert all(s['type'] == 'INTERNAL' for s in switches)
CIRCUIT_INFO_SCHEMA = {
"$schema": "http://json-schema.org/draft-07/schema#",
......
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