Search in sources :

Example 86 with ElanInstance

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

the class ElanServiceProvider method createIetfInterfaces.

/**
 * Create ietf-interfaces based on the ELAN segment type.<br>
 * For segment type flat - create transparent interface pointing to the
 * patch-port attached to the physnet port.<br>
 * For segment type vlan - create trunk interface pointing to the patch-port
 * attached to the physnet port + trunk-member interface pointing to the
 * trunk interface.
 *
 * @param elanInstance
 *            ELAN instance
 * @param parentRef
 *            parent interface name
 * @return the name of the interface to be added to the ELAN instance i.e.
 *         trunk-member name for vlan network and transparent for flat
 *         network or null otherwise
 */
private String createIetfInterfaces(ElanInstance elanInstance, String parentRef) {
    String interfaceName = null;
    try {
        String trunkName = getTrunkInterfaceName(parentRef);
        // trunk interface may have been created by other vlan network
        Interface trunkInterface = interfaceManager.getInterfaceInfoFromConfigDataStore(trunkName);
        if (trunkInterface == null) {
            interfaceManager.createVLANInterface(trunkName, parentRef, null, null, IfL2vlan.L2vlanMode.Trunk, true);
        }
        if (ElanUtils.isFlat(elanInstance)) {
            interfaceName = trunkName;
        } else if (ElanUtils.isVlan(elanInstance)) {
            Long segmentationId = elanInstance.getSegmentationId();
            interfaceName = parentRef + IfmConstants.OF_URI_SEPARATOR + segmentationId;
            interfaceManager.createVLANInterface(interfaceName, trunkName, segmentationId.intValue(), null, IfL2vlan.L2vlanMode.TrunkMember, true);
        }
    } catch (InterfaceAlreadyExistsException e) {
        LOG.trace("Interface {} was already created", interfaceName);
    }
    return interfaceName;
}
Also used : InterfaceAlreadyExistsException(org.opendaylight.genius.interfacemanager.exceptions.InterfaceAlreadyExistsException) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) EtreeInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface)

Example 87 with ElanInstance

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

the class ElanServiceProvider method deleteExternalElanNetwork.

protected void deleteExternalElanNetwork(ElanInstance elanInstance, BigInteger dpnId) {
    String providerIntfName = bridgeMgr.getProviderInterfaceName(dpnId, elanInstance.getPhysicalNetworkName());
    String intfName = providerIntfName + IfmConstants.OF_URI_SEPARATOR + elanInstance.getSegmentationId();
    Interface memberIntf = interfaceManager.getInterfaceInfoFromConfigDataStore(intfName);
    if (memberIntf != null) {
        deleteElanInterface(intfName);
        deleteIetfInterface(intfName);
        LOG.debug("delete vlan prv intf {} in elan {}, dpID {}", intfName, elanInstance.getElanInstanceName(), dpnId);
    } else {
        LOG.debug("vlan prv intf {} not found in interfacemgr config DS", intfName);
    }
}
Also used : Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) EtreeInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface)

Example 88 with ElanInstance

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

the class ElanServiceProvider method createElanInstance.

@Override
public boolean createElanInstance(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.debug("Elan Instance is already present in the Operational DS {}", existingElanInstance);
            return true;
        } else {
            ElanInstance updateElanInstance = new ElanInstanceBuilder().setElanInstanceName(elanInstanceName).setDescription(description).setMacTimeout(macTimeout).setKey(new ElanInstanceKey(elanInstanceName)).build();
            MDSALUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION, ElanHelper.getElanInstanceConfigurationDataPath(elanInstanceName), updateElanInstance);
            LOG.debug("Updating the Elan Instance {} with MAC TIME-OUT {} and Description {}", updateElanInstance, macTimeout, description);
        }
    } else {
        ElanInstance elanInstance = new ElanInstanceBuilder().setElanInstanceName(elanInstanceName).setMacTimeout(macTimeout).setDescription(description).setKey(new ElanInstanceKey(elanInstanceName)).build();
        MDSALUtil.syncWrite(broker, LogicalDatastoreType.CONFIGURATION, ElanHelper.getElanInstanceConfigurationDataPath(elanInstanceName), elanInstance);
        LOG.debug("Creating the new Elan Instance {}", elanInstance);
    }
    return isSuccess;
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) ElanInstanceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey) ElanInstanceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder)

Example 89 with ElanInstance

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

the class ElanServiceProvider method getEgressMatchesForElanInstance.

@Override
public List<MatchInfoBase> getEgressMatchesForElanInstance(String elanInstanceName) {
    ElanInstance elanInstance = getElanInstance(elanInstanceName);
    if (elanInstance == null) {
        LOG.debug("No ELAN instance found for {}", elanInstanceName);
        return Collections.emptyList();
    }
    Long elanTag = elanInstance.getElanTag();
    if (elanTag == null) {
        LOG.debug("No ELAN tag found for {}", elanInstanceName);
        return Collections.emptyList();
    }
    return Collections.singletonList(new NxMatchRegister(ElanConstants.ELAN_REG_ID, elanTag, MetaDataUtil.getElanMaskForReg()));
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) NxMatchRegister(org.opendaylight.genius.mdsalutil.nxmatches.NxMatchRegister)

Example 90 with ElanInstance

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

the class AssociateHwvtepToElanJob method createLogicalSwitch.

private ListenableFuture<Void> createLogicalSwitch() {
    final String logicalSwitchName = ElanL2GatewayUtils.getLogicalSwitchFromElan(elanInstance.getElanInstanceName());
    String segmentationId = ElanUtils.getVxlanSegmentationId(elanInstance).toString();
    String replicationMode = "";
    LOG.trace("logical switch {} is created on {} with VNI {}", logicalSwitchName, l2GatewayDevice.getHwvtepNodeId(), segmentationId);
    NodeId hwvtepNodeId = new NodeId(l2GatewayDevice.getHwvtepNodeId());
    String dbVersion = HwvtepUtils.getDbVersion(broker, hwvtepNodeId);
    if (SouthboundUtils.compareDbVersionToMinVersion(dbVersion, "1.6.0")) {
        replicationMode = "source_node";
    }
    LOG.trace("logical switch {} has schema version {}, replication mode set to {}", logicalSwitchName, dbVersion, replicationMode);
    LogicalSwitches logicalSwitch = HwvtepSouthboundUtils.createLogicalSwitch(logicalSwitchName, elanInstance.getDescription(), segmentationId, replicationMode);
    ListenableFuture<Void> lsCreateFuture = HwvtepUtils.addLogicalSwitch(broker, hwvtepNodeId, logicalSwitch);
    Futures.addCallback(lsCreateFuture, new FutureCallback<Void>() {

        @Override
        public void onSuccess(Void noarg) {
            // Listener will be closed after all configuration completed
            // on hwvtep by
            // listener itself
            LOG.trace("Successful in initiating logical switch {} creation", logicalSwitchName);
        }

        @Override
        public void onFailure(Throwable error) {
            LOG.error("Failed logical switch {} creation", logicalSwitchName, error);
        }
    }, MoreExecutors.directExecutor());
    return lsCreateFuture;
}
Also used : LogicalSwitches(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)

Aggregations

ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)75 BigInteger (java.math.BigInteger)36 ArrayList (java.util.ArrayList)33 InterfaceInfo (org.opendaylight.genius.interfacemanager.globals.InterfaceInfo)18 DpnInterfaces (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces)16 Flow (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)14 Bucket (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket)14 ElanInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface)13 ElanDpnInterfacesList (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList)12 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)11 EtreeInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance)11 ElanDpnInterfaces (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces)11 ActionGroup (org.opendaylight.genius.mdsalutil.actions.ActionGroup)10 L2GatewayDevice (org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice)10 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)10 Group (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group)10 ElanInstanceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder)10 ElanInstanceKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey)10 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)9 MacEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry)9