コード例 #1
0
ファイル: test_bgp.py プロジェクト: modong/midonet
def test_snat_2():
    """
    Title: Emulate Cassandra failure

           basically the same one as test_snat_1, but the difference is
           how and when to inject failures.

    """
    p1 = add_bgp_1(route_snat)

    set_filters('router-000-001', 'pre_filter_snat_ip', 'post_filter_snat_ip')

    try:
        for failure in (NoFailure(), NetifFailure(NS_CASSANDRA_1, 'eth0', 30),
                        NoFailure(), NetifFailure(NS_CASSANDRA_2, 'eth0', 30),
                        NetifFailure(NS_CASSANDRA_3, 'eth0', 30), NoFailure()):
            failure.inject()
            try:
                for i in range(0, 10):
                    ping_inet(count=1, retry_count=5)
            finally:
                failure.eject()
    finally:
        unset_filters('router-000-001')

    clear_bgp(p1)
コード例 #2
0
ファイル: test_bgp.py プロジェクト: modong/midonet
    failure = PktFailure(NS_BGP_PEER_1, 'eth1', 30)
    failure.inject()
    try:
        ping_inet()  # BGP #2 is lost
    finally:
        failure.eject()

    ping_inet()  # BGP #2 is back

    clear_bgp(p1)
    clear_bgp(p2)


@attr(version="v1.2.0", slow=True)
@failures(NoFailure(), NetifFailure(NS_CASSANDRA_1, 'eth0', 30), NoFailure(),
          NetifFailure(NS_CASSANDRA_2, 'eth0', 30),
          NetifFailure(NS_CASSANDRA_3, 'eth0', 30), NoFailure())
@bindings(binding_uplink_1, binding_uplink_2, binding_indirect)
def test_snat_1():
    """
    Title: Emulate Cassandra failure

    Scenario 1:
    Given: one uplink
    When: inject network interface failure in ONE of Cassandra nodes
    Then: ICMP echo RR should work

    """
    p1 = add_bgp_1(route_snat)
コード例 #3
0
ファイル: test_bridge.py プロジェクト: ruo91/midonet
    except subprocess.CalledProcessError as e:
        # we just want to let dhclient go
        pass

    # Assert that the interface gets ip address
    assert iface.get_cidr() == '172.16.1.101/24'

    #TODO(tomoe): assert for default gw and static routes with opt 121
    assert iface.get_num_routes() > 0

    # MTU should be 1450 (interface mtu minus 50B, the max of gre/vxlan overhead)
    assert iface.get_mtu() == "1450"


@attr(version="v1.2.0", slow=False)
@failures(NoFailure(), NetifFailure(NS_ZOOKEEPER_1, 'eth0', 30),
          NetifFailure(NS_ZOOKEEPER_2, 'eth0', 30),
          NetifFailure(NS_ZOOKEEPER_3, 'eth0', 30))
@bindings(bindings1, bindings2)
def test_icmp():
    """
    Title: ICMP reachability over bridge

    Scenario 1:
    When: a VM sends ICMP echo request with ping command
    Then: the receiver VM should receive the ICMP echo packet.
    And: the ping command succeeds
    """

    sender = BM.get_iface_for_port('bridge-000-001', 1)
    receiver = BM.get_iface_for_port('bridge-000-001', 3)