Search in sources :

Example 1 with EtreeInstance

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance in project netvirt by opendaylight.

the class ElanInterfaceManager method setupLeavesLocalBroadcastGroups.

private void setupLeavesLocalBroadcastGroups(ElanInstance elanInfo, DpnInterfaces newDpnInterface, InterfaceInfo interfaceInfo) {
    EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
    if (etreeInstance != null) {
        List<Bucket> listBucket = new ArrayList<>();
        int bucketId = 0;
        List<String> interfaces = new ArrayList<>();
        if (newDpnInterface != null) {
            interfaces = newDpnInterface.getInterfaces();
        }
        for (String ifName : interfaces) {
            // In case if there is a InterfacePort in the cache which is not
            // in
            // operational state, skip processing it
            InterfaceInfo ifInfo = interfaceManager.getInterfaceInfoFromOperationalDataStore(ifName, interfaceInfo.getInterfaceType());
            if (!isOperational(ifInfo)) {
                continue;
            }
            if (!interfaceManager.isExternalInterface(ifName)) {
                // only add root interfaces
                bucketId = addInterfaceIfRootInterface(bucketId, ifName, listBucket, ifInfo);
            }
        }
        if (listBucket.isEmpty()) {
            // No Buckets
            createDropBucket(listBucket);
        }
        long etreeLeafTag = etreeInstance.getEtreeLeafTagVal().getValue();
        long groupId = ElanUtils.getEtreeLeafLocalBCGId(etreeLeafTag);
        Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBucket));
        LOG.trace("installing the localBroadCast Group:{}", group);
        mdsalManager.syncInstallGroup(interfaceInfo.getDpId(), group);
    }
}
Also used : ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) ArrayList(java.util.ArrayList) EtreeInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance) InterfaceInfo(org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)

Example 2 with EtreeInstance

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance in project netvirt by opendaylight.

the class ElanInterfaceManager method removeLeavesLocalBroadcastGroup.

private void removeLeavesLocalBroadcastGroup(ElanInstance elanInfo, InterfaceInfo interfaceInfo, WriteTransaction deleteFlowGroupTx) {
    EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
    if (etreeInstance != null) {
        BigInteger dpnId = interfaceInfo.getDpId();
        long groupId = ElanUtils.getEtreeLeafLocalBCGId(etreeInstance.getEtreeLeafTagVal().getValue());
        List<Bucket> listBuckets = new ArrayList<>();
        int bucketId = 0;
        listBuckets.add(getLocalBCGroupBucketInfo(interfaceInfo, bucketId));
        Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBuckets));
        LOG.trace("deleted the localBroadCast Group:{}", group);
        mdsalManager.removeGroupToTx(dpnId, group, deleteFlowGroupTx);
    }
}
Also used : ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) ArrayList(java.util.ArrayList) EtreeInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance) BigInteger(java.math.BigInteger)

Example 3 with EtreeInstance

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance in project netvirt by opendaylight.

the class ElanServiceProvider method createEtreeInstance.

@Override
public boolean createEtreeInstance(String elanInstanceName, long macTimeout, String description) {
    Optional<ElanInstance> existingElanInstance = elanInstanceCache.get(elanInstanceName);
    boolean isSuccess = true;
    if (existingElanInstance.isPresent()) {
        if (compareWithExistingElanInstance(existingElanInstance.get(), macTimeout, description)) {
            LOG.warn("Etree Instance is already present in the Operational DS {}", existingElanInstance);
            return true;
        } else {
            EtreeInstance etreeInstance = new EtreeInstanceBuilder().build();
            ElanInstance updateElanInstance = new ElanInstanceBuilder().setElanInstanceName(elanInstanceName).setDescription(description).setMacTimeout(macTimeout).setKey(new ElanInstanceKey(elanInstanceName)).addAugmentation(EtreeInstance.class, etreeInstance).build();
            MDSALUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION, ElanHelper.getElanInstanceConfigurationDataPath(elanInstanceName), updateElanInstance);
            LOG.debug("Updating the Etree Instance {} with MAC TIME-OUT {} and Description {} ", updateElanInstance, macTimeout, description);
        }
    } else {
        EtreeInstance etreeInstance = new EtreeInstanceBuilder().build();
        ElanInstance elanInstance = new ElanInstanceBuilder().setElanInstanceName(elanInstanceName).setMacTimeout(macTimeout).setDescription(description).setKey(new ElanInstanceKey(elanInstanceName)).addAugmentation(EtreeInstance.class, etreeInstance).build();
        MDSALUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION, ElanHelper.getElanInstanceConfigurationDataPath(elanInstanceName), elanInstance);
        LOG.debug("Creating the new Etree Instance {}", elanInstance);
    }
    return isSuccess;
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) EtreeInstanceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstanceBuilder) ElanInstanceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey) EtreeInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance) ElanInstanceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder)

Example 4 with EtreeInstance

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance in project netvirt by opendaylight.

the class ElanL2GatewayMulticastUtils method setupLeavesEtreeBroadcastGroups.

public void setupLeavesEtreeBroadcastGroups(ElanInstance elanInfo, DpnInterfaces dpnInterfaces, BigInteger dpnId) {
    EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
    if (etreeInstance != null) {
        long etreeLeafTag = etreeInstance.getEtreeLeafTagVal().getValue();
        List<Bucket> listBucket = new ArrayList<>();
        int bucketId = 0;
        int actionKey = 0;
        List<Action> listAction = new ArrayList<>();
        listAction.add(new ActionGroup(ElanUtils.getEtreeLeafLocalBCGId(etreeLeafTag)).buildAction(++actionKey));
        listBucket.add(MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
        bucketId++;
        List<Bucket> listBucketInfoRemote = getRemoteBCGroupBuckets(elanInfo, dpnInterfaces, dpnId, bucketId, etreeLeafTag);
        listBucket.addAll(listBucketInfoRemote);
        long groupId = ElanUtils.getEtreeLeafRemoteBCGId(etreeLeafTag);
        Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBucket));
        LOG.trace("Installing the remote BroadCast Group:{}", group);
        mdsalManager.syncInstallGroup(dpnId, group);
    }
}
Also used : ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) 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) ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) ArrayList(java.util.ArrayList) EtreeInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)

Example 5 with EtreeInstance

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance in project netvirt by opendaylight.

the class EtreeGet method doExecute.

@Override
protected Object doExecute() {
    LOG.debug("Executing Get EtreeInstance command for {}", etreeName);
    if (etreeName != null) {
        ElanInstance elanInstance = elanProvider.getElanInstance(etreeName);
        if (elanInstance == null || elanInstance.getAugmentation(EtreeInstance.class) == null) {
            session.getConsole().println("No Etree Instance present with name:" + etreeName);
        } else {
            session.getConsole().println(getEtreeHeaderOutput());
            session.getConsole().println(String.format(ElanCLIUtils.ETREE_CLI_FORMAT, elanInstance.getElanInstanceName(), elanInstance.getMacTimeout(), elanInstance.getElanTag(), elanInstance.getDescription()));
        }
    } else {
        List<ElanInstance> elanInstanceList = elanProvider.getElanInstances();
        if (elanInstanceList != null && !elanInstanceList.isEmpty()) {
            session.getConsole().println(getEtreeHeaderOutput());
            for (ElanInstance elanInstance : elanInstanceList) {
                if (elanInstance.getAugmentation(EtreeInstance.class) != null) {
                    session.getConsole().println(String.format(ElanCLIUtils.ETREE_INTERFACE_CLI_FORMAT, elanInstance.getElanInstanceName(), elanInstance.getMacTimeout(), elanInstance.getElanTag(), elanInstance.getAugmentation(EtreeInstance.class).getEtreeLeafTagVal().getValue(), elanInstance.getDescription()));
                }
            }
        } else {
            session.getConsole().println("No Etree Instances are present");
        }
    }
    return null;
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) EtreeInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance)

Aggregations

EtreeInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance)8 ArrayList (java.util.ArrayList)4 ActionGroup (org.opendaylight.genius.mdsalutil.actions.ActionGroup)4 Bucket (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket)4 Group (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group)4 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)3 BigInteger (java.math.BigInteger)2 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)2 EtreeInstanceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstanceBuilder)2 ElanInstanceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder)2 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)1 EtreeLeafTag (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTag)1 EtreeLeafTagName (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTagName)1 EtreeLeafTagNameBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTagNameBuilder)1 MacTable (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.forwarding.tables.MacTable)1 MacTableBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.forwarding.tables.MacTableBuilder)1 MacTableKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.forwarding.tables.MacTableKey)1 ElanInstanceKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey)1 Elan (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan)1 ElanBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.ElanBuilder)1