From 348fdf5adc9a53c5a80042bf3c9a2e7e28982a8d Mon Sep 17 00:00:00 2001
From: David Schmitz <schmitz@lrz.de>
Date: Tue, 9 Oct 2018 11:04:47 +0000
Subject: [PATCH] add code for external debugging of netconf

---
 utils/proxy.py | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/utils/proxy.py b/utils/proxy.py
index 8014a6d8..5c9a016c 100644
--- a/utils/proxy.py
+++ b/utils/proxy.py
@@ -203,6 +203,37 @@ class Applier(object):
         else:
             return False
 
+    def get_existing_config_xml(self):
+        retriever0 = Retriever(xml=None)
+        config_xml_running = retriever0.fetch_xml()
+        logger.info("proxy::get_existing_config(): config_xml_running="+str(config_xml_running))
+        return config_xml_running
+
+    def get_existing_config(self):
+        retriever0 = Retriever(xml=None)
+        config_parsed = retriever0.proccess_xml()
+        logger.info("proxy::get_existing_config(): config_parsed="+str(config_parsed))
+        return config_parsed
+
+    def get_existing_routes(self):
+        config_parsed = self.get_existing_config()
+        if config_parsed.routing_options and config_parsed.routing_options.__len__()>0:
+          flow = config_parsed.routing_options[0]
+          logger.info("proxy::get_existing_routes(): config_parsed.flow="+str(flow))
+          routes_existing = flow.routes
+          logger.info("proxy::get_existing_routes(): config_parsed.flow.routes="+str(routes_existing))
+          return routes_existing
+        else:
+          logger.info("proxy::get_existing_routes(): no routing_options or is empty")
+          return []
+
+    def get_existing_route_names(self):
+      routes_existing = self.get_existing_routes()
+      route_ids_existing = [route.name for route in routes_existing]
+      logger.info("proxy::get_existing_route_names(): config_parsed.flow.routes.ids="+str(route_ids_existing))
+      return route_ids_existing
+
+
     def apply(self, configuration = None, operation=None):
         reason = None
         if not configuration:
-- 
GitLab