parser.add_argument('--file', default='',
                        help='File from which to read the JSON flow template; default: no file, use a built in '
                             'template.')
    parser.add_argument('--config_monitor', type=int, default=60,
                        help='Time to monotir inventory after flows are configured in seconds; default=60')
    parser.add_argument('--deconfig_monitor', type=int, default=60,
                        help='Time to monitor inventory after flows are de configured in seconds; default=60')
    parser.add_argument('--monitor_period', type=int, default=10,
                        help='Monitor period of triggering inventory crawler in seconds; default=10')
    parser.add_argument('--monitor_outfile', default=None, help='Output file(if specified)')

    in_args = parser.parse_args()

    # Initialize
    if in_args.file != '':
        flow_template = get_json_from_file(in_args.file)
    else:
        flow_template = None

    ic = InventoryCrawler(in_args.host, in_args.port, 0, 'operational', in_args.auth, False)

    fct = FlowConfigBlaster(in_args.host, in_args.port, in_args.cycles, in_args.threads, in_args.fpr,
                            16, in_args.flows, in_args.startflow, in_args.auth)
    # Get the baseline stats. Required in Step 3 to validate if the delete
    # function gets the controller back to the baseline
    ic.crawl_inventory()
    reported = ic.reported_flows
    found = ic.found_flows

    print 'Baseline:'
    print '   Reported nodes: %d' % reported
    # This program executes the base performance test. The test adds flows into
    # the controller's config space. This function is basically the CLI frontend
    # to the FlowConfigBlaster class and drives its main functions: adding and
    # deleting flows from the controller's config data store
    ############################################################################
    parser = flow_config_blaster.create_arguments_parser()
    parser.add_argument('--bulk-type',
                        default='RPC',
                        dest='bulk_type',
                        choices=['RPC', 'DS'],
                        help='Bulk type to use: RPC, DS (default is RPC)')

    in_args = parser.parse_args()

    if in_args.file != '':
        flow_template = flow_config_blaster.get_json_from_file(in_args.file)
    else:
        flow_template = None

    fcbb = FlowConfigBulkBlaster(in_args.host, in_args.port, in_args.cycles,
                                 in_args.threads, in_args.fpr, in_args.nodes,
                                 in_args.flows, in_args.startflow,
                                 in_args.auth)
    fcbb.bulk_type = in_args.bulk_type
    fcbb.update_post_url_template('ADD')

    # Run through <cycles>, where <threads> are started in each cycle and
    # <flows> are added from each thread
    fcbb.add_blaster()

    print '\n*** Total flows added: %s' % fcbb.get_ok_flows()
示例#3
0
    parser.add_argument('--startflow',
                        type=int,
                        default=0,
                        help='The starting Flow ID; default=0')
    parser.add_argument(
        '--file',
        default='',
        help=
        'File from which to read the JSON flow template; default: no file, use a built in '
        'template.')

    in_args = parser.parse_args()

    # Initialize
    if in_args.file != '':
        flow_template = get_json_from_file(in_args.file)
    else:
        flow_template = None

    ic = InventoryCrawler(in_args.host, in_args.port, 0, 'operational',
                          in_args.auth, False)

    fct = FlowConfigBlaster(in_args.host, in_args.port, in_args.cycles,
                            in_args.threads, in_args.fpr, 16, in_args.flows,
                            in_args.startflow, in_args.auth)
    # Get the baseline stats. Required in Step 3 to validate if the delete
    # function gets the controller back to the baseline
    ic.crawl_inventory()
    reported = ic.reported_flows
    found = ic.found_flows
if __name__ == "__main__":
    ############################################################################
    # This program executes the base performance test. The test adds flows into
    # the controller's config space. This function is basically the CLI frontend
    # to the FlowConfigBlaster class and drives its main functions: adding and
    # deleting flows from the controller's config data store
    ############################################################################
    parser = flow_config_blaster.create_arguments_parser()
    parser.add_argument('--bulk-type', default='RPC', dest='bulk_type',
                        choices=['RPC', 'DS'],
                        help='Bulk type to use: RPC, DS (default is RPC)')

    in_args = parser.parse_args()

    if in_args.file != '':
        flow_template = flow_config_blaster.get_json_from_file(in_args.file)
    else:
        flow_template = None

    fcbb = FlowConfigBulkBlaster(in_args.host, in_args.port, in_args.cycles,
                                 in_args.threads, in_args.fpr, in_args.nodes,
                                 in_args.flows, in_args.startflow, in_args.auth)
    fcbb.bulk_type = in_args.bulk_type
    fcbb.update_post_url_template('ADD')

    # Run through <cycles>, where <threads> are started in each cycle and
    # <flows> are added from each thread
    fcbb.add_blaster()

    print '\n*** Total flows added: %s' % fcbb.get_ok_flows()
    print '    HTTP[OK] results:  %d\n' % fcbb.get_ok_rqsts()