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)
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)
'host_id': 1, 'interface_id': 2 } }, { 'binding': { 'device_name': 'bridge-000-002', 'port_id': 1, 'host_id': 2, 'interface_id': 2 } }] } @attr(version="v1.2.0") @failures(NoFailure()) @bindings(bindings1) def test_mac_learning(): """ Title: Bridge mac learning Scenario 1: When: the destination ethernet address has never been seen before. Then: the bridge should flood the ethernet unicast Scenario 2: When: the destination ethernet address has been seen before. Then: the bridge should not flood the ethernet frame, instaed it should forward to only the port that is connected to the interface with the mac address. """
binding_two_isolated_bridges = { 'description': 'two isolated bridges', 'bindings': [ {'binding': {'device_name': 'bridge-000-001', 'port_id': 1, 'host_id': 1, 'interface_id': 2}}, {'binding': {'device_name': 'bridge-000-002', 'port_id': 1, 'host_id': 2, 'interface_id': 2}} ] } @attr(version="v1.2.0") @failures(NoFailure()) @bindings(bindings1) def test_mac_learning(): """ Title: Bridge mac learning Scenario 1: When: the destination ethernet address has never been seen before. Then: the bridge should flood the ethernet unicast Scenario 2: When: the destination ethernet address has been seen before. Then: the bridge should not flood the ethernet frame, instaed it should forward to only the port that is connected to the interface with the mac address. """
} def setup(): PTM.build() VTM.build() def teardown(): time.sleep(2) PTM.destroy() VTM.destroy() @attr(version="v1.2.0", slow=False) @failures(NoFailure()) @bindings(bindings1, bindings2) def test_mac_learning(): """ Title: Bridge mac learning Scenario 1: When: the destination ethernet address has never been seen before. Then: the bridge should flood the ethernet unicast Scenario 2: When: the destination ethernet address has been seen before. Then: the bridge should not flood the ethernet frame, instaed it should forward to only the port that is connected to the interface with the mac address. """