Search in sources :

Example 1 with InterfaceChildEntryBuilder

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

the class InterfaceManagerCommonUtils method createInterfaceChildEntry.

private void createInterfaceChildEntry(String parentInterface, String childInterface, Consumer<Pair<InstanceIdentifier<InterfaceChildEntry>, InterfaceChildEntry>> writer) {
    InterfaceParentEntryKey interfaceParentEntryKey = new InterfaceParentEntryKey(parentInterface);
    InterfaceChildEntryKey interfaceChildEntryKey = new InterfaceChildEntryKey(childInterface);
    InstanceIdentifier<InterfaceChildEntry> interfaceChildEntryIdentifier = InterfaceMetaUtils.getInterfaceChildEntryIdentifier(interfaceParentEntryKey, interfaceChildEntryKey);
    InterfaceChildEntry interfaceChildEntry = new InterfaceChildEntryBuilder().setKey(interfaceChildEntryKey).setChildInterface(childInterface).build();
    writer.accept(Pair.of(interfaceChildEntryIdentifier, interfaceChildEntry));
}
Also used : InterfaceParentEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntryKey) 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)

Example 2 with InterfaceChildEntryBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntryBuilder 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)

Aggregations

InterfaceChildEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntry)2 InterfaceChildEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntryBuilder)2 InterfaceChildEntryKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntryKey)2 BigInteger (java.math.BigInteger)1 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)1 InterfaceParentEntryKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntryKey)1 Bucket (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket)1