Search in sources :

Example 6 with InterfaceParentEntry

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntry in project genius by opendaylight.

the class ItmTunnelAggregationHelper method updateLogicalTunnelSelectGroup.

public void updateLogicalTunnelSelectGroup(InterfaceParentEntry entry, DataBroker broker) {
    String logicTunnelName = entry.getParentInterface();
    org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface ifaceConfig = ItmUtils.getInterface(logicTunnelName, interfaceManager);
    if (ifaceConfig == null || !ifaceConfig.getType().isAssignableFrom(Tunnel.class)) {
        return;
    }
    IfTunnel ifTunnel = ifaceConfig.getAugmentation(IfTunnel.class);
    if (!ifTunnel.getTunnelInterfaceType().isAssignableFrom(TunnelTypeLogicalGroup.class)) {
        return;
    }
    LOG.debug("MULTIPLE_VxLAN_TUNNELS: updateLogicalTunnelSelectGroup name {}", logicTunnelName);
    TunnelAggregationUpdateWorker worker = new TunnelAggregationUpdateWorker(null, null, ifaceConfig, entry, MOD_GROUP_TUNNEL, broker);
    jobCoordinator.enqueueJob(logicTunnelName, worker);
}
Also used : TunnelTypeLogicalGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeLogicalGroup) IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel)

Example 7 with InterfaceParentEntry

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntry in project genius by opendaylight.

the class ItmTunnelAggregationHelper method updateTunnelAggregationGroupBucket.

private void updateTunnelAggregationGroupBucket(Interface ifaceState, IfTunnel ifTunnel, ParentRefs parentRefs, InterfaceParentEntry groupParentEntry, int action, WriteTransaction tx) {
    String logicTunnelName = parentRefs.getParentInterface();
    List<InterfaceChildEntry> interfaceChildEntries = groupParentEntry.getInterfaceChildEntry();
    if (interfaceChildEntries == null) {
        LOG.debug("MULTIPLE_VxLAN_TUNNELS: empty child list in group {}", groupParentEntry.getParentInterface());
        return;
    }
    String ifaceName = ifaceState.getName();
    InterfaceChildEntry childEntry = new InterfaceChildEntryBuilder().setChildInterface(ifaceName).setKey(new InterfaceChildEntryKey(ifaceName)).build();
    int bucketId = interfaceChildEntries.indexOf(childEntry);
    if (bucketId == -1) {
        LOG.debug("MULTIPLE_VxLAN_TUNNELS: wrong child id for {} in group {}", ifaceName, groupParentEntry.getParentInterface());
        return;
    }
    InterfaceInfo ifLogicTunnel = interfaceManager.getInterfaceInfoFromOperationalDataStore(logicTunnelName);
    long groupId = ifLogicTunnel != null ? interfaceManager.getLogicalTunnelSelectGroupId(ifLogicTunnel.getInterfaceTag()) : INVALID_ID;
    if (groupId == INVALID_ID) {
        LOG.warn("MULTIPLE_VxLAN_TUNNELS: unknown group id for logic tunnel {}", logicTunnelName);
        return;
    }
    // openflow:dpnid:portnum
    String lowerLayerIf = ifaceState.getLowerLayerIf().get(0);
    String[] split = lowerLayerIf.split(IfmConstants.OF_URI_SEPARATOR);
    BigInteger srcDpnId = new BigInteger(split[1]);
    int portNumber = Integer.parseInt(split[2]);
    if (action == ADD_TUNNEL) {
        if (!mdsalManager.groupExists(srcDpnId, groupId)) {
            createLogicalTunnelSelectGroup(srcDpnId, logicTunnelName, ifLogicTunnel.getInterfaceTag());
        }
        Bucket buckt = createBucket(ifaceName, ifTunnel, bucketId, portNumber);
        LOG.debug("MULTIPLE_VxLAN_TUNNELS: add bucketId {} to groupId {}", bucketId, groupId);
        mdsalManager.addBucketToTx(srcDpnId, groupId, buckt, tx);
    } else {
        LOG.debug("MULTIPLE_VxLAN_TUNNELS: remove bucketId {} from groupId {}", bucketId, groupId);
        mdsalManager.removeBucketToTx(srcDpnId, groupId, bucketId, tx);
    }
}
Also used : Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) InterfaceChildEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntryBuilder) InterfaceChildEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntryKey) 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)

Example 8 with InterfaceParentEntry

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntry in project genius by opendaylight.

the class ItmTunnelAggregationHelper method getAggregatedOperStatus.

private OperStatus getAggregatedOperStatus(Interface ifaceState, InterfaceParentEntry parentEntry) {
    String logicalTunnelName = parentEntry.getParentInterface();
    if (!logicalTunnelName.equals(ifaceState.getName()) && ifaceState.getOperStatus() == OperStatus.Up) {
        return OperStatus.Up;
    }
    List<InterfaceChildEntry> interfaceChildEntries = parentEntry.getInterfaceChildEntry();
    if (interfaceChildEntries == null || interfaceChildEntries.isEmpty()) {
        LOG.debug("MULTIPLE_VxLAN_TUNNELS: OperStatus is Down, because of the empty child list in group {}", parentEntry.getParentInterface());
        return OperStatus.Down;
    }
    for (InterfaceChildEntry interfaceChildEntry : interfaceChildEntries) {
        String curChildInterface = interfaceChildEntry.getChildInterface();
        if (!curChildInterface.equals(ifaceState.getName())) {
            InterfaceInfo ifInfo = interfaceManager.getInterfaceInfoFromOperationalDataStore(curChildInterface);
            if (ifInfo != null && InterfaceInfo.InterfaceOpState.UP.equals(ifInfo.getOpState())) {
                return OperStatus.Up;
            }
        }
    }
    return OperStatus.Down;
}
Also used : InterfaceChildEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntry) InterfaceInfo(org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)

Example 9 with InterfaceParentEntry

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntry in project genius by opendaylight.

the class ItmTunnelAggregationHelper method updateLogicalTunnelGroupOperStatus.

private void updateLogicalTunnelGroupOperStatus(String logicalTunnelIfaceName, Interface ifaceState, InterfaceParentEntry parentEntry, ReadWriteTransaction tx) throws ReadFailedException {
    if (parentEntry == null) {
        LOG.debug("MULTIPLE_VxLAN_TUNNELS: uninitialized parent entry {}", logicalTunnelIfaceName);
        return;
    }
    OperStatus newOperStatus = getAggregatedOperStatus(ifaceState, parentEntry);
    if (logicalTunnelIfaceName.equals(ifaceState.getName())) {
        // the current interface is logical tunnel itself
        if (ifaceState.getOperStatus() != newOperStatus) {
            updateInterfaceOperStatus(logicalTunnelIfaceName, ifaceState, newOperStatus, tx);
        }
    } else {
        InterfaceInfo ifLogicInfo = interfaceManager.getInterfaceInfoFromOperationalDataStore(logicalTunnelIfaceName);
        if (isLogicalTunnelStateUpdateNeeded(newOperStatus, ifLogicInfo)) {
            InstanceIdentifier<Interface> id = ItmUtils.buildStateInterfaceId(logicalTunnelIfaceName);
            Optional<Interface> ifState = tx.read(LogicalDatastoreType.OPERATIONAL, id).checkedGet();
            if (ifState.isPresent()) {
                Interface ifStateLogicTunnel = ifState.get();
                updateInterfaceOperStatus(logicalTunnelIfaceName, ifStateLogicTunnel, newOperStatus, tx);
            }
        }
    }
}
Also used : OperStatus(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus) InterfaceInfo(org.opendaylight.genius.interfacemanager.globals.InterfaceInfo) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface)

Example 10 with InterfaceParentEntry

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntry in project genius by opendaylight.

the class InterfaceManagerCommonUtils method deleteParentInterfaceEntry.

public boolean deleteParentInterfaceEntry(String parentInterface) {
    if (parentInterface == null) {
        return false;
    }
    InterfaceParentEntryKey interfaceParentEntryKey = new InterfaceParentEntryKey(parentInterface);
    InstanceIdentifier<InterfaceParentEntry> interfaceParentEntryIdentifier = InterfaceMetaUtils.getInterfaceParentEntryIdentifier(interfaceParentEntryKey);
    batchingUtils.delete(interfaceParentEntryIdentifier, BatchingUtils.EntityType.DEFAULT_CONFIG);
    return true;
}
Also used : InterfaceParentEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntryKey) InterfaceParentEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntry)

Aggregations

InterfaceParentEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntry)8 InterfaceChildEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntry)7 InterfaceParentEntryKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntryKey)6 BigInteger (java.math.BigInteger)4 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)4 ArrayList (java.util.ArrayList)3 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)3 OperStatus (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus)2 InterfaceChildEntryKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntryKey)2 IfTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel)2 ParentRefs (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs)2 TunnelTypeLogicalGroup (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeLogicalGroup)2 Bucket (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket)2 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 Collections (java.util.Collections)1 List (java.util.List)1 Inject (javax.inject.Inject)1 Singleton (javax.inject.Singleton)1 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)1 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)1