Example #1
0
def test_chain_runner_ext_no_openstack():
    """Test ChainRunner EXT no openstack."""
    config = _get_chain_config(sc=ChainType.EXT)
    specs = Specs()
    config.vlans = [100, 200]
    config['traffic_generator']['mac_addrs_left'] = ['00:00:00:00:00:00']
    config['traffic_generator']['mac_addrs_right'] = ['00:00:00:00:01:00']

    for shared_net in [True, False]:
        for no_arp in [False, True]:
            for vlan_tag in [False, True]:
                for scc in [1, 2]:
                    config = _get_chain_config(ChainType.EXT, scc, shared_net)
                    config.no_arp = no_arp
                    if no_arp:
                        # If EXT and no arp, the config must provide mac (1 pair per chain)
                        config['traffic_generator']['mac_addrs_left'] = [
                            '00:00:00:00:00:00'
                        ] * scc
                        config['traffic_generator']['mac_addrs_right'] = [
                            '00:00:00:00:01:00'
                        ] * scc
                    config['vlan_tagging'] = vlan_tag
                    if vlan_tag:
                        # these are the 2 valid forms of vlan ranges
                        if scc == 1:
                            config.vlans = [100, 200]
                        else:
                            config.vlans = [[
                                port * 100 + index for index in range(scc)
                            ] for port in range(2)]
                    runner = ChainRunner(config, None, specs, BasicFactory())
                    runner.close()
Example #2
0
def _test_ext_chain(config, cred, mock_glance, mock_neutron, mock_client):
    # instance = self.novaclient.servers.create(name=vmname,...)
    # instance.status == 'ACTIVE'
    mock_client.return_value.servers.create.return_value.status = 'ACTIVE'
    netw = {
        'id': 0,
        'provider:network_type': 'vlan',
        'provider:segmentation_id': 1000
    }
    mock_neutron.Client.return_value.list_networks.return_value = {
        'networks': [netw]
    }
    specs = Specs()
    openstack_spec = OpenStackSpec()
    specs.set_openstack_spec(openstack_spec)
    cred = MagicMock(spec=nfvbench.credentials.Credentials)
    cred.is_admin = True
    runner = ChainRunner(config, cred, specs, BasicFactory())
    runner.close()
Example #3
0
def _test_pvp_chain_no_admin_config_values(config, cred, mock_glance,
                                           mock_neutron, mock_client):
    # instance = self.novaclient.servers.create(name=vmname,...)
    # instance.status == 'ACTIVE'
    mock_client.return_value.servers.create.return_value.status = 'ACTIVE'
    netw = {
        'id': 0,
        'provider:network_type': 'vlan',
        'provider:segmentation_id': 1000
    }
    mock_neutron.Client.return_value.create_network.return_value = {
        'network': netw
    }
    mock_neutron.Client.return_value.list_networks.return_value = {
        'networks': None
    }
    specs = Specs()
    openstack_spec = OpenStackSpec()
    specs.set_openstack_spec(openstack_spec)
    runner = ChainRunner(config, cred, specs, BasicFactory())
    runner.close()
Example #4
0
def test_fixed_rate_no_openstack():
    """Test FIxed Rate run - no openstack."""
    config = _get_chain_config(ChainType.EXT, 1, True, rate='100%')
    specs = Specs()
    config.vlans = [100, 200]
    config['traffic_generator']['mac_addrs_left'] = ['00:00:00:00:00:00']
    config['traffic_generator']['mac_addrs_right'] = ['00:00:00:00:01:00']
    config.no_arp = True
    config['vlan_tagging'] = True
    config['traffic'] = {'profile': 'profile_64', 'bidirectional': True}
    config['traffic_profile'] = [{
        'name': 'profile_64',
        'l2frame_size': ['64']
    }]

    runner = ChainRunner(config, None, specs, BasicFactory())
    tg = runner.traffic_client.gen

    tg.set_response_curve(lr_dr=0, ndr=100, max_actual_tx=50, max_11_tx=50)
    # tx packets should be 50% at requested 50% line rate or higher for 64B and no drops...
    results = runner.run()
    assert results
    # pprint.pprint(results['EXT']['result']['result']['64'])
    runner.close()