本文整理汇总了Python中pycalico.datastore_datatypes.Endpoint.ipv4_nets方法的典型用法代码示例。如果您正苦于以下问题:Python Endpoint.ipv4_nets方法的具体用法?Python Endpoint.ipv4_nets怎么用?Python Endpoint.ipv4_nets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pycalico.datastore_datatypes.Endpoint
的用法示例。
在下文中一共展示了Endpoint.ipv4_nets方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_status_no_ip
# 需要导入模块: from pycalico.datastore_datatypes import Endpoint [as 别名]
# 或者: from pycalico.datastore_datatypes.Endpoint import ipv4_nets [as 别名]
def test_status_no_ip(self, m_print):
"""Test Pod Status Hook: No IP on Endpoint
Test for sys exit when endpoint ipv4_nets is empty.
"""
# Set up args
namespace = "ns"
pod_name = "pod1"
docker_id = 123456789101112
# Call method under test
endpoint = Endpoint(TEST_HOST, TEST_ORCH_ID, "1234", "5678", "active", "mac")
endpoint.ipv4_nets = None
endpoint.ipv6_nets = None
self.m_datastore_client.get_endpoint.return_value = endpoint
assert_raises(SystemExit, self.plugin.status, namespace, pod_name, docker_id)
# Prints are read externally. We don't want to print in a fail state.
assert_false(m_print.called)
示例2: test__cleanup
# 需要导入模块: from pycalico.datastore_datatypes import Endpoint [as 别名]
# 或者: from pycalico.datastore_datatypes.Endpoint import ipv4_nets [as 别名]
def test__cleanup(self, m_datastore):
ep = Endpoint("test_host",
"mesos",
"test_workload",
"test_endpoint",
"active",
"aa:bb:cc:dd:ee:ff")
ipv4_addrs = {IPAddress(ip) for ip in ["192.168.1.1", "192.168.5.4"]}
ipv6_addrs = {IPAddress("2001:4567::1:1")}
ep.ipv4_nets = {IPNetwork(ip) for ip in ipv4_addrs}
ep.ipv6_nets = {IPNetwork(ip) for ip in ipv6_addrs}
m_datastore.get_endpoint.return_value = ep
calico_mesos._cleanup("test_host", "test_workload")
m_datastore.release_ips.assert_called_once_with(ipv4_addrs |
ipv6_addrs)
m_datastore.remove_endpoint.assert_called_once_with(ep)
m_datastore.remove_workload.assert_called_once_with(
hostname=ANY,
orchestrator_id=ANY,
workload_id="test_workload")