use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.object.Of 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.params.xml.ns.yang.pcep.types.rev131005.of.object.Of in project netvirt by opendaylight.
the class AbstractAclServiceImpl method programAclRules.
/**
* Programs the acl custom rules.
*
* @param port acl interface
* @param aclUuidList the list of acl uuid to be applied
* @param addOrRemove whether to delete or add flow
* @return program succeeded
*/
protected boolean programAclRules(AclInterface port, List<Uuid> aclUuidList, int addOrRemove) {
BigInteger dpId = port.getDpId();
LOG.debug("Applying custom rules on DpId {}, lportTag {}", dpId, port.getLPortTag());
if (aclUuidList == null || dpId == null) {
LOG.warn("{} ACL parameters can not be null. dpId={}, aclUuidList={}", this.directionString, dpId, aclUuidList);
return false;
}
for (Uuid aclUuid : aclUuidList) {
Acl acl = this.aclDataUtil.getAcl(aclUuid.getValue());
if (null == acl) {
LOG.warn("The ACL {} not found in cache", aclUuid.getValue());
continue;
}
AccessListEntries accessListEntries = acl.getAccessListEntries();
List<Ace> aceList = accessListEntries.getAce();
for (Ace ace : aceList) {
programAceRule(port, aclUuid.getValue(), ace, addOrRemove);
}
}
return true;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.object.Of in project netvirt by opendaylight.
the class NexthopManager method removeLocalNextHop.
public void removeLocalNextHop(BigInteger dpnId, Long vpnId, String ipNextHopAddress, String ipPrefixAddress) {
String ipPrefixStr = vpnId + ipPrefixAddress;
VpnNexthop prefixNh = null;
synchronized (ipPrefixStr.intern()) {
prefixNh = getVpnNexthop(vpnId, ipPrefixAddress);
}
String ipAddress = prefixNh != null ? ipPrefixAddress : ipNextHopAddress;
String nextHopLockStr = vpnId + ipAddress;
synchronized (nextHopLockStr.intern()) {
VpnNexthop nh = getVpnNexthop(vpnId, ipAddress);
if (nh != null) {
int newFlowrefCnt = nh.getFlowrefCount() - 1;
if (newFlowrefCnt == 0) {
// remove the group only if there are no more flows using this group
GroupEntity groupEntity = MDSALUtil.buildGroupEntity(dpnId, nh.getEgressPointer(), ipAddress, GroupTypes.GroupAll, Collections.EMPTY_LIST);
// remove Group ...
mdsalApiManager.removeGroup(groupEntity);
// update MD-SAL DS
removeVpnNexthopFromDS(vpnId, ipAddress);
// release groupId
removeNextHopPointer(getNextHopKey(vpnId, ipAddress));
LOG.debug("Local Next hop {} for {} {} on dpn {} successfully deleted", nh.getEgressPointer(), vpnId, ipAddress, dpnId);
} else {
// just update the flowrefCount of the vpnNexthop
VpnNexthop currNh = new VpnNexthopBuilder().setKey(new VpnNexthopKey(ipAddress)).setFlowrefCount(newFlowrefCnt).build();
LOG.trace("Updating vpnnextHop {} for refCount {} to Operational DS", currNh, newFlowrefCnt);
MDSALUtil.syncUpdate(dataBroker, LogicalDatastoreType.OPERATIONAL, getVpnNextHopIdentifier(vpnId, ipAddress), currNh);
}
} else {
// throw error
LOG.error("Local Next hop for Prefix {} VpnId {} on dpn {} not deleted", ipAddress, vpnId, dpnId);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.object.Of in project netvirt by opendaylight.
the class ElanL2GatewayMulticastUtils method getTepIpOfDesignatedSwitchForExternalTunnel.
/**
* Gets the tep ip of designated switch for external tunnel.
*
* @param l2GwDevice
* the l2 gw device
* @param elanInstanceName
* the elan instance name
* @return the tep ip of designated switch for external tunnel
*/
public IpAddress getTepIpOfDesignatedSwitchForExternalTunnel(L2GatewayDevice l2GwDevice, String elanInstanceName) {
IpAddress tepIp = null;
if (l2GwDevice.getTunnelIp() == null) {
LOG.warn("Tunnel IP not found for {}", l2GwDevice.getDeviceName());
return tepIp;
}
DesignatedSwitchForTunnel desgSwitch = getDesignatedSwitchForExternalTunnel(l2GwDevice.getTunnelIp(), elanInstanceName);
if (desgSwitch != null) {
tepIp = elanItmUtils.getSourceDpnTepIp(BigInteger.valueOf(desgSwitch.getDpId()), new NodeId(l2GwDevice.getHwvtepNodeId()));
}
return tepIp;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.object.Of in project netvirt by opendaylight.
the class ElanL2GatewayUtils method getL2GwDeviceLocalMacs.
/**
* Gets the l2 gw device local macs.
* @param elanName
* name of the elan
* @param l2gwDevice
* the l2gw device
* @return the l2 gw device local macs
*/
public Collection<MacAddress> getL2GwDeviceLocalMacs(String elanName, L2GatewayDevice l2gwDevice) {
if (l2gwDevice == null) {
return Collections.emptyList();
}
Collection<LocalUcastMacs> lstUcastLocalMacs = l2gwDevice.getUcastLocalMacs();
Set<MacAddress> macs = new HashSet<>();
if (!lstUcastLocalMacs.isEmpty()) {
macs.addAll(lstUcastLocalMacs.stream().filter(Objects::nonNull).map(mac -> new MacAddress(mac.getMacEntryKey().getValue().toLowerCase())).collect(Collectors.toList()));
}
Optional<Node> configNode = MDSALUtil.read(broker, LogicalDatastoreType.CONFIGURATION, HwvtepSouthboundUtils.createInstanceIdentifier(new NodeId(l2gwDevice.getHwvtepNodeId())));
if (configNode.isPresent()) {
HwvtepGlobalAugmentation augmentation = configNode.get().getAugmentation(HwvtepGlobalAugmentation.class);
if (augmentation != null && augmentation.getLocalUcastMacs() != null) {
macs.addAll(augmentation.getLocalUcastMacs().stream().filter(mac -> getLogicalSwitchName(mac).equals(elanName)).map(mac -> mac.getMacEntryKey()).collect(Collectors.toSet()));
}
}
return macs;
}
Aggregations