use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow in project netvirt by opendaylight.
the class ElanDmacUtils method buildDmacFlowForExternalRemoteMac.
/**
* Builds a Flow to be programmed in a DPN's DMAC table. This method must be
* used when the MAC is located in an External Device (TOR). The flow
* matches on the specified MAC and 1) sends the packet over the CSS-TOR
* tunnel if SHFlag is not set, or 2) drops it if SHFlag is set (what means
* the packet came from an external tunnel)
*
* @param dpId
* DPN whose DMAC table is going to be modified
* @param extDeviceNodeId
* Hwvtep node where the mac is attached to
* @param elanTag
* ElanId to which the MAC is being added to
* @param vni
* the vni
* @param dstMacAddress
* The mac address to be programmed
* @param displayName
* the display name
* @return the flow
*/
@SuppressWarnings("checkstyle:IllegalCatch")
public Flow buildDmacFlowForExternalRemoteMac(BigInteger dpId, String extDeviceNodeId, long elanTag, Long vni, String dstMacAddress, String displayName) {
List<MatchInfo> mkMatches = ElanUtils.buildMatchesForElanTagShFlagAndDstMac(elanTag, /* shFlag */
false, dstMacAddress);
List<Instruction> mkInstructions = new ArrayList<>();
try {
List<Action> actions = elanItmUtils.getExternalTunnelItmEgressAction(dpId, new NodeId(extDeviceNodeId), vni);
mkInstructions.add(MDSALUtil.buildApplyActionsInstruction(actions));
} catch (Exception e) {
LOG.error("Could not get Egress Actions for DpId {} externalNode {}", dpId, extDeviceNodeId, e);
}
return MDSALUtil.buildFlowNew(NwConstants.ELAN_DMAC_TABLE, ElanUtils.getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpId, extDeviceNodeId, dstMacAddress, elanTag, false), 20, /* prio */
displayName, 0, /* idleTimeout */
0, /* hardTimeout */
ElanConstants.COOKIE_ELAN_KNOWN_DMAC.add(BigInteger.valueOf(elanTag)), mkMatches, mkInstructions);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow in project netvirt by opendaylight.
the class ElanUtils method buildLocalDmacFlowEntry.
/**
* Builds the flow to be programmed in the DMAC table of the local DPN (that
* is, where the MAC is attached to). This flow consists in:
*
* <p>Match: + elanTag in metadata + packet goes to a MAC locally attached
* Actions: + optionally, pop-vlan + set-vlan-id + output to ifName's
* portNumber
*
* @param elanTag
* the elan tag
* @param dpId
* the dp id
* @param ifName
* the if name
* @param macAddress
* the mac address
* @param elanInfo
* the elan info
* @param ifTag
* the if tag
* @return the flow
*/
public Flow buildLocalDmacFlowEntry(long elanTag, BigInteger dpId, String ifName, String macAddress, ElanInstance elanInfo, long ifTag) {
List<MatchInfo> mkMatches = new ArrayList<>();
mkMatches.add(new MatchMetadata(ElanHelper.getElanMetadataLabel(elanTag), MetaDataUtil.METADATA_MASK_SERVICE));
mkMatches.add(new MatchEthernetDestination(new MacAddress(macAddress)));
List<Instruction> mkInstructions = new ArrayList<>();
List<Action> actions = getEgressActionsForInterface(ifName, /* tunnelKey */
null);
mkInstructions.add(MDSALUtil.buildApplyActionsInstruction(actions));
Flow flow = MDSALUtil.buildFlowNew(NwConstants.ELAN_DMAC_TABLE, getKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpId, ifTag, macAddress, elanTag), 20, elanInfo.getElanInstanceName(), 0, 0, ElanConstants.COOKIE_ELAN_KNOWN_DMAC.add(BigInteger.valueOf(elanTag)), mkMatches, mkInstructions);
return flow;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow in project netvirt by opendaylight.
the class ElanUtils method getFlowIid.
public static InstanceIdentifier<Flow> getFlowIid(Flow flow, BigInteger dpnId) {
FlowKey flowKey = new FlowKey(new FlowId(flow.getId()));
org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId nodeId = new org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId("openflow:" + dpnId);
org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node nodeDpn = new NodeBuilder().setId(nodeId).setKey(new NodeKey(nodeId)).build();
return InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class).child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flowKey).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow in project netvirt by opendaylight.
the class ElanUtils method setupLocalDmacFlow.
private void setupLocalDmacFlow(long elanTag, BigInteger dpId, String ifName, String macAddress, ElanInstance elanInfo, IMdsalApiManager mdsalApiManager, long ifTag, WriteTransaction writeFlowGroupTx) {
Flow flowEntity = buildLocalDmacFlowEntry(elanTag, dpId, ifName, macAddress, elanInfo, ifTag);
mdsalApiManager.addFlowToTx(dpId, flowEntity, writeFlowGroupTx);
installEtreeLocalDmacFlow(elanTag, dpId, ifName, macAddress, elanInfo, ifTag, writeFlowGroupTx);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow in project netvirt by opendaylight.
the class ElanUtils method setupTermDmacFlows.
/**
* Installs a Flow in INTERNAL_TUNNEL_TABLE of the affected DPN that sends
* the packet through the specified interface if the tunnel_id matches the
* interface's lportTag.
*
* @param interfaceInfo
* the interface info
* @param mdsalApiManager
* the mdsal API manager
* @param writeFlowGroupTx
* the writeFLowGroup tx
*/
public void setupTermDmacFlows(InterfaceInfo interfaceInfo, IMdsalApiManager mdsalApiManager, WriteTransaction writeFlowGroupTx) {
BigInteger dpId = interfaceInfo.getDpId();
int lportTag = interfaceInfo.getInterfaceTag();
Flow flow = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE, getIntTunnelTableFlowRef(NwConstants.INTERNAL_TUNNEL_TABLE, lportTag), 5, String.format("%s:%d", "ITM Flow Entry ", lportTag), 0, 0, ITMConstants.COOKIE_ITM.add(BigInteger.valueOf(lportTag)), getTunnelIdMatchForFilterEqualsLPortTag(lportTag), getInstructionsInPortForOutGroup(interfaceInfo.getInterfaceName()));
mdsalApiManager.addFlowToTx(dpId, flow, writeFlowGroupTx);
LOG.debug("Terminating service table flow entry created on dpn:{} for logical Interface port:{}", dpId, interfaceInfo.getPortName());
}
Aggregations