def test_remove_host_tunnel_addr(self, m_client, m_get_ip): startup.hostname = "host" ip_address = IPAddress("10.0.0.1") m_get_ip.return_value = ip_address startup._remove_host_tunnel_addr() assert_equal(m_client.release_ips.mock_calls, [call({ip_address})]) assert_equal(m_client.remove_per_host_config.mock_calls, [call("host", "IpInIpTunnelAddr")])
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()