Search in sources :

Example 11 with Transport

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project genius by opendaylight.

the class TepCommandHelper method createLocalCache.

@SuppressWarnings("checkstyle:IllegalCatch")
public void createLocalCache(Uint64 dpnId, String ipAddress, String transportZone) throws TepException {
    CHECK.incrementAndGet();
    IpAddress ipAddressObj;
    final VtepsKey vtepkey = new VtepsKey(dpnId);
    ipAddressObj = IpAddressBuilder.getDefaultInstance(ipAddress);
    if (checkTepPerTzPerDpn(transportZone, dpnId)) {
        handleError("Only one end point per transport Zone per Dpn is allowed");
        return;
    }
    Vteps vtepCli = new VtepsBuilder().setDpnId(dpnId).setIpAddress(ipAddressObj).withKey(vtepkey).build();
    if (transportZonesHashMap.containsKey(transportZone)) {
        List<Vteps> vtepListTemp = transportZonesHashMap.get(transportZone);
        if (!vtepListTemp.contains(vtepCli)) {
            vtepListTemp.add(vtepCli);
        }
    } else {
        List<Vteps> vtepListTemp = new ArrayList<>();
        vtepListTemp.add(vtepCli);
        transportZonesHashMap.put(transportZone, vtepListTemp);
    }
}
Also used : VtepsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.VtepsKey) Vteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Vteps) ArrayList(java.util.ArrayList) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) VtepsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.VtepsBuilder)

Example 12 with Transport

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project genius by opendaylight.

the class ItmInternalTunnelAddWorker method wireUpWithinTransportZone.

private void wireUpWithinTransportZone(TypedReadWriteTransaction<Configuration> tx, DPNTEPsInfo srcDpn, DPNTEPsInfo dstDpn, IMdsalApiManager mdsalManager) throws ExecutionException, InterruptedException, OperationFailedException {
    LOG.trace("Wiring up within Transport Zone for Dpns {}, {} ", srcDpn, dstDpn);
    List<TunnelEndPoints> srcEndPts = srcDpn.nonnullTunnelEndPoints();
    List<TunnelEndPoints> dstEndPts = dstDpn.nonnullTunnelEndPoints();
    for (TunnelEndPoints srcte : srcEndPts) {
        for (TunnelEndPoints dstte : dstEndPts) {
            // Compare the Transport zones
            if (!Objects.equals(srcDpn.getDPNID(), dstDpn.getDPNID())) {
                if (!ItmUtils.getIntersection(srcte.nonnullTzMembership(), dstte.nonnullTzMembership()).isEmpty()) {
                    // wire them up
                    wireUpBidirectionalTunnel(tx, srcte, dstte, srcDpn.getDPNID(), dstDpn.getDPNID(), mdsalManager);
                    if (!ItmTunnelAggregationHelper.isTunnelAggregationEnabled()) {
                        // CHECK THIS -- Assumption -- One end point per Dpn per transport zone
                        break;
                    }
                }
            }
        }
    }
}
Also used : TunnelEndPoints(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPoints)

Example 13 with Transport

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project genius by opendaylight.

the class ItmUtils method getTransportZoneOfVtep.

/**
 * Returns the transport zone of vtep from Configuration datastore.
 *
 * @param dpid datapath id of vtep
 * @param dataBroker data broker handle to perform operations on datastore
 * @return the TransportZone object in Config DS
 */
public static TransportZone getTransportZoneOfVtep(Uint64 dpid, DataBroker dataBroker) {
    InstanceIdentifier<TransportZones> path = InstanceIdentifier.builder(TransportZones.class).build();
    Optional<TransportZones> transportZonesOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, dataBroker);
    if (transportZonesOptional.isPresent()) {
        TransportZones tzones = transportZonesOptional.get();
        for (TransportZone tzone : tzones.getTransportZone()) {
            List<Vteps> vtepList = new ArrayList<>(tzone.nonnullVteps().values());
            if (vtepList != null && !vtepList.isEmpty()) {
                for (Vteps vtep : vtepList) {
                    if (vtep.getDpnId().equals(dpid)) {
                        return tzone;
                    }
                }
            }
        }
    }
    return null;
}
Also used : Vteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Vteps) ArrayList(java.util.ArrayList) TransportZones(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones) NotHostedTransportZones(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.NotHostedTransportZones) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone) TepsInNotHostedTransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.TepsInNotHostedTransportZone)

Example 14 with Transport

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project genius by opendaylight.

the class TransportZoneListener method createDPNTepInfo.

private List<DPNTEPsInfo> createDPNTepInfo(TransportZone transportZone) {
    Map<Uint64, List<TunnelEndPoints>> mapDPNToTunnelEndpt = new ConcurrentHashMap<>();
    List<DPNTEPsInfo> dpnTepInfo = new ArrayList<>();
    List<TzMembership> zones = ItmUtils.createTransportZoneMembership(transportZone.getZoneName());
    Class<? extends TunnelTypeBase> tunnelType = transportZone.getTunnelType();
    LOG.trace("Transport Zone_name: {}", transportZone.getZoneName());
    @Nullable Map<VtepsKey, Vteps> vtepsList = transportZone.getVteps();
    String portName = itmConfig.getPortname() == null ? ITMConstants.DUMMY_PORT : itmConfig.getPortname();
    int vlanId = itmConfig.getVlanId() != null ? itmConfig.getVlanId().toJava() : ITMConstants.DUMMY_VLANID;
    if (vtepsList != null && !vtepsList.isEmpty()) {
        for (Vteps vteps : vtepsList.values()) {
            Uint64 dpnID = vteps.getDpnId();
            IpAddress ipAddress = vteps.getIpAddress();
            boolean useOfTunnel = itmConfig.isUseOfTunnels();
            String tos = vteps.getOptionTunnelTos();
            if (tos == null) {
                tos = itmConfig.getDefaultTunnelTos();
            }
            LOG.trace("DpnID: {}, ipAddress: {}", dpnID, ipAddress);
            TunnelEndPoints tunnelEndPoints = ItmUtils.createTunnelEndPoints(dpnID, ipAddress, portName, useOfTunnel, vlanId, zones, tunnelType, tos);
            EVENT_LOGGER.debug("ITM-createDPNTepInfo for {} {}", dpnID, ipAddress);
            List<TunnelEndPoints> tunnelEndPointsList = mapDPNToTunnelEndpt.get(dpnID);
            if (tunnelEndPointsList != null) {
                LOG.trace("Existing DPN info list in the Map: {} ", dpnID);
                tunnelEndPointsList.add(tunnelEndPoints);
            } else {
                LOG.trace("Adding new DPN info list to the Map: {} ", dpnID);
                tunnelEndPointsList = new ArrayList<>();
                tunnelEndPointsList.add(tunnelEndPoints);
                mapDPNToTunnelEndpt.put(dpnID, tunnelEndPointsList);
            }
        }
    }
    if (!mapDPNToTunnelEndpt.isEmpty()) {
        LOG.trace("List of dpns in the Map: {} ", mapDPNToTunnelEndpt.keySet());
        for (Entry<Uint64, List<TunnelEndPoints>> entry : mapDPNToTunnelEndpt.entrySet()) {
            DPNTEPsInfo newDpnTepsInfo = ItmUtils.createDPNTepInfo(entry.getKey(), entry.getValue());
            dpnTepInfo.add(newDpnTepsInfo);
        }
    }
    return dpnTepInfo;
}
Also used : VtepsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.VtepsKey) DeviceVtepsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.DeviceVtepsKey) UnknownVtepsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.tepsinnothostedtransportzone.UnknownVtepsKey) ArrayList(java.util.ArrayList) TzMembership(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.tunnel.end.points.TzMembership) TunnelEndPoints(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPoints) UnknownVteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.tepsinnothostedtransportzone.UnknownVteps) Vteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Vteps) DeviceVteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.DeviceVteps) List(java.util.List) ArrayList(java.util.ArrayList) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) DPNTEPsInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo) Nullable(org.eclipse.jdt.annotation.Nullable) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Example 15 with Transport

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project genius by opendaylight.

the class OvsdbTepAddConfigHelper method addUnknownTzTepIntoTepsNotHosted.

/**
 * Adds the TEP into Vtep list in the subnet list in the transport zone list
 * from ITM operational Datastore by merge operation with write transaction.
 *
 * @param tzName transport zone name in string
 * @param tepIpAddress TEP IP address in IpAddress object
 * @param dpid bridge datapath ID
 * @param ofTunnel boolean flag for TEP to enable/disable of-tunnel feature on it
 * @param dataBroker data broker handle to perform operations on operational datastore
 * @param tx TypedWriteTransaction object
 */
protected static void addUnknownTzTepIntoTepsNotHosted(String tzName, IpAddress tepIpAddress, Uint64 dpid, boolean ofTunnel, DataBroker dataBroker, TypedWriteTransaction<Datastore.Operational> tx) {
    Map<UnknownVtepsKey, UnknownVteps> vtepList;
    TepsInNotHostedTransportZone tepsInNotHostedTransportZone = ItmUtils.getUnknownTransportZoneFromITMOperDS(tzName, dataBroker);
    if (tepsInNotHostedTransportZone == null) {
        LOG.trace("Unhosted TransportZone ({}) does not exist in OperDS.", tzName);
        vtepList = new HashMap<>();
        addVtepIntoTepsNotHosted(addVtepToUnknownVtepsList(vtepList, tepIpAddress, dpid, ofTunnel), tzName, tx);
    } else {
        vtepList = tepsInNotHostedTransportZone.getUnknownVteps();
        if (vtepList == null || vtepList.isEmpty()) {
            // case: vtep list does not exist or it has no elements
            if (vtepList == null) {
                LOG.trace("Add TEP into unhosted TZ ({}) when no vtep-list in the TZ.", tzName);
                vtepList = new HashMap<>();
            }
            LOG.trace("Add TEP into unhosted TZ ({}) when no vtep-list in the TZ.", tzName);
            addVtepIntoTepsNotHosted(addVtepToUnknownVtepsList(vtepList, tepIpAddress, dpid, ofTunnel), tzName, tx);
        } else {
            // case: vtep list has elements
            boolean vtepFound = false;
            UnknownVteps oldVtep = null;
            for (UnknownVteps vtep : vtepList.values()) {
                if (Objects.equals(vtep.getDpnId(), dpid)) {
                    vtepFound = true;
                    oldVtep = vtep;
                    break;
                }
            }
            if (!vtepFound) {
                addVtepIntoTepsNotHosted(addVtepToUnknownVtepsList(vtepList, tepIpAddress, dpid, ofTunnel), tzName, tx);
            } else {
                // vtep is found, update it with tep-ip
                vtepList.remove(oldVtep.key());
                addVtepIntoTepsNotHosted(addVtepToUnknownVtepsList(vtepList, tepIpAddress, dpid, ofTunnel), tzName, tx);
            }
        }
    }
}
Also used : TepsInNotHostedTransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.TepsInNotHostedTransportZone) UnknownVteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.tepsinnothostedtransportzone.UnknownVteps) UnknownVtepsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.tepsinnothostedtransportzone.UnknownVtepsKey)

Aggregations

ArrayList (java.util.ArrayList)24 UnknownVteps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.tepsinnothostedtransportzone.UnknownVteps)24 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)24 TepsInNotHostedTransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.TepsInNotHostedTransportZone)21 UnknownVtepsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.tepsinnothostedtransportzone.UnknownVtepsKey)20 Vteps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Vteps)17 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)16 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)16 TransportZoneKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)15 List (java.util.List)13 VtepsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.VtepsKey)13 DataBroker (org.opendaylight.mdsal.binding.api.DataBroker)12 TransportZones (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones)12 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)12 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)11 Map (java.util.Map)11 Test (org.junit.Test)11 TepsInNotHostedTransportZoneKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.TepsInNotHostedTransportZoneKey)11 Optional (java.util.Optional)10 Inject (javax.inject.Inject)10