本文整理匯總了Python中pycalico.datastore_datatypes.Endpoint.ipv6_nets方法的典型用法代碼示例。如果您正苦於以下問題:Python Endpoint.ipv6_nets方法的具體用法?Python Endpoint.ipv6_nets怎麽用?Python Endpoint.ipv6_nets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pycalico.datastore_datatypes.Endpoint
的用法示例。
在下文中一共展示了Endpoint.ipv6_nets方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_status_no_ip
# 需要導入模塊: from pycalico.datastore_datatypes import Endpoint [as 別名]
# 或者: from pycalico.datastore_datatypes.Endpoint import ipv6_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 ipv6_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")