From 6f13ff406f53e1aa5510bf61d01c88b9bc6e0feb Mon Sep 17 00:00:00 2001
From: Robert Latta <robert.latta@geant.org>
Date: Wed, 6 Nov 2019 10:20:36 +0000
Subject: [PATCH] Added the non-services (e.g. L2 circuits) back into the
 services and related-services sections; added circuit_type to
 related-services

---
 inventory_provider/routes/classifier.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/inventory_provider/routes/classifier.py b/inventory_provider/routes/classifier.py
index 14396033..751321a1 100644
--- a/inventory_provider/routes/classifier.py
+++ b/inventory_provider/routes/classifier.py
@@ -62,11 +62,11 @@ def get_top_level_services(circuit_id, r):
         for c in results:
             temp_parents = \
                 get_top_level_services(c['parent_circuit_id'], r)
-            if not temp_parents and \
-                    c['parent_circuit_type'].lower() == 'service':
+            if not temp_parents:
                 tls.append(
                     {'name': c['parent_circuit'],
-                     'status': c['parent_circuit_status']})
+                     'status': c['parent_circuit_status'],
+                     'circuit_type': c['parent_circuit_type']})
             tls.extend(temp_parents)
     return tls
 
@@ -118,9 +118,12 @@ def get_juniper_link_info(source_equipment, interface):
                     for s in json.loads(rs.decode('utf-8')):
                         top_level_services.extend(
                             get_top_level_services(s['id'], r))
-                        if s['circuit_type'].lower() == 'service':
-                            all_rs.append(
-                                {'name': s['name'], 'status': s['status']})
+                        all_rs.append(
+                            {
+                                'name': s['name'],
+                                'status': s['status'],
+                                'circuit_type': s['circuit_type']
+                            })
                 return all_rs
 
         related_services = _related_services()
-- 
GitLab