org.opendaylight.lispflowmapping.neutron.intenthandler.util.LispNeutronUtil Maven / Gradle / Ivy
/*
* Copyright (c) 2017 Cisco Systems, Inc. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.lispflowmapping.neutron.intenthandler.util;
import java.util.Optional;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.MountPoint;
import org.opendaylight.mdsal.binding.api.MountPointService;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Created by Shakib Ahmed on 1/12/17.
*/
public final class LispNeutronUtil {
protected static final Logger LOG = LoggerFactory.getLogger(LispNeutronUtil.class);
private LispNeutronUtil() {
}
public static DataBroker resolveDataBrokerForMountPoint(InstanceIdentifier iiToMountPoint,
MountPointService mountService) {
final Optional vppMountPointOpt = mountService.getMountPoint(iiToMountPoint);
if (vppMountPointOpt.isPresent()) {
final MountPoint vppMountPoint = vppMountPointOpt.get();
final Optional dataBrokerOpt = vppMountPoint.getService(DataBroker.class);
if (dataBrokerOpt.isPresent()) {
return dataBrokerOpt.get();
}
}
return null;
}
}