def do_task(ctl, hosts, ifaces, aliases):
    m1, m2, sw = hosts
    m1_if1, m2_if1, sw_if1, sw_if2 = ifaces

    m1_if1_10 = m1.create_vlan(m1_if1, 10, ip=test_ip(1,1))
    m2_if1_20 = m2.create_vlan(m2_if1, 20, ip=test_ip(1,2))
    sw_if1_10 = sw.create_vlan(sw_if1, 10)
    sw_if2_20 = sw.create_vlan(sw_if2, 20)

    # Ageing time is 10 seconds.
    br_options = {"vlan_filtering": 0, "ageing_time": 1000}
    sw_br = sw.create_bridge(slaves = [sw_if1_10, sw_if2_20], options=br_options)

    sleep(15)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software")
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")

    sleep(20)

    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)

    # Disable learning and make sure FDB is not populated.
    sw_if1_10.set_br_learning(on=False, self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)

    # Disable flooding and make sure ping fails.
    sw_if1_10.set_br_flooding(on=False, self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)

    # Set a static FDB entry and make sure ping works again.
    sw_if1_10.add_br_fdb(str(m1_if1_10.get_hwaddr()), self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")

    # Remove static FDB entry. Ping should fail.
    sw_if1_10.del_br_fdb(str(m1_if1_10.get_hwaddr()), self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)

    # Enable learning_sync and make sure both FDBs are populated.
    sw_if1_10.set_br_learning(on=True, self=True)
    sw_if1_10.set_br_flooding(on=True, self=True)
    sw_if1_10.set_br_learning_sync(on=True, self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software")
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")

    sleep(20)

    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)

    # Disable learning_sync and make sure only hardware FDB is populated.
    sw_if1_10.set_br_learning_sync(on=False, self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")

    # Remove port from bridge and add it back. Disable flooding and learning
    # and make sure ping doesn't work. Note that port must be removed from
    # bridge when the FDB entry exists only in the hardware table. Otherwise,
    # bridge code will flush it himself, instead of driver.
    sw_br.slave_del(sw_if1_10.get_id())
    sw_br.slave_add(sw_if1_10.get_id())    # Enables learning sync by default.
    sw_if1_10.set_br_learning(on=False, self=True)
    sw_if1_10.set_br_flooding(on=False, self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)

    # Enable learning and make sure ping works again.
    sw_if1_10.set_br_learning(on=True, self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software")
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")

    sleep(20)

    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)

    # Insert a static FDB entry and disable learning sync. Ping should work.
    sw_if1_10.add_br_fdb(str(m1_if1_10.get_hwaddr()), self=True)
    sw_if1_10.set_br_learning_sync(on=False, self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")

    sleep(20)

    # Make sure static entry is not aged out.
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")

    # Remove port from bridge and add it back. Disable flooding and learning
    # and make sure ping doesn't work. Note that port must be removed from
    # bridge when the FDB entry exists only in the hardware table. Otherwise,
    # bridge code will flush it himself, instead of driver. Unlike the
    # previous case, here we check if the driver correctly removes the static
    # entry.
    sw_br.slave_del(sw_if1_10.get_id())
    sw_br.slave_add(sw_if1_10.get_id())
    sw_if1_10.set_br_learning(on=False, self=True)
    sw_if1_10.set_br_flooding(on=False, self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)
def do_task(ctl, hosts, ifaces, aliases):
    m1, m2, sw = hosts
    m1_if1, m2_if1, sw_if1, sw_if2 = ifaces

    m1_if1_10 = m1.create_vlan(m1_if1, 10, ip=test_ip(1,1))
    m2_if1_20 = m2.create_vlan(m2_if1, 20, ip=test_ip(1,2))
    sw_if1_10 = sw.create_vlan(sw_if1, 10)
    sw_if2_20 = sw.create_vlan(sw_if2, 20)

    # Ageing time is 10 seconds.
    br_options = {"vlan_filtering": 0, "ageing_time": 1000}
    sw_br = sw.create_bridge(slaves = [sw_if1_10, sw_if2_20], options=br_options)

    sleep(30)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software")
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")
    sw_if1_10.set_br_learning(on=False, self=True)

    sleep(30)

    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)

    # Make sure FDB is not populated when learning is disabled.
    sw_if1_10.set_br_learning(on=False, self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)

    # Disable flooding and make sure ping fails.
    sw_if1_10.set_br_flooding(on=False, self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)

    # Set a static FDB entry and make sure ping works again.
    sw_if1_10.add_br_fdb(str(m1_if1_10.get_hwaddr()), self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")

    # Remove static FDB entry. Ping should fail.
    sw_if1_10.del_br_fdb(str(m1_if1_10.get_hwaddr()), self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)

    # Enable learning_sync and make sure both FDBs are populated.
    sw_if1_10.set_br_learning(on=True, self=True)
    sw_if1_10.set_br_flooding(on=True, self=True)
    sw_if1_10.set_br_learning_sync(on=True, self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software")
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")
    sw_if1_10.set_br_learning(on=False, self=True)

    sleep(20)

    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)

    # Disable learning_sync and make sure only hardware FDB is populated.
    sw_if1_10.set_br_learning(on=True, self=True)
    sw_if1_10.set_br_learning_sync(on=False, self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")

    # Remove port from bridge and add it back. Disable flooding and learning
    # and make sure ping doesn't work. Note that port must be removed from
    # bridge when the FDB entry exists only in the hardware table. Otherwise,
    # bridge code will flush it himself, instead of driver.
    sw_br.slave_del(sw_if1_10.get_id())
    sw_br.slave_add(sw_if1_10.get_id())    # Enables learning sync by default.
    sw_if1_10.set_br_learning(on=False, self=True)
    sw_if1_10.set_br_flooding(on=False, self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)

    # Enable learning and make sure ping works again.
    sw_if1_10.set_br_learning(on=True, self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software")
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")
    sw_if1_10.set_br_learning(on=False, self=True)

    sleep(20)

    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)

    # Insert a static FDB entry and disable learning sync. Ping should work.
    sw_if1_10.add_br_fdb(str(m1_if1_10.get_hwaddr()), self=True)
    sw_if1_10.set_br_learning_sync(on=False, self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")

    sleep(20)

    # Make sure static entry is not aged out.
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")

    # Remove port from bridge and add it back. Disable flooding and learning
    # and make sure ping doesn't work. Note that port must be removed from
    # bridge when the FDB entry exists only in the hardware table. Otherwise,
    # bridge code will flush it himself, instead of driver. Unlike the
    # previous case, here we check if the driver correctly removes the static
    # entry.
    sw_br.slave_del(sw_if1_10.get_id())
    sw_br.slave_add(sw_if1_10.get_id())
    sw_if1_10.set_br_learning(on=False, self=True)
    sw_if1_10.set_br_flooding(on=False, self=True)
    tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)
def do_task(ctl, hosts, ifaces, aliases):
    m1, m2, sw = hosts
    m1_if1, m1_if2, m2_if1, m2_if2, sw_if1, sw_if2, sw_if3, sw_if4 = ifaces

    team_config = '{"runner" : {"name" : "lacp"}}'
    m1_lag1 = m1.create_team(slaves=[m1_if1, m1_if2],
                             config=team_config,
                             ip=["192.168.101.10/24", "2002::1/64"])

    m2_lag1 = m2.create_team(slaves=[m2_if1, m2_if2],
                             config=team_config,
                             ip=["192.168.101.11/24", "2002::2/64"])

    sw_lag1 = sw.create_team(slaves=[sw_if1, sw_if2], config=team_config)

    sw_lag2 = sw.create_team(slaves=[sw_if3, sw_if4], config=team_config)

    # Ageing time is 10 seconds.
    br_options = {
        "vlan_filtering": 1,
        "ageing_time": 1000,
        "multicast_querier": 1
    }
    sw_br = sw.create_bridge(slaves=[sw_lag1, sw_lag2], options=br_options)

    sleep(30)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True)
    sw_lag1.set_br_learning(on=False, master=True)

    sleep(30)

    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True, False)

    # Make sure FDB is not populated when learning is disabled.
    sw_lag1.set_br_learning(on=False, master=True)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True, False)

    # Disable flooding and make sure ping fails.
    sw_lag1.set_br_flooding(on=False, master=True)
    tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)

    # Set a static FDB entry and make sure ping works again. Also check
    # its offloaded
    sw_lag1.add_br_fdb(str(m1_lag1.get_hwaddr()), master=True, vlan_tci=1)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, False)

    # Remove static FDB entry. Ping should fail.
    sw_lag1.del_br_fdb(str(m1_lag1.get_hwaddr()), master=True, vlan_tci=1)
    tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, False, False)

    # Enable learning and flooading and make sure ping works again.
    sw_lag1.set_br_learning(on=True, master=True)
    sw_lag1.set_br_flooding(on=True, master=True)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True)
    sw_lag1.set_br_learning(on=False, master=True)

    sleep(30)

    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True, False)

    # Insert a static FDB entry. Ping should work.
    sw_lag1.add_br_fdb(str(m1_lag1.get_hwaddr()), master=True, vlan_tci=1)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, False)

    sleep(30)

    # Make sure static entry is not aged out.
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, False)

    # Remove port from bridge and add it back. The static entry added
    # before should be flushed. Disable flooding and learning and make
    # sure ping doesn't work.
    sw_br.slave_del(sw_lag1.get_id())
    sw_br.slave_add(sw_lag1.get_id())
    sw_lag1.set_br_learning(on=False, master=True)
    sw_lag1.set_br_flooding(on=False, master=True)
    tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)
def do_task(ctl, hosts, ifaces, aliases):
    m1, m2, sw = hosts
    m1_if1, m2_if1, sw_if1, sw_if2 = ifaces

    m1_if1_10 = m1.create_vlan(m1_if1, 10, ip=test_ip(1, 1))
    m2_if1_20 = m2.create_vlan(m2_if1, 20, ip=test_ip(1, 2))
    sw_if1_10 = sw.create_vlan(sw_if1, 10)
    sw_if2_20 = sw.create_vlan(sw_if2, 20)

    # Ageing time is 10 seconds.
    br_options = {
        "vlan_filtering": 0,
        "ageing_time": 1000,
        "multicast_snooping": 0
    }
    sw_br = sw.create_bridge(slaves=[sw_if1_10, sw_if2_20], options=br_options)

    sleep(30)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, True)
    sw_if1_10.set_br_learning(on=False, master=True)

    sleep(30)

    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, True, False)

    # Make sure FDB is not populated when learning is disabled.
    sw_if1_10.set_br_learning(on=False, master=True)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, True, False)

    # Disable flooding and make sure ping fails.
    sw_if1_10.set_br_flooding(on=False, master=True)
    tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)

    # Set a static FDB entry and make sure ping works again.  Also check
    # its offloaded
    sw_if1_10.add_br_fdb(str(m1_if1_10.get_hwaddr()), master=True)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, False)

    # Remove static FDB entry. Ping should fail.
    sw_if1_10.del_br_fdb(str(m1_if1_10.get_hwaddr()), master=True)
    tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, False, False)

    # Enable learning and flooding and make sure ping works again.
    sw_if1_10.set_br_learning(on=True, master=True)
    sw_if1_10.set_br_flooding(on=True, master=True)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, True)
    sw_if1_10.set_br_learning(on=False, master=True)

    sleep(20)

    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, True, False)

    # Insert a static FDB entry. Ping should work.
    sw_if1_10.add_br_fdb(str(m1_if1_10.get_hwaddr()), master=True)
    tl.ping_simple(m1_if1_10, m2_if1_20)
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, False)

    sleep(20)

    # Make sure static entry is not aged out.
    tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, True, False)

    # Remove port from bridge and add it back. The static entry added
    # before should be flushed. Disable flooding and learning and make
    # sure ping doesn't work.
    sw_br.slave_del(sw_if1_10.get_id())
    sw_br.slave_add(sw_if1_10.get_id())
    sw_if1_10.set_br_learning(on=False, master=True)
    sw_if1_10.set_br_flooding(on=False, master=True)
    tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)
Beispiel #5
0
def do_task(ctl, hosts, ifaces, aliases):
    m1, m2, sw = hosts
    m1_if1, m1_if2, m2_if1, m2_if2, sw_if1, sw_if2, sw_if3, sw_if4 = ifaces

    team_config = '{"runner" : {"name" : "lacp"}}'
    m1_lag1 = m1.create_team(slaves=[m1_if1, m1_if2], config=team_config,
                             ip=["192.168.101.10/24", "2002::1/64"])

    m2_lag1 = m2.create_team(slaves=[m2_if1, m2_if2], config=team_config,
                             ip=["192.168.101.11/24", "2002::2/64"])

    sw_lag1 = sw.create_team(slaves=[sw_if1, sw_if2], config=team_config)

    sw_lag2 = sw.create_team(slaves=[sw_if3, sw_if4], config=team_config)

    # Ageing time is 10 seconds.
    br_options = {"vlan_filtering": 1, "ageing_time": 1000}
    sw_br = sw.create_bridge(slaves = [sw_lag1, sw_lag2], options=br_options)

    sleep(15)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software")
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")

    sleep(20)

    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)

    # Disable learning and make sure FDB is not populated.
    sw_lag1.set_br_learning(on=False, self=True)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)

    # Disable flooding and make sure ping fails.
    sw_lag1.set_br_flooding(on=False, self=True)
    tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)

    # Set a static FDB entry and make sure ping works again.
    sw_lag1.add_br_fdb(str(m1_lag1.get_hwaddr()), self=True, vlan_tci=1)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")

    # Remove static FDB entry. Ping should fail.
    sw_lag1.del_br_fdb(str(m1_lag1.get_hwaddr()), self=True, vlan_tci=1)
    tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)

    # Enable learning_sync and make sure both FDBs are populated.
    sw_lag1.set_br_learning(on=True, self=True)
    sw_lag1.set_br_flooding(on=True, self=True)
    sw_lag1.set_br_learning_sync(on=True, self=True)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software")
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")

    sleep(20)

    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)

    # Disable learning_sync and make sure only hardware FDB is populated.
    sw_lag1.set_br_learning_sync(on=False, self=True)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")

    # Remove port from bridge and add it back. Disable flooding and learning
    # and make sure ping doesn't work. Note that port must be removed from
    # bridge when the FDB entry exists only in the hardware table. Otherwise,
    # bridge code will flush it himself, instead of driver.
    sw_br.slave_del(sw_lag1.get_id())
    sw_br.slave_add(sw_lag1.get_id())    # Enables learning sync by default.
    sw_lag1.set_br_learning(on=False, self=True)
    sw_lag1.set_br_flooding(on=False, self=True)
    tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)

    # Enable learning and make sure ping works again.
    sw_lag1.set_br_learning(on=True, self=True)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software")
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")

    sleep(20)

    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)

    # Insert a static FDB entry and disable learning sync. Ping should work.
    sw_lag1.add_br_fdb(str(m1_lag1.get_hwaddr()), self=True, vlan_tci=1)
    sw_lag1.set_br_learning_sync(on=False, self=True)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")

    sleep(20)

    # Make sure static entry is not aged out.
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")

    # Remove port from bridge and add it back. Disable flooding and learning
    # and make sure ping doesn't work. Note that port must be removed from
    # bridge when the FDB entry exists only in the hardware table. Otherwise,
    # bridge code will flush it himself, instead of driver. Unlike the
    # previous case, here we check if the driver correctly removes the static
    # entry.
    sw_br.slave_del(sw_lag1.get_id())
    sw_br.slave_add(sw_lag1.get_id())
    sw_lag1.set_br_learning(on=False, self=True)
    sw_lag1.set_br_flooding(on=False, self=True)
    tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)
Beispiel #6
0
def do_task(ctl, hosts, ifaces, aliases):
    m1, m2, sw = hosts
    m1_if1, m2_if1, sw_if1, sw_if2 = ifaces

    m1_if1.reset(ip=test_ip(1,1))
    m2_if1.reset(ip=test_ip(1,2))

    # Ageing time is 10 seconds.
    br_options = {"vlan_filtering": 1, "ageing_time": 1000,
                  "multicast_querier": 1}
    sw_br = sw.create_bridge(slaves = [sw_if1, sw_if2], options=br_options)

    sleep(30)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_if1, m2_if1)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True)
    sw_if1.set_br_learning(on=False, master=True)

    sleep(30)

    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True, False)

    # Make sure FDB is not populated when learning is disabled.
    sw_if1.set_br_learning(on=False, master=True)
    tl.ping_simple(m1_if1, m2_if1)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True, False)

    # Disable flooding and make sure ping fails.
    sw_if1.set_br_flooding(on=False, master=True)
    tl.ping_simple(m1_if1, m2_if1, fail_expected=True)

    # Set a static FDB entry and make sure ping works again. Also check
    # its offloaded
    sw_if1.add_br_fdb(str(m1_if1.get_hwaddr()), master=True, vlan_tci=1)
    tl.ping_simple(m1_if1, m2_if1)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, False)

    # Remove static FDB entry. Ping should fail.
    sw_if1.del_br_fdb(str(m1_if1.get_hwaddr()), master=True, vlan_tci=1)
    tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, False, False)

    # Enable learning and flooding and make sure ping works again.
    sw_if1.set_br_learning(on=True, master=True)
    sw_if1.set_br_flooding(on=True, master=True)
    tl.ping_simple(m1_if1, m2_if1)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True)
    sw_if1.set_br_learning(on=False, master=True)

    sleep(20)

    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True, False)

    # Insert a static FDB entry. Ping should work.
    sw_if1.add_br_fdb(str(m1_if1.get_hwaddr()), master=True, vlan_tci=1)
    tl.ping_simple(m1_if1, m2_if1)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, False)

    sleep(20)

    # Make sure static entry is not aged out.
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, False)

    # Remove port from bridge and add it back. The static entry added
    # before should be flushed. Disable flooding and learning and make
    # sure ping doesn't work.
    sw_br.slave_del(sw_if1.get_id())
    sw_br.slave_add(sw_if1.get_id())
    sw_if1.set_br_learning(on=False, master=True)
    sw_if1.set_br_flooding(on=False, master=True)
    tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
Beispiel #7
0
def do_task(ctl, hosts, ifaces, aliases):
    m1, m2, sw = hosts
    m1_if1, m1_if2, m2_if1, m2_if2, sw_if1, sw_if2, sw_if3, sw_if4 = ifaces

    team_config = '{"runner" : {"name" : "lacp"}}'
    m1_lag1 = m1.create_team(slaves=[m1_if1, m1_if2], config=team_config,
                             ip=["192.168.101.10/24", "2002::1/64"])

    m2_lag1 = m2.create_team(slaves=[m2_if1, m2_if2], config=team_config,
                             ip=["192.168.101.11/24", "2002::2/64"])

    sw_lag1 = sw.create_team(slaves=[sw_if1, sw_if2], config=team_config)

    sw_lag2 = sw.create_team(slaves=[sw_if3, sw_if4], config=team_config)

    # Ageing time is 10 seconds.
    br_options = {"vlan_filtering": 1, "ageing_time": 1000}
    sw_br = sw.create_bridge(slaves = [sw_lag1, sw_lag2], options=br_options)

    sleep(30)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software")
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")
    sw_lag1.set_br_learning(on=False, self=True)

    sleep(30)

    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)

    # Make sure FDB is not populated when learning is disabled.
    sw_lag1.set_br_learning(on=False, self=True)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)

    # Disable flooding and make sure ping fails.
    sw_lag1.set_br_flooding(on=False, self=True)
    tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)

    # Set a static FDB entry and make sure ping works again.
    sw_lag1.add_br_fdb(str(m1_lag1.get_hwaddr()), self=True, vlan_tci=1)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")

    # Remove static FDB entry. Ping should fail.
    sw_lag1.del_br_fdb(str(m1_lag1.get_hwaddr()), self=True, vlan_tci=1)
    tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)

    # Enable learning_sync and make sure both FDBs are populated.
    sw_lag1.set_br_learning(on=True, self=True)
    sw_lag1.set_br_flooding(on=True, self=True)
    sw_lag1.set_br_learning_sync(on=True, self=True)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software")
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")
    sw_lag1.set_br_learning(on=False, self=True)

    sleep(30)

    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)

    # Disable learning_sync and make sure only hardware FDB is populated.
    sw_lag1.set_br_learning(on=True, self=True)
    sw_lag1.set_br_learning_sync(on=False, self=True)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")

    # Remove port from bridge and add it back. Disable flooding and learning
    # and make sure ping doesn't work. Note that port must be removed from
    # bridge when the FDB entry exists only in the hardware table. Otherwise,
    # bridge code will flush it himself, instead of driver.
    sw_br.slave_del(sw_lag1.get_id())
    sw_br.slave_add(sw_lag1.get_id())    # Enables learning sync by default.
    sw_lag1.set_br_learning(on=False, self=True)
    sw_lag1.set_br_flooding(on=False, self=True)
    tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)

    # Enable learning and make sure ping works again.
    sw_lag1.set_br_learning(on=True, self=True)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software")
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")
    sw_lag1.set_br_learning(on=False, self=True)

    sleep(30)

    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)

    # Insert a static FDB entry and disable learning sync. Ping should work.
    sw_lag1.add_br_fdb(str(m1_lag1.get_hwaddr()), self=True, vlan_tci=1)
    sw_lag1.set_br_learning_sync(on=False, self=True)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")

    sleep(30)

    # Make sure static entry is not aged out.
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")

    # Remove port from bridge and add it back. Disable flooding and learning
    # and make sure ping doesn't work. Note that port must be removed from
    # bridge when the FDB entry exists only in the hardware table. Otherwise,
    # bridge code will flush it himself, instead of driver. Unlike the
    # previous case, here we check if the driver correctly removes the static
    # entry.
    sw_br.slave_del(sw_lag1.get_id())
    sw_br.slave_add(sw_lag1.get_id())
    sw_lag1.set_br_learning(on=False, self=True)
    sw_lag1.set_br_flooding(on=False, self=True)
    tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)
Beispiel #8
0
def do_task(ctl, hosts, ifaces, aliases):
    m1, m2, sw = hosts
    m1_if1, m2_if1, sw_if1, sw_if2 = ifaces

    # We can't set STP state if kernel's STP is running.
    br_options = {"stp_state": 0, "vlan_filtering": 1, "ageing_time": 1000}
    sw.create_bridge(slaves=[sw_if1, sw_if2], options=br_options)

    m1_if1.reset(ip=test_ip(1, 1))
    m2_if1.reset(ip=test_ip(1, 2))

    sleep(40)

    tl = TestLib(ctl, aliases)

    # Set STP state to DISABLED and make sure ping fails and FDB is not
    # populated.
    sw_if1.set_br_state(0)
    tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware", False)

    # Set STP state to LISTENING and make sure ping fails and FDB is not
    # populated.
    sw_if1.set_br_state(1)
    tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware", False)

    # Set STP state to LEARNING and make sure ping fails, but FDB *is*
    # populated.
    sw_if1.set_br_state(2)
    tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software")
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware")

    sleep(20)

    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware", False)

    # Set STP state to FORWARDING and make sure ping works and FDB is
    # populated.
    sw_if1.set_br_state(3)
    tl.ping_simple(m1_if1, m2_if1)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software")
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware")

    sleep(20)

    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware", False)

    # Make sure that even with a static FDB record we don't get traffic
    # when state is DISABLED, LEARNING or LISTENING.
    sw_if2.add_br_fdb(str(m2_if1.get_hwaddr()), self=True, vlan_tci=1)
    sw_if1.set_br_state(0)
    tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
    sw_if1.set_br_state(1)
    tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
    sw_if1.set_br_state(2)
    tl.ping_simple(m1_if1, m2_if1, fail_expected=True)

    # Cleanup
    sw_if2.del_br_fdb(str(m2_if1.get_hwaddr()), self=True, vlan_tci=1)
Beispiel #9
0
def do_task(ctl, hosts, ifaces, aliases):
    m1, m2, sw = hosts
    m1_if1, m2_if1, sw_if1, sw_if2 = ifaces

    # We can't set STP state if kernel's STP is running.
    br_options = {
        "stp_state": 0,
        "vlan_filtering": 1,
        "ageing_time": 1000,
        "multicast_querier": 1
    }
    sw.create_bridge(slaves=[sw_if1, sw_if2], options=br_options)

    m1_if1.reset(ip=test_ip(1, 1))
    m2_if1.reset(ip=test_ip(1, 2))

    sleep(40)

    tl = TestLib(ctl, aliases)

    # Set STP state to DISABLED and make sure ping fails and FDB is not
    # populated.
    sw_if1.set_br_state(0)
    tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True, False)

    # Set STP state to LISTENING and make sure ping fails and FDB is not
    # populated.
    sw_if1.set_br_state(1)
    tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True, False)

    # Set STP state to LEARNING and make sure ping fails, but FDB *is*
    # populated.
    sw_if1.set_br_state(2)
    tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True)

    sleep(30)

    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True, False)

    # Set STP state to FORWARDING and make sure ping works and FDB is
    # populated.
    sw_if1.set_br_state(3)
    tl.ping_simple(m1_if1, m2_if1)
    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True)

    sleep(30)

    tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True, False)

    # Make sure that even with a static FDB record we don't get traffic
    # when state is DISABLED, LEARNING or LISTENING.
    sw_if2.add_br_fdb(str(m2_if1.get_hwaddr()), master=True, vlan_tci=1)
    sw_if1.set_br_state(0)
    tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
    sw_if1.set_br_state(1)
    tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
    sw_if1.set_br_state(2)
    tl.ping_simple(m1_if1, m2_if1, fail_expected=True)

    # Cleanup
    sw_if2.del_br_fdb(str(m2_if1.get_hwaddr()), master=True, vlan_tci=1)
Beispiel #10
0
def do_task(ctl, hosts, ifaces, aliases):
    m1, m2, sw = hosts
    m1_if1, m1_if2, m2_if1, m2_if2, sw_if1, sw_if2, sw_if3, sw_if4 = ifaces

    team_config = '{"runner" : {"name" : "lacp"}}'
    m1_lag1 = m1.create_team(slaves=[m1_if1, m1_if2], config=team_config,
                             ip=["192.168.101.10/24", "2002::1/64"])

    m2_lag1 = m2.create_team(slaves=[m2_if1, m2_if2], config=team_config,
                             ip=["192.168.101.11/24", "2002::2/64"])

    sw_lag1 = sw.create_team(slaves=[sw_if1, sw_if2], config=team_config)

    sw_lag2 = sw.create_team(slaves=[sw_if3, sw_if4], config=team_config)

    # Ageing time is 10 seconds.
    br_options = {"vlan_filtering": 1, "ageing_time": 1000, "multicast_querier": 1}
    sw_br = sw.create_bridge(slaves = [sw_lag1, sw_lag2], options=br_options)

    sleep(30)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True)
    sw_lag1.set_br_learning(on=False, master=True)

    sleep(30)

    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True, False)

    # Make sure FDB is not populated when learning is disabled.
    sw_lag1.set_br_learning(on=False, master=True)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True, False)

    # Disable flooding and make sure ping fails.
    sw_lag1.set_br_flooding(on=False, master=True)
    tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)

    # Set a static FDB entry and make sure ping works again. Also check
    # its offloaded
    sw_lag1.add_br_fdb(str(m1_lag1.get_hwaddr()), master=True, vlan_tci=1)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, False)

    # Remove static FDB entry. Ping should fail.
    sw_lag1.del_br_fdb(str(m1_lag1.get_hwaddr()), master=True, vlan_tci=1)
    tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, False, False)

    # Enable learning and flooading and make sure ping works again.
    sw_lag1.set_br_learning(on=True, master=True)
    sw_lag1.set_br_flooding(on=True, master=True)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True)
    sw_lag1.set_br_learning(on=False, master=True)

    sleep(30)

    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True, False)

    # Insert a static FDB entry. Ping should work.
    sw_lag1.add_br_fdb(str(m1_lag1.get_hwaddr()), master=True, vlan_tci=1)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, False)

    sleep(30)

    # Make sure static entry is not aged out.
    tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, False)

    # Remove port from bridge and add it back. The static entry added
    # before should be flushed. Disable flooding and learning and make
    # sure ping doesn't work.
    sw_br.slave_del(sw_lag1.get_id())
    sw_br.slave_add(sw_lag1.get_id())
    sw_lag1.set_br_learning(on=False, master=True)
    sw_lag1.set_br_flooding(on=False, master=True)
    tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)