예제 #1
0
 def test_host_endpoint_set_invalid(self):
     self.dispatch("/calico/v1/host/h1/endpoint/e1",
                   "set", value="{}")
     self.m_splitter.on_host_ep_update.assert_called_once_with(
         HostEndpointId("h1", "e1"),
         None,
     )
예제 #2
0
 def test_host_endpoint_set(self):
     self.dispatch("/calico/v1/host/h1/endpoint/e1",
                   "set", value=HOST_ENDPOINT_STR)
     self.m_splitter.on_host_ep_update.assert_called_once_with(
         HostEndpointId("h1", "e1"),
         VALID_HOST_ENDPOINT,
     )
예제 #3
0
 def on_host_ep_set(self, response, hostname, endpoint_id):
     """Handler for create/update of host endpoint."""
     combined_id = HostEndpointId(hostname, endpoint_id)
     _log.debug("Host iface %s updated", combined_id)
     _stats.increment("Host iface created/updated")
     iface_data = parse_host_ep(self._config, combined_id, response.value)
     self.splitter.on_host_ep_update(combined_id, iface_data)
예제 #4
0
 def on_host_ep_remove(self, msg):
     """Handler for create/update of host endpoint."""
     hostname = self._config.HOSTNAME
     endpoint_id = msg.id.endpoint_id
     combined_id = HostEndpointId(hostname, endpoint_id)
     _log.debug("Host endpoint %s removed", combined_id)
     _stats.increment("Host endpoint removed")
     self.splitter.on_host_ep_update(combined_id, None)
예제 #5
0
 def on_host_ep_update(self, msg):
     """Handler for create/update of host endpoint."""
     hostname = self._config.HOSTNAME
     endpoint_id = msg.id.endpoint_id
     combined_id = HostEndpointId(hostname, endpoint_id)
     _log.debug("Host endpoint %s updated", combined_id)
     _stats.increment("Host endpoint created/updated")
     endpoint = {
         "name": msg.endpoint.name or None,
         "profile_ids": msg.endpoint.profile_ids,
         "expected_ipv4_addrs": msg.endpoint.expected_ipv4_addrs,
         "expected_ipv6_addrs": msg.endpoint.expected_ipv6_addrs,
         "tiers": convert_pb_tiers(msg.endpoint.tiers),
     }
     self.splitter.on_host_ep_update(combined_id, endpoint)
예제 #6
0
    "profile_ids": ["prof1", "prof2"],
    "ipv4_nets": ["10.0.0.1/32"],
    "labels": {
        "a": "a1",
    }
}
EP_1_1_LABELS_NEW_IP = {
    "profile_ids": ["prof1", "prof2"],
    "ipv4_nets": ["10.0.0.2/32"],
    "labels": {
        "a": "a1",
    }
}
EP_DATA_1_1 = EndpointData(["prof1", "prof2"], ["10.0.0.1"])

HOST_EP_ID_1_1 = HostEndpointId("host1", "ep1_1")
HOST_EP_1_1 = {
    "profile_ids": ["prof1", "prof2"],
    "expected_ipv4_addrs": ["10.0.0.1"],
}
HOST_EP_1_1_NO_IPS = {"profile_ids": ["prof1", "prof2"], "name": "eth0"}
HOST_EP_1_1_LABELS = {
    "profile_ids": ["prof1", "prof2"],
    "expected_ipv4_addrs": ["10.0.0.1"],
    "labels": {
        "a": "a1",
    }
}
HOST_EP_DATA_1_1 = EndpointData(["prof1", "prof2"], ["10.0.0.1"])

EP_1_1_NEW_IP = {
예제 #7
0
 def test_host_endpoint_del_bad_json(self):
     self.dispatch("/calico/v1/host/h1/endpoint/e1", "delete")
     self.m_splitter.on_host_ep_update.assert_called_once_with(
         HostEndpointId("h1", "e1"),
         None,
     )
예제 #8
0
 def on_host_ep_delete(self, response, hostname, endpoint_id):
     """Handler for delete of host endpoint."""
     combined_id = HostEndpointId(hostname, endpoint_id)
     _log.debug("Host iface %s deleted", combined_id)
     _stats.increment("Host iface deleted")
     self.splitter.on_host_ep_update(combined_id, None)
예제 #9
0
 def create_id(self):
     return HostEndpointId("localhost", "endpoint")