Search in sources :

Example 61 with CONFIGURATION

use of org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION in project netvirt by opendaylight.

the class ElanInterfaceManager method removeEntriesForElanInterface.

List<ListenableFuture<?>> removeEntriesForElanInterface(ElanInstance elanInfo, InterfaceInfo interfaceInfo, String interfaceName, boolean isLastElanInterface) {
    String elanName = elanInfo.getElanInstanceName();
    EVENT_LOGGER.debug("ELAN-InterfaceEntries, REMOVE {} Instance {}", interfaceName, elanName);
    List<ListenableFuture<?>> futures = new ArrayList<>();
    futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, flowTx -> {
        futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(OPERATIONAL, interfaceTx -> {
            InstanceIdentifier<ElanInterfaceMac> elanInterfaceId = ElanUtils.getElanInterfaceMacEntriesOperationalDataPath(interfaceName);
            Optional<ElanInterfaceMac> existingElanInterfaceMac = interfaceTx.read(elanInterfaceId).get();
            LOG.debug("Removing the Interface:{} from elan:{}", interfaceName, elanName);
            if (interfaceInfo != null) {
                if (existingElanInterfaceMac.isPresent()) {
                    Map<MacEntryKey, MacEntry> existingMacEntries = existingElanInterfaceMac.get().nonnullMacEntry();
                    if (existingMacEntries != null) {
                        List<PhysAddress> macAddresses = new ArrayList<>();
                        for (MacEntry macEntry : existingMacEntries.values()) {
                            PhysAddress macAddress = macEntry.getMacAddress();
                            LOG.debug("removing the  mac-entry:{} present on elanInterface:{}", macAddress.getValue(), interfaceName);
                            Optional<MacEntry> macEntryOptional = elanUtils.getMacEntryForElanInstance(interfaceTx, elanName, macAddress);
                            if (!isLastElanInterface && macEntryOptional.isPresent()) {
                                interfaceTx.delete(ElanUtils.getMacEntryOperationalDataPath(elanName, macAddress));
                            }
                            EVENT_LOGGER.debug("ELAN-MacFlows, REMOVE {} Instance {} Mac {}", interfaceName, elanName, macAddress);
                            elanUtils.deleteMacFlows(elanInfo, interfaceInfo, macEntry, flowTx);
                            macAddresses.add(macAddress);
                        }
                        // to this ELAN
                        if (isVxlanNetworkOrVxlanSegment(elanInfo) && !macAddresses.isEmpty()) {
                            elanL2GatewayUtils.removeMacsFromElanExternalDevices(elanInfo, macAddresses);
                        }
                    }
                }
                removeDefaultTermFlow(interfaceInfo.getDpId(), interfaceInfo.getInterfaceTag());
                removeFilterEqualsTable(elanInfo, interfaceInfo, flowTx);
            } else if (existingElanInterfaceMac.isPresent()) {
                // Interface does not exist in ConfigDS, so lets remove everything
                // about that interface related to Elan
                Map<MacEntryKey, MacEntry> macEntries = existingElanInterfaceMac.get().nonnullMacEntry();
                if (macEntries != null) {
                    for (MacEntry macEntry : macEntries.values()) {
                        PhysAddress macAddress = macEntry.getMacAddress();
                        if (elanUtils.getMacEntryForElanInstance(elanName, macAddress).isPresent()) {
                            interfaceTx.delete(ElanUtils.getMacEntryOperationalDataPath(elanName, macAddress));
                        }
                    }
                }
            }
            if (existingElanInterfaceMac.isPresent()) {
                interfaceTx.delete(elanInterfaceId);
            }
            unbindService(interfaceName, flowTx);
            deleteElanInterfaceFromConfigDS(interfaceName, flowTx);
        }));
    }));
    return futures;
}
Also used : MacTableKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.forwarding.tables.MacTableKey) ActionDrop(org.opendaylight.genius.mdsalutil.actions.ActionDrop) ElanForwardingTables(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanForwardingTables) StringUtils(org.apache.commons.lang3.StringUtils) ElanServiceRecoveryHandler(org.opendaylight.netvirt.elan.recovery.impl.ElanServiceRecoveryHandler) RecoverableListener(org.opendaylight.serviceutils.srm.RecoverableListener) ServiceIndex(org.opendaylight.genius.utils.ServiceIndex) Map(java.util.Map) DpnInterfacesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfacesBuilder) BigInteger(java.math.BigInteger) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) PhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress) MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) MacTable(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.forwarding.tables.MacTable) Elan(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan) GroupId(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId) Set(java.util.Set) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) InstructionWriteActions(org.opendaylight.genius.mdsalutil.instructions.InstructionWriteActions) EtreeInterfaceType(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface.EtreeInterfaceType) RemoteMcastMacs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacs) TypedWriteTransaction(org.opendaylight.mdsal.binding.util.TypedWriteTransaction) TypedReadWriteTransaction(org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) ActionSetFieldTunnelId(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId) EtreeInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance) ElanL2GatewayMulticastUtils(org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils) Uint64(org.opendaylight.yangtools.yang.common.Uint64) ManagedNewTransactionRunner(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) DpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces) FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) INeutronVpnManager(org.opendaylight.netvirt.neutronvpn.interfaces.INeutronVpnManager) ArrayList(java.util.ArrayList) GroupKey(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey) MacEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryBuilder) ElanDpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) EtreeInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface) StaticMacEntriesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntriesKey) InterfaceInfo(org.opendaylight.genius.interfacemanager.globals.InterfaceInfo) ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) AbstractAsyncDataTreeChangeListener(org.opendaylight.serviceutils.tools.listener.AbstractAsyncDataTreeChangeListener) ExecutionException(java.util.concurrent.ExecutionException) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) ElanInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInterfaces) IMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) GroupTypes(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes) MetaDataUtil(org.opendaylight.genius.mdsalutil.MetaDataUtil) L2GatewayDevice(org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) CONFIGURATION(org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION) ElanItmUtils(org.opendaylight.netvirt.elan.utils.ElanItmUtils) ElanL2GwCacheUtils(org.opendaylight.netvirt.elanmanager.utils.ElanL2GwCacheUtils) Acquired(org.opendaylight.infrautils.utils.concurrent.NamedSimpleReentrantLock.Acquired) ElanConstants(org.opendaylight.netvirt.elan.utils.ElanConstants) LoggerFactory(org.slf4j.LoggerFactory) ElanInterfaceCache(org.opendaylight.netvirt.elan.cache.ElanInterfaceCache) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) ActionNxResubmit(org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit) PreDestroy(javax.annotation.PreDestroy) ElanUtils(org.opendaylight.netvirt.elan.utils.ElanUtils) ExternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel) ElanDpnInterfacesList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList) ElanDpnInterfacesListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesListKey) LoggingFutures(org.opendaylight.infrautils.utils.concurrent.LoggingFutures) MDSALUtil(org.opendaylight.genius.mdsalutil.MDSALUtil) NxmNxReg1(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg1) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) Collections.emptyList(java.util.Collections.emptyList) Configuration(org.opendaylight.mdsal.binding.util.Datastore.Configuration) NeutronUtils(org.opendaylight.netvirt.neutronvpn.api.utils.NeutronUtils) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ElanForwardingEntriesHandler(org.opendaylight.netvirt.elan.utils.ElanForwardingEntriesHandler) LoggingFutures.addErrorLogging(org.opendaylight.infrautils.utils.concurrent.LoggingFutures.addErrorLogging) ElanKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.ElanKey) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface) ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) Objects(java.util.Objects) List(java.util.List) ElanL2GatewayUtils(org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils) ManagedNewTransactionRunnerImpl(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl) FlowEntityBuilder(org.opendaylight.genius.mdsalutil.FlowEntityBuilder) Optional(java.util.Optional) Queue(java.util.Queue) ElanInterfaceMac(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan._interface.forwarding.entries.ElanInterfaceMac) ElanUtils.isVxlanNetworkOrVxlanSegment(org.opendaylight.netvirt.elan.utils.ElanUtils.isVxlanNetworkOrVxlanSegment) InstructionKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) ElanEtreeUtils(org.opendaylight.netvirt.elan.utils.ElanEtreeUtils) Executors(org.opendaylight.infrautils.utils.concurrent.Executors) HashMap(java.util.HashMap) Singleton(javax.inject.Singleton) InstructionWriteMetadata(org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata) FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) MacEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry) MacEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryKey) DpnInterfacesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfacesKey) HashSet(java.util.HashSet) Inject(javax.inject.Inject) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) MatchTunnelId(org.opendaylight.genius.mdsalutil.matches.MatchTunnelId) Objects.requireNonNull(java.util.Objects.requireNonNull) ActionRegLoad(org.opendaylight.genius.mdsalutil.actions.ActionRegLoad) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) NwConstants(org.opendaylight.genius.mdsalutil.NwConstants) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) IInterfaceManager(org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager) Uint32(org.opendaylight.yangtools.yang.common.Uint32) Logger(org.slf4j.Logger) ReentrantLock(java.util.concurrent.locks.ReentrantLock) ElanHelper(org.opendaylight.netvirt.elanmanager.api.ElanHelper) Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) StaticMacEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries) ElanInstanceCache(org.opendaylight.netvirt.elan.cache.ElanInstanceCache) JobCoordinator(org.opendaylight.infrautils.jobcoordinator.JobCoordinator) Operational(org.opendaylight.mdsal.binding.util.Datastore.Operational) EtreeLeafTagName(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTagName) ServiceRecoveryRegistry(org.opendaylight.serviceutils.srm.ServiceRecoveryRegistry) IdManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService) Port(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port) ElanBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.ElanBuilder) ElanInstanceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder) ITMConstants(org.opendaylight.genius.itm.globals.ITMConstants) Collections(java.util.Collections) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction) OPERATIONAL(org.opendaylight.mdsal.binding.util.Datastore.OPERATIONAL) FluentFuture(com.google.common.util.concurrent.FluentFuture) JvmGlobalLocks(org.opendaylight.genius.utils.JvmGlobalLocks) MacEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry) ArrayList(java.util.ArrayList) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ElanInterfaceMac(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan._interface.forwarding.entries.ElanInterfaceMac) MacEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryKey) PhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress)

Example 62 with CONFIGURATION

use of org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION in project netvirt by opendaylight.

the class ElanInterfaceManager method handleExternalTunnelStateEvent.

/**
 * Handle external tunnel state event.
 *
 * @param externalTunnel
 *            the external tunnel
 * @param intrf
 *            the interface
 */
void handleExternalTunnelStateEvent(ExternalTunnel externalTunnel, Interface intrf) {
    if (!validateExternalTunnelStateEvent(externalTunnel, intrf)) {
        return;
    }
    // dpId/externalNodeId will be available either in source or destination
    // based on the tunnel end point
    Uint64 dpId = null;
    NodeId externalNodeId = null;
    if (StringUtils.isNumeric(externalTunnel.getSourceDevice())) {
        dpId = Uint64.valueOf(externalTunnel.getSourceDevice());
        externalNodeId = new NodeId(externalTunnel.getDestinationDevice());
    } else if (StringUtils.isNumeric(externalTunnel.getDestinationDevice())) {
        dpId = Uint64.valueOf(externalTunnel.getDestinationDevice());
        externalNodeId = new NodeId(externalTunnel.getSourceDevice());
    }
    if (dpId == null || externalNodeId == null) {
        LOG.error("Dp ID / externalNodeId not found in external tunnel {}", externalTunnel);
        return;
    }
    ElanDpnInterfaces dpnInterfaceLists = elanUtils.getElanDpnInterfacesList();
    if (dpnInterfaceLists == null) {
        return;
    }
    Map<ElanDpnInterfacesListKey, ElanDpnInterfacesList> elanDpnIf = dpnInterfaceLists.nonnullElanDpnInterfacesList();
    for (ElanDpnInterfacesList elanDpns : elanDpnIf.values()) {
        String elanName = elanDpns.getElanInstanceName();
        ElanInstance elanInfo = elanInstanceCache.get(elanName).orElse(null);
        DpnInterfaces dpnInterfaces = elanUtils.getElanInterfaceInfoByElanDpn(elanName, dpId);
        if (elanInfo == null || dpnInterfaces == null || dpnInterfaces.getInterfaces() == null || dpnInterfaces.getInterfaces().isEmpty()) {
            continue;
        }
        LOG.debug("Elan instance:{} is present in Dpn:{} ", elanName, dpId);
        final Uint64 finalDpId = dpId;
        LoggingFutures.addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, confTx -> elanL2GatewayMulticastUtils.setupElanBroadcastGroups(elanInfo, finalDpId, confTx)), LOG, "Error setting up ELAN BGs");
        // install L2gwDevices local macs in dpn.
        elanL2GatewayUtils.installL2gwDeviceMacsInDpn(dpId, externalNodeId, elanInfo, intrf.getName());
        // Install dpn macs on external device
        installDpnMacsInL2gwDevice(elanName, new HashSet<>(dpnInterfaces.getInterfaces()), dpId, externalNodeId);
    }
    LOG.info("Handled ExternalTunnelStateEvent for {}", externalTunnel);
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) MacTableKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.forwarding.tables.MacTableKey) ActionDrop(org.opendaylight.genius.mdsalutil.actions.ActionDrop) ElanForwardingTables(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanForwardingTables) StringUtils(org.apache.commons.lang3.StringUtils) ElanServiceRecoveryHandler(org.opendaylight.netvirt.elan.recovery.impl.ElanServiceRecoveryHandler) RecoverableListener(org.opendaylight.serviceutils.srm.RecoverableListener) ServiceIndex(org.opendaylight.genius.utils.ServiceIndex) Map(java.util.Map) DpnInterfacesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfacesBuilder) BigInteger(java.math.BigInteger) Bucket(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket) PhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress) MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) MacTable(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.forwarding.tables.MacTable) Elan(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.Elan) GroupId(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId) Set(java.util.Set) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) InstructionWriteActions(org.opendaylight.genius.mdsalutil.instructions.InstructionWriteActions) EtreeInterfaceType(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface.EtreeInterfaceType) RemoteMcastMacs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacs) TypedWriteTransaction(org.opendaylight.mdsal.binding.util.TypedWriteTransaction) TypedReadWriteTransaction(org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction) ElanInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface) ActionSetFieldTunnelId(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId) EtreeInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInstance) ElanL2GatewayMulticastUtils(org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils) Uint64(org.opendaylight.yangtools.yang.common.Uint64) ManagedNewTransactionRunner(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) DpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces) FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) INeutronVpnManager(org.opendaylight.netvirt.neutronvpn.interfaces.INeutronVpnManager) ArrayList(java.util.ArrayList) GroupKey(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey) MacEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryBuilder) ElanDpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) EtreeInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeInterface) StaticMacEntriesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntriesKey) InterfaceInfo(org.opendaylight.genius.interfacemanager.globals.InterfaceInfo) ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) AbstractAsyncDataTreeChangeListener(org.opendaylight.serviceutils.tools.listener.AbstractAsyncDataTreeChangeListener) ExecutionException(java.util.concurrent.ExecutionException) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) ElanInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInterfaces) IMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) GroupTypes(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes) MetaDataUtil(org.opendaylight.genius.mdsalutil.MetaDataUtil) L2GatewayDevice(org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) CONFIGURATION(org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION) ElanItmUtils(org.opendaylight.netvirt.elan.utils.ElanItmUtils) ElanL2GwCacheUtils(org.opendaylight.netvirt.elanmanager.utils.ElanL2GwCacheUtils) Acquired(org.opendaylight.infrautils.utils.concurrent.NamedSimpleReentrantLock.Acquired) ElanConstants(org.opendaylight.netvirt.elan.utils.ElanConstants) LoggerFactory(org.slf4j.LoggerFactory) ElanInterfaceCache(org.opendaylight.netvirt.elan.cache.ElanInterfaceCache) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) ActionNxResubmit(org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit) PreDestroy(javax.annotation.PreDestroy) ElanUtils(org.opendaylight.netvirt.elan.utils.ElanUtils) ExternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel) ElanDpnInterfacesList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList) ElanDpnInterfacesListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesListKey) LoggingFutures(org.opendaylight.infrautils.utils.concurrent.LoggingFutures) MDSALUtil(org.opendaylight.genius.mdsalutil.MDSALUtil) NxmNxReg1(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg1) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) Collections.emptyList(java.util.Collections.emptyList) Configuration(org.opendaylight.mdsal.binding.util.Datastore.Configuration) NeutronUtils(org.opendaylight.netvirt.neutronvpn.api.utils.NeutronUtils) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ElanForwardingEntriesHandler(org.opendaylight.netvirt.elan.utils.ElanForwardingEntriesHandler) LoggingFutures.addErrorLogging(org.opendaylight.infrautils.utils.concurrent.LoggingFutures.addErrorLogging) ElanKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.ElanKey) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface) ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) Objects(java.util.Objects) List(java.util.List) ElanL2GatewayUtils(org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils) ManagedNewTransactionRunnerImpl(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl) FlowEntityBuilder(org.opendaylight.genius.mdsalutil.FlowEntityBuilder) Optional(java.util.Optional) Queue(java.util.Queue) ElanInterfaceMac(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan._interface.forwarding.entries.ElanInterfaceMac) ElanUtils.isVxlanNetworkOrVxlanSegment(org.opendaylight.netvirt.elan.utils.ElanUtils.isVxlanNetworkOrVxlanSegment) InstructionKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) ElanEtreeUtils(org.opendaylight.netvirt.elan.utils.ElanEtreeUtils) Executors(org.opendaylight.infrautils.utils.concurrent.Executors) HashMap(java.util.HashMap) Singleton(javax.inject.Singleton) InstructionWriteMetadata(org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata) FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) MacEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntry) MacEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.forwarding.entries.MacEntryKey) DpnInterfacesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfacesKey) HashSet(java.util.HashSet) Inject(javax.inject.Inject) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) MatchTunnelId(org.opendaylight.genius.mdsalutil.matches.MatchTunnelId) Objects.requireNonNull(java.util.Objects.requireNonNull) ActionRegLoad(org.opendaylight.genius.mdsalutil.actions.ActionRegLoad) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) NwConstants(org.opendaylight.genius.mdsalutil.NwConstants) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) IInterfaceManager(org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager) Uint32(org.opendaylight.yangtools.yang.common.Uint32) Logger(org.slf4j.Logger) ReentrantLock(java.util.concurrent.locks.ReentrantLock) ElanHelper(org.opendaylight.netvirt.elanmanager.api.ElanHelper) Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) StaticMacEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.elan._interface.StaticMacEntries) ElanInstanceCache(org.opendaylight.netvirt.elan.cache.ElanInstanceCache) JobCoordinator(org.opendaylight.infrautils.jobcoordinator.JobCoordinator) Operational(org.opendaylight.mdsal.binding.util.Datastore.Operational) EtreeLeafTagName(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTagName) ServiceRecoveryRegistry(org.opendaylight.serviceutils.srm.ServiceRecoveryRegistry) IdManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService) Port(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port) ElanBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.state.ElanBuilder) ElanInstanceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceBuilder) ITMConstants(org.opendaylight.genius.itm.globals.ITMConstants) Collections(java.util.Collections) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction) OPERATIONAL(org.opendaylight.mdsal.binding.util.Datastore.OPERATIONAL) FluentFuture(com.google.common.util.concurrent.FluentFuture) JvmGlobalLocks(org.opendaylight.genius.utils.JvmGlobalLocks) ElanDpnInterfacesList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) DpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces) ElanDpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces) ElanDpnInterfacesListKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesListKey) Uint64(org.opendaylight.yangtools.yang.common.Uint64) ElanDpnInterfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces)

Example 63 with CONFIGURATION

use of org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION in project netvirt by opendaylight.

the class ElanEvpnFlowUtils method evpnRemoveTheDropFlow.

private List<ListenableFuture<?>> evpnRemoveTheDropFlow(long elanTag, Uint64 dpId, String nexthopIp, String macToRemove) {
    String flowId = ElanEvpnFlowUtils.evpnGetKnownDynamicmacFlowRef(NwConstants.ELAN_DMAC_TABLE, dpId, nexthopIp, macToRemove, elanTag, true);
    Flow flowToRemove = new FlowBuilder().setId(new FlowId(flowId)).setTableId(NwConstants.ELAN_DMAC_TABLE).build();
    return Collections.singletonList(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, tx -> mdsalManager.removeFlow(tx, dpId, flowToRemove)));
}
Also used : FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) CONFIGURATION(org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION) Uint64(org.opendaylight.yangtools.yang.common.Uint64) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) ElanItmUtils(org.opendaylight.netvirt.elan.utils.ElanItmUtils) Acquired(org.opendaylight.infrautils.utils.concurrent.NamedSimpleReentrantLock.Acquired) ElanConstants(org.opendaylight.netvirt.elan.utils.ElanConstants) ElanEtreeUtils(org.opendaylight.netvirt.elan.utils.ElanEtreeUtils) ManagedNewTransactionRunner(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner) HashMap(java.util.HashMap) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) Singleton(javax.inject.Singleton) FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) ElanUtils(org.opendaylight.netvirt.elan.utils.ElanUtils) Map(java.util.Map) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) BigInteger(java.math.BigInteger) NwConstants(org.opendaylight.genius.mdsalutil.NwConstants) MDSALUtil(org.opendaylight.genius.mdsalutil.MDSALUtil) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) EtreeLeafTagName(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.etree.rev160614.EtreeLeafTagName) List(java.util.List) ManagedNewTransactionRunnerImpl(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl) IMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager) Collections(java.util.Collections) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction) InstructionKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow)

Example 64 with CONFIGURATION

use of org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION in project netvirt by opendaylight.

the class ElanNodeListener method add.

@Override
public void add(InstanceIdentifier<Node> identifier, Node add) {
    NodeId nodeId = add.getId();
    String[] node = nodeId.getValue().split(":");
    if (node.length < 2) {
        LOG.warn("Unexpected nodeId {}", nodeId.getValue());
        return;
    }
    addErrorLogging(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> {
        Uint64 dpId = Uint64.valueOf(node[1]);
        createTableMissEntry(tx, dpId);
        createMulticastFlows(tx, dpId);
        createArpDefaultFlowsForArpCheckTable(dpId);
    }), LOG, "Error handling ELAN node addition for {}", add);
}
Also used : CONFIGURATION(org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION) Arrays(java.util.Arrays) ActionDrop(org.opendaylight.genius.mdsalutil.actions.ActionDrop) ElanConstants(org.opendaylight.netvirt.elan.utils.ElanConstants) LoggerFactory(org.slf4j.LoggerFactory) ActionNxResubmit(org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit) MatchEthernetDestination(org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination) PreDestroy(javax.annotation.PreDestroy) ElanUtils(org.opendaylight.netvirt.elan.utils.ElanUtils) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) NxmNxReg4(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg4) DataTreeEventCallbackRegistrar(org.opendaylight.genius.datastoreutils.listeners.DataTreeEventCallbackRegistrar) Duration(java.time.Duration) BigInteger(java.math.BigInteger) LoggingFutures(org.opendaylight.infrautils.utils.concurrent.LoggingFutures) MDSALUtil(org.opendaylight.genius.mdsalutil.MDSALUtil) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) ActionLearn(org.opendaylight.genius.mdsalutil.actions.ActionLearn) NxMatchRegister(org.opendaylight.genius.mdsalutil.nxmatches.NxMatchRegister) Configuration(org.opendaylight.mdsal.binding.util.Datastore.Configuration) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) LoggingFutures.addErrorLogging(org.opendaylight.infrautils.utils.concurrent.LoggingFutures.addErrorLogging) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) List(java.util.List) ManagedNewTransactionRunnerImpl(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl) TypedWriteTransaction(org.opendaylight.mdsal.binding.util.TypedWriteTransaction) ElanConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.config.rev150710.ElanConfig) TypedReadWriteTransaction(org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) MatchFromValue(org.opendaylight.genius.mdsalutil.actions.ActionLearn.MatchFromValue) Uint64(org.opendaylight.yangtools.yang.common.Uint64) Executors(org.opendaylight.infrautils.utils.concurrent.Executors) ManagedNewTransactionRunner(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase) MatchArpOp(org.opendaylight.genius.mdsalutil.matches.MatchArpOp) Singleton(javax.inject.Singleton) NxmOfFieldType(org.opendaylight.genius.mdsalutil.NwConstants.NxmOfFieldType) ArpResponderConstant(org.opendaylight.netvirt.elan.arp.responder.ArpResponderConstant) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) ArpResponderUtil(org.opendaylight.netvirt.elan.arp.responder.ArpResponderUtil) ActionRegLoad(org.opendaylight.genius.mdsalutil.actions.ActionRegLoad) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) ActionPuntToController(org.opendaylight.genius.mdsalutil.actions.ActionPuntToController) MatchEthernetType(org.opendaylight.genius.mdsalutil.matches.MatchEthernetType) NwConstants(org.opendaylight.genius.mdsalutil.NwConstants) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) Logger(org.slf4j.Logger) Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) AbstractAsyncDataTreeChangeListener(org.opendaylight.serviceutils.tools.listener.AbstractAsyncDataTreeChangeListener) JobCoordinator(org.opendaylight.infrautils.jobcoordinator.JobCoordinator) MatchFromField(org.opendaylight.genius.mdsalutil.actions.ActionLearn.MatchFromField) GroupEntity(org.opendaylight.genius.mdsalutil.GroupEntity) IdManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService) ExecutionException(java.util.concurrent.ExecutionException) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) IMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) GroupTypes(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes) BucketInfo(org.opendaylight.genius.mdsalutil.BucketInfo) CopyFromValue(org.opendaylight.genius.mdsalutil.actions.ActionLearn.CopyFromValue) Collections(java.util.Collections) MetaDataUtil(org.opendaylight.genius.mdsalutil.MetaDataUtil) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) Uint64(org.opendaylight.yangtools.yang.common.Uint64)

Example 65 with CONFIGURATION

use of org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION in project netvirt by opendaylight.

the class ElanNodeListener method createArpRequestMatchFlows.

private void createArpRequestMatchFlows(Uint64 dpId, TypedReadWriteTransaction<Configuration> tx) throws ExecutionException, InterruptedException {
    long arpRequestGroupId = ArpResponderUtil.retrieveStandardArpResponderGroupId(idManagerService);
    List<BucketInfo> buckets = ArpResponderUtil.getDefaultBucketInfos(NwConstants.ARP_RESPONDER_TABLE);
    LOG.trace("Installing group flow on dpn {}", dpId);
    GroupEntity groupEntity = MDSALUtil.buildGroupEntity(dpId, arpRequestGroupId, ArpResponderConstant.GROUP_FLOW_NAME.value(), GroupTypes.GroupAll, buckets);
    mdsalManager.addGroup(tx, groupEntity);
    InstanceIdentifier<Group> groupIid = ElanUtils.getGroupInstanceid(dpId, arpRequestGroupId);
    if (tx.read(groupIid).get().isPresent()) {
        LOG.info("group {} is present in the config hence adding the flow", arpRequestGroupId);
        createArpRequestMatchFlowsForGroup(dpId, arpRequestGroupId, tx);
        return;
    }
    eventCallbacks.onAddOrUpdate(LogicalDatastoreType.CONFIGURATION, ElanUtils.getGroupInstanceid(dpId, arpRequestGroupId), (unused, newGroupId) -> {
        LOG.info("group {} added in the config", arpRequestGroupId);
        LoggingFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, innerConfTx -> createArpRequestMatchFlowsForGroup(dpId, arpRequestGroupId, innerConfTx)), LOG, "Error adding flow for the group {}", arpRequestGroupId);
        return DataTreeEventCallbackRegistrar.NextAction.UNREGISTER;
    }, Duration.ofSeconds(5), iid -> LOG.error("arpRequestGroupId {} not found in Config datastore", arpRequestGroupId));
}
Also used : CONFIGURATION(org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION) Arrays(java.util.Arrays) ActionDrop(org.opendaylight.genius.mdsalutil.actions.ActionDrop) ElanConstants(org.opendaylight.netvirt.elan.utils.ElanConstants) LoggerFactory(org.slf4j.LoggerFactory) ActionNxResubmit(org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit) MatchEthernetDestination(org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination) PreDestroy(javax.annotation.PreDestroy) ElanUtils(org.opendaylight.netvirt.elan.utils.ElanUtils) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) NxmNxReg4(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg4) DataTreeEventCallbackRegistrar(org.opendaylight.genius.datastoreutils.listeners.DataTreeEventCallbackRegistrar) Duration(java.time.Duration) BigInteger(java.math.BigInteger) LoggingFutures(org.opendaylight.infrautils.utils.concurrent.LoggingFutures) MDSALUtil(org.opendaylight.genius.mdsalutil.MDSALUtil) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) ActionLearn(org.opendaylight.genius.mdsalutil.actions.ActionLearn) NxMatchRegister(org.opendaylight.genius.mdsalutil.nxmatches.NxMatchRegister) Configuration(org.opendaylight.mdsal.binding.util.Datastore.Configuration) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) LoggingFutures.addErrorLogging(org.opendaylight.infrautils.utils.concurrent.LoggingFutures.addErrorLogging) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) List(java.util.List) ManagedNewTransactionRunnerImpl(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl) TypedWriteTransaction(org.opendaylight.mdsal.binding.util.TypedWriteTransaction) ElanConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.config.rev150710.ElanConfig) TypedReadWriteTransaction(org.opendaylight.mdsal.binding.util.TypedReadWriteTransaction) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) MatchFromValue(org.opendaylight.genius.mdsalutil.actions.ActionLearn.MatchFromValue) Uint64(org.opendaylight.yangtools.yang.common.Uint64) Executors(org.opendaylight.infrautils.utils.concurrent.Executors) ManagedNewTransactionRunner(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner) MatchInfoBase(org.opendaylight.genius.mdsalutil.MatchInfoBase) MatchArpOp(org.opendaylight.genius.mdsalutil.matches.MatchArpOp) Singleton(javax.inject.Singleton) NxmOfFieldType(org.opendaylight.genius.mdsalutil.NwConstants.NxmOfFieldType) ArpResponderConstant(org.opendaylight.netvirt.elan.arp.responder.ArpResponderConstant) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) ArpResponderUtil(org.opendaylight.netvirt.elan.arp.responder.ArpResponderUtil) ActionRegLoad(org.opendaylight.genius.mdsalutil.actions.ActionRegLoad) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) ActionPuntToController(org.opendaylight.genius.mdsalutil.actions.ActionPuntToController) MatchEthernetType(org.opendaylight.genius.mdsalutil.matches.MatchEthernetType) NwConstants(org.opendaylight.genius.mdsalutil.NwConstants) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) Logger(org.slf4j.Logger) Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) AbstractAsyncDataTreeChangeListener(org.opendaylight.serviceutils.tools.listener.AbstractAsyncDataTreeChangeListener) JobCoordinator(org.opendaylight.infrautils.jobcoordinator.JobCoordinator) MatchFromField(org.opendaylight.genius.mdsalutil.actions.ActionLearn.MatchFromField) GroupEntity(org.opendaylight.genius.mdsalutil.GroupEntity) IdManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService) ExecutionException(java.util.concurrent.ExecutionException) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) IMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) GroupTypes(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes) BucketInfo(org.opendaylight.genius.mdsalutil.BucketInfo) CopyFromValue(org.opendaylight.genius.mdsalutil.actions.ActionLearn.CopyFromValue) Collections(java.util.Collections) MetaDataUtil(org.opendaylight.genius.mdsalutil.MetaDataUtil) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) GroupEntity(org.opendaylight.genius.mdsalutil.GroupEntity) BucketInfo(org.opendaylight.genius.mdsalutil.BucketInfo)

Aggregations

DataBroker (org.opendaylight.mdsal.binding.api.DataBroker)83 CONFIGURATION (org.opendaylight.mdsal.binding.util.Datastore.CONFIGURATION)83 Logger (org.slf4j.Logger)82 LoggerFactory (org.slf4j.LoggerFactory)82 ManagedNewTransactionRunner (org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner)81 ManagedNewTransactionRunnerImpl (org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl)81 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)80 Inject (javax.inject.Inject)75 Singleton (javax.inject.Singleton)75 LogicalDatastoreType (org.opendaylight.mdsal.common.api.LogicalDatastoreType)72 ArrayList (java.util.ArrayList)66 Collections (java.util.Collections)66 List (java.util.List)66 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)61 ExecutionException (java.util.concurrent.ExecutionException)60 Optional (java.util.Optional)57 LoggingFutures (org.opendaylight.infrautils.utils.concurrent.LoggingFutures)56 JobCoordinator (org.opendaylight.infrautils.jobcoordinator.JobCoordinator)53 NwConstants (org.opendaylight.genius.mdsalutil.NwConstants)51 PreDestroy (javax.annotation.PreDestroy)50