当前位置: 首页>>代码示例>>Python>>正文


Python TestLib.ping_simple方法代码示例

本文整理汇总了Python中TestLib.TestLib.ping_simple方法的典型用法代码示例。如果您正苦于以下问题:Python TestLib.ping_simple方法的具体用法?Python TestLib.ping_simple怎么用?Python TestLib.ping_simple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestLib.TestLib的用法示例。


在下文中一共展示了TestLib.ping_simple方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import ping_simple [as 别名]
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

    bond_options = {"mode": "802.3ad", "miimon": "100"}
    m1_lag1 = m1.create_bond(slaves=[m1_if1, m1_if2], options=bond_options,
                             ip=test_ip(1,1))
    m2_lag1 = m2.create_bond(slaves=[m2_if1, m2_if2], options=bond_options,
                             ip=test_ip(2,1))

    m1_lag1.add_nhs_route(ipv4(test_ip(2,0)), [ipv4(test_ip(1,2,[]))]);
    m2_lag1.add_nhs_route(ipv4(test_ip(1,0)), [ipv4(test_ip(2,2,[]))]);

    m1_if1.add_nhs_route(ipv6(test_ip(2,0)), [ipv6(test_ip(1,2,[]))], ipv6=True);
    m2_if1.add_nhs_route(ipv6(test_ip(1,0)), [ipv6(test_ip(2,2,[]))], ipv6=True);

    sw_lag1 = sw.create_bond(slaves=[sw_if1, sw_if2], options=bond_options,
                             ip=test_ip(1,2))
    sw_lag2 = sw.create_bond(slaves=[sw_if3, sw_if4], options=bond_options,
                             ip=test_ip(2,2))

    sleep(30)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.netperf_tcp(m1_lag1, m2_lag1)
    tl.netperf_udp(m1_lag1, m2_lag1)
开发者ID:jpirko,项目名称:lnst,代码行数:29,代码来源:l3-003-bond-interface.py

示例2: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import ping_simple [as 别名]
def do_task(ctl, hosts, ifaces, aliases):
    tl = TestLib(ctl, aliases)
    m1, m2, sw = hosts
    m1_if1, m2_if1, m2_if2, sw_if1, sw_if2, sw_if3 = ifaces
    m1.sync_resources(modules=["PacketAssert"])

    # configure interfaces
    m1_if1.reset(ip=["192.168.101.10/24", "2002::1/64"])
    m2_if1.reset(ip=["192.168.101.11/24", "2002::2/64"])
    sw_if3.set_link_up()
    m2_if2.set_link_up()
    sw.create_bridge(slaves=[sw_if1, sw_if2], options={"vlan_filtering": 1})
    mirred_port = MirredPort(sw_if2)

    sleep(15)

    mirror_status = {"ingress": False, "egress": False}
    for i in range(10):
        change = random.choice(mirror_status.keys())
        change_mirror_status(mirror_status, change, mirred_port, sw_if3)

        in_num = 10 if mirror_status["ingress"] else 0
        out_num = 10 if mirror_status["egress"] else 0

        in_assert_proc = run_packet_assert(in_num, m2_if2, m2_if1, m1_if1)
        out_assert_proc = run_packet_assert(out_num, m2_if2, m1_if1, m2_if1)
        tl.ping_simple(m1_if1, m2_if1, count=10)
        in_assert_proc.intr()
        out_assert_proc.intr()

    return 0
开发者ID:jpirko,项目名称:lnst,代码行数:33,代码来源:l2-021-span.py

示例3: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import ping_simple [as 别名]
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(2,1))

    sw_if1.reset(ip=test_ip(1,2))
    sw_if2.reset(ip=test_ip(2,2))

    m1_if1.add_nhs_route(ipv4(test_ip(2,0)), [ipv4(test_ip(1,2,[]))]);
    m2_if1.add_nhs_route(ipv4(test_ip(1,0)), [ipv4(test_ip(2,2,[]))]);

    m1_if1.add_nhs_route(ipv6(test_ip(2,0)), [ipv6(test_ip(1,2,[]))], ipv6=True);
    m2_if1.add_nhs_route(ipv6(test_ip(1,0)), [ipv6(test_ip(2,2,[]))], ipv6=True);

    sleep(30)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_if1, m2_if1)

    # Remove route and check that traffic is not passing
    sw_if1.set_addresses(ips=[])
    sw_if2.set_addresses(ips=[])
    tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
开发者ID:jpirko,项目名称:lnst,代码行数:27,代码来源:l3-000-minimal.py

示例4: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import ping_simple [as 别名]
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=test_ip(1,1))
    m2_lag1 = m2.create_team(slaves=[m2_if1, m2_if2], config=team_config,
                             ip=test_ip(2,1))

    m1_lag1.add_nhs_route(ipv4(test_ip(2,0)), [ipv4(test_ip(1,2,[]))]);
    m2_lag1.add_nhs_route(ipv4(test_ip(1,0)), [ipv4(test_ip(2,2,[]))]);

    m1_if1.add_nhs_route(ipv6(test_ip(2,0)), [ipv6(test_ip(1,2,[]))], ipv6=True);
    m2_if1.add_nhs_route(ipv6(test_ip(1,0)), [ipv6(test_ip(2,2,[]))], ipv6=True);

    sw_lag1 = sw.create_team(slaves=[sw_if1, sw_if2], config=team_config,
                             ip=test_ip(1,2))
    sw_lag2 = sw.create_team(slaves=[sw_if3, sw_if4], config=team_config,
                             ip=test_ip(2,2))

    sleep(30)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_lag1, m2_lag1)
    tl.netperf_tcp(m1_lag1, m2_lag1)
    tl.netperf_udp(m1_lag1, m2_lag1)
开发者ID:jpirko,项目名称:lnst,代码行数:29,代码来源:l3-004-team-interface.py

示例5: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import ping_simple [as 别名]
def do_task(ctl, hosts, ifaces, aliases):
    m1, m2, sw = hosts
    m1_if1, m2_if1, sw_if1, sw_if2 = ifaces

    m1_if1.reset(ip=["192.168.101.10/24", "2002::1/64"])
    m2_if1.reset(ip=["192.168.101.11/24", "2002::2/64"])

    sleep(30)

    sw.create_bridge(slaves=[sw_if1, sw_if2], options={"vlan_filtering": 1})
    sw_if1.add_br_vlan(10)
    sw_if2.add_br_vlan(10)

    tl = TestLib(ctl, aliases)

    sw.enable_service("lldpad")
    sw_if1.enable_lldp()
    tl.lldp_ets_default_set(sw_if1, willing=False)

    m1.enable_service("lldpad")
    m1_if1.enable_lldp()
    tl.lldp_ets_default_set(m1_if1)

    tl.ping_simple(m1_if1, m2_if1)

    for prio in range(1, 8):
        tl.lldp_ets_up2tc_set(sw_if1, [(prio, prio)])
        tl.devlink_clearmax(sw, sw_if1.get_devlink_name())

        sleep(5)    # lldpad's event loop runs every second.
        tl.pktgen(m1_if1, m2_if1, m1_if1.get_mtu(), vlan_id=10, vlan_p=prio)
        check_itc_max_occ(tl, sw_if1, prio)

        tl.lldp_ets_up2tc_set(sw_if1, [(prio, 0)])
开发者ID:jpirko,项目名称:lnst,代码行数:36,代码来源:qos-001-pg.py

示例6: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import ping_simple [as 别名]
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

    bond_options = {"mode": "802.3ad", "miimon": "100"}
    m1_lag1 = m1.create_bond(slaves=[m1_if1, m1_if2], options=bond_options, ip=["192.168.101.10/24", "2002::1/64"])
    m2_lag1 = m2.create_bond(slaves=[m2_if1, m2_if2], options=bond_options, ip=["192.168.101.11/24", "2002::2/64"])

    sw_lag1 = sw.create_bond(slaves=[sw_if1, sw_if2], options=bond_options)
    sw_lag2 = sw.create_bond(slaves=[sw_if3, sw_if4], options=bond_options)

    sw.create_bridge(slaves=[sw_lag1, sw_lag2], options={"vlan_filtering": 1})

    sleep(15)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_lag1, m2_lag1)

    sw_if1.set_link_down()
    tl.ping_simple(m1_lag1, m2_lag1, limit_rate=50)

    sw_if1.set_link_up()
    sw_if2.set_link_down()
    tl.ping_simple(m1_lag1, m2_lag1, limit_rate=50)

    sw_if2.set_link_up()
    sw_if1.set_link_down()
    sw_if3.set_link_down()
    tl.ping_simple(m1_lag1, m2_lag1, limit_rate=50)

    sw_if1.set_link_up()
    sw_if3.set_link_up()
    sw_if2.set_link_down()
    sw_if4.set_link_down()
    tl.ping_simple(m1_lag1, m2_lag1, limit_rate=50)
开发者ID:jpirko,项目名称:lnst,代码行数:37,代码来源:l2-005-bridge_bond_failover.py

示例7: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import ping_simple [as 别名]
def do_task(ctl, hosts, ifaces, aliases):
    m1, m2, sw = hosts
    m1_if1, m2_if1, sw_if1, sw_if2 = ifaces

    m1_if1.reset(ip=["192.168.101.10/24", "2002::1/64"])
    m2_if1.reset(ip=["192.168.101.11/24", "2002::2/64"])

    sw.create_bridge(slaves=[sw_if1, sw_if2], options={"vlan_filtering": 1})

    sleep(15)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_if1, m2_if1)
开发者ID:eladraz,项目名称:lnst,代码行数:15,代码来源:l2-000-minimal.py

示例8: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import ping_simple [as 别名]
def do_task(ctl, hosts, ifaces, aliases):
    m1, sw = hosts
    m1_if1, sw_if1 = ifaces

    m1_if1.reset(ip=["192.168.101.10/24", "2002::1/64"])
    sw_if1.reset(ip=["192.168.101.11/24", "2002::2/64"])

    sleep(15)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_if1, sw_if1)
    tl.netperf_tcp(m1_if1, sw_if1)
    tl.netperf_udp(m1_if1, sw_if1)
开发者ID:eladraz,项目名称:lnst,代码行数:15,代码来源:basic-004-slowpath.py

示例9: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import ping_simple [as 别名]
def do_task(ctl, hosts, ifaces, aliases):
    m1, sw = hosts
    m1_if1, sw_if1 = ifaces

    m1_if1_10 = m1.create_vlan(m1_if1, 10, ip=["192.168.101.10/24",
                                               "2002::1/64"])
    sw_if1_10 = sw.create_vlan(sw_if1, 10, ip=["192.168.101.11/24",
                                               "2002::2/64"])

    sleep(15)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_if1_10, sw_if1_10)
    tl.netperf_tcp(m1_if1_10, sw_if1_10)
    tl.netperf_udp(m1_if1_10, sw_if1_10)
开发者ID:eladraz,项目名称:lnst,代码行数:17,代码来源:basic-006-slowpath-vlan.py

示例10: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import ping_simple [as 别名]
def do_task(ctl, hosts, ifaces, aliases):
    m1, sw = hosts
    m1_if1, sw_if1 = ifaces

    m1_if1.reset(ip=["192.168.101.10/24", "2002::1/64"])
    sw_if1.reset(ip=["192.168.101.11/24", "2002::2/64"])

    sleep(15)

    tl = TestLib(ctl, aliases)
    for x in range(64, 1500):
        tl.pktgen(sw_if1, m1_if1, x)
    for x in range(64, 1500):
        tl.pktgen(m1_if1, sw_if1, x)
    # Make sure switch is not stuck by performing ping test
    tl.ping_simple(m1_if1, sw_if1)
开发者ID:jpirko,项目名称:lnst,代码行数:18,代码来源:basic-005-slowpath-exhaustive.py

示例11: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import ping_simple [as 别名]
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)
开发者ID:jpirko,项目名称:lnst,代码行数:48,代码来源:tc-002-flower-vlan.py

示例12: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import ping_simple [as 别名]
def do_task(ctl, hosts, ifaces, aliases):
    m1, sw = hosts
    m1_if1, sw_if1 = ifaces

    m1_if1_20 = m1.create_vlan(m1_if1, 20, ip=["192.168.101.10/24", "2002::1/64"])
    sw_if1_20 = sw.create_vlan(sw_if1, 20, ip=["192.168.101.11/24", "2002::2/64"])

    # We need to get a netlink message with the VLAN devices' info,
    # so make sure we wait long enough.
    sleep(30)

    tl = TestLib(ctl, aliases)
    for x in range(64, 1500):
        tl.pktgen(sw_if1_20, m1_if1_20, x)
    for x in range(64, 1500):
        tl.pktgen(m1_if1_20, sw_if1_20, x)
    # Make sure switch is not stuck by performing ping test
    tl.ping_simple(m1_if1_20, sw_if1_20)
开发者ID:jpirko,项目名称:lnst,代码行数:20,代码来源:basic-007-slowpath-vlan-exhaustive.py

示例13: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import ping_simple [as 别名]
def do_task(ctl, hosts, ifaces, aliases):
    m1, sw, m2 = hosts
    m1_if1, sw_if1, sw_if2, sw_if3, m2_if1, m2_if2, m2_if3, m3_if1 = ifaces

    ecmp_sw_ifaces = [sw_if2, sw_if3]
    ecmp_m_ifaces = [m2_if1, m2_if2]

    m2.config("/proc/sys/net/ipv4/ip_forward", "1")
    m2.config("/proc/sys/net/ipv6/conf/all/forwarding", "1")

    ecmp_common.create_topology(m1_if1, sw_if1, ecmp_sw_ifaces, ecmp_m_ifaces,
                                m2_if3, m3_if1)
    sleep(30)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_if1, m3_if1)
    tl.netperf_udp(m1_if1, m3_if1)
    ecmp_common.test_traffic(tl, m1_if1, m3_if1, sw_if1, ecmp_sw_ifaces)
开发者ID:jpirko,项目名称:lnst,代码行数:20,代码来源:l3-005-ecmp-basic.py

示例14: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import ping_simple [as 别名]
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)

    sw.create_bridge(slaves=[sw_lag1, sw_lag2], options={"vlan_filtering": 1,
                                                         "multicast_querier": 1})

    sleep(30)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_lag1, m2_lag1)

    sw_if1.set_link_down()
    tl.ping_simple(m1_lag1, m2_lag1, limit_rate=50)

    sw_if1.set_link_up()
    sw_if2.set_link_down()
    tl.ping_simple(m1_lag1, m2_lag1, limit_rate=50)

    sw_if2.set_link_up()
    sw_if1.set_link_down()
    sw_if3.set_link_down()
    tl.ping_simple(m1_lag1, m2_lag1, limit_rate=50)

    sw_if1.set_link_up()
    sw_if3.set_link_up()
    sw_if2.set_link_down()
    sw_if4.set_link_down()
    tl.ping_simple(m1_lag1, m2_lag1, limit_rate=50)
开发者ID:jpirko,项目名称:lnst,代码行数:46,代码来源:l2-007-bridge_team_failover.py

示例15: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import ping_simple [as 别名]
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)
开发者ID:jpirko,项目名称:lnst,代码行数:24,代码来源:tc-001-action-vlan-modify.py


注:本文中的TestLib.TestLib.ping_simple方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。