Ejemplo n.º 1
0
def process_initialize():
    """
    Virtual Infrastructure Manager - Initialize
    """
    init_complete = True

    debug.debug_initialize(config.CONF['debug'], 'VIM')
    profiler.profiler_initialize()
    selobj.selobj_initialize()
    timers.timers_initialize(PROCESS_TICK_INTERVAL_IN_MS,
                             PROCESS_TICK_MAX_DELAY_IN_MS,
                             PROCESS_TICK_DELAY_DEBOUNCE_IN_MS)
    schedule.schedule_initialize()
    event_log.event_log_initialize(config.CONF['event-log'])
    alarm.alarm_initialize(config.CONF['alarm'])
    if not nfvi.nfvi_initialize(config.CONF['nfvi']):
        DLOG.info("nfvi_initialize failed")
        init_complete = False
    database.database_initialize(config.CONF['database'])
    database.database_migrate_data()
    tables.tables_initialize()
    directors.directors_initialize()
    events.events_initialize()
    audits.audits_initialize()
    dor.dor_initialize()
    network_rebalance.nr_initialize()
    return init_complete
Ejemplo n.º 2
0
def process_initialize():
    """
    Virtual Infrastructure Manager Web Server - Initialize
    """
    debug.debug_initialize(config.CONF['debug'], 'VIM-WEB')
    selobj.selobj_initialize()
    timers.timers_initialize(PROCESS_TICK_INTERVAL_IN_MS,
                             PROCESS_TICK_MAX_DELAY_IN_MS,
                             PROCESS_TICK_DELAY_DEBOUNCE_IN_MS)
    database.database_initialize(config.CONF['database'])
    tables.tables_initialize()
Ejemplo n.º 3
0
def process_initialize():
    """
    Virtual Infrastructure Manager - Initialize
    """
    debug.debug_initialize(config.CONF['debug'], 'VIM')
    profiler.profiler_initialize()
    selobj.selobj_initialize()
    timers.timers_initialize(PROCESS_TICK_INTERVAL_IN_MS,
                             PROCESS_TICK_MAX_DELAY_IN_MS,
                             PROCESS_TICK_DELAY_DEBOUNCE_IN_MS)
    schedule.schedule_initialize()
    event_log.event_log_initialize(config.CONF['event-log'])
    alarm.alarm_initialize(config.CONF['alarm'])
    nfvi.nfvi_initialize(config.CONF['nfvi'])
    database.database_initialize(config.CONF['database'])
    database.database_migrate_data()
    tables.tables_initialize()
    directors.directors_initialize()
    events.events_initialize()
    audits.audits_initialize()
    dor.dor_initialize()
Ejemplo n.º 4
0
    def test_nfv_vim_database_upgrade_from_18_03(self):
        """
        Test VIM database upgrades from 18.03 GA
        """
        root_dir = os.environ['VIRTUAL_ENV']

        devnull = open(os.devnull, 'w')
        try:
            vim_cmd = ("nfv-vim-manage db-load-data -d %s "
                       "-f %s/nfv_vim_db_18.03_GA" % (root_dir, root_dir))

            subprocess.check_call([vim_cmd], shell=True, stderr=devnull)

        except subprocess.CalledProcessError:
            raise

        config = dict()
        config['database_dir'] = root_dir
        database.database_initialize(config)
        database.database_migrate_data()
        tables.tables_initialize()
Ejemplo n.º 5
0
def process_main():
    """
    Virtual Infrastructure Manager Manage - Main
    """
    try:
        parser = argparse.ArgumentParser(
            usage=('nfv-vim-manage <command> [<args>] \n' +
                   '  where command is one of \n' +
                   '    db-dump-data    dump data from database \n' +
                   '    db-load-data    load data into database \n'))
        parser.add_argument('command', help='command to be run')
        args = parser.parse_args(sys.argv[1:2])

        debug.debug_initialize(None, 'VIM-DB')

        if 'db-dump-data' == args.command:
            parser = argparse.ArgumentParser(
                description='Dump data from database')
            parser.add_argument('-d',
                                '--database',
                                help='database directory',
                                required=True)
            parser.add_argument('-f',
                                '--filename',
                                help='dump data to file',
                                required=True)
            args = parser.parse_args(sys.argv[2:])
            if args.database is None or args.filename is None:
                parser.print_help()

            database_config = dict()
            database_config['database_dir'] = args.database
            database.database_initialize(database_config)
            database.database_dump_data(args.filename)
            database.database_finalize()
            print("Database data dump....... [complete]")

        elif 'db-load-data' == args.command:
            parser = argparse.ArgumentParser(
                description='Load data into database')
            parser.add_argument('-d',
                                '--database',
                                help='database directory',
                                required=True)
            parser.add_argument('-f',
                                '--filename',
                                help='load data from file',
                                required=True)
            args = parser.parse_args(sys.argv[2:])
            if args.database is None or args.filename is None:
                parser.print_help()

            database_config = dict()
            database_config['database_dir'] = args.database
            database.database_initialize(database_config)
            database.database_load_data(args.filename)
            database.database_finalize()
            print("Database data load....... [complete]")

        else:
            parser.print_help()

    except KeyboardInterrupt:
        print("Keyboard Interrupt received.")
        pass

    except Exception as e:
        print(e)
        sys.exit(1)

    finally:
        debug.debug_finalize()