use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.label._case.Label in project netvirt by opendaylight.
the class ExternalRoutersListener method removeTunnelTableEntry.
private void removeTunnelTableEntry(BigInteger dpnId, long serviceId, WriteTransaction writeFlowInvTx) {
LOG.info("removeTunnelTableEntry : called with DpnId = {} and label = {}", dpnId, serviceId);
List<MatchInfo> mkMatches = new ArrayList<>();
// Matching metadata
mkMatches.add(new MatchTunnelId(BigInteger.valueOf(serviceId)));
Flow flowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE, getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, serviceId, ""), 5, String.format("%s:%d", "TST Flow Entry ", serviceId), 0, 0, COOKIE_TUNNEL.add(BigInteger.valueOf(serviceId)), mkMatches, null);
mdsalManager.removeFlowToTx(dpnId, flowEntity, writeFlowInvTx);
LOG.debug("removeTunnelTableEntry : dpID {} : label : {} removed successfully", dpnId, serviceId);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.label._case.Label in project netvirt by opendaylight.
the class VpnFloatingIpHandler method cleanupFibEntries.
@Override
public void cleanupFibEntries(final BigInteger dpnId, final String vpnName, final String externalIp, final long label, WriteTransaction removeFlowInvTx, ProviderTypes provType) {
// Remove Prefix from BGP
String rd = NatUtil.getVpnRd(dataBroker, vpnName);
String fibExternalIp = NatUtil.validateAndAddNetworkMask(externalIp);
NatUtil.removePrefixFromBGP(bgpManager, fibManager, rd, fibExternalIp, vpnName, LOG);
// Remove custom FIB routes
// Future<RpcResult<java.lang.Void>> removeFibEntry(RemoveFibEntryInput input);
RemoveFibEntryInput input = new RemoveFibEntryInputBuilder().setVpnName(vpnName).setSourceDpid(dpnId).setIpAddress(fibExternalIp).setServiceId(label).setIpAddressSource(RemoveFibEntryInput.IpAddressSource.FloatingIP).build();
Future<RpcResult<Void>> future = fibService.removeFibEntry(input);
ListenableFuture<RpcResult<Void>> labelFuture = Futures.transformAsync(JdkFutureAdapters.listenInPoolThread(future), (AsyncFunction<RpcResult<Void>, RpcResult<Void>>) result -> {
if (result.isSuccessful()) {
Boolean removeTunnelFlow = Boolean.TRUE;
if (NatUtil.isOpenStackVniSemanticsEnforcedForGreAndVxlan(elanService, provType)) {
if (NatUtil.isFloatingIpPresentForDpn(dataBroker, dpnId, rd, vpnName, externalIp, false)) {
removeTunnelFlow = Boolean.FALSE;
}
}
if (removeTunnelFlow) {
removeTunnelTableEntry(dpnId, label, removeFlowInvTx);
}
removeLFibTableEntry(dpnId, label, removeFlowInvTx);
RemoveVpnLabelInput labelInput = new RemoveVpnLabelInputBuilder().setVpnName(vpnName).setIpPrefix(externalIp).build();
Future<RpcResult<Void>> labelFuture1 = vpnService.removeVpnLabel(labelInput);
return JdkFutureAdapters.listenInPoolThread(labelFuture1);
} else {
String errMsg = String.format("onRemoveFloatingIp :RPC call to remove custom FIB entries " + "on dpn %s for prefix %s Failed - %s", dpnId, externalIp, result.getErrors());
LOG.error(errMsg);
return Futures.immediateFailedFuture(new RuntimeException(errMsg));
}
}, MoreExecutors.directExecutor());
Futures.addCallback(labelFuture, new FutureCallback<RpcResult<Void>>() {
@Override
public void onFailure(@Nonnull Throwable error) {
LOG.error("onRemoveFloatingIp : Error in removing the label or custom fib entries", error);
}
@Override
public void onSuccess(@Nonnull RpcResult<Void> result) {
if (result.isSuccessful()) {
LOG.debug("onRemoveFloatingIp : Successfully removed the label for the prefix {} from VPN {}", externalIp, vpnName);
} else {
LOG.error("onRemoveFloatingIp : Error in removing the label for prefix {} from VPN {}, {}", externalIp, vpnName, result.getErrors());
}
}
}, MoreExecutors.directExecutor());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.label._case.Label in project netvirt by opendaylight.
the class VpnFloatingIpHandler method removeLFibTableEntry.
private void removeLFibTableEntry(BigInteger dpnId, long serviceId, WriteTransaction removeFlowInvTx) {
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.MPLS_UNICAST);
matches.add(new MatchMplsLabel(serviceId));
String flowRef = getFlowRef(dpnId, NwConstants.L3_LFIB_TABLE, serviceId, "");
LOG.debug("removeLFibTableEntry : removing LFib entry with flow ref {}", flowRef);
Flow flowEntity = MDSALUtil.buildFlowNew(NwConstants.L3_LFIB_TABLE, flowRef, 10, flowRef, 0, 0, NwConstants.COOKIE_VM_LFIB_TABLE, matches, null);
mdsalManager.removeFlowToTx(dpnId, flowEntity, removeFlowInvTx);
LOG.debug("removeLFibTableEntry : LFIB Entry for dpID : {} label : {} removed successfully", dpnId, serviceId);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.label._case.Label in project netvirt by opendaylight.
the class VpnFloatingIpHandler method removeTunnelTableEntry.
private void removeTunnelTableEntry(BigInteger dpnId, long serviceId, WriteTransaction removeFlowInvTx) {
LOG.debug("removeTunnelTableEntry : called with DpnId = {} and label = {}", dpnId, serviceId);
List<MatchInfo> mkMatches = new ArrayList<>();
// Matching metadata
mkMatches.add(new MatchTunnelId(BigInteger.valueOf(serviceId)));
Flow flowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE, getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, serviceId, ""), 5, String.format("%s:%d", "TST Flow Entry ", serviceId), 0, 0, COOKIE_TUNNEL.add(BigInteger.valueOf(serviceId)), mkMatches, null);
mdsalManager.removeFlowToTx(dpnId, flowEntity, removeFlowInvTx);
LOG.debug("removeTunnelTableEntry : Terminating service Entry for dpID {} : label : {} removed successfully", dpnId, serviceId);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.label._case.Label in project netvirt by opendaylight.
the class VpnFloatingIpHandler method onRemoveFloatingIp.
@Override
public void onRemoveFloatingIp(final BigInteger dpnId, String routerUuid, long routerId, final Uuid networkId, InternalToExternalPortMap mapping, final long label, WriteTransaction removeFlowInvTx) {
String externalIp = mapping.getExternalIp();
Uuid floatingIpId = mapping.getExternalId();
Uuid subnetId = NatUtil.getFloatingIpPortSubnetIdFromFloatingIpId(dataBroker, floatingIpId);
Optional<Subnets> externalSubnet = NatUtil.getOptionalExternalSubnets(dataBroker, subnetId);
final String vpnName = externalSubnet.isPresent() ? subnetId.getValue() : NatUtil.getAssociatedVPN(dataBroker, networkId);
if (vpnName == null) {
LOG.error("onRemoveFloatingIp: No VPN associated with ext nw {} to remove floating ip {} configuration " + "for router {}", networkId, externalIp, routerUuid);
return;
}
// Remove floating mac from mymac table
LOG.debug("onRemoveFloatingIp: Removing FloatingIp {}", externalIp);
String floatingIpPortMacAddress = NatUtil.getFloatingIpPortMacFromFloatingIpId(dataBroker, floatingIpId);
if (floatingIpPortMacAddress == null) {
LOG.error("onRemoveFloatingIp: Unable to retrieve floatingIp port MAC address from floatingIpId {} for " + "router {} to remove floatingIp {}", floatingIpId, routerUuid, externalIp);
return;
}
ListenableFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> {
String networkVpnName = NatUtil.getAssociatedVPN(dataBroker, networkId);
vpnManager.removeSubnetMacFromVpnInstance(networkVpnName, subnetId.getValue(), floatingIpPortMacAddress, dpnId, tx);
vpnManager.removeArpResponderFlowsToExternalNetworkIps(routerUuid, Collections.singletonList(externalIp), floatingIpPortMacAddress, dpnId, networkId);
}), LOG, "onRemoveFloatingIp");
removeFromFloatingIpPortInfo(floatingIpId);
ProviderTypes provType = NatEvpnUtil.getExtNwProvTypeFromRouterName(dataBroker, routerUuid, networkId);
if (provType == null) {
return;
}
if (provType == ProviderTypes.VXLAN) {
Uuid floatingIpInterface = NatEvpnUtil.getFloatingIpInterfaceIdFromFloatingIpId(dataBroker, floatingIpId);
evpnDnatFlowProgrammer.onRemoveFloatingIp(dpnId, vpnName, externalIp, floatingIpInterface.getValue(), floatingIpPortMacAddress, routerId, removeFlowInvTx);
return;
}
cleanupFibEntries(dpnId, vpnName, externalIp, label, removeFlowInvTx, provType);
}
Aggregations