import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
+import org.opendaylight.controller.config.yang.config.groupbasedpolicy.GroupbasedpolicyInstance;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.groupbasedpolicy.neutron.vpp.mapper.NeutronVppMapper;
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
private static final Logger LOG = LoggerFactory.getLogger(NeutronVppMapperInstance.class);
private static final ServiceGroupIdentifier IDENTIFIER =
- ServiceGroupIdentifier.create(NeutronVppMapperInstance.class.getName());
+ ServiceGroupIdentifier.create(GroupbasedpolicyInstance.GBP_SERVICE_GROUP_IDENTIFIER);
private final DataBroker dataBroker;
private final String socketPath;
private final String socketPrefix;
+ private final String routingNode;
private final ClusterSingletonServiceProvider clusterSingletonService;
private ClusterSingletonServiceRegistration singletonServiceRegistration;
private NeutronVppMapper mapper;
public NeutronVppMapperInstance(final DataBroker dataBroker,
final String socketPath,
final String socketPrefix,
+ final String routingNode,
final ClusterSingletonServiceProvider clusterSingletonService) {
this.dataBroker = Preconditions.checkNotNull(dataBroker);
this.socketPath = Preconditions.checkNotNull(socketPath);
this.socketPrefix = Preconditions.checkNotNull(socketPrefix);
+ this.routingNode = Preconditions.checkNotNull(routingNode);
this.clusterSingletonService = Preconditions.checkNotNull(clusterSingletonService);
}
public void initialize() {
LOG.info("Clustering session initiated for {}", this.getClass().getSimpleName());
- singletonServiceRegistration = clusterSingletonService.registerClusterSingletonService(this);
+ try {
+ singletonServiceRegistration = clusterSingletonService.registerClusterSingletonService(this);
+ } catch (Exception e) {
+ LOG.warn("Exception thrown while registering cluster singleton service in {}", this.getClass(), e.getMessage());
+ }
}
@Override
public void instantiateServiceInstance() {
LOG.info("Instantiating {}", this.getClass().getSimpleName());
- mapper = new NeutronVppMapper(socketPath, socketPrefix, dataBroker);
+ mapper = new NeutronVppMapper(socketPath, socketPrefix, routingNode, dataBroker);
}
@Override