}] } binding_multihost = { 'description': 'two vms on different MMs', 'bindings': [{ 'vport': 'port1', 'interface': 'vm1_host1' }, { 'vport': 'port2', 'interface': 'vm2_host2' }] } BM = BindingManager(PTM2, VTM2) @nottest @bindings(binding_singlehost, binding_multihost, binding_manager=BM) def test_icmp_autobind(): vm1 = BM.get_interface_on_vport('port1') vm2 = BM.get_interface_on_vport('port2') # Test ping works f1 = async_assert_that( vm2, receives('dst host %s and icmp' % vm2.get_ip(), within_sec(10))) f2 = vm1.ping4(vm2) wait_on_futures([f1, f2])
port_spec['fixed_ips'] = [{ 'ip_address': real_ip, 'subnet_id': subnet_id }] if vip != None and vmac != None: port_spec['allowed_address_pairs'] = [{ 'ip_address': vip, 'mac_address': vmac }] elif vip != None: port_spec['allowed_address_pairs'] = [{'ip_address': vip}] return self.create_resource(self.api.create_port({'port': port_spec})) VTM_vip = VT_Networks_with_SG(virtual_ip) BM_vip = BindingManager(None, VTM_vip) VTM_vmac = VT_Networks_with_SG(virtual_ip, virtual_mac) BM_vmac = BindingManager(None, VTM_vmac) binding_multinode = { 'description': 'multinode node setup', 'bindings': [{ 'vport': 'port_ext0', 'interface': { 'definition': { 'ipv4_gw': '1.0.0.1' }, 'hostname': 'midolman1', 'type': 'vmguest'
(container, tries * delay_seconds)) def client_check_result(container, stream, count=100): # read stream and break into lines lines = reduce(list.__add__, [ i.split() for i in stream ]) LOG.info("%s: RESULT: got %d lines" % (container, len(lines))) assert (len(lines) == count) for i in range(count): # server must've echoed the line back to us with a dollar sign at the end wanted = "%s:%d$" % (container, i+1) LOG.info("%s: RESULT: lines[%d] = %s" % (container, i, lines[i])) assert(lines[i] == wanted) @attr(version="v1.2.0") @bindings(binding_empty, binding_manager=BindingManager(vtm=UplinkWithVPP())) def test_uplink_ipv6(): """ Title: ping ipv6 uplink of midolman1 from quagga1. VPP must respond """ ping_from_inet('quagga1', '2001::1', 10) @attr(version="v1.2.0") @bindings(binding_multihost_singletenant, binding_manager=BindingManager(vtm=SingleTenantAndUplinkWithVPP())) def test_ping_vm_ipv6(): """ Title: ping a VM in a IPv4 neutron topology from a remote IPv6 endpoint """ ping_from_inet('quagga1', 'cccc:bbbb::2', 10, namespace='ip6')
for internal_subnet in internal_subnets: self.add_router_interface(router, subnet=internal_subnet) return router def add_network(self, name, cidr, gateway, external=False): network = self.create_network(name, external) subnet = self.create_subnet(name + '_subnet', network, cidr, gateway_ip=gateway) return network, subnet VTM = VT_Networks_with_SG() BM = BindingManager(None, VTM) binding_multihost = { 'description': 'spanning across 2 midolman', 'bindings': [ { 'vport': 'private_1', 'interface': { 'definition': { 'ipv4_gw': '10.0.0.1' }, 'hostname': 'midolman1', 'type': 'vmguest' } },
'hostname': 'midolman3', 'type': 'vmguest' } }, { 'vport': 'tenant2', 'interface': { 'definition': { 'ifname': 'tenant2-do' }, 'hostname': 'midolman1', 'type': 'provided' } }] } BM_dual_ext = BindingManager(vtm=TenantDualStack()) BM_dual_full = BindingManager(vtm=FullDualStack()) # Runs ping command with given ip address from given containter # Count provides the number of packets ping will send. # The number must be positive def ping_from_inet(container, ip='2001::1', count=4, namespace=None): count = max(1, count) if ':' in ip: ping_cmd = "ping6" else: ping_cmd = "ping" cmd = "%s %s %s -c %d" % ("ip netns exec %s" % namespace if namespace else "", ping_cmd, ip, count) cont_services = service.get_container_by_hostname(container)
} # Runs ping6 command with given ip6 address from given containter # Count provides the number of packets ping will send. # The number must be positive def ping_from_inet(container, ipv6='2001::1', count=4, namespace=None): count = max(1, count) cmd = "%s ping6 %s -c %d" % ("ip netns exec %s" % namespace if namespace else "", ipv6, count) cont_services = service.get_container_by_hostname(container) cont_services.try_command_blocking(cmd) @attr(version="v1.2.0") @bindings(binding_empty, binding_manager=BindingManager(vtm=UplinkWithVPP())) def test_uplink_ipv6(): """ Title: ping ipv6 uplink of midolman1 from quagga1. VPP must respond """ time.sleep(10) ping_from_inet('quagga1', '2001::1', 10) @attr(version="v1.2.0") @bindings(binding_multihost, binding_manager=BindingManager(vtm=SingleTenantAndUplinkWithVPP())) def test_ping_vm_ipv6(): """ Title: ping a VM in a IPv4 neutron topology from a remote IPv6 endpoint