Search in sources :

Example 1 with ExternalTeps

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.elan.instance.ExternalTeps in project netvirt by opendaylight.

the class ElanExtnTepListener method updateElanRemoteBroadCastGroup.

@SuppressWarnings("checkstyle:IllegalCatch")
private void updateElanRemoteBroadCastGroup(final InstanceIdentifier<ExternalTeps> iid) {
    String elanName = iid.firstKeyOf(ElanInstance.class).getElanInstanceName();
    ElanInstance elanInfo = elanInstanceCache.get(elanName).orNull();
    if (elanInfo == null) {
        return;
    }
    jobCoordinator.enqueueJob(elanName, () -> {
        SettableFuture<Void> ft = SettableFuture.create();
        try {
            // TODO make the following method return ft
            elanL2GatewayMulticastUtils.updateRemoteBroadcastGroupForAllElanDpns(elanInfo);
            ft.set(null);
        } catch (Exception e) {
            // since the above method does a sync write , if it fails there was no retry
            // by setting the above mdsal exception in ft, and returning the ft makes sures that job is retried
            ft.setException(e);
        }
        return Lists.newArrayList(ft);
    }, ElanConstants.JOB_MAX_RETRIES);
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)

Example 2 with ExternalTeps

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.elan.instance.ExternalTeps in project netvirt by opendaylight.

the class ElanL2GatewayMulticastUtils method getRemoteBCGroupBucketsOfElanExternalTeps.

public List<Bucket> getRemoteBCGroupBucketsOfElanExternalTeps(ElanInstance elanInfo, BigInteger dpnId, int bucketId) {
    ElanInstance operElanInstance = null;
    try {
        operElanInstance = new SingleTransactionDataBroker(broker).syncReadOptional(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class, elanInfo.getKey()).build()).orNull();
    } catch (ReadFailedException e) {
        LOG.error("Failed to read elan instance operational path {}", elanInfo, e);
        return emptyList();
    }
    if (operElanInstance == null) {
        return emptyList();
    }
    List<ExternalTeps> teps = operElanInstance.getExternalTeps();
    if (teps == null || teps.isEmpty()) {
        return emptyList();
    }
    List<Bucket> listBucketInfo = new ArrayList<>();
    for (ExternalTeps tep : teps) {
        String externalTep = tep.getNodeid() != null ? tep.getNodeid() : tep.getTepIp().toString();
        String interfaceName = elanItmUtils.getExternalTunnelInterfaceName(String.valueOf(dpnId), externalTep);
        if (interfaceName == null) {
            LOG.error("Could not get interface name to ext tunnel {} {}", dpnId, tep.getTepIp());
            continue;
        }
        List<Action> listActionInfo = elanItmUtils.buildTunnelItmEgressActions(interfaceName, elanUtils.getVxlanSegmentationId(elanInfo));
        listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
        bucketId++;
    }
    return listBucketInfo;
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) ExternalTeps(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.elan.instance.ExternalTeps) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) ArrayList(java.util.ArrayList) SingleTransactionDataBroker(org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker) ElanInstances(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInstances)

Example 3 with ExternalTeps

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.elan.instance.ExternalTeps in project netvirt by opendaylight.

the class BgpUtil method addTepToElanInstance.

public void addTepToElanInstance(String rd, String tepIp) {
    if (rd == null || tepIp == null) {
        LOG.error("addTepToElanInstance : Null parameters returning");
        return;
    }
    String elanName = getElanNamefromRd(rd);
    if (elanName == null) {
        LOG.error("Elan null while processing RT2 for RD {}", rd);
        return;
    }
    LOG.debug("Adding tepIp {} to elan {}", tepIp, elanName);
    InstanceIdentifier<ExternalTeps> externalTepsId = getExternalTepsIdentifier(elanName, tepIp);
    ExternalTepsBuilder externalTepsBuilder = new ExternalTepsBuilder();
    ExternalTepsKey externalTepsKey = externalTepsId.firstKeyOf(ExternalTeps.class);
    externalTepsBuilder.setKey(externalTepsKey);
    externalTepsBuilder.setTepIp(externalTepsKey.getTepIp());
    update(externalTepsId, externalTepsBuilder.build());
}
Also used : ExternalTeps(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.elan.instance.ExternalTeps) ExternalTepsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.elan.instance.ExternalTepsKey) ExternalTepsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.elan.instance.ExternalTepsBuilder)

Aggregations

ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)2 ExternalTeps (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.elan.instance.ExternalTeps)2 ArrayList (java.util.ArrayList)1 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)1 SingleTransactionDataBroker (org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker)1 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)1 Bucket (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket)1 ElanInstances (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInstances)1 ExternalTepsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.elan.instance.ExternalTepsBuilder)1 ExternalTepsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.elan.instance.ExternalTepsKey)1