Search in sources :

Example 6 with EtreeLeafTag

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

the class ElanDmacUtils method buildEtreeDmacFlowForExternalRemoteMacWithBatch.

private ListenableFuture<Void> buildEtreeDmacFlowForExternalRemoteMacWithBatch(BigInteger dpnId, String extDeviceNodeId, Long vni, String macAddress, String displayName, String interfaceName, EtreeLeafTagName etreeLeafTag) {
    boolean isRoot;
    if (interfaceName == null) {
        isRoot = true;
    } else {
        Optional<EtreeInterface> etreeInterface = elanInterfaceCache.getEtreeInterface(interfaceName);
        isRoot = etreeInterface.isPresent() ? etreeInterface.get().getEtreeInterfaceType() == EtreeInterface.EtreeInterfaceType.Root : false;
    }
    if (isRoot) {
        Flow flow = buildDmacFlowForExternalRemoteMac(dpnId, extDeviceNodeId, etreeLeafTag.getEtreeLeafTag().getValue(), vni, macAddress, displayName);
        return ResourceBatchingManager.getInstance().put(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, ElanUtils.getFlowIid(flow, dpnId), flow);
    }
    return Futures.immediateFuture(null);
}
Also used : EtreeInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 7 with EtreeLeafTag

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

the class ElanUtils method updateOperationalDataStore.

/**
 * Updates the Elan information in the Operational DS. It also updates the
 * ElanInstance in the Config DS by setting the adquired elanTag.
 *
 * @param idManager
 *            the id manager
 * @param elanInstanceAdded
 *            the elan instance added
 * @param elanInterfaces
 *            the elan interfaces
 * @param tx
 *            transaction
 *
 * @return the updated ELAN instance.
 */
public static ElanInstance updateOperationalDataStore(IdManagerService idManager, ElanInstance elanInstanceAdded, List<String> elanInterfaces, WriteTransaction tx) {
    String elanInstanceName = elanInstanceAdded.getElanInstanceName();
    Long elanTag = elanInstanceAdded.getElanTag();
    if (elanTag == null || elanTag == 0L) {
        elanTag = retrieveNewElanTag(idManager, elanInstanceName);
    }
    Elan elanInfo = new ElanBuilder().setName(elanInstanceName).setElanInterfaces(elanInterfaces).setKey(new ElanKey(elanInstanceName)).build();
    // Add the ElanState in the elan-state operational data-store
    tx.put(LogicalDatastoreType.OPERATIONAL, getElanInstanceOperationalDataPath(elanInstanceName), elanInfo, WriteTransaction.CREATE_MISSING_PARENTS);
    // Add the ElanMacTable in the elan-mac-table operational data-store
    MacTable elanMacTable = new MacTableBuilder().setKey(new MacTableKey(elanInstanceName)).build();
    tx.put(LogicalDatastoreType.OPERATIONAL, getElanMacTableOperationalDataPath(elanInstanceName), elanMacTable, WriteTransaction.CREATE_MISSING_PARENTS);
    ElanTagNameBuilder elanTagNameBuilder = new ElanTagNameBuilder().setElanTag(elanTag).setKey(new ElanTagNameKey(elanTag)).setName(elanInstanceName);
    long etreeLeafTag = -1;
    if (isEtreeInstance(elanInstanceAdded)) {
        etreeLeafTag = retrieveNewElanTag(idManager, elanInstanceName + ElanConstants.LEAVES_POSTFIX);
        EtreeLeafTagName etreeLeafTagName = new EtreeLeafTagNameBuilder().setEtreeLeafTag(new EtreeLeafTag(etreeLeafTag)).build();
        elanTagNameBuilder.addAugmentation(EtreeLeafTagName.class, etreeLeafTagName);
        addTheLeafTagAsElanTag(elanInstanceName, etreeLeafTag, tx);
    }
    ElanTagName elanTagName = elanTagNameBuilder.build();
    // Add the ElanTag to ElanName in the elan-tag-name Operational
    // data-store
    tx.put(LogicalDatastoreType.OPERATIONAL, getElanInfoEntriesOperationalDataPath(elanTag), elanTagName);
    // Updates the ElanInstance Config DS by setting the just acquired
    // elanTag
    ElanInstanceBuilder elanInstanceBuilder = new ElanInstanceBuilder().setElanInstanceName(elanInstanceName).setDescription(elanInstanceAdded.getDescription()).setMacTimeout(elanInstanceAdded.getMacTimeout() == null ? Long.valueOf(ElanConstants.DEFAULT_MAC_TIME_OUT) : elanInstanceAdded.getMacTimeout()).setKey(elanInstanceAdded.getKey()).setElanTag(elanTag);
    if (isEtreeInstance(elanInstanceAdded)) {
        EtreeInstance etreeInstance = new EtreeInstanceBuilder().setEtreeLeafTagVal(new EtreeLeafTag(etreeLeafTag)).build();
        elanInstanceBuilder.addAugmentation(EtreeInstance.class, etreeInstance);
    }
    ElanInstance elanInstanceWithTag = elanInstanceBuilder.build();
    tx.merge(LogicalDatastoreType.CONFIGURATION, ElanHelper.getElanInstanceConfigurationDataPath(elanInstanceName), elanInstanceWithTag, WriteTransaction.CREATE_MISSING_PARENTS);
    return elanInstanceWithTag;
}
Also used : ElanTagName(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.tag.name.map.ElanTagName) ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) ElanKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.ElanKey) MacTableBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.forwarding.tables.MacTableBuilder) ElanInstanceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder) EtreeInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance) MacTable(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.forwarding.tables.MacTable) EtreeLeafTagName(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTagName) ElanBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.ElanBuilder) ElanTagNameBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.tag.name.map.ElanTagNameBuilder) MacTableKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.forwarding.tables.MacTableKey) ElanTagNameKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.tag.name.map.ElanTagNameKey) Elan(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan) EtreeInstanceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstanceBuilder) EtreeLeafTagNameBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTagNameBuilder) EtreeLeafTag(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTag)

Example 8 with EtreeLeafTag

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

the class ElanInterfaceManager method setupEtreeUnknownDMacTable.

private void setupEtreeUnknownDMacTable(ElanInstance elanInfo, BigInteger dpId, long elanTag, WriteTransaction writeFlowGroupTx) {
    EtreeLeafTagName etreeLeafTag = elanEtreeUtils.getEtreeLeafTagByElanTag(elanTag);
    if (etreeLeafTag != null) {
        long leafTag = etreeLeafTag.getEtreeLeafTag().getValue();
        installRemoteUnknownFlow(elanInfo, dpId, leafTag, writeFlowGroupTx);
        installLocalUnknownFlow(elanInfo, dpId, leafTag, writeFlowGroupTx);
    }
}
Also used : EtreeLeafTagName(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTagName)

Example 9 with EtreeLeafTag

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

the class ElanInterfaceManager method removeEtreeUnknownDmacFlow.

private void removeEtreeUnknownDmacFlow(BigInteger dpId, ElanInstance elanInfo, WriteTransaction deleteFlowGroupTx) {
    EtreeLeafTagName etreeLeafTag = elanEtreeUtils.getEtreeLeafTagByElanTag(elanInfo.getElanTag());
    if (etreeLeafTag != null) {
        long leafTag = etreeLeafTag.getEtreeLeafTag().getValue();
        removeUnknownDmacFlow(dpId, elanInfo, deleteFlowGroupTx, leafTag);
    }
}
Also used : EtreeLeafTagName(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTagName)

Example 10 with EtreeLeafTag

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

the class ElanInterfaceManager method setElanAndEtreeBCGrouponOtherDpns.

private void setElanAndEtreeBCGrouponOtherDpns(ElanInstance elanInfo, BigInteger dpId) {
    int elanTag = elanInfo.getElanTag().intValue();
    long groupId = ElanUtils.getElanRemoteBCGId(elanTag);
    setBCGrouponOtherDpns(elanInfo, dpId, elanTag, groupId);
    EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
    if (etreeInstance != null) {
        int etreeLeafTag = etreeInstance.getEtreeLeafTagVal().getValue().intValue();
        long etreeLeafGroupId = ElanUtils.getEtreeLeafRemoteBCGId(etreeLeafTag);
        setBCGrouponOtherDpns(elanInfo, dpId, etreeLeafTag, etreeLeafGroupId);
    }
}
Also used : 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)4 EtreeLeafTagName (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTagName)4 ArrayList (java.util.ArrayList)3 ActionGroup (org.opendaylight.genius.mdsalutil.actions.ActionGroup)2 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)2 Bucket (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket)2 Group (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group)2 EtreeInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface)2 ElanTagName (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.tag.name.map.ElanTagName)2 ElanTagNameBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.tag.name.map.ElanTagNameBuilder)2 ElanTagNameKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.tag.name.map.ElanTagNameKey)2 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)1 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)1 EtreeInstanceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstanceBuilder)1 EtreeLeafTag (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTag)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