2 * Copyright (c) 2015 Inocybe Technologies and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.groupbasedpolicy.renderer.iovisor.endpoint;
11 import java.util.Map.Entry;
13 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
14 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
15 import org.opendaylight.groupbasedpolicy.endpoint.EndpointRpcRegistry;
16 import org.opendaylight.groupbasedpolicy.endpoint.EpRendererAugmentation;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.RegisterEndpointInput;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.RegisterL3PrefixEndpointInput;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.endpoints.Endpoint;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.endpoints.EndpointL3;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.groupbasedpolicy.endpoint.rev140421.endpoints.EndpointL3Prefix;
22 import org.opendaylight.yangtools.yang.binding.Augmentation;
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
26 import com.google.common.base.Preconditions;
28 public class EndpointManager implements EpRendererAugmentation, AutoCloseable {
30 private static final Logger LOG = LoggerFactory.getLogger(EndpointManager.class);
32 private EndpointRpcRegistry endpointRpcRegistry;
33 private EndpointListener endpointListener;
35 public EndpointManager(DataBroker dataBroker, RpcProviderRegistry rpcProviderRegistry) {
36 LOG.debug("Initialized IOVisor EndpointManager");
37 Preconditions.checkNotNull(dataBroker, "DataBroker instance must not be null");
38 Preconditions.checkNotNull(rpcProviderRegistry, "RpcProviderRegistry instance must not be null");
40 this.endpointRpcRegistry = new EndpointRpcRegistry(dataBroker, rpcProviderRegistry);
41 this.endpointListener = new EndpointListener(dataBroker);
43 EndpointRpcRegistry.register(this);
47 public void close() throws Exception {
48 if (endpointListener != null) {
49 endpointListener.close();
51 if (endpointRpcRegistry != null) {
52 endpointRpcRegistry.close();
54 EndpointRpcRegistry.unregister(this);
58 public Entry<Class<? extends Augmentation<Endpoint>>, Augmentation<Endpoint>> buildEndpointAugmentation(
59 RegisterEndpointInput input) {
60 // TODO Auto-generated method stub
65 public Entry<Class<? extends Augmentation<EndpointL3>>, Augmentation<EndpointL3>> buildEndpointL3Augmentation(
66 RegisterEndpointInput input) {
67 // TODO Auto-generated method stub
72 public Entry<Class<? extends Augmentation<EndpointL3Prefix>>, Augmentation<EndpointL3Prefix>> buildL3PrefixEndpointAugmentation(
73 RegisterL3PrefixEndpointInput input) {
74 // TODO Auto-generated method stub