if (path_choice_type == "spine"): vpc_name = weight_data["vpc_name"] if not raas_utils.client_exists_vpc(vpc_name): raas_utils.log_service("VPC does not exist") exit(1) node_name = weight_data["node_name"] path_choice_name = weight_data["path_choice"] if not raas_utils.check_exists(node_type, node_name, vpc_name) or \ not raas_utils.check_exists(path_choice_type, path_choice_name, vpc_name): raas_utils.log_service("Either Node does not exists") exit(1) if (node_type == "spine"): node_name_hyp = hyp_utils.get_hyp_spine_name(hypervisor, vpc_name, node_name) elif (node_type == "l1_transit"): node_name_hyp = hyp_utils.get_hyp_l1_transit_name( hypervisor, node_name) elif (node_type == "l2_transit"): node_name_hyp = hyp_utils.get_hyp_l2_transit_name( hypervisor, node_name) else: exit(1) node_name_hyp_arg = "c_name=" + node_name_hyp if (path_choice_type == "spine"): path_choice_name_hyp = hyp_utils.get_hyp_spine_name( hypervisor, vpc_name, path_choice_name) elif (path_choice_type == "l1_transit"):
hypervisor_ip = hyp_utils.get_hyp_ip(hypervisor) vpc_name = advertise_data["vpc_name"] if not raas_utils.client_exists_vpc(vpc_name): raas_utils.log_service("VPC does not exist") exit(1) spine_name = advertise_data["spine_name"] l1_transit_name = advertise_data["l1_transit_name"] if not raas_utils.check_exists("spine", spine_name, vpc_name) or \ not raas_utils.check_exists("l1_transit", l1_transit_name, vpc_name): raas_utils.log_service("Either Node does not exists") exit(1) spine_name_hyp = hyp_utils.get_hyp_spine_name(hypervisor, vpc_name, spine_name) l1_transit_name_hyp = hyp_utils.get_hyp_l1_transit_name( hypervisor, l1_transit_name) spine_name_hyp_arg = "c_name=" + spine_name_hyp advertise = advertise_data["networks_advertised"] advertise_arg = "adv_subnets=" + advertise client_spine_data = raas_utils.get_client_node_data( "spine", spine_name, vpc_name) self_as = str(client_spine_data["self_as"]) self_as_arg = "self_as=" + self_as client_l1_transit_data = raas_utils.get_client_node_data(
extra_vars = constants.ansible_become_pass + l2_hypervisor_arg + leaf2_id_arg + l_local_ip_arg + l_remote_ip_arg + vxlan_tunnel_name_arg + br_name_arg raas_utils.run_playbook( "ansible-playbook logic/subnet/add_vxlan_to_leaf.yml -i logic/inventory/hosts.yml -v --extra-vars '" + extra_vars + "'") except Exception as e: raas_utils.log_service("Configure VXLAN on leaf 2 subnet failed" + str(e)) raise try: spines_data = raas_utils.get_all_spines(leaf1_vpc_name) leaf1_loopback_arg = " leaf_loopback=" + leaf1_lo_ip for spine in spines_data: spine_id = hyp_utils.get_hyp_spine_name( leaf1_hypervisor_name, leaf1_vpc_name, spine) if spine_id is None: continue node_name_hyp_arg = "c_name=" + spine_id spine_self_as = raas_utils.get_client_node_data( "spine", spine_id, leaf1_vpc_name)["self_as"] spine_self_as_arg = " spine_self_as=" + str(spine_self_as) extra_vars = constants.ansible_become_pass + l1_hypervisor_arg + leaf1_loopback_arg + spine_self_as_arg + node_name_hyp_arg raas_utils.run_playbook( "ansible-playbook logic/subnet/advertise_leaf_to_spine.yml -i logic/inventory/hosts.yml -v --extra-vars '" + extra_vars + "'") except: raas_utils.log_service("Advertising routes of leaf 1 failed" + str(e)) try: