Search in sources :

Example 21 with IfL2vlan

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan in project genius by opendaylight.

the class OvsInterfaceConfigRemoveHelper method removeVlanConfiguration.

private void removeVlanConfiguration(ParentRefs parentRefs, String interfaceName, IfL2vlan ifL2vlan, WriteTransaction tx, List<ListenableFuture<Void>> futures) {
    if (parentRefs == null || ifL2vlan == null || IfL2vlan.L2vlanMode.Trunk != ifL2vlan.getL2vlanMode() && IfL2vlan.L2vlanMode.Transparent != ifL2vlan.getL2vlanMode()) {
        return;
    }
    LOG.info("removing vlan configuration for interface {}", interfaceName);
    interfaceManagerCommonUtils.deleteInterfaceStateInformation(interfaceName, tx);
    org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = interfaceManagerCommonUtils.getInterfaceState(interfaceName);
    if (ifState == null) {
        LOG.debug("could not fetch interface state corresponding to {}, probably already removed as part of port " + "removal event, proceeding with remaining config cleanups", interfaceName);
    }
    cleanUpInterfaceWithUnknownState(interfaceName, parentRefs, null, tx);
    BigInteger dpId = IfmUtil.getDpnFromInterface(ifState);
    FlowBasedServicesUtils.removeIngressFlow(interfaceName, dpId, txRunner, futures);
    interfaceManagerCommonUtils.deleteParentInterfaceEntry(parentRefs.getParentInterface());
    // For Vlan-Trunk Interface, remove the trunk-member operstates as
    // well...
    InterfaceParentEntry interfaceParentEntry = interfaceMetaUtils.getInterfaceParentEntryFromConfigDS(interfaceName);
    if (interfaceParentEntry == null || interfaceParentEntry.getInterfaceChildEntry() == null) {
        return;
    }
    VlanMemberStateRemoveWorker vlanMemberStateRemoveWorker = new VlanMemberStateRemoveWorker(txRunner, interfaceManagerCommonUtils, dpId, interfaceName, interfaceParentEntry);
    coordinator.enqueueJob(interfaceName, vlanMemberStateRemoveWorker, IfmConstants.JOB_MAX_RETRIES);
}
Also used : Collections(java.util.Collections) BigInteger(java.math.BigInteger) InterfaceParentEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntry)

Example 22 with IfL2vlan

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan in project genius by opendaylight.

the class OvsInterfaceConfigUpdateHelper method portAttributesModified.

private static boolean portAttributesModified(Interface interfaceOld, Interface interfaceNew) {
    ParentRefs parentRefsOld = interfaceOld.getAugmentation(ParentRefs.class);
    ParentRefs parentRefsNew = interfaceNew.getAugmentation(ParentRefs.class);
    if (checkAugmentations(parentRefsOld, parentRefsNew)) {
        return true;
    }
    IfL2vlan ifL2vlanOld = interfaceOld.getAugmentation(IfL2vlan.class);
    IfL2vlan ifL2vlanNew = interfaceNew.getAugmentation(IfL2vlan.class);
    if (checkAugmentations(ifL2vlanOld, ifL2vlanNew)) {
        return true;
    }
    IfTunnel ifTunnelOld = interfaceOld.getAugmentation(IfTunnel.class);
    IfTunnel ifTunnelNew = interfaceNew.getAugmentation(IfTunnel.class);
    if (checkAugmentations(ifTunnelOld, ifTunnelNew)) {
        if (!ifTunnelNew.getTunnelDestination().equals(ifTunnelOld.getTunnelDestination()) || !ifTunnelNew.getTunnelSource().equals(ifTunnelOld.getTunnelSource()) || ifTunnelNew.getTunnelGateway() != null && ifTunnelOld.getTunnelGateway() != null && !ifTunnelNew.getTunnelGateway().equals(ifTunnelOld.getTunnelGateway())) {
            return true;
        }
    }
    return false;
}
Also used : ParentRefs(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs) IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) IfL2vlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan)

Example 23 with IfL2vlan

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan in project genius by opendaylight.

the class OvsVlanMemberConfigAddHelper method addConfiguration.

public List<ListenableFuture<Void>> addConfiguration(ParentRefs parentRefs, Interface interfaceNew) {
    LOG.info("adding vlan member configuration for interface {}", interfaceNew.getName());
    List<ListenableFuture<Void>> futures = new ArrayList<>();
    futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> interfaceManagerCommonUtils.createInterfaceChildEntry(parentRefs.getParentInterface(), interfaceNew.getName(), tx)));
    InterfaceKey interfaceKey = new InterfaceKey(parentRefs.getParentInterface());
    Interface ifaceParent = interfaceManagerCommonUtils.getInterfaceFromConfigDS(interfaceKey);
    if (ifaceParent == null) {
        LOG.info("Parent Interface: {} not found when adding child interface: {}", parentRefs.getParentInterface(), interfaceNew.getName());
        return futures;
    }
    IfL2vlan parentIfL2Vlan = ifaceParent.getAugmentation(IfL2vlan.class);
    if (parentIfL2Vlan == null || parentIfL2Vlan.getL2vlanMode() != IfL2vlan.L2vlanMode.Trunk) {
        LOG.error("Parent Interface: {} not of trunk Type when adding trunk-member: {}", ifaceParent, interfaceNew);
        return futures;
    }
    org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = interfaceManagerCommonUtils.getInterfaceState(parentRefs.getParentInterface());
    interfaceManagerCommonUtils.addStateEntry(interfaceNew.getName(), futures, ifState);
    return futures;
}
Also used : Logger(org.slf4j.Logger) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) ManagedNewTransactionRunner(org.opendaylight.genius.infra.ManagedNewTransactionRunner) LoggerFactory(org.slf4j.LoggerFactory) InterfaceManagerCommonUtils(org.opendaylight.genius.interfacemanager.commons.InterfaceManagerCommonUtils) Singleton(javax.inject.Singleton) IfL2vlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) ArrayList(java.util.ArrayList) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface) Inject(javax.inject.Inject) List(java.util.List) ParentRefs(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) ManagedNewTransactionRunnerImpl(org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl) ArrayList(java.util.ArrayList) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface) IfL2vlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan)

Example 24 with IfL2vlan

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan in project genius by opendaylight.

the class VlanMemberConfigListener method update.

@Override
public void update(@Nonnull Interface originalInterface, @Nonnull Interface updatedInterface) {
    IfL2vlan ifL2vlanNew = updatedInterface.getAugmentation(IfL2vlan.class);
    if (ifL2vlanNew == null) {
        return;
    }
    IfL2vlan ifL2vlanOld = originalInterface.getAugmentation(IfL2vlan.class);
    if (IfL2vlan.L2vlanMode.TrunkMember == ifL2vlanNew.getL2vlanMode() && IfL2vlan.L2vlanMode.Trunk == ifL2vlanOld.getL2vlanMode()) {
        // Trunk subport add use case
        addVlanMember(updatedInterface);
        return;
    } else if (IfL2vlan.L2vlanMode.Trunk == ifL2vlanNew.getL2vlanMode() && IfL2vlan.L2vlanMode.TrunkMember == ifL2vlanOld.getL2vlanMode()) {
        // Trunk subport remove use case
        removeVlanMember(originalInterface);
    } else if (IfL2vlan.L2vlanMode.TrunkMember != ifL2vlanNew.getL2vlanMode()) {
        return;
    }
    ParentRefs parentRefsNew = updatedInterface.getAugmentation(ParentRefs.class);
    if (parentRefsNew == null) {
        LOG.error("Configuration Error. Attempt to update Vlan Trunk-Member {} without a " + "parent interface", updatedInterface);
        return;
    }
    String lowerLayerIf = parentRefsNew.getParentInterface();
    if (lowerLayerIf.equals(updatedInterface.getName())) {
        LOG.error("Configuration Error. Attempt to update Vlan Trunk-Member {} with same parent " + "interface name.", updatedInterface);
        return;
    }
    coordinator.enqueueJob(lowerLayerIf, () -> ovsVlanMemberConfigUpdateHelper.updateConfiguration(parentRefsNew, originalInterface, ifL2vlanNew, updatedInterface), IfmConstants.JOB_MAX_RETRIES);
}
Also used : ParentRefs(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs) IfL2vlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan)

Aggregations

IfL2vlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan)23 ParentRefs (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs)11 ArrayList (java.util.ArrayList)9 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)9 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)5 Collections (java.util.Collections)5 ManagedNewTransactionRunner (org.opendaylight.genius.infra.ManagedNewTransactionRunner)5 IfTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel)5 Logger (org.slf4j.Logger)5 LoggerFactory (org.slf4j.LoggerFactory)5 BigInteger (java.math.BigInteger)4 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)4 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)4 ManagedNewTransactionRunnerImpl (org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl)4 VlanId (org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId)4 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)4 List (java.util.List)3 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)3 InterfaceManagerCommonUtils (org.opendaylight.genius.interfacemanager.commons.InterfaceManagerCommonUtils)3 InterfaceBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder)3