import sys import do_json import raas_utils import hyp_utils import constants import ipaddress #import logging #from logging import info as raas_utils.log_service #logging.basicConfig(filename='raas.log', filemode='a', format='%(asctime)s %(name)s - %(levelname)s - %(message)s', level=logging.INFO) """@params: param1 = bgp config file (required) """ if __name__ == "__main__": if (len(sys.argv) < 2): raas_utils.log_service("Please give bgp config file") exit(1) advertise_file = sys.argv[1] #pc_name = pc_config_file.split('/')[-1].split('.')[0] #Assumed customer always gives correct config file advertise_data = do_json.json_read(advertise_file) hypervisor = advertise_data["hypervisor_name"] hypervisor_arg = "hypervisor=" + hypervisor hypervisors_data = hyp_utils.get_hypervisors_data() hypervisor_ip = hyp_utils.get_hyp_ip(hypervisor)
import os import sys import do_json import raas_utils import hyp_utils import constants import ipaddress """@params: param1 = connection config name (required) """ if __name__ == "__main__": if (len(sys.argv) < 2): raas_utils.log_service("Please give connection config file") exit(1) connection_config_file = sys.argv[1] connection_name = connection_config_file.split('/')[-1].split('.')[0] cid = hyp_utils.get_client_id() connection_data = do_json.json_read(connection_config_file) raas_utils.log_service(connection_data) vpc_name = connection_data["vpc_name"] pc_name = connection_data["pc_name"] leaf_name = connection_data["leaf_name"] if not raas_utils.client_exists_pc(vpc_name, pc_name): raas_utils.log_service("pc does not exists " + pc_name) exit(1) if not raas_utils.client_exists_leaf(vpc_name, leaf_name):
import os import sys import do_json import raas_utils import hyp_utils import constants import ipaddress """@params: param1 = bgp config file (required) """ if __name__ == "__main__": if (len(sys.argv) < 2): raas_utils.log_service("Please give bgp config file") exit(1) multipath_file = sys.argv[1] #pc_name = pc_config_file.split('/')[-1].split('.')[0] #Assumed customer always gives correct config file multipath_data = do_json.json_read(multipath_file) hypervisor = multipath_data["hypervisor_name"] hypervisor_arg = "hypervisor=" + hypervisor hypervisors_data = hyp_utils.get_hypervisors_data() hypervisor_ip = hyp_utils.get_hyp_ip(hypervisor) node_type = multipath_data["node_type"]
import os import sys import do_json import raas_utils import hyp_utils import constants import ipaddress """@params: param1 = bgp config file (required) """ if __name__ == "__main__": if (len(sys.argv) < 2): raas_utils.log_service("Please give bgp config file") exit(1) weight_file = sys.argv[1] #pc_name = pc_config_file.split('/')[-1].split('.')[0] #Assumed customer always gives correct config file weight_data = do_json.json_read(weight_file) hypervisor = weight_data["hypervisor_name"] hypervisor_arg = "hypervisor=" + hypervisor hypervisors_data = hyp_utils.get_hypervisors_data() hypervisor_ip = hyp_utils.get_hyp_ip(hypervisor) node_type = weight_data["node_type"] path_choice_type = weight_data["path_choice_type"]
import sys #from do_json import * import do_json import hyp_utils import constants import ipaddress import raas_utils """@params: param1 = vpc config file (required) """ if __name__=="__main__": if (len(sys.argv) < 2): raas_utils.log_client("VPC config not provided") raas_utils.log_service("Please give vpc config file") exit(1) spine_config_file = sys.argv[1] spine_name = spine_config_file.split('/')[-1].split('.')[0] #Assumed customer always gives correct config file spine_data = do_json.json_read(spine_config_file) hypervisor = spine_data["hypervisor_name"] hypervisor_arg = "hypervisor="+hypervisor hypervisors_data = hyp_utils.get_hypervisors_data() hypervisor_ip = hyp_utils.get_hyp_ip(hypervisor)
import do_json import raas_utils import hyp_utils import constants import ipaddress #import logging #from logging import info as raas_utils.log_service #logging.basicConfig(filename='raas.log', filemode='a', format='%(asctime)s %(name)s - %(levelname)s - %(message)s', level=logging.INFO) """@params: param1 = connection config name (required) """ if __name__=="__main__": if (len(sys.argv) < 2): raas_utils.log_service("Please give connection config file") exit(1) connection_config_file = sys.argv[1] connection_name = connection_config_file.split('/')[-1].split('.')[0] cid = hyp_utils.get_client_id() connection_data = do_json.json_read(connection_config_file) raas_utils.log_service(connection_data) # hypervisor = connection_data["hypervisor_name"] # hypervisor_arg = "hypervisor="+hypervisor # hypervisors_data = hyp_utils.get_hypervisors_data() # hypervisor_ip = hyp_utils.get_hyp_ip(hypervisor) cid = hyp_utils.get_client_id()
import sys import do_json import raas_utils import hyp_utils import constants import ipaddress #import logging #from logging import info as raas_utils.log_service #logging.basicConfig(filename='raas.log', filemode='a', format='%(asctime)s %(name)s - %(levelname)s - %(message)s', level=logging.INFO) """@params: param1 = connection config name (required) """ if __name__ == "__main__": if (len(sys.argv) < 2): raas_utils.log_service("Please give connection config file") exit(1) connection_config_file = sys.argv[1] connection_name = connection_config_file.split('/')[-1].split('.')[0] cid = hyp_utils.get_client_id() connection_data = do_json.json_read(connection_config_file) raas_utils.log_service(connection_data) cid = hyp_utils.get_client_id() leaf1_vpc_name = connection_data["leaf1_vpc_name"] leaf2_vpc_name = connection_data["leaf2_vpc_name"] leaf1_name = connection_data["leaf1_name"]
import do_json import raas_utils import hyp_utils import constants import ipaddress #import logging #from logging import info as raas_utils.log_service #logging.basicConfig(filename='raas.log', filemode='a', format='%(asctime)s %(name)s - %(levelname)s - %(message)s', level=logging.INFO) """@params: param1 = config file (required) """ if __name__=="__main__": if (len(sys.argv) < 2): raas_utils.log_service("Please give peering config file") exit(1) peer_config_file = sys.argv[1] leaf_name = peer_config_file.split('/')[-1].split('.')[0] #Assumed customer always gives correct config file peering_data = do_json.json_read(peer_config_file) hypervisor = peering_data["hypervisor_name"] hypervisor_arg = "hypervisor="+hypervisor hypervisors_data = hyp_utils.get_hypervisors_data() hypervisor_ip = hyp_utils.get_hyp_ip(hypervisor) vpc_name = peering_data["vpc_name"]
import raas_utils import hyp_utils import constants import ipaddress #import logging #from logging import info as raas_utils.log_service #logging.basicConfig(filename='raas.log', filemode='a', format='%(asctime)s %(name)s - %(levelname)s - %(message)s', level=logging.INFO) """@params: param1 = l1_transit config file (required) """ if __name__=="__main__": if (len(sys.argv) < 2): raas_utils.log_client("Please give l1_transit config file.....aborting") raas_utils.log_service("Please give l1_transit config file......aborting") exit(1) l1_transit_config_file = sys.argv[1] l1_transit_name = l1_transit_config_file.split('/')[-1].split('.')[0] #Assumed customer always gives correct config file l1_transit_data = do_json.json_read(l1_transit_config_file) hypervisor = l1_transit_data["hypervisor_name"] hypervisor_arg = "hypervisor="+hypervisor hypervisors_data = hyp_utils.get_hypervisors_data() hypervisor_ip = hyp_utils.get_hyp_ip(hypervisor)
def restore_pod_checkpoint(pod, version, hypervisor): hypervisor_arg = " hypervisor=" + hypervisor pod_arg = " pod=" + pod version_arg = " version=" + version extra_vars = constants.ansible_become_pass + hypervisor_arg + pod_arg + version_arg rc = raas_utils.run_playbook( "ansible-playbook logic/checkpoint/restore_checkpoint.yml -i logic/inventory/hosts.yml -v --extra-vars '" + extra_vars + "'") # if (rc != 0): # raas_utils.log_service ("restore checkpoint failed") if (len(sys.argv) < 2): raas_utils.log_service( "Please give correct arguments <checkpoint/restore> <version>") exit(1) with open('var/hypervisors.json') as tenant_file: action = sys.argv[1] version = sys.argv[2] data = json.load(tenant_file) nodes = [] h1_cns = [] _finditem(data['h1'], 'name', h1_cns) nodes.append(['h1', h1_cns])
import os import sys import do_json import raas_utils import constants import ipaddress import hyp_utils from subprocess import Popen, PIPE """@params: param1 = vpc config file (required) """ if __name__ == "__main__": if (len(sys.argv) < 2): raas_utils.log_service("Please give vpc config file") raas_utils.log_client("No config file present") exit(1) vpc_config_file = sys.argv[1] vpc_name = vpc_config_file.split('/')[-1].split('.')[0] if raas_utils.client_exists_vpc(vpc_name): raas_utils.log_client("Vpc already exists") raas_utils.log_client("aborting vpc creation") raas_utils.log_service("Vpc already exists") raas_utils.log_service("aborting vpc creation") exit(1) #Assumed customer always gives correct config file vpc_config_data = do_json.json_read(vpc_config_file)
import sys import do_json import raas_utils import hyp_utils import constants import ipaddress #import logging #from logging import info as raas_utils.log_service #logging.basicConfig(filename='raas.log', filemode='a', format='%(asctime)s %(name)s - %(levelname)s - %(message)s', level=logging.INFO) """@params: param1 = l2_transit config file (required) """ if __name__ == "__main__": if (len(sys.argv) < 2): raas_utils.log_service("Please give l2_transit config file") raas_utils.log_client("Please give l2_transit config file") exit(1) l2_transit_config_file = sys.argv[1] l2_transit_name = l2_transit_config_file.split('/')[-1].split('.')[0] #Assumed customer always gives correct config file l2_transit_data = do_json.json_read(l2_transit_config_file) hypervisor = l2_transit_data["hypervisor_name"] hypervisor_arg = "hypervisor=" + hypervisor hypervisors_data = hyp_utils.get_hypervisors_data()
import raas_utils import hyp_utils import constants import ipaddress #import logging #from logging import info as raas_utils.log_service #logging.basicConfig(filename='raas.log', filemode='a', format='%(asctime)s %(name)s - %(levelname)s - %(message)s', level=logging.INFO) """@params: param1 = leaf config file (required) """ if __name__=="__main__": if (len(sys.argv) < 3): raas_utils.log_client("Config file missing.......aborting") raas_utils.log_service("Please give leaf config file......asborting") exit(1) leaf_config_file = sys.argv[1] #dhcp leaf or dummy leaf dhcp_flag = sys.argv[2] if (dhcp_flag == "true" or dhcp_flag == "True"): dhcp_flag = True else: dhcp_flag = False leaf_name = leaf_config_file.split('/')[-1].split('.')[0] #Assumed customer always gives correct config file leaf_data = do_json.json_read(leaf_config_file)
import do_json import raas_utils import hyp_utils import constants import ipaddress #import logging #from logging import info as raas_utils.log_service #logging.basicConfig(filename='raas.log', filemode='a', format='%(asctime)s %(name)s - %(levelname)s - %(message)s', level=logging.INFO) """@params: param1 = connection config name (required) """ if __name__=="__main__": if (len(sys.argv) < 2): raas_utils.log_service("Please give connection config file") exit(1) connection_config_file = sys.argv[1] connection_name = connection_config_file.split('/')[-1].split('.')[0] cid = hyp_utils.get_client_id() connection_data = do_json.json_read(connection_config_file) raas_utils.log_service(connection_data) cid = hyp_utils.get_client_id() l1_transit_name = connection_data["l1_transit_name"] l1_transit_hypervisor_name = connection_data["l1_transit_hypervisor_name"] l1_transit_id = hyp_utils.get_hyp_l1_transit_name(l1_transit_hypervisor_name,l1_transit_name)