Beispiel #1
0
def run(arguments):
    """
     This will launch the provisioning of Bare metal & IaaS.
     There is pxe based configuration defined to provision the bare metal.
     For IaaS provisioning different deployment models are supported.
     Relevant conf files related to PXE based Hw provisioning & IaaS must be
     present in ./conf folder.
     :param arguments: This expects command line options to be entered by user
                       for relevant operations.
     :return: To the OS
    """
    __installation_logs(arguments)

    logger.info('Launching Operation Starts ........')
    dir_path = os.path.dirname(os.path.realpath(__file__))
    export_path = dir_path + "/"
    os.environ['CWD_IAAS'] = export_path
    logger.info('Current Exported Relevant Path - %s', export_path)

    config_file = os.path.abspath(os.path.expanduser(arguments.config))
    config = file_utils.read_yaml(config_file)
    logger.info('Read configuration file - %s', config_file)

    __manage_keys(config)

    if arguments.deploy_kubernetes:
        __launcher_conf()
        validate_deployment_file(config)
        k8_utils.execute(config)
    if arguments.clean_kubernetes:
        k8_utils.clean_k8(config)
Beispiel #2
0
 def setUp(self):
     config_file = pkg_resources.resource_filename('tests.conf',
                                                   'deployment.yaml')
     self.config = file_utils.read_yaml(config_file)
     self.node_list = self.config[consts.K8S_KEY][consts.NODE_CONF_KEY]
     self.network_list = self.config[consts.K8S_KEY][consts.NETWORKS_KEY]
     self.persis_vol = self.config[consts.K8S_KEY][consts.PERSIST_VOL_KEY]
Beispiel #3
0
 def test_setup_dhcp_service(self, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10,
                             m11, m12):
     """
     Tests the rebar_utils.
     :return:
     """
     conf_file = pkg_resources.resource_filename('tests.conf', 'hosts.yaml')
     conf = file_utils.read_yaml(conf_file)
     rebar_utils.install_config_drp(None, conf)
Beispiel #4
0
def __reboot_openstack_nodes(os_manifest_file):
    """
    Reboots openstack node server instances
    :param os_manifest_file: the OpenStack manifest
    """
    logger.info('Attempting to reboot nodes running on OpenStack')
    logger.debug('Reading in OpenStack manifest YAML file [%s]',
                 os_manifest_file)

    os_dict = file_utils.read_yaml(os_manifest_file)
    logger.debug('Read config file [%s] with contents [%s]', os_manifest_file,
                 os_dict)
    logger.debug('Looking up VMs with %s', os_dict)

    for vm_info in os_dict['vms']:
        __reboot_openstack_node(vm_info)
Beispiel #5
0
 def setUp(self):
     self.pb_loc = pkg_resources.resource_filename('tests.openstack.conf',
                                                   'snaps-orch-tmplt.yaml')
     self.pb_dict = file_utils.read_yaml(self.pb_loc)
Beispiel #6
0
def __run(arguments):
    """
     This will launch the provisioning of Bare metat & IaaS.
     There is pxe based configuration defined to provision the bare metal.
     For IaaS provisioning different deployment models are supported.
     Relevant conf files related to PXE based Hw provisioning & Openstack based
     IaaS must be present in ./conf folder.
     :param arguments: This expects command line options to be entered by user
                       for relavant operations.
     :return: To the OS
    """

    log_level = logging.INFO
    if arguments.log_level != 'INFO':
        log_level = logging.DEBUG
    logging.basicConfig(stream=sys.stdout, level=log_level)

    logger.info('Launching Operation Starts ........')

    user = getpass.getuser()
    logger.info('Running as user %s', user)

    config_filepath = os.path.expanduser(arguments.config)
    logger.info('Reading configuration file [%s]', config_filepath)
    config = file_utils.read_yaml(config_filepath)

    prv_config = config.get('PROVISION')
    if not prv_config:
        raise Exception('Missing top-level config member PROVISION')
    logger.debug('PROVISION configuration %s', prv_config)

    # TODO/FIXME - Hardcoding of user/pass should be configurable
    drp_config = prv_config.get('digitalRebar')
    if drp_config:
        logger.info('Rebar configuration %s', drp_config)
        user = drp_config.get('user', 'rocketskates')
        password = drp_config.get('password', 'r0cketsk8ts')
    else:
        user = '******'
        password = '******'

    # TODO/FIXME - DRP host and port should be configurable
    rebar_session = HttpSession('https://localhost:8092', user, password)

    if arguments.hardware is not ARG_NOT_SET:
        rebar_utils.install_config_drp(rebar_session, config)

    if arguments.provisionClean is not ARG_NOT_SET:
        rebar_utils.cleanup_drp(rebar_session, config)

    if arguments.staticIPCleanup is not ARG_NOT_SET:
        # Do we really need to support this function?
        pxe_utils.static_ip_cleanup(config)

    if arguments.staticIPConfigure is not ARG_NOT_SET:
        # Is this something that we should do with cloud-init or other means
        # immediately after the OS is laid down?
        pxe_utils.static_ip_configure(config)

    if arguments.boot is not ARG_NOT_SET:
        ipmi_utils.reboot_pxe(config)

    if arguments.bootd is not ARG_NOT_SET:
        # This power cycles the nodes
        ipmi_utils.reboot_disk(config)
    if arguments.setIsolCpus is not ARG_NOT_SET:
        # This operation is unclear
        pxe_utils.set_isol_cpus(config)
    if arguments.delIsolCpus is not ARG_NOT_SET:
        # This operation is unclear
        pxe_utils.del_isol_cpus(config)
    logger.info('Completed operation successfully')
Beispiel #7
0
 def test_get_ipmi_creds(self):
     conf_file = pkg_resources.resource_filename('tests.conf', 'hosts.yaml')
     conf = file_utils.read_yaml(conf_file)
     creds = ipmi_utils.get_ipmi_creds(conf)
     self.assertEqual(5, len(creds))
Beispiel #8
0
 def setUp(self):
     conf_file = pkg_resources.resource_filename('tests.conf', 'hosts.yaml')
     self.boot_conf = file_utils.read_yaml(conf_file)
Beispiel #9
0
 def setUp(self):
     config_file = pkg_resources.resource_filename('tests.conf',
                                                   'deployment.yaml')
     self.config = file_utils.read_yaml(config_file)
def __run(deploy_file):
    """
    Validates that the cluster has been properly deployed
    """
    k8s_conf = file_utils.read_yaml(deploy_file)
    validate_cluster.validate_all(k8s_conf)