Search in sources :

Example 36 with Tunnel

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.Tunnel in project genius by opendaylight.

the class ItmInternalTunnelDeleteWorker method removeTrunkInterface.

private void removeTrunkInterface(TunnelEndPoints srcTep, TunnelEndPoints dstTep, BigInteger srcDpnId, BigInteger dstDpnId, WriteTransaction transaction) {
    String trunkfwdIfName = ItmUtils.getTrunkInterfaceName(srcTep.getInterfaceName(), new String(srcTep.getIpAddress().getValue()), new String(dstTep.getIpAddress().getValue()), srcTep.getTunnelType().getName());
    LOG.trace("Removing forward Trunk Interface {}", trunkfwdIfName);
    InstanceIdentifier<Interface> trunkIdentifier = ItmUtils.buildId(trunkfwdIfName);
    LOG.debug(" Removing Trunk Interface Name - {} , Id - {} from Config DS ", trunkfwdIfName, trunkIdentifier);
    transaction.delete(LogicalDatastoreType.CONFIGURATION, trunkIdentifier);
    ItmUtils.ITM_CACHE.removeInterface(trunkfwdIfName);
    // also update itm-state ds -- Delete the forward tunnel-interface from the tunnel list
    InstanceIdentifier<InternalTunnel> path = InstanceIdentifier.create(TunnelList.class).child(InternalTunnel.class, new InternalTunnelKey(dstDpnId, srcDpnId, srcTep.getTunnelType()));
    transaction.delete(LogicalDatastoreType.CONFIGURATION, path);
    ItmUtils.ITM_CACHE.removeInternalTunnel(trunkfwdIfName);
    // Release the Ids for the forward trunk interface Name
    ItmUtils.releaseIdForTrunkInterfaceName(srcTep.getInterfaceName(), new String(srcTep.getIpAddress().getValue()), new String(dstTep.getIpAddress().getValue()), srcTep.getTunnelType().getName());
    removeLogicalGroupTunnel(srcDpnId, dstDpnId);
    String trunkRevIfName = ItmUtils.getTrunkInterfaceName(dstTep.getInterfaceName(), new String(dstTep.getIpAddress().getValue()), new String(srcTep.getIpAddress().getValue()), srcTep.getTunnelType().getName());
    LOG.trace("Removing Reverse Trunk Interface {}", trunkRevIfName);
    trunkIdentifier = ItmUtils.buildId(trunkRevIfName);
    LOG.debug(" Removing Trunk Interface Name - {} , Id - {} from Config DS ", trunkRevIfName, trunkIdentifier);
    transaction.delete(LogicalDatastoreType.CONFIGURATION, trunkIdentifier);
    ItmUtils.ITM_CACHE.removeInternalTunnel(trunkRevIfName);
    // also update itm-state ds -- Delete the reverse tunnel-interface from the tunnel list
    path = InstanceIdentifier.create(TunnelList.class).child(InternalTunnel.class, new InternalTunnelKey(srcDpnId, dstDpnId, dstTep.getTunnelType()));
    transaction.delete(LogicalDatastoreType.CONFIGURATION, path);
    // Release the Ids for the reverse trunk interface Name
    ItmUtils.releaseIdForTrunkInterfaceName(dstTep.getInterfaceName(), new String(dstTep.getIpAddress().getValue()), new String(srcTep.getIpAddress().getValue()), dstTep.getTunnelType().getName());
    removeLogicalGroupTunnel(dstDpnId, srcDpnId);
}
Also used : InternalTunnelKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnelKey) TunnelList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.TunnelList) InternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnel) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)

Example 37 with Tunnel

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.Tunnel in project genius by opendaylight.

the class ItmMonitorIntervalWorker method toggle.

private void toggle(String tunnelInterfaceName, WriteTransaction transaction) {
    if (tunnelInterfaceName != null) {
        LOG.debug("tunnel {} will have monitor interval {}", tunnelInterfaceName, interval);
        InstanceIdentifier<IfTunnel> trunkIdentifier = ItmUtils.buildTunnelId(tunnelInterfaceName);
        IfTunnel tunnel = new IfTunnelBuilder().setMonitorInterval(interval.longValue()).build();
        transaction.merge(LogicalDatastoreType.CONFIGURATION, trunkIdentifier, tunnel);
    }
}
Also used : IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) IfTunnelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnelBuilder)

Example 38 with Tunnel

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.Tunnel in project genius by opendaylight.

the class ItmMonitorIntervalWorker method toggleTunnelMonitoring.

private void toggleTunnelMonitoring(WriteTransaction transaction) {
    List<String> tunnelList = ItmUtils.getInternalTunnelInterfaces(dataBroker);
    LOG.debug("ItmMonitorIntervalWorker toggleTunnelMonitoring: List of tunnel interfaces: {}", tunnelList);
    InstanceIdentifier<TunnelMonitorInterval> iid = InstanceIdentifier.builder(TunnelMonitorInterval.class).build();
    TunnelMonitorInterval intervalBuilder = new TunnelMonitorIntervalBuilder().setInterval(interval).build();
    ItmUtils.asyncUpdate(LogicalDatastoreType.OPERATIONAL, iid, intervalBuilder, dataBroker, ItmUtils.DEFAULT_CALLBACK);
    for (String tunnel : tunnelList) {
        toggle(tunnel, transaction);
    }
}
Also used : TunnelMonitorIntervalBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorIntervalBuilder) TunnelMonitorInterval(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorInterval)

Example 39 with Tunnel

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.Tunnel in project genius by opendaylight.

the class ItmMonitorToggleWorker method toggle.

private void toggle(String tunnelInterfaceName, WriteTransaction transaction) {
    if (tunnelInterfaceName != null) {
        InstanceIdentifier<IfTunnel> trunkIdentifier = ItmUtils.buildTunnelId(tunnelInterfaceName);
        LOG.debug("TunnelMonitorToggleWorker: tunnelInterfaceName: {}, monitorProtocol = {},  " + "monitorEnable = {} ", tunnelInterfaceName, monitorProtocol, enabled);
        IfTunnel tunnel = new IfTunnelBuilder().setMonitorEnabled(enabled).setMonitorProtocol(monitorProtocol).build();
        transaction.merge(LogicalDatastoreType.CONFIGURATION, trunkIdentifier, tunnel);
    }
}
Also used : IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) IfTunnelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnelBuilder)

Example 40 with Tunnel

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.Tunnel in project genius by opendaylight.

the class ItmTunnelAggregationHelper method updateTunnelAggregationGroup.

private void updateTunnelAggregationGroup(InterfaceParentEntry parentEntry) {
    String logicTunnelName = parentEntry.getParentInterface();
    InternalTunnel logicInternalTunnel = ItmUtils.ITM_CACHE.getInternalTunnel(logicTunnelName);
    if (logicInternalTunnel == null) {
        LOG.debug("MULTIPLE_VxLAN_TUNNELS: {} not found in internal tunnels list", logicTunnelName);
        return;
    }
    InterfaceInfo ifLogicTunnel = interfaceManager.getInterfaceInfoFromOperationalDataStore(logicTunnelName);
    long groupId = ifLogicTunnel != null ? interfaceManager.getLogicalTunnelSelectGroupId(ifLogicTunnel.getInterfaceTag()) : INVALID_ID;
    BigInteger srcDpnId = logicInternalTunnel.getSourceDPN();
    List<Bucket> listBuckets = new ArrayList<>();
    List<InterfaceChildEntry> interfaceChildEntries = parentEntry.getInterfaceChildEntry();
    if (interfaceChildEntries == null || interfaceChildEntries.isEmpty()) {
        LOG.debug("MULTIPLE_VxLAN_TUNNELS: empty child list in group {}", parentEntry.getParentInterface());
        return;
    }
    for (InterfaceChildEntry interfaceChildEntry : interfaceChildEntries) {
        String curChildName = interfaceChildEntry.getChildInterface();
        org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface childIface = ItmUtils.getInterface(curChildName, interfaceManager);
        IfTunnel ifTunnel = childIface != null ? childIface.getAugmentation(IfTunnel.class) : null;
        if (ifTunnel == null || !ifTunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeVxlan.class)) {
            LOG.debug("MULTIPLE_VxLAN_TUNNELS: not tunnel interface {} found in group {}", curChildName, logicTunnelName);
            continue;
        }
        ParentRefs parentRefs = childIface.getAugmentation(ParentRefs.class);
        if (parentRefs == null) {
            LOG.debug("MULTIPLE_VxLAN_TUNNELS: parent refs not specified for interface {} in group {}", curChildName, logicTunnelName);
            continue;
        }
        InterfaceInfo ifInfo = interfaceManager.getInterfaceInfoFromOperationalDataStore(curChildName);
        if (ifInfo == null) {
            LOG.debug("MULTIPLE_VxLAN_TUNNELS: interface state not found for {} in groupId {}", curChildName, groupId);
            continue;
        }
        int bucketId = interfaceChildEntries.indexOf(interfaceChildEntry);
        LOG.debug("MULTIPLE_VxLAN_TUNNELS: updateTunnelAggregationGroup - add bucketId {} to groupId {}", bucketId, groupId);
        listBuckets.add(createBucket(curChildName, ifTunnel, bucketId, ifInfo.getPortNo()));
    }
    if (!listBuckets.isEmpty()) {
        Group group = MDSALUtil.buildGroup(groupId, logicTunnelName, GroupTypes.GroupSelect, MDSALUtil.buildBucketLists(listBuckets));
        mdsalManager.syncInstallGroup(srcDpnId, group);
    }
}
Also used : TunnelTypeLogicalGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeLogicalGroup) Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) ArrayList(java.util.ArrayList) IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) InternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnel) ParentRefs(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) InterfaceChildEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntry) BigInteger(java.math.BigInteger) InterfaceInfo(org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)

Aggregations

ArrayList (java.util.ArrayList)61 ExecutionException (java.util.concurrent.ExecutionException)48 BigInteger (java.math.BigInteger)42 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)37 IfTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel)28 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)26 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)25 TunnelTypeVxlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)25 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)23 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)22 List (java.util.List)21 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)21 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)21 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)20 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction)18 Logger (org.slf4j.Logger)18 LoggerFactory (org.slf4j.LoggerFactory)18 Inject (javax.inject.Inject)17 Singleton (javax.inject.Singleton)17 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)17