This patch removes unused methods, classes and fields.
Change-Id: I3241d203ac11f02dc9ab17209a624eb8ddbcdfd1
Signed-off-by: Stephen Kitt <skitt@redhat.com>
l2GatewayIds.remove(l2GatewayId);
}
- /**
- * Clear hwvtep node data.
- */
- public void clearHwvtepNodeData() {
- tunnelIps.clear();
- hwvtepNodeId = null;
- }
-
/**
* Sets the tunnel ips.
*
return input -> input != null && input.getDataAfter() != null && filter.test(input);
}
- private static <T extends DataObject> Predicate<DataObjectModification<T>> matchesEverything() {
- return input -> true;
- }
-
private static <T extends DataObject> Predicate<DataObjectModification<T>> modificationIsDeletion() {
return input -> input != null && input.getModificationType() == DataObjectModification
.ModificationType.DELETE;
}
- private static <T extends DataObject> Predicate<DataObjectModification<T>>
- modificationIsDeletionAndHasDataBefore() {
- return input -> input != null && input.getModificationType() == DataObjectModification
- .ModificationType.DELETE && input.getDataBefore() != null;
- }
-
/**
* Extract all the instances of {@code clazz} which were created in the given set of modifications.
*
return result;
}
- /**
- * Extract all the instances of {@code clazz} which were created or updated in the given set of modifications.
- *
- * @param changes The changes to process.
- * @param clazz The class we're interested in.
- * @param <T> The type of changes we're interested in.
- * @param <U> The type of changes to process.
- * @return The created or updated instances, mapped by instance identifier.
- */
- public static <T extends DataObject, U extends DataObject> Map<InstanceIdentifier<T>, T> extractCreatedOrUpdated(
- Collection<DataTreeModification<U>> changes, Class<T> clazz) {
- return extractCreatedOrUpdated(changes, clazz, matchesEverything());
- }
-
- /**
- * Extract all the instances of {@code clazz} which were created, updated, or removed in the given set of
- * modifications. For instances which were created or updated, the new instances are returned; for instances
- * which were removed, the old instances are returned.
- *
- * @param changes The changes to process.
- * @param clazz The class we're interested in.
- * @param <T> The type of changes we're interested in.
- * @param <U> The type of changes to process.
- * @return The created, updated or removed instances, mapped by instance identifier.
- */
- public static <T extends DataObject, U extends DataObject> Map<InstanceIdentifier<T>, T>
- extractCreatedOrUpdatedOrRemoved(Collection<DataTreeModification<U>> changes, Class<T> clazz) {
- Map<InstanceIdentifier<T>, T> result = extractCreatedOrUpdated(changes, clazz);
- result.putAll(extractRemovedObjects(changes, clazz));
- return result;
- }
-
/**
* Extract the original instances of class {@code clazz} in the given set of modifications.
*
}
}
- /**
- * Extract the removed instances of {@code clazz} from the given set of modifications.
- *
- * @param changes The changes to process.
- * @param clazz The class we're interested in.
- * @param <T> The type of changes we're interested in.
- * @param <U> The type of changes to process.
- * @return The removed instances, keyed by instance identifier.
- */
- public static <T extends DataObject, U extends DataObject> Map<InstanceIdentifier<T>, T> extractRemovedObjects(
- Collection<DataTreeModification<U>> changes, Class<T> clazz) {
- Map<InstanceIdentifier<T>, T> result = new HashMap<>();
- for (Entry<InstanceIdentifier<T>, DataObjectModification<T>> entry :
- extractDataObjectModifications(changes, clazz, modificationIsDeletionAndHasDataBefore()).entrySet()) {
- result.put(entry.getKey(), entry.getValue().getDataBefore());
- }
- return result;
- }
-
- public static <T extends DataObject> Map<InstanceIdentifier<T>,T> extract(
- Map<InstanceIdentifier<?>, DataObject> changes, Class<T> klazz) {
- Map<InstanceIdentifier<T>,T> result = new HashMap<>();
- if (changes != null) {
- for (Entry<InstanceIdentifier<?>, DataObject> created : changes.entrySet()) {
- if (klazz.isInstance(created.getValue())) {
- @SuppressWarnings("unchecked")
- T value = (T) created.getValue();
- Class<?> type = created.getKey().getTargetType();
- if (type.equals(klazz)) {
- // Actually checked above
- @SuppressWarnings("unchecked")
- InstanceIdentifier<T> iid = (InstanceIdentifier<T>) created.getKey();
- result.put(iid, value);
- }
- }
- }
- }
- return result;
- }
}
import java.util.Collections;
import java.util.List;
import java.util.Locale;
-import java.util.Objects;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.eclipse.jdt.annotation.NonNull;
return networkType != null && networkType.isAssignableFrom(expectedNetworkType);
}
- public static <T extends NetworkTypeBase> boolean isNetworkSegmentType(Network network, Long index,
- Class<T> expectedNetworkType) {
- Class<? extends NetworkTypeBase> segmentType = null;
- NetworkProviderExtension providerExtension = network.augmentation(NetworkProviderExtension.class);
- if (providerExtension != null) {
- List<Segments> providerSegments = providerExtension.getSegments();
- if (providerSegments != null && providerSegments.size() > 0) {
- for (Segments providerSegment : providerSegments) {
- if (Objects.equals(providerSegment.getSegmentationIndex(), index)) {
- segmentType = providerSegment.getNetworkType();
- break;
- }
- }
- }
- }
- return segmentType != null && segmentType.isAssignableFrom(expectedNetworkType);
- }
-
- public static Long getNumberSegmentsFromNeutronNetwork(Network network) {
- NetworkProviderExtension providerExtension = network.augmentation(NetworkProviderExtension.class);
- Integer numSegs = 0;
- if (providerExtension != null) {
- List<Segments> providerSegments = providerExtension.getSegments();
- if (providerSegments != null) {
- numSegs = providerSegments.size();
- }
- }
- return Long.valueOf(numSegs);
- }
-
- public static String getSegmentationIdFromNeutronNetworkSegment(Network network, Long index) {
- String segmentationId = null;
- NetworkProviderExtension providerExtension = network.augmentation(NetworkProviderExtension.class);
- if (providerExtension != null) {
- List<Segments> providerSegments = providerExtension.getSegments();
- if (providerSegments != null && providerSegments.size() > 0) {
- for (Segments providerSegment : providerSegments) {
- if (Objects.equals(providerSegment.getSegmentationIndex(), index)) {
- segmentationId = providerSegment.getSegmentationId();
- break;
- }
- }
- }
- }
- return segmentationId;
- }
-
public static boolean isUuid(String possibleUuid) {
Preconditions.checkNotNull(possibleUuid, "possibleUuid == null");
public interface INeutronVpnManager {
- void addSubnetToVpn(Uuid vpnId, Uuid subnet);
-
- void removeSubnetFromVpn(Uuid vpnId, Uuid subnet);
-
List<String> showVpnConfigCLI(Uuid vuuid) throws InterruptedException, ExecutionException;
List<String> showNeutronPortsCLI() throws ReadFailedException;
Port getNeutronPort(String name);
- Port getNeutronPort(Uuid portId);
-
Subnet getNeutronSubnet(Uuid subnetId);
- IpAddress getNeutronSubnetGateway(Uuid subnetId);
-
Collection<Uuid> getSubnetIdsForGatewayIp(IpAddress ipAddress);
Uuid getNetworkForSubnet(Uuid subnetId);
List<Uuid> getNetworksForVpn(Uuid vpnId);
- String getOpenDaylightVniRangesConfig();
-
void programV6InternetFallbackFlow(Uuid routerId, Uuid internetVpnId, int addOrRemove);
}
import javax.inject.Inject;
import javax.inject.Singleton;
import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.genius.arputil.api.ArpConstants;
import org.opendaylight.genius.mdsalutil.NWUtil;
import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
private static final Logger LOG = LoggerFactory.getLogger(NeutronSubnetGwMacResolver.class);
private static final long L3_INSTALL_DELAY_MILLIS = 5000;
- private final DataBroker broker;
private final OdlArputilService arpUtilService;
private final IElanService elanService;
private final ICentralizedSwitchProvider cswitchProvider;
private final Ipv6NdUtilService ipv6NdUtilService;
@Inject
- public NeutronSubnetGwMacResolver(final DataBroker broker,
- final OdlArputilService arputilService, final IElanService elanService,
+ public NeutronSubnetGwMacResolver(final OdlArputilService arputilService, final IElanService elanService,
final ICentralizedSwitchProvider cswitchProvider, final NeutronvpnUtils neutronvpnUtils,
final Ipv6NdUtilService ipv6NdUtilService) {
- this.broker = broker;
this.arpUtilService = arputilService;
this.elanService = elanService;
this.cswitchProvider = cswitchProvider;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.OptimisticLockFailedException;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
private final DataBroker dataBroker;
private final ManagedNewTransactionRunner txRunner;
- private final NotificationPublishService notificationPublishService;
private final VpnRpcService vpnRpcService;
private final NeutronFloatingToFixedIpMappingChangeListener floatingIpMapListener;
private final IElanService elanService;
@Inject
public NeutronvpnManager(
- final DataBroker dataBroker, final NotificationPublishService notiPublishService,
+ final DataBroker dataBroker,
final VpnRpcService vpnRpcSrv, final IElanService elanService,
final NeutronFloatingToFixedIpMappingChangeListener neutronFloatingToFixedIpMappingChangeListener,
final NeutronvpnConfig neutronvpnConfig, final IVpnManager vpnManager,
final NeutronvpnUtils neutronvpnUtils) throws TransactionCommitFailedException {
this.dataBroker = dataBroker;
this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
- notificationPublishService = notiPublishService;
vpnRpcService = vpnRpcSrv;
this.elanService = elanService;
floatingIpMapListener = neutronFloatingToFixedIpMappingChangeListener;
protected Adjacencies createPortIpAdjacencies(Port port, Boolean isRouterInterface,
TypedWriteTransaction<Configuration> wrtConfigTxn,
- @Nullable Subnetmap sn, @Nullable VpnInterface vpnIface) {
+ @Nullable VpnInterface vpnIface) {
List<Adjacency> adjList = new ArrayList<>();
if (vpnIface != null) {
adjList = vpnIface.augmentation(Adjacencies.class).getAdjacency();
String infName = port.getUuid().getValue();
// Handling cluster reboot scenario where VpnInterface already exists in datastore.
VpnInterface vpnIface = VpnHelper.getVpnInterface(dataBroker, infName);
- Adjacencies adjs = createPortIpAdjacencies(port, isRouterInterface, wrtConfigTxn, null, vpnIface);
+ Adjacencies adjs = createPortIpAdjacencies(port, isRouterInterface, wrtConfigTxn, vpnIface);
LOG.trace("createVpnInterface for Port: {}, isRouterInterface: {}", infName, isRouterInterface);
writeVpnInterfaceToDs(vpnIds, infName, adjs, port.getNetworkId(), isRouterInterface, wrtConfigTxn);
}
.equals(NeutronConstants.DEVICE_OWNER_ROUTER_INF) ? true : false;
jobCoordinator.enqueueJob("PORT-" + portId.getValue(), () -> singletonList(
txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, wrtConfigTxn -> {
- Adjacencies portAdj = createPortIpAdjacencies(port, isRouterInterface, wrtConfigTxn, sn,
- vpnIface);
+ Adjacencies portAdj = createPortIpAdjacencies(port, isRouterInterface, wrtConfigTxn,
+ vpnIface);
if (vpnIface == null) {
LOG.trace("addSubnetToVpn: create new VpnInterface for Port {}", vpnInfName);
Set<Uuid> listVpn = new HashSet<>();
return nvManager.showVpnConfigCLI(vuuid);
}
- @Override
- public void addSubnetToVpn(Uuid vpnId, Uuid subnet) {
- nvManager.addSubnetToVpn(vpnId, subnet, null /* internet-vpn-id */);
- }
-
- @Override
- public void removeSubnetFromVpn(Uuid vpnId, Uuid subnet) {
- nvManager.removeSubnetFromVpn(vpnId, subnet, null /* internet-vpn-id */);
- }
-
@Override
public Uuid getNetworkForSubnet(Uuid subnetId) {
return nvManager.getNetworkForSubnet(subnetId);
return nvManager.getNeutronPort(name);
}
- @Override
- public Port getNeutronPort(Uuid portId) {
- return nvManager.getNeutronPort(portId);
- }
-
@Override
public Subnet getNeutronSubnet(Uuid subnetId) {
return nvManager.getNeutronSubnet(subnetId);
}
- @Override
- public IpAddress getNeutronSubnetGateway(Uuid subnetId) {
- return nvManager.getNeutronSubnetGateway(subnetId);
- }
-
@Override
public Collection<Uuid> getSubnetIdsForGatewayIp(IpAddress ipAddress) {
return neutronvpnUtils.getSubnetIdsForGatewayIp(ipAddress);
}
- @Override
- public String getOpenDaylightVniRangesConfig() {
- return nvManager.getOpenDaylightVniRangesConfig();
- }
-
@Override
public void programV6InternetFallbackFlow(Uuid routerId, Uuid internetVpnId, int addOrRemove) {
nvManager.programV6InternetFallbackFlow(routerId, internetVpnId, addOrRemove);
private final DataBroker dataBroker;
private final NeutronvpnUtils neutronvpnUtils;
- private final NeutronvpnManager nvpnManager;
private final IElanService elanService;
@Inject
public NeutronvpnNatManager(final DataBroker dataBroker, final NeutronvpnUtils neutronvpnUtils,
- final NeutronvpnManager neutronvpnManager, final IElanService elanService) {
+ final IElanService elanService) {
this.dataBroker = dataBroker;
this.neutronvpnUtils = neutronvpnUtils;
- this.nvpnManager = neutronvpnManager;
this.elanService = elanService;
}
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
import java.util.concurrent.locks.ReentrantLock;
-import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.apache.commons.lang3.StringUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.PortKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.portsecurity.rev150712.PortSecurityExtension;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.provider.ext.rev150712.NetworkProviderExtension;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.qos.rev160613.qos.attributes.qos.policies.QosPolicy;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.Subnets;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.subnets.rev150712.subnets.attributes.subnets.Subnet;
private final ConcurrentMap<Uuid, Port> portMap = new ConcurrentHashMap<>();
private final ConcurrentMap<Uuid, Subnet> subnetMap = new ConcurrentHashMap<>();
private final Map<IpAddress, Set<Uuid>> subnetGwIpMap = new ConcurrentHashMap<>();
- private final ConcurrentMap<Uuid, QosPolicy> qosPolicyMap = new ConcurrentHashMap<>();
- private final ConcurrentMap<Uuid, HashMap<Uuid, Port>> qosPortsMap = new ConcurrentHashMap<>();
- private final ConcurrentMap<Uuid, HashMap<Uuid, Network>> qosNetworksMap = new ConcurrentHashMap<>();
private final DataBroker dataBroker;
private final ManagedNewTransactionRunner txRunner;
return null;
}
- @Nullable
- protected List<Uuid> getPortIdsFromSubnetId(Uuid subnetId) {
- InstanceIdentifier<Subnetmap> id = buildSubnetMapIdentifier(subnetId);
- Optional<Subnetmap> optionalSubnetmap = read(LogicalDatastoreType.CONFIGURATION, id);
- if (optionalSubnetmap.isPresent()) {
- return optionalSubnetmap.get().getPortList();
- }
- return null;
- }
-
protected Router getNeutronRouter(Uuid routerId) {
Router router = routerMap.get(routerId);
if (router != null) {
&& network.augmentation(NetworkL3Extension.class).isExternal();
}
- public void addToQosPolicyCache(QosPolicy qosPolicy) {
- qosPolicyMap.put(qosPolicy.getUuid(),qosPolicy);
- }
-
- public void removeFromQosPolicyCache(QosPolicy qosPolicy) {
- qosPolicyMap.remove(qosPolicy.getUuid());
- }
-
- public void addToQosPortsCache(Uuid qosUuid, Port port) {
- if (qosPortsMap.containsKey(qosUuid)) {
- if (!qosPortsMap.get(qosUuid).containsKey(port.getUuid())) {
- qosPortsMap.get(qosUuid).put(port.getUuid(), port);
- }
- } else {
- HashMap<Uuid, Port> newPortMap = new HashMap<>();
- newPortMap.put(port.getUuid(), port);
- qosPortsMap.put(qosUuid, newPortMap);
- }
- }
-
- public void removeFromQosPortsCache(Uuid qosUuid, Port port) {
- if (qosPortsMap.containsKey(qosUuid) && qosPortsMap.get(qosUuid).containsKey(port.getUuid())) {
- qosPortsMap.get(qosUuid).remove(port.getUuid(), port);
- }
- }
-
- public void addToQosNetworksCache(Uuid qosUuid, Network network) {
- if (qosNetworksMap.containsKey(qosUuid)) {
- if (!qosNetworksMap.get(qosUuid).containsKey(network.getUuid())) {
- qosNetworksMap.get(qosUuid).put(network.getUuid(), network);
- }
- } else {
- HashMap<Uuid, Network> newNetworkMap = new HashMap<>();
- newNetworkMap.put(network.getUuid(), network);
- qosNetworksMap.put(qosUuid, newNetworkMap);
- }
- }
-
- public void removeFromQosNetworksCache(Uuid qosUuid, Network network) {
- if (qosNetworksMap.containsKey(qosUuid) && qosNetworksMap.get(qosUuid).containsKey(network.getUuid())) {
- qosNetworksMap.get(qosUuid).remove(network.getUuid(), network);
- }
- }
-
static InstanceIdentifier<NetworkMap> buildNetworkMapIdentifier(Uuid networkId) {
InstanceIdentifier<NetworkMap> id = InstanceIdentifier.builder(NetworkMaps.class).child(NetworkMap.class, new
NetworkMapKey(networkId)).build();
}
}
- public static Class<? extends NetworkTypeBase> getNetworkType(Network network) {
- NetworkProviderExtension providerExtension = network.augmentation(NetworkProviderExtension.class);
- return providerExtension != null ? providerExtension.getNetworkType() : null;
- }
-
@Nullable
static ProviderTypes getProviderNetworkType(Network network) {
if (network == null) {
return Optional.absent();
}
- public Set<RouterDpnList> getAllRouterDpnList(BigInteger dpid) {
- Set<RouterDpnList> ret = new HashSet<>();
- InstanceIdentifier<NeutronRouterDpns> routerDpnId =
- InstanceIdentifier.create(NeutronRouterDpns.class);
- Optional<NeutronRouterDpns> neutronRouterDpnsOpt =
- MDSALUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL, routerDpnId);
- if (neutronRouterDpnsOpt.isPresent()) {
- NeutronRouterDpns neutronRouterDpns = neutronRouterDpnsOpt.get();
- for (RouterDpnList routerDpnList : neutronRouterDpns.nonnullRouterDpnList()) {
- if (routerDpnList.getDpnVpninterfacesList() != null) {
- for (DpnVpninterfacesList dpnInterfaceList : routerDpnList.getDpnVpninterfacesList()) {
- if (dpnInterfaceList.getDpnId().equals(dpid)) {
- ret.add(routerDpnList);
- }
- }
- }
- }
- }
- return ret;
- }
-
- @Nullable
- protected Integer getUniqueRDId(String poolName, String idKey) {
- AllocateIdInput getIdInput = new AllocateIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build();
- try {
- Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput);
- RpcResult<AllocateIdOutput> rpcResult = result.get();
- if (rpcResult.isSuccessful()) {
- return rpcResult.getResult().getIdValue().intValue();
- } else {
- LOG.error("RPC call to get unique ID for pool name {} with ID key {} returned with errors {}",
- poolName, idKey, rpcResult.getErrors());
- }
- } catch (InterruptedException | ExecutionException e) {
- LOG.error("Exception when getting Unique Id for poolname {} and ID Key {}", poolName, idKey, e);
- }
- LOG.error("getUniqueRdId: Failed to return ID for poolname {} and ID Key {}", poolName, idKey);
- return null;
- }
-
protected void releaseRDId(String poolName, String idKey) {
ReleaseIdInput idInput = new ReleaseIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build();
try {
}), LOG, "Error updating VPN instance op {} with type {}", vpn, choice);
}
- public List<Uuid> getAssociateRouterInputRouterIdsListUuid(List<RouterIds> routerIds) {
- if (routerIds == null) {
- return Collections.emptyList();
- }
- return routerIds.stream().map(
- routerId -> routerId.getRouterId()).collect(Collectors.toList());
- }
-
- public List<Uuid> getDisassociateRouterInputRouterIdsListUuid(List<RouterIds> routerIds) {
- if (routerIds == null) {
- return Collections.emptyList();
- }
- return routerIds.stream().map(
- routerId -> routerId.getRouterId()).collect(Collectors.toList());
- }
-
- public RouterIds getvpnMapRouterIds(Uuid routerId) {
- return new RouterIdsBuilder().setRouterId(routerId).build();
- }
-
- public void removeVpnMapRouterIdsFromList(Uuid routerId, List<RouterIds> vpnRouterIds) {
- Iterator<RouterIds> vpnRouterIdIter = vpnRouterIds.iterator();
- while (vpnRouterIdIter.hasNext()) {
- RouterIds vpnRouterId = vpnRouterIdIter.next();
- if (vpnRouterId.getRouterId().getValue().equals(routerId.getValue())) {
- vpnRouterIdIter.remove();
- return;
- }
- }
- return;
- }
-
- public boolean vpnMapRouterIdsContainsRouterId(Uuid routerId, List<RouterIds> vpnRouterIds) {
- if (routerId == null) {
- return false;
- }
- return vpnRouterIds.stream().anyMatch(vpnRouterId ->
- vpnRouterId.getRouterId().getValue().equals(routerId.getValue()));
- }
-
- public List<Uuid> getVpnInstanceRouterIdsListUuid(List<RouterIds> routerIds) {
- if (routerIds == null) {
- return Collections.emptyList();
- }
- return routerIds.stream().map(
- routerId -> routerId.getRouterId()).collect(Collectors.toList());
- }
-
public static RouterIds getvpnInstanceRouterIds(Uuid routerId) {
return new RouterIdsBuilder().setRouterId(routerId).build();
}
return dpns;
}
- @Nullable
- public List<Uuid> getRouterIdsfromVpnInstance(String vpnName) {
- // returns only router, attached to IPv4 networks
- InstanceIdentifier<VpnMap> vpnMapIdentifier = InstanceIdentifier.builder(VpnMaps.class)
- .child(VpnMap.class, new VpnMapKey(new Uuid(vpnName))).build();
- Optional<VpnMap> optionalVpnMap = SingleTransactionDataBroker
- .syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker,
- LogicalDatastoreType.CONFIGURATION, vpnMapIdentifier);
- if (!optionalVpnMap.isPresent()) {
- LOG.error("getRouterIdsfromVpnInstance : Router not found for vpn : {}", vpnName);
- return null;
- }
- List<Uuid> rtrIds = optionalVpnMap.get().getRouterIds().stream().map(routerIds -> routerIds.getRouterId())
- .collect(Collectors.toList());
- return rtrIds;
-
- }
-
- public InstanceIdentifier<Router> buildNeutronRouterIdentifier(Uuid routerUuid) {
- InstanceIdentifier<Router> routerInstanceIdentifier = InstanceIdentifier.create(Neutron.class)
- .child(Routers.class).child(Router.class, new RouterKey(routerUuid));
- return routerInstanceIdentifier;
- }
-
@Nullable
List<Subnetmap> getSubnetmapListFromNetworkId(Uuid networkId) {
List<Uuid> subnetIdList = getSubnetIdsFromNetworkId(networkId);
import com.google.common.base.Optional;
import java.util.Collections;
-import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
import org.opendaylight.netvirt.elanmanager.api.ElanHelper;
import org.opendaylight.netvirt.vpnmanager.api.IVpnManager;
-import org.opendaylight.netvirt.vpnmanager.api.VpnHelper;
import org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.EvpnAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.EvpnAugmentationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
this.jobCoordinator = jobCoordinator;
}
- @Nullable
- public VpnInstance getVpnInstance(Uuid vpnId) {
- return VpnHelper.getVpnInstance(dataBroker, vpnId.getValue());
- }
-
public boolean isVpnAssociatedWithNetwork(VpnInstance vpnInstance) throws ReadFailedException {
String rd = vpnManager.getPrimaryRdFromVpnInstance(vpnInstance);
InstanceIdentifier<EvpnRdToNetwork> id = InstanceIdentifier.builder(EvpnRdToNetworks.class)
private L2GatewayUtils() { }
- protected static boolean isGatewayAssociatedToL2Device(L2GatewayDevice l2GwDevice) {
- return l2GwDevice.getL2GatewayIds().size() > 0;
- }
-
protected static boolean isLastL2GatewayBeingDeleted(L2GatewayDevice l2GwDevice) {
return l2GwDevice.getL2GatewayIds().size() == 1;
}
- protected static boolean isItmTunnelsCreatedForL2Device(L2GatewayDevice l2GwDevice) {
- return l2GwDevice.getHwvtepNodeId() != null && l2GwDevice.getL2GatewayIds().size() > 0;
- }
-
protected static void createItmTunnels(ItmRpcService itmRpcService, String hwvtepId, String psName,
IpAddress tunnelIp) {
AddL2GwDeviceInputBuilder builder = new AddL2GwDeviceInputBuilder();