Exemplo n.º 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,
     )
Exemplo n.º 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,
     )
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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 = {
Exemplo n.º 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,
     )
Exemplo n.º 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)
Exemplo n.º 9
0
 def create_id(self):
     return HostEndpointId("localhost", "endpoint")