use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId in project netvirt by opendaylight.
the class ElanUtils method buildDmacRedirectToDispatcherFlow.
public static FlowEntity buildDmacRedirectToDispatcherFlow(BigInteger dpId, String dstMacAddress, String displayName, long elanTag) {
List<MatchInfo> matches = new ArrayList<>();
matches.add(new MatchMetadata(ElanHelper.getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE));
matches.add(new MatchEthernetDestination(new MacAddress(dstMacAddress)));
List<InstructionInfo> instructions = new ArrayList<>();
List<ActionInfo> actions = new ArrayList<>();
actions.add(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));
instructions.add(new InstructionApplyActions(actions));
String flowId = getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpId, dstMacAddress, elanTag);
return MDSALUtil.buildFlowEntity(dpId, NwConstants.ELAN_DMAC_TABLE, flowId, 20, displayName, 0, 0, ElanConstants.COOKIE_ELAN_KNOWN_DMAC.add(BigInteger.valueOf(elanTag)), matches, instructions);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId in project netvirt by opendaylight.
the class ElanServiceProvider method addArpResponderFlow.
@Override
public void addArpResponderFlow(ArpResponderInput arpResponderInput) {
String ingressInterfaceName = arpResponderInput.getInterfaceName();
String macAddress = arpResponderInput.getSha();
String ipAddress = arpResponderInput.getSpa();
int lportTag = arpResponderInput.getLportTag();
BigInteger dpnId = arpResponderInput.getDpId();
LOG.info("Installing the ARP responder flow on DPN {} for Interface {} with MAC {} & IP {}", dpnId, ingressInterfaceName, macAddress, ipAddress);
Optional<ElanInterface> elanIface = elanInterfaceCache.get(ingressInterfaceName);
ElanInstance elanInstance = elanIface.isPresent() ? elanInstanceCache.get(elanIface.get().getElanInstanceName()).orNull() : null;
if (elanInstance == null) {
LOG.debug("addArpResponderFlow: elanInstance is null, Failed to install arp responder flow for dpnId {}" + "for Interface {} with MAC {} & IP {}", dpnId, ingressInterfaceName, macAddress, ipAddress);
return;
}
String flowId = ArpResponderUtil.getFlowId(lportTag, ipAddress);
ArpResponderUtil.installFlow(mdsalManager, dpnId, flowId, flowId, NwConstants.DEFAULT_ARP_FLOW_PRIORITY, ArpResponderUtil.generateCookie(lportTag, ipAddress), ArpResponderUtil.getMatchCriteria(lportTag, elanInstance, ipAddress), arpResponderInput.getInstructions());
LOG.info("Installed the ARP Responder flow for Interface {}", ingressInterfaceName);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId in project netvirt by opendaylight.
the class VpnUtil method buildL3vpnGatewayFlow.
public static FlowEntity buildL3vpnGatewayFlow(BigInteger dpId, String gwMacAddress, long vpnId, long subnetVpnId) {
List<MatchInfo> mkMatches = new ArrayList<>();
mkMatches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
mkMatches.add(new MatchEthernetDestination(new MacAddress(gwMacAddress)));
List<InstructionInfo> mkInstructions = new ArrayList<>();
mkInstructions.add(new InstructionGotoTable(NwConstants.L3_FIB_TABLE));
if (subnetVpnId != VpnConstants.INVALID_ID) {
BigInteger subnetIdMetaData = MetaDataUtil.getVpnIdMetadata(subnetVpnId);
mkInstructions.add(new InstructionWriteMetadata(subnetIdMetaData, MetaDataUtil.METADATA_MASK_VRFID));
}
String flowId = getL3VpnGatewayFlowRef(NwConstants.L3_GW_MAC_TABLE, dpId, vpnId, gwMacAddress);
return MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_GW_MAC_TABLE, flowId, 20, flowId, 0, 0, NwConstants.COOKIE_L3_GW_MAC_TABLE, mkMatches, mkInstructions);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId in project netvirt by opendaylight.
the class InterVpnLinkListener method removeVpnLinkEndpointFlows.
// We're catching Exception here to continue deleting as much as possible
// TODO Rework this so it's done in one transaction
@SuppressWarnings("checkstyle:IllegalCatch")
private void removeVpnLinkEndpointFlows(InterVpnLink del, String vpnUuid, String rd, List<BigInteger> dpns, int otherEndpointLportTag, String otherEndpointIpAddr, List<VrfEntry> vrfEntries, final boolean isVpnFirstEndPoint) {
String interVpnLinkName = del.getName();
LOG.debug("Removing endpoint flows for vpn {}. InterVpnLink={}. OtherEndpointLportTag={}", vpnUuid, interVpnLinkName, otherEndpointLportTag);
if (dpns == null) {
LOG.debug("VPN {} endpoint is not instantiated in any DPN for InterVpnLink {}", vpnUuid, interVpnLinkName);
return;
}
for (BigInteger dpnId : dpns) {
try {
// Removing flow from LportDispatcher table
String flowRef = InterVpnLinkUtil.getLportDispatcherFlowRef(interVpnLinkName, otherEndpointLportTag);
FlowKey flowKey = new FlowKey(new FlowId(flowRef));
Flow flow = new FlowBuilder().setKey(flowKey).setId(new FlowId(flowRef)).setTableId(NwConstants.LPORT_DISPATCHER_TABLE).setFlowName(flowRef).build();
mdsalManager.removeFlow(dpnId, flow);
// Also remove the 'fake' iface from the VpnToDpn map
InterVpnLinkUtil.removeIVpnLinkIfaceFromVpnFootprint(vpnFootprintService, vpnUuid, rd, dpnId);
} catch (Exception e) {
// Whatever happens it should not stop it from trying to remove as much as possible
LOG.warn("Error while removing InterVpnLink {} Endpoint flows on dpn {}. Reason: ", interVpnLinkName, dpnId, e);
}
}
// Removing flow from FIB and LFIB tables
LOG.trace("Removing flow in FIB and LFIB tables for vpn {} interVpnLink {} otherEndpointIpAddr {}", vpnUuid, interVpnLinkName, otherEndpointIpAddr);
cleanUpInterVPNRoutes(interVpnLinkName, vrfEntries, isVpnFirstEndPoint);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId in project netvirt by opendaylight.
the class ElanInterfaceManager method removeUnknownDmacFlow.
private void removeUnknownDmacFlow(BigInteger dpId, ElanInstance elanInfo, WriteTransaction deleteFlowGroupTx, long elanTag) {
Flow flow = new FlowBuilder().setId(new FlowId(getUnknownDmacFlowRef(NwConstants.ELAN_UNKNOWN_DMAC_TABLE, elanTag, SH_FLAG_UNSET))).setTableId(NwConstants.ELAN_UNKNOWN_DMAC_TABLE).build();
mdsalManager.removeFlowToTx(dpId, flow, deleteFlowGroupTx);
if (isVxlanNetworkOrVxlanSegment(elanInfo)) {
Flow flow2 = new FlowBuilder().setId(new FlowId(getUnknownDmacFlowRef(NwConstants.ELAN_UNKNOWN_DMAC_TABLE, elanTag, SH_FLAG_SET))).setTableId(NwConstants.ELAN_UNKNOWN_DMAC_TABLE).build();
mdsalManager.removeFlowToTx(dpId, flow2, deleteFlowGroupTx);
}
}
Aggregations