Search in sources :

Example 1 with DpnTepInterfaceInfo

use of org.opendaylight.genius.itm.utils.DpnTepInterfaceInfo in project genius by opendaylight.

the class DirectTunnelUtils method getEgressActionInfosForInterface.

private List<ActionInfo> getEgressActionInfosForInterface(String interfaceName, long tunnelKey, int actionKeyStart) {
    DpnTepInterfaceInfo interfaceInfo = dpnTepStateCache.getTunnelFromCache(interfaceName);
    if (interfaceInfo == null) {
        LOG.error("Interface information not present in config DS for {}", interfaceName);
        return Collections.singletonList(new ActionDrop());
    }
    Optional<StateTunnelList> ifState;
    try {
        ifState = tunnelStateCache.get(tunnelStateCache.getStateTunnelListIdentifier(interfaceName));
    } catch (ReadFailedException e) {
        LOG.error("Interface information not present in oper DS for {} ", interfaceName, e);
        return Collections.singletonList(new ActionDrop());
    }
    if (ifState.isPresent()) {
        String tunnelType = ItmUtils.convertTunnelTypetoString(interfaceInfo.getTunnelType());
        return getEgressActionInfosForInterface(tunnelType, ifState.get().getPortNumber(), tunnelKey, actionKeyStart);
    }
    LOG.error("Interface information not present in oper DS for {}", interfaceName);
    return Collections.singletonList(new ActionDrop());
}
Also used : ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) StateTunnelList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList) DpnTepInterfaceInfo(org.opendaylight.genius.itm.utils.DpnTepInterfaceInfo) ActionDrop(org.opendaylight.genius.mdsalutil.actions.ActionDrop)

Example 2 with DpnTepInterfaceInfo

use of org.opendaylight.genius.itm.utils.DpnTepInterfaceInfo in project genius by opendaylight.

the class DpnTepStateCache method added.

@Override
protected void added(InstanceIdentifier<DpnsTeps> path, DpnsTeps dpnsTeps) {
    for (RemoteDpns remoteDpns : dpnsTeps.getRemoteDpns()) {
        final String dpn = getDpnId(dpnsTeps.getSourceDpnId(), remoteDpns.getDestinationDpnId());
        DpnTepInterfaceInfo value = new DpnTepInterfaceInfoBuilder().setTunnelName(remoteDpns.getTunnelName()).setGroupId(dpnsTeps.getGroupId()).setIsMonitoringEnabled(remoteDpns.isMonitoringEnabled()).setIsMonitoringEnabled(remoteDpns.isInternal()).setTunnelType(dpnsTeps.getTunnelType()).build();
        dpnTepInterfaceMap.put(dpn, value);
        addTunnelEndPointInfoToCache(remoteDpns.getTunnelName(), dpnsTeps.getSourceDpnId().toString(), remoteDpns.getDestinationDpnId().toString());
    }
}
Also used : DpnTepInterfaceInfoBuilder(org.opendaylight.genius.itm.utils.DpnTepInterfaceInfoBuilder) RemoteDpns(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.dpns.teps.RemoteDpns) DpnTepInterfaceInfo(org.opendaylight.genius.itm.utils.DpnTepInterfaceInfo)

Example 3 with DpnTepInterfaceInfo

use of org.opendaylight.genius.itm.utils.DpnTepInterfaceInfo in project genius by opendaylight.

the class DpnTepStateCache method getDpnTepInterface.

public DpnTepInterfaceInfo getDpnTepInterface(BigInteger srcDpnId, BigInteger dstDpnId) {
    DpnTepInterfaceInfo dpnTepInterfaceInfo = dpnTepInterfaceMap.get(getDpnId(srcDpnId, dstDpnId));
    if (dpnTepInterfaceInfo == null) {
        try {
            Optional<DpnsTeps> dpnsTeps = super.get(srcDpnId);
            if (dpnsTeps.isPresent()) {
                DpnsTeps teps = dpnsTeps.get();
                teps.getRemoteDpns().forEach(remoteDpns -> {
                    DpnTepInterfaceInfo value = new DpnTepInterfaceInfoBuilder().setTunnelName(remoteDpns.getTunnelName()).setGroupId(teps.getGroupId()).setIsMonitoringEnabled(remoteDpns.isMonitoringEnabled()).setIsMonitoringEnabled(remoteDpns.isInternal()).setTunnelType(teps.getTunnelType()).build();
                    dpnTepInterfaceMap.putIfAbsent(getDpnId(srcDpnId, remoteDpns.getDestinationDpnId()), value);
                    addTunnelEndPointInfoToCache(remoteDpns.getTunnelName(), teps.getSourceDpnId().toString(), remoteDpns.getDestinationDpnId().toString());
                });
            }
        } catch (ReadFailedException e) {
            LOG.error("cache read for dpnID {} in DpnTepStateCache failed ", srcDpnId, e);
        }
    }
    return dpnTepInterfaceMap.get(getDpnId(srcDpnId, dstDpnId));
}
Also used : ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) DpnTepInterfaceInfoBuilder(org.opendaylight.genius.itm.utils.DpnTepInterfaceInfoBuilder) DpnTepInterfaceInfo(org.opendaylight.genius.itm.utils.DpnTepInterfaceInfo) DpnsTeps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.DpnsTeps)

Example 4 with DpnTepInterfaceInfo

use of org.opendaylight.genius.itm.utils.DpnTepInterfaceInfo in project genius by opendaylight.

the class DpnTepStateCache method getInterfaceFromCache.

public Interface getInterfaceFromCache(String tunnelName) {
    TunnelEndPointInfo endPointInfo = getTunnelEndPointInfoFromCache(tunnelName);
    BigInteger srcDpnId = new BigInteger(endPointInfo.getSrcEndPointInfo());
    BigInteger dstDpnId = new BigInteger(endPointInfo.getDstEndPointInfo());
    Interface iface = null;
    int monitoringInt = 1000;
    DpnTepInterfaceInfo dpnTepInfo = getDpnTepInterface(srcDpnId, dstDpnId);
    if (dpnTepInfo != null) {
        List<DPNTEPsInfo> srcDpnTEPsInfo = dpnTepsInfoCache.getDPNTepListFromDPNId(Collections.singletonList(srcDpnId));
        List<DPNTEPsInfo> dstDpnTEPsInfo = dpnTepsInfoCache.getDPNTepListFromDPNId(Collections.singletonList(dstDpnId));
        iface = ItmUtils.buildTunnelInterface(srcDpnId, tunnelName, String.format("%s %s", ItmUtils.convertTunnelTypetoString(dpnTepInfo.getTunnelType()), "Trunk Interface"), true, dpnTepInfo.getTunnelType(), srcDpnTEPsInfo.get(0).getTunnelEndPoints().get(0).getIpAddress(), dstDpnTEPsInfo.get(0).getTunnelEndPoints().get(0).getIpAddress(), srcDpnTEPsInfo.get(0).getTunnelEndPoints().get(0).getGwIpAddress(), srcDpnTEPsInfo.get(0).getTunnelEndPoints().get(0).getVLANID(), true, dpnTepInfo.isMonitoringEnabled(), TunnelMonitoringTypeBfd.class, monitoringInt, true, null);
    }
    return iface;
}
Also used : TunnelMonitoringTypeBfd(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelMonitoringTypeBfd) BigInteger(java.math.BigInteger) TunnelEndPointInfo(org.opendaylight.genius.itm.utils.TunnelEndPointInfo) DPNTEPsInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface) DpnTepInterfaceInfo(org.opendaylight.genius.itm.utils.DpnTepInterfaceInfo)

Aggregations

DpnTepInterfaceInfo (org.opendaylight.genius.itm.utils.DpnTepInterfaceInfo)4 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)2 DpnTepInterfaceInfoBuilder (org.opendaylight.genius.itm.utils.DpnTepInterfaceInfoBuilder)2 BigInteger (java.math.BigInteger)1 TunnelEndPointInfo (org.opendaylight.genius.itm.utils.TunnelEndPointInfo)1 ActionDrop (org.opendaylight.genius.mdsalutil.actions.ActionDrop)1 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)1 TunnelMonitoringTypeBfd (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelMonitoringTypeBfd)1 DPNTEPsInfo (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo)1 DpnsTeps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.DpnsTeps)1 RemoteDpns (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.dpns.teps.RemoteDpns)1 StateTunnelList (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList)1