This fixes flow delete for tunnel interfaces
When interface is deleted we can't read Config DS to get NodeConnector
as it is already deleted.
This fix adds a new API.
Pending:
Group entries still not deleted, needs fix in MDSAL Util.
Change-Id: Ib82c68518f312b2c169455d85c5afacc82f38cbe
Signed-off-by: Vishal Thapar <vishal.thapar@ericsson.com>
(cherry picked from commit
dba7df67fcbe1c7aae2b2503b1811c07c24ad42f)
package org.opendaylight.vpnservice.interfacemgr.interfaces;
-import java.math.BigInteger;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
+import java.math.BigInteger;
import java.util.List;
import org.opendaylight.vpnservice.mdsalutil.ActionInfo;
import org.opendaylight.vpnservice.mdsalutil.MatchInfo;
public Long getPortForInterface(String ifName);
public BigInteger getDpnForInterface(String ifName);
+ public BigInteger getDpnForInterface(Interface intrf);
public String getEndpointIpForDpn(BigInteger dpnId);
public List<MatchInfo> getInterfaceIngressRule(String ifName);
public List<ActionInfo> getInterfaceEgressActions(String ifName);
return getPortNumForInterface(iface);
}
- BigInteger getDpnForInterface(String ifName) {
- Interface iface = getInterfaceByIfName(ifName);
+
+ public BigInteger getDpnForInterface(Interface intrf) {
try {
- NodeConnector port = getNodeConnectorFromDataStore(iface);
+ NodeConnector port = getNodeConnectorFromDataStore(intrf);
//TODO: This should be an MDSAL Util method
return new BigInteger(IfmUtil.getDpnFromNodeConnectorId(port.getId()));
} catch (NullPointerException e) {
- LOG.error("dpn for Interface {} not found", ifName);
+ LOG.error("dpn for Interface {} not found", intrf.getName(), e);
+ }
+ return BigInteger.ZERO;
+ }
+
+ BigInteger getDpnForInterface(String ifName) {
+ Interface iface = getInterfaceByIfName(ifName);
+ if(iface != null) {
+ return getDpnForInterface(iface);
}
+ LOG.error("Interface {} doesn't exist", ifName);
return BigInteger.ZERO;
}
*/
package org.opendaylight.vpnservice.interfacemgr;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
+
import java.math.BigInteger;
import java.util.List;
import java.util.concurrent.ExecutionException;
public List<ActionInfo> getInterfaceEgressActions(String ifName) {
return interfaceManager.getInterfaceEgressActions(ifName);
}
+
+ @Override
+ public BigInteger getDpnForInterface(Interface intrf) {
+ // TODO Auto-generated method stub
+ return interfaceManager.getDpnForInterface(intrf);
+ }
}
Interface intrf) {
LOG.trace("Removing interface : key: " + identifier + ", value=" + intrf );
if (intrf.getType().equals(L3tunnel.class)) {
- BigInteger dpnId = interfaceManager.getDpnForInterface(intrf.getName());
+ BigInteger dpnId = interfaceManager.getDpnForInterface(intrf);
IfL3tunnel intfData = intrf.getAugmentation(IfL3tunnel.class);
IpAddress gatewayIp = intfData.getGatewayIp();
IpAddress remoteIp = (gatewayIp == null) ? intfData.getRemoteIp() : gatewayIp;