SXP: Do not parse missing connections list 74/76874/1
authorIvan Hrasko <ihrasko@cisco.com>
Thu, 11 Oct 2018 12:36:20 +0000 (14:36 +0200)
committerIvan Hrasko <ihrasko@cisco.com>
Thu, 11 Oct 2018 12:36:20 +0000 (14:36 +0200)
- after upgrade to Neon platform empty lists
are removed from datastore
- this is also case for connections list -
do not try to parse it if its missing

Change-Id: I04a3695ecd76d3a13b1abee7e5b36738433dd759
Signed-off-by: Ivan Hrasko <ihrasko@cisco.com>
csit/libraries/Sxp.py

index e873b73b48f779e6a054b407ab5d88dfa6b721c5..644eae738755c3b23f1748fc6b9a8a3a7f23b79d 100644 (file)
@@ -414,11 +414,13 @@ def parse_connections(connections_json):
 
     """
     data = json.loads(connections_json)
-    connections = data['output']['connections']
-    output = []
-    for connection in connections.values():
-        output += connection
-    return output
+    output = data['output']
+    result = []
+    if output:
+        connections = output['connections']
+        for connection in connections.values():
+            result += connection
+    return result
 
 
 def find_connection(connections_json, version, mode, ip, port, state):