Search in sources :

Example 16 with ParentRefs

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

the class InterfaceManagerTestUtil method buildInterface.

static Interface buildInterface(String ifName, String desc, boolean enabled, Object ifType, String parentInterface, IfL2vlan.L2vlanMode l2vlanMode) {
    InterfaceBuilder builder = new InterfaceBuilder().setKey(new InterfaceKey(ifName)).setName(ifName).setDescription(desc).setEnabled(enabled).setType((Class<? extends InterfaceType>) ifType);
    ParentRefs parentRefs = new ParentRefsBuilder().setParentInterface(parentInterface).build();
    builder.addAugmentation(ParentRefs.class, parentRefs);
    if (ifType.equals(L2vlan.class)) {
        IfL2vlanBuilder ifL2vlanBuilder = new IfL2vlanBuilder().setL2vlanMode(l2vlanMode);
        if (IfL2vlan.L2vlanMode.TrunkMember.equals(l2vlanMode)) {
            ifL2vlanBuilder.setVlanId(new VlanId(100));
        } else {
            ifL2vlanBuilder.setVlanId(VlanId.getDefaultInstance("0"));
        }
        builder.addAugmentation(IfL2vlan.class, ifL2vlanBuilder.build());
    } else if (ifType.equals(IfTunnel.class)) {
        IfTunnel tunnel = new IfTunnelBuilder().setTunnelDestination(null).setTunnelGateway(null).setTunnelSource(null).setTunnelInterfaceType(null).build();
        builder.addAugmentation(IfTunnel.class, tunnel);
    }
    return builder.build();
}
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) InterfaceBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) IfTunnelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnelBuilder) IfL2vlanBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlanBuilder) VlanId(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId) ParentRefsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefsBuilder)

Example 17 with ParentRefs

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

the class InterfaceManagerTestUtil method putVlanInterfaceConfig.

static void putVlanInterfaceConfig(DataBroker dataBroker, String ifaceName, String parentRefs, IfL2vlan.L2vlanMode l2vlanMode) throws TransactionCommitFailedException {
    Interface interfaceInfo = InterfaceManagerTestUtil.buildInterface(ifaceName, ifaceName, true, L2vlan.class, parentRefs, l2vlanMode);
    InstanceIdentifier<Interface> interfaceInstanceIdentifier = IfmUtil.buildId(ifaceName);
    WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
    tx.put(CONFIGURATION, interfaceInstanceIdentifier, interfaceInfo, true);
    tx.submit().checkedGet();
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)

Example 18 with ParentRefs

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

the class InterfaceMetaUtils method getBridgeReferenceForInterface.

public BridgeRefEntry getBridgeReferenceForInterface(Interface interfaceInfo) {
    ParentRefs parentRefs = interfaceInfo.getAugmentation(ParentRefs.class);
    BigInteger dpn = parentRefs.getDatapathNodeIdentifier();
    return getBridgeRefEntryFromOperDS(dpn);
}
Also used : ParentRefs(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs) BigInteger(java.math.BigInteger)

Example 19 with ParentRefs

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

the class InterfaceConfigListener method update.

@Override
protected void update(InstanceIdentifier<Interface> key, Interface interfaceOld, Interface interfaceNew) {
    interfaceManagerCommonUtils.addInterfaceToCache(interfaceNew);
    if (!entityOwnershipUtils.isEntityOwner(IfmConstants.INTERFACE_CONFIG_ENTITY, IfmConstants.INTERFACE_CONFIG_ENTITY)) {
        return;
    }
    LOG.debug("Received Interface Update Event: {}, {}, {}", key, interfaceOld, interfaceNew);
    ParentRefs parentRefs = interfaceNew.getAugmentation(ParentRefs.class);
    if (parentRefs == null || parentRefs.getParentInterface() == null && !InterfaceManagerCommonUtils.isTunnelInterface(interfaceNew)) {
        // If parentRefs are missing, try to find a matching parent and
        // update - this will trigger another DCN
        updateInterfaceParentRefs(interfaceNew);
    }
    if (parentRefs == null || parentRefs.getDatapathNodeIdentifier() == null && parentRefs.getParentInterface() == null) {
        LOG.debug("parent refs not specified for {}, or parentRefs {} missing DPN/parentInterface", interfaceNew.getName(), parentRefs);
        return;
    }
    RendererConfigUpdateWorker configWorker = new RendererConfigUpdateWorker(key, interfaceOld, interfaceNew, interfaceNew.getName());
    String synchronizationKey = getSynchronizationKey(interfaceNew, parentRefs);
    coordinator.enqueueJob(synchronizationKey, configWorker, IfmConstants.JOB_MAX_RETRIES);
}
Also used : ParentRefs(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs)

Example 20 with ParentRefs

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

the class InterfaceConfigListener method add.

@Override
protected void add(InstanceIdentifier<Interface> key, Interface interfaceNew) {
    interfaceManagerCommonUtils.addInterfaceToCache(interfaceNew);
    if (!entityOwnershipUtils.isEntityOwner(IfmConstants.INTERFACE_CONFIG_ENTITY, IfmConstants.INTERFACE_CONFIG_ENTITY)) {
        return;
    }
    LOG.debug("Received Interface Add Event: {}, {}", key, interfaceNew);
    ParentRefs parentRefs = interfaceNew.getAugmentation(ParentRefs.class);
    if (parentRefs == null || parentRefs.getParentInterface() == null) {
        // If parentRefs are missing, try to find a matching parent and
        // update - this will trigger another DCN
        updateInterfaceParentRefs(interfaceNew);
    }
    if (parentRefs == null || parentRefs.getDatapathNodeIdentifier() == null && parentRefs.getParentInterface() == null) {
        LOG.debug("parent refs not specified for {}", interfaceNew.getName());
        return;
    }
    RendererConfigAddWorker configWorker = new RendererConfigAddWorker(key, interfaceNew, parentRefs, interfaceNew.getName());
    String synchronizationKey = getSynchronizationKey(interfaceNew, parentRefs);
    coordinator.enqueueJob(synchronizationKey, configWorker, IfmConstants.JOB_MAX_RETRIES);
}
Also used : ParentRefs(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs)

Aggregations

ParentRefs (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs)39 IfTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel)20 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)16 IfL2vlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan)13 BigInteger (java.math.BigInteger)12 ParentRefsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefsBuilder)12 InterfaceKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey)10 TunnelTypeVxlan (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan)10 InterfaceBuilder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder)9 ArrayList (java.util.ArrayList)8 Collections (java.util.Collections)7 InterfaceChildEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntry)6 IfTunnelBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnelBuilder)6 VlanId (org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId)6 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)5 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)5 ManagedNewTransactionRunner (org.opendaylight.genius.infra.ManagedNewTransactionRunner)5 ManagedNewTransactionRunnerImpl (org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl)5 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)5 Logger (org.slf4j.Logger)5