X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=sdnvpn%2Flib%2Fquagga.py;h=dc80657cf02708800da535ccdf2f393c4c8b6331;hb=f368948e25f78c64c328662b52d6b139b02826b4;hp=e2885c2d348d2de9216ecfa22ea16b55cd51dbd1;hpb=e6dc7ddf5f072f3ce477e08cd8f4373e47a93470;p=sdnvpn.git diff --git a/sdnvpn/lib/quagga.py b/sdnvpn/lib/quagga.py index e2885c2..dc80657 100644 --- a/sdnvpn/lib/quagga.py +++ b/sdnvpn/lib/quagga.py @@ -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 @@ -29,15 +33,19 @@ def bootstrap_quagga(fip_addr, controller_ip): return rc == 0 -def gen_quagga_setup_script(controller_ip, instance_floating_ip): +def gen_quagga_setup_script(controller_ip, + fake_floating_ip, + ext_net_mask): with open(COMMON_CONFIG.quagga_setup_script_path) as f: template = f.read() - script = template % (controller_ip, instance_floating_ip) + script = template % (controller_ip, + fake_floating_ip, + ext_net_mask) return script 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 =.*)")