use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table in project netvirt by opendaylight.
the class EvpnDnatFlowProgrammer method makeTunnelTableEntry.
private void makeTunnelTableEntry(BigInteger dpnId, long l3Vni, List<Instruction> customInstructions, WriteTransaction writeFlowInvTx) {
LOG.debug("makeTunnelTableEntry : Create terminating service table {} --> table {} flow on DpnId {} " + "with l3Vni {} as matching parameter", NwConstants.INTERNAL_TUNNEL_TABLE, NwConstants.PDNAT_TABLE, dpnId, l3Vni);
List<MatchInfo> mkMatches = new ArrayList<>();
mkMatches.add(new MatchTunnelId(BigInteger.valueOf(l3Vni)));
Flow terminatingServiceTableFlowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE, NatEvpnUtil.getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, l3Vni, NatConstants.DNAT_FLOW_NAME), 6, String.format("%s:%d", "TST Flow Entry ", l3Vni), 0, 0, COOKIE_TUNNEL.add(BigInteger.valueOf(l3Vni)), mkMatches, customInstructions);
mdsalManager.addFlowToTx(dpnId, terminatingServiceTableFlowEntity, writeFlowInvTx);
LOG.debug("makeTunnelTableEntry : Successfully installed terminating service table flow {} on DpnId {}", terminatingServiceTableFlowEntity, dpnId);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table in project netvirt by opendaylight.
the class AbstractAclServiceImpl method syncRemoteAclTable.
private void syncRemoteAclTable(String portId, Uuid acl, Integer aclTag, List<AllowedAddressPairs> aaps, int addOrRemove) {
Map<String, Set<AclInterface>> mapAclWithPortSet = aclDataUtil.getRemoteAclInterfaces(acl, this.direction);
Set<BigInteger> dpns = collectDpns(mapAclWithPortSet);
for (AllowedAddressPairs aap : aaps) {
if (!AclServiceUtils.isNotIpAllNetwork(aap)) {
continue;
}
if (aclServiceUtils.skipDeleteInCaseOfOverlappingIP(portId, acl, aap.getIpAddress(), addOrRemove)) {
LOG.debug("Skipping delete of IP={} in remote ACL table for remoteAclId={}, portId={}", aap.getIpAddress(), portId, acl.getValue());
continue;
}
for (BigInteger dpId : dpns) {
programRemoteAclTableFlow(dpId, aclTag, aap, addOrRemove);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table in project netvirt by opendaylight.
the class ElanL2GatewayUtils method getElanMacTableEntriesMacs.
/**
* Gets the elan mac table entries as remote ucast macs. <br>
* Note: ELAN MAC table only contains internal switches MAC's. It doesn't
* contain external device MAC's.
*
* @param elanName
* the elan name
* @param hwVtepNodeId
* the hw vtep node id
* @param logicalSwitchName
* the logical switch name
* @return the elan mac table entries as remote ucast macs
*/
public List<RemoteUcastMacs> getElanMacTableEntriesMacs(String elanName, NodeId hwVtepNodeId, String logicalSwitchName) {
List<RemoteUcastMacs> lstRemoteUcastMacs = new ArrayList<>();
MacTable macTable = ElanUtils.getElanMacTable(broker, elanName);
if (macTable == null || macTable.getMacEntry() == null || macTable.getMacEntry().isEmpty()) {
LOG.trace("MacTable is empty for elan: {}", elanName);
return lstRemoteUcastMacs;
}
for (MacEntry macEntry : macTable.getMacEntry()) {
BigInteger dpnId = getDpidFromInterface(macEntry.getInterface());
if (dpnId == null) {
LOG.error("DPN ID not found for interface {}", macEntry.getInterface());
continue;
}
IpAddress dpnTepIp = elanItmUtils.getSourceDpnTepIp(dpnId, hwVtepNodeId);
LOG.trace("Dpn Tep IP: {} for dpnId: {} and nodeId: {}", dpnTepIp, dpnId, hwVtepNodeId.getValue());
if (dpnTepIp == null) {
LOG.error("TEP IP not found for dpnId {} and nodeId {}", dpnId, hwVtepNodeId.getValue());
continue;
}
HwvtepPhysicalLocatorAugmentation physLocatorAug = HwvtepSouthboundUtils.createHwvtepPhysicalLocatorAugmentation(String.valueOf(dpnTepIp.getValue()));
// TODO: Query ARP cache to get IP address corresponding to the
// MAC
RemoteUcastMacs remoteUcastMac = HwvtepSouthboundUtils.createRemoteUcastMac(hwVtepNodeId, macEntry.getMacAddress().getValue().toLowerCase(Locale.getDefault()), null, /*IpAddress*/
logicalSwitchName, physLocatorAug);
lstRemoteUcastMacs.add(remoteUcastMac);
}
return lstRemoteUcastMacs;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table in project netvirt by opendaylight.
the class ElanL2GatewayUtils method installL2GwUcastMacInElan.
public void installL2GwUcastMacInElan(final ElanInstance elan, final L2GatewayDevice extL2GwDevice, final String macToBeAdded, final LocalUcastMacs localUcastMacs, String interfaceName) {
final String extDeviceNodeId = extL2GwDevice.getHwvtepNodeId();
final String elanInstanceName = elan.getElanInstanceName();
final Collection<DpnInterfaces> elanDpns = getElanDpns(elanInstanceName);
ConcurrentMap<String, L2GatewayDevice> elanL2GwDevices = ElanL2GwCacheUtils.getInvolvedL2GwDevices(elanInstanceName);
// DMAC table
if (elanDpns.size() > 0 || elanL2GwDevices.values().size() > 0) {
String jobKey = elanInstanceName + ":" + macToBeAdded;
IpAddress extL2GwDeviceTepIp = extL2GwDevice.getTunnelIp();
List<PhysAddress> macList = Lists.newArrayList(new PhysAddress(macToBeAdded));
elanClusterUtils.runOnlyInOwnerNode(jobKey, "install l2gw macs in dmac table", () -> {
if (doesLocalUcastMacExistsInCache(extL2GwDevice, localUcastMacs)) {
List<ListenableFuture<Void>> futures = new ArrayList<>();
for (DpnInterfaces elanDpn : elanDpns) {
futures.addAll(elanDmacUtils.installDmacFlowsToExternalRemoteMacInBatch(elanDpn.getDpId(), extDeviceNodeId, elan.getElanTag(), ElanUtils.getVxlanSegmentationId(elan), macToBeAdded, elanInstanceName, interfaceName));
}
for (L2GatewayDevice otherDevice : elanL2GwDevices.values()) {
if (!otherDevice.getHwvtepNodeId().equals(extDeviceNodeId) && !areMLAGDevices(extL2GwDevice, otherDevice)) {
final String hwvtepId = otherDevice.getHwvtepNodeId();
final String logicalSwitchName = elanInstanceName;
futures.add(HwvtepUtils.installUcastMacs(broker, hwvtepId, macList, logicalSwitchName, extL2GwDeviceTepIp));
}
}
return futures;
} else {
LOG.trace("Skipping install of dmac flows for mac {} as it is not found in cache", macToBeAdded);
}
return Collections.emptyList();
});
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table 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);
}
Aggregations