From fc0ed2cf6aae679f93e9defcb386e90760dbfddb Mon Sep 17 00:00:00 2001
From: Erik Reid <erik.reid@geant.org>
Date: Mon, 7 Dec 2020 21:13:06 +0100
Subject: [PATCH] remove junosspace and make srx* INTERNAL

---
 inventory_provider/db/opsdb.py | 4 +++-
 test/test_opsdb_queries.py     | 7 +++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/inventory_provider/db/opsdb.py b/inventory_provider/db/opsdb.py
index 2768a9ed..ac8958a5 100644
--- a/inventory_provider/db/opsdb.py
+++ b/inventory_provider/db/opsdb.py
@@ -410,7 +410,7 @@ WHERE
     e.manufacturer = 'Juniper'
     AND e.status = 'Operational'
     AND o.name = 'DANTE / GEANT'
-    AND NOT (e.name REGEXP 'vpn-proxy|vrr|taas')
+    AND NOT (e.name REGEXP 'vpn-proxy|vrr|taas|junosspace')
 """
 
     def _public(row):
@@ -421,6 +421,8 @@ WHERE
         if row['pop_city'].lower() == 'slough' \
                 and not row['equipment_model'].upper().startswith('MX'):
             return False
+        if row['router_name'].startswith('srx'):
+            return False
         return True
 
     def _row2rsp(row):
diff --git a/test/test_opsdb_queries.py b/test/test_opsdb_queries.py
index eb347d9f..021a2add 100644
--- a/test/test_opsdb_queries.py
+++ b/test/test_opsdb_queries.py
@@ -291,6 +291,13 @@ def test_lookup_lg_routers(connection, cached_test_data):
         lambda r: r['equipment name'].startswith('sw'), routers)
     assert all(s['type'] == 'INTERNAL' for s in switches)
 
+    assert not any(
+        r['equipment name'].lower().startswith('junosspace') for r in routers)
+
+    srx = filter(
+        lambda r: r['equipment name'].lower().startswith('srx'), routers)
+    assert all(s['type'] == 'INTERNAL' for s in srx)
+
 
 CIRCUIT_INFO_SCHEMA = {
     "$schema": "http://json-schema.org/draft-07/schema#",
-- 
GitLab