Exemplo n.º 1
0
 def test_ensure_host_tunnel_addr_bad_ip(self, m_client,
                                         m_assign_host_tunnel_addr,
                                         m_get_tunnel_host_ip):
     m_get_tunnel_host_ip.return_value = IPAddress("11.0.0.1")
     ipv4_pools = [IPPool("10.0.0.0/16"), IPPool("10.1.0.0/16", ipip=True)]
     ipip_pools = [IPPool("10.1.0.0/16", ipip=True)]
     startup._ensure_host_tunnel_addr(ipv4_pools, ipip_pools)
     assert_equal(m_assign_host_tunnel_addr.mock_calls, [call(ipip_pools)])
 def test_ensure_host_tunnel_addr_no_ip(self, m_client,
                                        m_assign_host_tunnel_addr,
                                        m_get_tunnel_host_ip):
     m_get_tunnel_host_ip.return_value = None
     ipv4_pools = [IPPool("10.0.0.0/16"),
                   IPPool("10.1.0.0/16", ipip=True)]
     ipip_pools = [IPPool("10.1.0.0/16", ipip=True)]
     startup._ensure_host_tunnel_addr(ipv4_pools, ipip_pools)
     assert_equal(m_assign_host_tunnel_addr.mock_calls, [call(ipip_pools)])
def main():
	ipv4_pools = client.get_ip_pools(4)
	ipip_pools = [p for p in ipv4_pools if p.ipip]

	if ipip_pools:
	    # IPIP is enabled, make sure the host has an address for its tunnel.
	    _ensure_host_tunnel_addr(ipv4_pools, ipip_pools)
	else:
	    # No IPIP pools, clean up any old address.
	    _remove_host_tunnel_addr()
Exemplo n.º 4
0
def main():
    ipv4_pools = client.get_ip_pools(4)
    ipip_pools = [p for p in ipv4_pools if p.ipip]

    if ipip_pools:
        # IPIP is enabled, make sure the host has an address for its tunnel.
        _ensure_host_tunnel_addr(ipv4_pools, ipip_pools)
    else:
        # No IPIP pools, clean up any old address.
        _remove_host_tunnel_addr()