Search in sources :

Example 1 with RemoteDpns

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.dpns.teps.RemoteDpns 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 2 with RemoteDpns

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.dpns.teps.RemoteDpns 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 3 with RemoteDpns

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.dpns.teps.RemoteDpns in project genius by opendaylight.

the class DpnTepStateCache method removeTepFromDpnTepInterfaceConfigDS.

public void removeTepFromDpnTepInterfaceConfigDS(BigInteger srcDpnId) throws TransactionCommitFailedException {
    Collection<DpnsTeps> dpnsTeps = this.getAllPresent();
    for (DpnsTeps dpnTep : dpnsTeps) {
        if (!dpnTep.getSourceDpnId().equals(srcDpnId)) {
            List<RemoteDpns> remoteDpns = dpnTep.getRemoteDpns();
            for (RemoteDpns remoteDpn : remoteDpns) {
                if (remoteDpn.getDestinationDpnId().equals(srcDpnId)) {
                    // Remote the SrcDpnId from the remote List. Remove it from COnfig DS. 4
                    // This will be reflected in cache by the ClusteredDTCN. Not removing it here !
                    // Caution :- Batching Delete !!
                    InstanceIdentifier<RemoteDpns> remoteDpnII = buildRemoteDpnsInstanceIdentifier(dpnTep.getSourceDpnId(), remoteDpn.getDestinationDpnId());
                    SingleTransactionDataBroker.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, remoteDpnII);
                    break;
                }
            }
        } else {
            // The source DPn id is the one to be removed
            InstanceIdentifier<DpnsTeps> dpnsTepsII = buildDpnsTepsInstanceIdentifier(dpnTep.getSourceDpnId());
            SingleTransactionDataBroker.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, dpnsTepsII);
        }
    }
}
Also used : RemoteDpns(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.dpns.teps.RemoteDpns) DpnsTeps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.DpnsTeps)

Example 4 with RemoteDpns

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.dpns.teps.RemoteDpns in project genius by opendaylight.

the class DpnTepStateCache method removed.

@Override
protected void removed(InstanceIdentifier<DpnsTeps> path, DpnsTeps dpnsTeps) {
    for (RemoteDpns remoteDpns : dpnsTeps.getRemoteDpns()) {
        dpnTepInterfaceMap.remove(getDpnId(dpnsTeps.getSourceDpnId(), remoteDpns.getDestinationDpnId()));
        tunnelEndpointMap.remove(remoteDpns.getTunnelName());
    }
}
Also used : RemoteDpns(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.dpns.teps.RemoteDpns)

Example 5 with RemoteDpns

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.dpns.teps.RemoteDpns in project genius by opendaylight.

the class DpnTepStateCache method buildRemoteDpnsInstanceIdentifier.

private InstanceIdentifier<RemoteDpns> buildRemoteDpnsInstanceIdentifier(BigInteger srcDpnId, BigInteger dstDpnId) {
    DpnsTepsKey dpnsTepsKey = new DpnsTepsKey(srcDpnId);
    RemoteDpnsKey remoteDpnsKey = new RemoteDpnsKey(dstDpnId);
    return InstanceIdentifier.builder(DpnTepsState.class).child(DpnsTeps.class, dpnsTepsKey).child(RemoteDpns.class, remoteDpnsKey).build();
}
Also used : RemoteDpnsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.dpns.teps.RemoteDpnsKey) RemoteDpns(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.dpns.teps.RemoteDpns) DpnTepsState(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.DpnTepsState) DpnsTepsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.DpnsTepsKey)

Aggregations

RemoteDpns (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.dpns.teps.RemoteDpns)4 DpnTepInterfaceInfo (org.opendaylight.genius.itm.utils.DpnTepInterfaceInfo)2 DpnTepInterfaceInfoBuilder (org.opendaylight.genius.itm.utils.DpnTepInterfaceInfoBuilder)2 DpnsTeps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.DpnsTeps)2 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)1 DpnTepsState (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.DpnTepsState)1 DpnsTepsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.DpnsTepsKey)1 RemoteDpnsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.teps.state.dpns.teps.RemoteDpnsKey)1