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

    m1_if1_85 = m1.create_vlan(m1_if1,
                               85,
                               ip=["192.168.85.10/24", "2002:85::1/64"])
    m2_if1_85 = m2.create_vlan(m2_if1,
                               85,
                               ip=["192.168.85.11/24", "2002:85::2/64"])
    m1.run("ip link set dev %s type vlan egress 0:7" % m1_if1_85.get_devname())
    m2.run("ip link set dev %s type vlan egress 0:7" % m2_if1_85.get_devname())

    m1_if1_95 = m1.create_vlan(m1_if1,
                               95,
                               ip=["192.168.95.10/24", "2002:95::1/64"])
    m2_if1_95 = m2.create_vlan(m2_if1,
                               95,
                               ip=["192.168.95.11/24", "2002:95::2/64"])

    sw_br1 = sw.create_bridge(slaves=[sw_if1, sw_if2],
                              options={
                                  "vlan_filtering": 1,
                                  "multicast_snooping": 0
                              })
    sw_if1.add_br_vlan(85)
    sw_if2.add_br_vlan(85)
    sw_if1.add_br_vlan(95)
    sw_if2.add_br_vlan(95)

    sleep(15)

    tl = TestLib(ctl, aliases)

    # Test to establish that there is connectivity.
    tl.ping_simple(m1_if1_85, m2_if1_85, count=10, limit_rate=9, interval=0.1)
    tl.ping_simple(m1_if1_95, m2_if1_95, count=10, limit_rate=9, interval=0.1)

    q1 = Qdisc(sw_if1, 0xffff, "ingress")

    # Test that PCP match matches only that PCP.
    q1.flush()
    q1.filter_add("protocol 802.1q flower vlan_prio 7 skip_sw action drop")
    sleep(1)
    tl.ping_simple(m1_if1_85, m2_if1_85, limit_rate=10, fail_expected=True)
    tl.ping_simple(m1_if1_95, m2_if1_95)

    # Test that vlan match actually matches only that vlan.
    q1.flush()
    q1.filter_add("protocol 802.1q flower vlan_id 95 skip_sw action drop")
    sleep(1)
    tl.ping_simple(m1_if1_85, m2_if1_85)
    tl.ping_simple(m1_if1_95, m2_if1_95, limit_rate=10, 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_85 = m1.create_vlan(m1_if1,
                               85,
                               ip=["192.168.101.10/24", "2002::1/64"])
    m2_if1_65 = m2.create_vlan(m2_if1,
                               65,
                               ip=["192.168.101.11/24", "2002::2/64"])

    sw_br1 = sw.create_bridge(slaves=[sw_if1, sw_if2],
                              options={
                                  "vlan_filtering": 1,
                                  "multicast_snooping": 0
                              })
    sw_if1.add_br_vlan(85)
    sw_if2.add_br_vlan(65)

    # These 2 aren't needed functionally, but used to prevent logged errors -
    # Learning fails upon receiving packets on a non-configured {port, vlan}
    sw_if1.add_br_vlan(65)
    sw_if2.add_br_vlan(85)

    q1 = Qdisc(sw_if1, 0xffff, "ingress")
    q1.filter_add("protocol all flower skip_sw action vlan modify id 65")

    q2 = Qdisc(sw_if2, 0xffff, "ingress")
    q2.filter_add("protocol all flower skip_sw action vlan modify id 85")

    sleep(10)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_if1_85, m2_if1_65)
Beispiel #3
0
def do_task(ctl, hosts, ifaces, aliases):
    m1, m2, sw = hosts
    m1_if1, m2_if1, sw_if1, sw_if2 = ifaces

    m1_if1_85 = m1.create_vlan(m1_if1,
                               85,
                               ip=["192.168.101.10/24", "2002::1/64"])
    m2_if1_65 = m2.create_vlan(m2_if1,
                               65,
                               ip=["192.168.101.11/24", "2002::2/64"])

    sw_br1 = sw.create_bridge(slaves=[sw_if1, sw_if2],
                              options={
                                  "vlan_filtering": 1,
                                  "multicast_snooping": 0
                              })
    sw_if1.add_br_vlan(85)
    sw_if2.add_br_vlan(65)

    q1 = Qdisc(sw_if1, 0xffff, "ingress")
    q1.filter_add("protocol all flower skip_sw action vlan modify id 65")

    q2 = Qdisc(sw_if2, 0xffff, "ingress")
    q2.filter_add("protocol all flower skip_sw action vlan modify id 85")

    sleep(10)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_if1_85, m2_if1_65)
Beispiel #4
0
def do_task(ctl, hosts, ifaces, aliases):
    m1, m2, sw = hosts
    m1_if1, m2_if1, sw_if1, sw_if2 = ifaces

    m1_if1_85 = m1.create_vlan(m1_if1, 85,
                               ip=["192.168.85.10/24", "2002:85::1/64"])
    m2_if1_85 = m2.create_vlan(m2_if1, 85,
                               ip=["192.168.85.11/24", "2002:85::2/64"])
    m1.run("ip link set dev %s type vlan egress 0:7" % m1_if1_85.get_devname())
    m2.run("ip link set dev %s type vlan egress 0:7" % m2_if1_85.get_devname())

    m1_if1_95 = m1.create_vlan(m1_if1, 95,
                               ip=["192.168.95.10/24", "2002:95::1/64"])
    m2_if1_95 = m2.create_vlan(m2_if1, 95,
                               ip=["192.168.95.11/24", "2002:95::2/64"])

    sw_br1 = sw.create_bridge(slaves=[sw_if1, sw_if2], options={"vlan_filtering": 1,
                                                                "multicast_snooping": 0})
    sw_if1.add_br_vlan(85)
    sw_if2.add_br_vlan(85)
    sw_if1.add_br_vlan(95)
    sw_if2.add_br_vlan(95)

    sleep(15)

    tl = TestLib(ctl, aliases)

    # Test to establish that there is connectivity.
    tl.ping_simple(m1_if1_85, m2_if1_85, count=10, limit_rate=9, interval=0.1)
    tl.ping_simple(m1_if1_95, m2_if1_95, count=10, limit_rate=9, interval=0.1)

    q1 = Qdisc(sw_if1, 0xffff, "ingress")

    # Test that PCP match matches only that PCP.
    q1.flush()
    q1.filter_add("protocol 802.1q flower vlan_prio 7 skip_sw action drop")
    sleep(1)
    tl.ping_simple(m1_if1_85, m2_if1_85, limit_rate=10, fail_expected=True)
    tl.ping_simple(m1_if1_95, m2_if1_95)

    # Test that vlan match actually matches only that vlan.
    q1.flush()
    q1.filter_add("protocol 802.1q flower vlan_id 95 skip_sw action drop")
    sleep(1)
    tl.ping_simple(m1_if1_85, m2_if1_85)
    tl.ping_simple(m1_if1_95, m2_if1_95, limit_rate=10, 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_85 = m1.create_vlan(m1_if1, 85, ip=["192.168.101.10/24", "2002::1/64"])
    m2_if1_65 = m2.create_vlan(m2_if1, 65, ip=["192.168.101.11/24", "2002::2/64"])

    sw_br1 = sw.create_bridge(slaves=[sw_if1, sw_if2], options={"vlan_filtering": 1,
                                                                "multicast_snooping": 0})
    sw_if1.add_br_vlan(85)
    sw_if2.add_br_vlan(65)

    q1 = Qdisc(sw_if1, 0xffff, "ingress")
    q1.filter_add("protocol all flower skip_sw action vlan modify id 65")

    q2 = Qdisc(sw_if2, 0xffff, "ingress")
    q2.filter_add("protocol all flower skip_sw action vlan modify id 85")

    sleep(10)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_if1_85, m2_if1_65)