def test_validate_2switch_2host_lag_l3(topology):

    ops1 = topology.get('ops1')
    ops2 = topology.get('ops2')
    hs1 = topology.get('hs1')
    hs2 = topology.get('hs2')
    topology_2switch_2host_lag(ops1, ops2, hs1, hs2)
    config_switches_l3_lag(
                ops1, ops2, ip_ops1_int1, ip_ops2_int2, ip_ops1_lag,
                ip_ops2_lag, ip_route_ops1, ip_route_ops2, lag_id_s1,
                lag_id_s2
                )
    config_hosts_l3(
                hs1, hs2, ip_hs1, ip_hs2,
                hs1_ip_route, hs2_ip_route
                )
    # Wait until interfaces are up
    for switch, portlbl in [(ops1, '1'), (ops1, '5'), (ops1, '6')]:
        wait_until_interface_up(switch, portlbl)
    for switch, portlbl in [(ops2, '1'), (ops2, '5'), (ops2, '6')]:
        wait_until_interface_up(switch, portlbl)

    ping_test(hs1, ip_only_hs2)
    ops1('show run')
    ops2('show run')
def configure_acl_test(topology):
    ops1 = topology.get('ops1')
    hs1 = topology.get('hs1')
    hs2 = topology.get('hs2')

    topology_1switch_2host(ops1, hs1, hs2)

    ingress_acl_test.set_acl_addr_type('ip')
    ingress_acl_test.set_acl_app_type('port')
    ingress_acl_test.set_acl_direction('in')
    ingress_acl_test.set_topology(topology)
    ingress_acl_test.set_switch_1(ops1)
    ingress_acl_test.set_tx_host(hs1, '1.1.1.1')
    ingress_acl_test.set_rx_host(hs2, '1.1.1.2')
    ingress_acl_test.set_primary_interface_number('1')
    ingress_acl_test.set_secondary_interface_number('6')
    ingress_acl_test.set_tx_count(10)

    config_switch_l2(ops1, '100')

    hs1.send_command('service network-manager stop', shell='bash')
    hs2.send_command('service network-manager stop', shell='bash')

    config_hosts_l2(hs1, hs2, ip_hs1='1.1.1.1/24', ip_hs2='1.1.1.2/24')

    # Delaying to allow commands to be implemented
    sleep(5)
    for portlbl in ['1', '6']:
        wait_until_interface_up(ops1, portlbl)

    ping_test(hs2, '1.1.1.1')
    start_scapy_on_hosts(hs1, hs2)
示例#3
0
def configure_acl_test(topology):
    ops1 = topology.get('ops1')
    hs1 = topology.get('hs1')
    hs2 = topology.get('hs2')

    topology_1switch_2host(ops1, hs1, hs2)

    ingress_acl_test.set_acl_addr_type('ip')
    ingress_acl_test.set_acl_app_type('port')
    ingress_acl_test.set_acl_direction('in')
    ingress_acl_test.set_topology(topology)
    ingress_acl_test.set_switch_1(ops1)
    ingress_acl_test.set_tx_host(hs1, '1.1.1.1')
    ingress_acl_test.set_rx_host(hs2, '1.1.1.2')
    ingress_acl_test.set_primary_interface_number('1')
    ingress_acl_test.set_secondary_interface_number('6')
    ingress_acl_test.set_tx_count(10)

    config_switch_l2(ops1, '100')

    hs1.send_command('service network-manager stop', shell='bash')
    hs2.send_command('service network-manager stop', shell='bash')

    config_hosts_l2(hs1, hs2, ip_hs1='1.1.1.1/24', ip_hs2='1.1.1.2/24')

    # Delaying to allow commands to be implemented
    sleep(5)
    for portlbl in ['1', '6']:
        wait_until_interface_up(ops1, portlbl)

    ping_test(hs2, '1.1.1.1')
    start_scapy_on_hosts(hs1, hs2)
def test_validate_1switch_2host_l2(topology):

    ops1 = topology.get('ops1')
    hs1 = topology.get('hs1')
    hs2 = topology.get('hs2')
    topology_1switch_2host(ops1, hs1, hs2)
    config_switch_l2(ops1, vlan_id)
    config_hosts_l2(hs1, hs2, ip_hs1_bitlength, ip_hs2_bitlength)
    for portlbl in ['1', '6']:
        wait_until_interface_up(ops1, portlbl)
    ping_test(hs1, ip_hs2)
    ops1('show run')
示例#5
0
def test_validate_1switch_2host_l2(topology):

    ops1 = topology.get('ops1')
    hs1 = topology.get('hs1')
    hs2 = topology.get('hs2')
    topology_1switch_2host(ops1, hs1, hs2)
    config_switch_l2(ops1, vlan_id)
    config_hosts_l2(hs1, hs2, ip_hs1_bitlength, ip_hs2_bitlength)
    for portlbl in ['1', '6']:
        wait_until_interface_up(ops1, portlbl)
    ping_test(hs1, ip_hs2)
    ops1('show run')
示例#6
0
def test_validate_1switch_2host_l3(topology):

    ops1 = topology.get('ops1')
    hs1 = topology.get('hs1')
    hs2 = topology.get('hs2')
    topology_1switch_2host(ops1, hs1, hs2)
    config_switch_l3(ops1, ip_ops1_int1, ip_ops1_int2)
    ops1('show run')
    config_hosts_l3(hs1, hs2, ip_hs1, ip_hs2, hs1_ip_route, hs2_ip_route)
    for portlbl in ['1', '6']:
        wait_until_interface_up(ops1, portlbl)
    ping_test(hs1, ip_only_hs2)
    ops1('show run')
def test_validate_2switch_2host_l2(topology):

    ops1 = topology.get("ops1")
    ops2 = topology.get("ops2")
    hs1 = topology.get("hs1")
    hs2 = topology.get("hs2")
    topology_2switch_2host(ops1, ops2, hs1, hs2)
    config_2switch_l2(ops1, ops2, vlan_id_s1, vlan_id_s2)
    config_hosts_l2(hs1, hs2, ip_hs1_bitlength, ip_hs2_bitlength)
    for portlbl in ["1", "6"]:
        wait_until_interface_up(ops1, portlbl)
    for portlbl in ["1", "6"]:
        wait_until_interface_up(ops2, portlbl)
    ping_test(hs1, ip_hs2)
    ops1("show run")
    ops2("show run")
def test_validate_1switch_2host_l3(topology):

    ops1 = topology.get('ops1')
    hs1 = topology.get('hs1')
    hs2 = topology.get('hs2')
    topology_1switch_2host(ops1, hs1, hs2)
    config_switch_l3(ops1, ip_ops1_int1, ip_ops1_int2)
    ops1('show run')
    config_hosts_l3(
                hs1, hs2, ip_hs1, ip_hs2,
                hs1_ip_route, hs2_ip_route
                )
    for portlbl in ['1', '6']:
        wait_until_interface_up(ops1, portlbl)
    ping_test(hs1, ip_only_hs2)
    ops1('show run')
def test_validate_2switch_2host_lag_l2(topology):

    ops1 = topology.get('ops1')
    ops2 = topology.get('ops2')
    hs1 = topology.get('hs1')
    hs2 = topology.get('hs2')
    topology_2switch_2host_lag(ops1, ops2, hs1, hs2)
    config_switch_lag_l2(ops1, ops2, vlan_id_s1, vlan_id_s2, lag_id_s1,
                         lag_id_s2)
    config_hosts_l2(hs1, hs2, ip_hs1_bitlength, ip_hs2_bitlength)
    # Wait until interfaces are up
    for switch, portlbl in [(ops1, '1'), (ops1, '5'), (ops1, '6')]:
        wait_until_interface_up(switch, portlbl)
    for switch, portlbl in [(ops2, '1'), (ops2, '5'), (ops2, '6')]:
        wait_until_interface_up(switch, portlbl)

    ping_test(hs1, ip_hs2)
    ops1('show run')
    ops2('show run')
def test_validate_2switch_2host_lag_l3(topology):

    ops1 = topology.get('ops1')
    ops2 = topology.get('ops2')
    hs1 = topology.get('hs1')
    hs2 = topology.get('hs2')
    topology_2switch_2host_lag(ops1, ops2, hs1, hs2)
    config_switches_l3_lag(ops1, ops2, ip_ops1_int1, ip_ops2_int2, ip_ops1_lag,
                           ip_ops2_lag, ip_route_ops1, ip_route_ops2,
                           lag_id_s1, lag_id_s2)
    config_hosts_l3(hs1, hs2, ip_hs1, ip_hs2, hs1_ip_route, hs2_ip_route)
    # Wait until interfaces are up
    for switch, portlbl in [(ops1, '1'), (ops1, '5'), (ops1, '6')]:
        wait_until_interface_up(switch, portlbl)
    for switch, portlbl in [(ops2, '1'), (ops2, '5'), (ops2, '6')]:
        wait_until_interface_up(switch, portlbl)

    ping_test(hs1, ip_only_hs2)
    ops1('show run')
    ops2('show run')
def test_validate_2switch_2host_lag_l2(topology):

    ops1 = topology.get('ops1')
    ops2 = topology.get('ops2')
    hs1 = topology.get('hs1')
    hs2 = topology.get('hs2')
    topology_2switch_2host_lag(ops1, ops2, hs1, hs2)
    config_switch_lag_l2(
                        ops1, ops2, vlan_id_s1, vlan_id_s2,
                        lag_id_s1, lag_id_s2
                        )
    config_hosts_l2(hs1, hs2, ip_hs1_bitlength, ip_hs2_bitlength)
    # Wait until interfaces are up
    for switch, portlbl in [(ops1, '1'), (ops1, '5'), (ops1, '6')]:
        wait_until_interface_up(switch, portlbl)
    for switch, portlbl in [(ops2, '1'), (ops2, '5'), (ops2, '6')]:
        wait_until_interface_up(switch, portlbl)

    ping_test(hs1, ip_hs2)
    ops1('show run')
    ops2('show run')