@Override public AbstractRegistration registerService(final TopologyReferenceSingletonService topologyProviderService) { final Dictionary<String, String> properties = new Hashtable<>(); properties.put("topology-id", topologyProviderService.getInstanceIdentifier().firstKeyOf(Topology.class).getTopologyId().getValue()); final ServiceRegistration<?> registerService = this.context.registerService(new String[] {TopologyReference.class.getName()}, topologyProviderService, properties); final ClusterSingletonServiceRegistration registerClusterSingletonService = this.singletonProvider.registerClusterSingletonService(topologyProviderService); return new AbstractRegistration() { @Override protected void removeRegistration() { try { registerClusterSingletonService.close(); } catch (final Exception e) { LOG.warn("Failed to close ClusterSingletonServiceRegistration {} for TopologyBuilder {}", registerClusterSingletonService, topologyProviderService.getInstanceIdentifier(), e); } registerService.unregister(); } }; }
@Override public ServiceGroupIdentifier getIdentifier() { return ServiceGroupIdentifier.create(getInstanceIdentifier().firstKeyOf(Topology.class).getTopologyId().getValue()); }
public static void createItmTunnels(ItmRpcService itmRpcService, String hwvtepId, String psName, IpAddress tunnelIp) { AddL2GwDeviceInputBuilder builder = new AddL2GwDeviceInputBuilder(); builder.setTopologyId(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID.getValue()); builder.setNodeId(HwvtepSouthboundUtils.createManagedNodeId(new NodeId(hwvtepId), psName).getValue()); builder.setIpAddress(tunnelIp); try { Future<RpcResult<Void>> result = itmRpcService.addL2GwDevice(builder.build()); RpcResult<Void> rpcResult = result.get(); if (rpcResult.isSuccessful()) { LOG.info("Created ITM tunnels for {}", hwvtepId); } else { LOG.error("Failed to create ITM Tunnels: ", rpcResult.getErrors()); } } catch (InterruptedException | ExecutionException e) { LOG.error("RPC to create ITM tunnels failed", e); } }
protected static void createItmTunnels(ItmRpcService itmRpcService, String hwvtepId, String psName, IpAddress tunnelIp) { AddL2GwDeviceInputBuilder builder = new AddL2GwDeviceInputBuilder(); builder.setTopologyId(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID.getValue()); builder.setNodeId(HwvtepSouthboundUtils.createManagedNodeId(new NodeId(hwvtepId), psName).getValue()); builder.setIpAddress(tunnelIp); try { Future<RpcResult<Void>> result = itmRpcService.addL2GwDevice(builder.build()); RpcResult<Void> rpcResult = result.get(); if (rpcResult.isSuccessful()) { LOG.info("Created ITM tunnels for {}", hwvtepId); } else { LOG.error("Failed to create ITM Tunnels: ", rpcResult.getErrors()); } } catch (InterruptedException | ExecutionException e) { LOG.error("RPC to create ITM tunnels failed", e); } }
protected static void deleteItmTunnels(ItmRpcService itmRpcService, String hwvtepId, String psName, IpAddress tunnelIp) { DeleteL2GwDeviceInputBuilder builder = new DeleteL2GwDeviceInputBuilder(); builder.setTopologyId(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID.getValue()); builder.setNodeId(HwvtepSouthboundUtils.createManagedNodeId(new NodeId(hwvtepId), psName).getValue()); builder.setIpAddress(tunnelIp); try { Future<RpcResult<Void>> result = itmRpcService.deleteL2GwDevice(builder.build()); RpcResult<Void> rpcResult = result.get(); if (rpcResult.isSuccessful()) { LOG.info("Deleted ITM tunnels for {}", hwvtepId); } else { LOG.error("Failed to delete ITM Tunnels: ", rpcResult.getErrors()); } } catch (InterruptedException | ExecutionException e) { LOG.error("RPC to delete ITM tunnels failed", e); } } }
bundleContext, "(" + "topology-id" + "=" + topology.getTopologyId().getValue() + ")"); final TopologyReference topologyService = topologyTracker.waitForService(WaitingServiceTracker.FIVE_MINUTES); return Reflection.newProxy(TopologyReferenceSingletonService.class, new AbstractInvocationHandler() {