Fix broken call to re.search()
[sdnvpn.git] / sdnvpn / lib / quagga.py
index 9f8a4cd..dc80657 100644 (file)
@@ -13,10 +13,14 @@ logger = ft_logger.Logger("sdnvpn-quagga").getLogger()
 COMMON_CONFIG = config.CommonConfig()
 
 
-def odl_add_neighbor(neighbor_ip, controller):
+def odl_add_neighbor(neighbor_ip, controller_ip, controller):
+    # Explicitly pass controller_ip because controller.ip
+    # Might not be accessible from the Quagga instance
     command = 'configure-bgp -op add-neighbor --as-num 200'
-    command += ' --ip %s --use-source-ip %s' % (neighbor_ip, controller.ip)
+    command += ' --ip %s --use-source-ip %s' % (neighbor_ip, controller_ip)
     success = run_odl_cmd(controller, command)
+    # The run_cmd api is really whimsical
+    logger.info("Maybe stdout of %s: %s", command, success)
     return success
 
 
@@ -41,7 +45,7 @@ def gen_quagga_setup_script(controller_ip,
 
 
 def check_for_peering(controller):
-    cmd = 'show-bgp --cmd "ip bgp neighbors"'
+    cmd = 'show-bgp --cmd \\"ip bgp neighbors\\"'
     tries = 20
     neighbors = None
     bgp_state_regex = re.compile("(BGP state =.*)")