Example #1
0
def process_finalize():
    """
    Virtual Infrastructure Manager Web Server - Finalize
    """
    tables.tables_finalize()
    database.database_finalize()
    timers.timers_finalize()
    selobj.selobj_finalize()
    debug.debug_finalize()
Example #2
0
def process_finalize():
    """
    Virtual Infrastructure Manager - Finalize
    """
    dor.dor_finalize()
    audits.audits_finalize()
    events.events_finalize()
    directors.directors_finalize()
    tables.tables_finalize()
    database.database_finalize()
    nfvi.nfvi_finalize()
    alarm.alarm_finalize()
    event_log.event_log_finalize()
    schedule.schedule_finalize()
    timers.timers_finalize()
    selobj.selobj_finalize()
    profiler.profiler_finalize()
    debug.debug_finalize()
Example #3
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()