Search in sources :

Example 41 with InstructionInfo

use of org.opendaylight.genius.mdsalutil.InstructionInfo in project netvirt by opendaylight.

the class IPv6Handler method installPing6ResponderFlowEntry.

public void installPing6ResponderFlowEntry(BigInteger dpnId, long vpnId, String routerInternalIp, MacAddress routerMac, long label, int addOrRemove) {
    List<MatchInfo> matches = new ArrayList<>();
    matches.add(MatchIpProtocol.ICMPV6);
    matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
    matches.add(new MatchIcmpv6((short) 128, (short) 0));
    matches.add(MatchEthernetType.IPV6);
    matches.add(new MatchIpv6Destination(routerInternalIp));
    List<ActionInfo> actionsInfos = new ArrayList<>();
    // Set Eth Src and Eth Dst
    actionsInfos.add(new ActionMoveSourceDestinationEth());
    actionsInfos.add(new ActionSetFieldEthernetSource(routerMac));
    // Move Ipv6 Src to Ipv6 Dst
    actionsInfos.add(new ActionMoveSourceDestinationIpv6());
    actionsInfos.add(new ActionSetSourceIpv6(new Ipv6Prefix(routerInternalIp)));
    // Set the ICMPv6 type to 129 (echo reply)
    actionsInfos.add(new ActionSetIcmpv6Type((short) 129));
    actionsInfos.add(new ActionNxLoadInPort(BigInteger.ZERO));
    actionsInfos.add(new ActionNxResubmit(NwConstants.L3_FIB_TABLE));
    List<InstructionInfo> instructions = new ArrayList<>();
    instructions.add(new InstructionApplyActions(actionsInfos));
    int priority = FibConstants.DEFAULT_FIB_FLOW_PRIORITY + FibConstants.DEFAULT_IPV6_PREFIX_LENGTH;
    String flowRef = FibUtil.getFlowRef(dpnId, NwConstants.L3_FIB_TABLE, label, priority);
    FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L3_FIB_TABLE, flowRef, priority, flowRef, 0, 0, NwConstants.COOKIE_VM_FIB_TABLE, matches, instructions);
    if (addOrRemove == NwConstants.ADD_FLOW) {
        mdsalManager.syncInstallFlow(flowEntity);
    } else {
        mdsalManager.syncRemoveFlow(flowEntity);
    }
}
Also used : MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) ActionSetSourceIpv6(org.opendaylight.genius.mdsalutil.actions.ActionSetSourceIpv6) ArrayList(java.util.ArrayList) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) ActionMoveSourceDestinationIpv6(org.opendaylight.genius.mdsalutil.actions.ActionMoveSourceDestinationIpv6) ActionNxLoadInPort(org.opendaylight.genius.mdsalutil.actions.ActionNxLoadInPort) MatchIpv6Destination(org.opendaylight.genius.mdsalutil.matches.MatchIpv6Destination) ActionSetFieldEthernetSource(org.opendaylight.genius.mdsalutil.actions.ActionSetFieldEthernetSource) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) MatchIcmpv6(org.opendaylight.genius.mdsalutil.matches.MatchIcmpv6) ActionMoveSourceDestinationEth(org.opendaylight.genius.mdsalutil.actions.ActionMoveSourceDestinationEth) ActionSetIcmpv6Type(org.opendaylight.genius.mdsalutil.actions.ActionSetIcmpv6Type) ActionNxResubmit(org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)

Example 42 with InstructionInfo

use of org.opendaylight.genius.mdsalutil.InstructionInfo in project netvirt by opendaylight.

the class VrfEntryListener method installSubnetBroadcastAddrDropRule.

private void installSubnetBroadcastAddrDropRule(final BigInteger dpnId, final String rd, final long vpnId, final VrfEntry vrfEntry, int addOrRemove, WriteTransaction tx) {
    List<MatchInfo> matches = new ArrayList<>();
    LOG.debug("SUBNETROUTE: installSubnetBroadcastAddrDropRule: destPrefix {} rd {} vpnId {} dpnId {}", vrfEntry.getDestPrefix(), rd, vpnId, dpnId);
    String[] ipAddress = vrfEntry.getDestPrefix().split("/");
    String subnetBroadcastAddr = FibUtil.getBroadcastAddressFromCidr(vrfEntry.getDestPrefix());
    final int prefixLength = ipAddress.length == 1 ? 0 : Integer.parseInt(ipAddress[1]);
    InetAddress destPrefix;
    try {
        destPrefix = InetAddress.getByName(subnetBroadcastAddr);
    } catch (UnknownHostException e) {
        LOG.error("Failed to get destPrefix for prefix {} rd {} VpnId {} DPN {}", vrfEntry.getDestPrefix(), rd, vpnId, dpnId, e);
        return;
    }
    // Match on VpnId and SubnetBroadCast IP address
    matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
    matches.add(MatchEthernetType.IPV4);
    if (prefixLength != 0) {
        matches.add(new MatchIpv4Destination(subnetBroadcastAddr, Integer.toString(IPV4_ADDR_PREFIX_LENGTH)));
    }
    // Action is to drop the packet
    List<InstructionInfo> dropInstructions = new ArrayList<>();
    List<ActionInfo> actionsInfos = new ArrayList<>();
    actionsInfos.add(new ActionDrop());
    dropInstructions.add(new InstructionApplyActions(actionsInfos));
    int priority = DEFAULT_FIB_FLOW_PRIORITY + IPV4_ADDR_PREFIX_LENGTH;
    String flowRef = FibUtil.getFlowRef(dpnId, NwConstants.L3_SUBNET_ROUTE_TABLE, rd, priority, destPrefix);
    FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpnId, NwConstants.L3_SUBNET_ROUTE_TABLE, flowRef, priority, flowRef, 0, 0, COOKIE_TABLE_MISS, matches, dropInstructions);
    Flow flow = flowEntity.getFlowBuilder().build();
    String flowId = flowEntity.getFlowId();
    FlowKey flowKey = new FlowKey(new FlowId(flowId));
    Node nodeDpn = FibUtil.buildDpnNode(dpnId);
    InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class).child(Table.class, new TableKey(flow.getTableId())).child(Flow.class, flowKey).build();
    if (addOrRemove == NwConstants.ADD_FLOW) {
        tx.put(LogicalDatastoreType.CONFIGURATION, flowInstanceId, flow, true);
    } else {
        tx.delete(LogicalDatastoreType.CONFIGURATION, flowInstanceId);
    }
}
Also used : FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) MatchIpv4Destination(org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) ActionDrop(org.opendaylight.genius.mdsalutil.actions.ActionDrop) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) FlowKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey) UnknownHostException(java.net.UnknownHostException) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) TableKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) InetAddress(java.net.InetAddress)

Example 43 with InstructionInfo

use of org.opendaylight.genius.mdsalutil.InstructionInfo in project netvirt by opendaylight.

the class VrfEntryListener method createRemoteFibEntry.

private void createRemoteFibEntry(final BigInteger remoteDpnId, final long vpnId, String rd, final VrfEntry vrfEntry, WriteTransaction tx) {
    Boolean wrTxPresent = true;
    if (tx == null) {
        wrTxPresent = false;
        tx = dataBroker.newWriteOnlyTransaction();
    }
    String vpnName = fibUtil.getVpnNameFromId(vpnId);
    LOG.debug("createremotefibentry: adding route {} for rd {} on remoteDpnId {}", vrfEntry.getDestPrefix(), rd, remoteDpnId);
    List<AdjacencyResult> adjacencyResults = baseVrfEntryHandler.resolveAdjacency(remoteDpnId, vpnId, vrfEntry, rd);
    if (adjacencyResults.isEmpty()) {
        LOG.error("Could not get interface for route-paths: {} in vpn {} on DPN {}", vrfEntry.getRoutePaths(), rd, remoteDpnId);
        LOG.error("Failed to add Route: {} in vpn: {}", vrfEntry.getDestPrefix(), rd);
        return;
    }
    List<String> usedRds = VpnExtraRouteHelper.getUsedRds(dataBroker, vpnId, vrfEntry.getDestPrefix());
    List<Routes> vpnExtraRoutes = VpnExtraRouteHelper.getAllVpnExtraRoutes(dataBroker, vpnName, usedRds, vrfEntry.getDestPrefix());
    // multiple VMs
    if (!vpnExtraRoutes.isEmpty() && (vpnExtraRoutes.size() > 1 || vpnExtraRoutes.get(0).getNexthopIpList().size() > 1)) {
        List<InstructionInfo> instructions = new ArrayList<>();
        // Obtain the local routes for this particular dpn.
        java.util.Optional<Routes> routes = vpnExtraRoutes.stream().filter(route -> {
            Prefixes prefixToInterface = fibUtil.getPrefixToInterface(vpnId, fibUtil.getIpPrefix(route.getNexthopIpList().get(0)));
            if (prefixToInterface == null) {
                return false;
            }
            return remoteDpnId.equals(prefixToInterface.getDpnId());
        }).findFirst();
        long groupId = nextHopManager.createNextHopGroups(vpnId, rd, remoteDpnId, vrfEntry, routes.isPresent() ? routes.get() : null, vpnExtraRoutes);
        if (groupId == FibConstants.INVALID_GROUP_ID) {
            LOG.error("Unable to create Group for local prefix {} on rd {} on Node {}", vrfEntry.getDestPrefix(), rd, remoteDpnId.toString());
            return;
        }
        List<ActionInfo> actionInfos = Collections.singletonList(new ActionGroup(groupId));
        instructions.add(new InstructionApplyActions(actionInfos));
        baseVrfEntryHandler.makeConnectedRoute(remoteDpnId, vpnId, vrfEntry, rd, instructions, NwConstants.ADD_FLOW, tx, null);
    } else {
        baseVrfEntryHandler.programRemoteFib(remoteDpnId, vpnId, vrfEntry, tx, rd, adjacencyResults, null);
    }
    if (!wrTxPresent) {
        tx.submit();
    }
    LOG.debug("Successfully added FIB entry for prefix {} in vpnId {}", vrfEntry.getDestPrefix(), vpnId);
}
Also used : Arrays(java.util.Arrays) Table(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table) AdjacencyResult(org.opendaylight.netvirt.fibmanager.NexthopManager.AdjacencyResult) FibEntries(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.FibEntries) ActionDrop(org.opendaylight.genius.mdsalutil.actions.ActionDrop) LoggerFactory(org.slf4j.LoggerFactory) CheckedFuture(com.google.common.util.concurrent.CheckedFuture) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) VpnInterfaceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn._interface.op.data.VpnInterfaceOpDataEntry) InetAddress(java.net.InetAddress) ServiceIndex(org.opendaylight.genius.utils.ServiceIndex) InterVpnLinkCache(org.opendaylight.netvirt.vpnmanager.api.intervpnlink.InterVpnLinkCache) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) FlowKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey) Optional(com.google.common.base.Optional) BigInteger(java.math.BigInteger) LabelRouteInfoBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.label.route.map.LabelRouteInfoBuilder) MDSALUtil(org.opendaylight.genius.mdsalutil.MDSALUtil) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) ManagedNewTransactionRunner(org.opendaylight.genius.infra.ManagedNewTransactionRunner) LabelRouteInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.label.route.map.LabelRouteInfo) Collection(java.util.Collection) LogicalDatastoreType(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions) Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.vpn.extra.routes.Routes) TransactionCommitFailedException(org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException) WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) PrefixesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.PrefixesBuilder) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) SubTransaction(org.opendaylight.genius.utils.batching.SubTransaction) List(java.util.List) RoutePaths(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentrybase.RoutePaths) VpnInstanceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry) State(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.inter.vpn.link.rev160311.inter.vpn.link.states.InterVpnLinkState.State) PostConstruct(javax.annotation.PostConstruct) SubnetRoute(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.SubnetRoute) AdjacenciesOp(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.AdjacenciesOp) NWUtil.isIpv4Address(org.opendaylight.genius.mdsalutil.NWUtil.isIpv4Address) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) LabelRouteMap(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.LabelRouteMap) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) Callable(java.util.concurrent.Callable) IElanService(org.opendaylight.netvirt.elanmanager.api.IElanService) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) VrfEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry) Singleton(javax.inject.Singleton) InstructionWriteMetadata(org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata) 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) MatchIpv4Destination(org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination) InstanceIdentifierBuilder(org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder) MatchTunnelId(org.opendaylight.genius.mdsalutil.matches.MatchTunnelId) LabelRouteInfoKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.label.route.map.LabelRouteInfoKey) InterVpnLinkDataComposite(org.opendaylight.netvirt.vpnmanager.api.intervpnlink.InterVpnLinkDataComposite) ManagedNewTransactionRunnerImpl(org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) MatchEthernetType(org.opendaylight.genius.mdsalutil.matches.MatchEthernetType) NwConstants(org.opendaylight.genius.mdsalutil.NwConstants) ActionPopMpls(org.opendaylight.genius.mdsalutil.actions.ActionPopMpls) VpnExtraRouteHelper(org.opendaylight.netvirt.vpnmanager.api.VpnExtraRouteHelper) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) RouterInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.RouterInterface) ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) Logger(org.slf4j.Logger) VrfTablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTablesKey) RouteOrigin(org.opendaylight.netvirt.fibmanager.api.RouteOrigin) JobCoordinator(org.opendaylight.infrautils.jobcoordinator.JobCoordinator) VrfTables(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTables) AsyncDataTreeChangeListenerBase(org.opendaylight.genius.datastoreutils.AsyncDataTreeChangeListenerBase) RetryingManagedNewTransactionRunner(org.opendaylight.genius.infra.RetryingManagedNewTransactionRunner) TableKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey) UnknownHostException(java.net.UnknownHostException) FutureCallback(com.google.common.util.concurrent.FutureCallback) ExecutionException(java.util.concurrent.ExecutionException) Futures(com.google.common.util.concurrent.Futures) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) Prefixes(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.Prefixes) VpnToDpnList(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.vpn.instance.op.data.entry.VpnToDpnList) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) IMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager) MatchMplsLabel(org.opendaylight.genius.mdsalutil.matches.MatchMplsLabel) Preconditions(com.google.common.base.Preconditions) InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) VrfEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntryKey) Collections(java.util.Collections) MetaDataUtil(org.opendaylight.genius.mdsalutil.MetaDataUtil) FibHelper(org.opendaylight.netvirt.fibmanager.api.FibHelper) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.vpn.extra.routes.Routes) ActionInfo(org.opendaylight.genius.mdsalutil.ActionInfo) Prefixes(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.Prefixes) AdjacencyResult(org.opendaylight.netvirt.fibmanager.NexthopManager.AdjacencyResult) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ActionGroup(org.opendaylight.genius.mdsalutil.actions.ActionGroup) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)

Example 44 with InstructionInfo

use of org.opendaylight.genius.mdsalutil.InstructionInfo in project netvirt by opendaylight.

the class VrfEntryListener method createTerminatingServiceActions.

public void createTerminatingServiceActions(BigInteger destDpId, int label, List<ActionInfo> actionsInfos, WriteTransaction tx) {
    List<MatchInfo> mkMatches = new ArrayList<>();
    LOG.debug("create terminatingServiceAction on DpnId = {} and serviceId = {} and actions = {}", destDpId, label, actionsInfos);
    // Matching metadata
    // FIXME vxlan vni bit set is not working properly with OVS.need to revisit
    mkMatches.add(new MatchTunnelId(BigInteger.valueOf(label)));
    List<InstructionInfo> mkInstructions = new ArrayList<>();
    mkInstructions.add(new InstructionApplyActions(actionsInfos));
    FlowEntity terminatingServiceTableFlowEntity = MDSALUtil.buildFlowEntity(destDpId, NwConstants.INTERNAL_TUNNEL_TABLE, getTableMissFlowRef(destDpId, NwConstants.INTERNAL_TUNNEL_TABLE, label), 5, String.format("%s:%d", "TST Flow Entry ", label), 0, 0, COOKIE_TUNNEL.add(BigInteger.valueOf(label)), mkMatches, mkInstructions);
    FlowKey flowKey = new FlowKey(new FlowId(terminatingServiceTableFlowEntity.getFlowId()));
    FlowBuilder flowbld = terminatingServiceTableFlowEntity.getFlowBuilder();
    Node nodeDpn = FibUtil.buildDpnNode(terminatingServiceTableFlowEntity.getDpnId());
    InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class).child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class).child(Table.class, new TableKey(terminatingServiceTableFlowEntity.getTableId())).child(Flow.class, flowKey).build();
    tx.put(LogicalDatastoreType.CONFIGURATION, flowInstanceId, flowbld.build(), WriteTransaction.CREATE_MISSING_PARENTS);
}
Also used : FlowKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) ArrayList(java.util.ArrayList) TableKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) FlowEntity(org.opendaylight.genius.mdsalutil.FlowEntity) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) MatchTunnelId(org.opendaylight.genius.mdsalutil.matches.MatchTunnelId) FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) InstructionApplyActions(org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)

Example 45 with InstructionInfo

use of org.opendaylight.genius.mdsalutil.InstructionInfo in project netvirt by opendaylight.

the class BaseVrfEntryHandler method buildL3vpnGatewayFlow.

public FlowEntity buildL3vpnGatewayFlow(BigInteger dpId, String gwMacAddress, long vpnId) {
    List<MatchInfo> mkMatches = new ArrayList<>();
    mkMatches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
    mkMatches.add(new MatchEthernetDestination(new MacAddress(gwMacAddress)));
    List<InstructionInfo> mkInstructions = new ArrayList<>();
    mkInstructions.add(new InstructionGotoTable(NwConstants.L3_FIB_TABLE));
    String flowId = FibUtil.getL3VpnGatewayFlowRef(NwConstants.L3_GW_MAC_TABLE, dpId, vpnId, gwMacAddress);
    return MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_GW_MAC_TABLE, flowId, 20, flowId, 0, 0, NwConstants.COOKIE_L3_GW_MAC_TABLE, mkMatches, mkInstructions);
}
Also used : MatchMetadata(org.opendaylight.genius.mdsalutil.matches.MatchMetadata) InstructionGotoTable(org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable) MatchInfo(org.opendaylight.genius.mdsalutil.MatchInfo) InstructionInfo(org.opendaylight.genius.mdsalutil.InstructionInfo) ArrayList(java.util.ArrayList) MatchEthernetDestination(org.opendaylight.genius.mdsalutil.matches.MatchEthernetDestination) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)

Aggregations

InstructionInfo (org.opendaylight.genius.mdsalutil.InstructionInfo)120 ArrayList (java.util.ArrayList)113 ActionInfo (org.opendaylight.genius.mdsalutil.ActionInfo)74 InstructionApplyActions (org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions)74 MatchInfo (org.opendaylight.genius.mdsalutil.MatchInfo)63 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)52 MatchMetadata (org.opendaylight.genius.mdsalutil.matches.MatchMetadata)41 InstructionGotoTable (org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable)34 BigInteger (java.math.BigInteger)33 MatchInfoBase (org.opendaylight.genius.mdsalutil.MatchInfoBase)33 ActionNxResubmit (org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit)27 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)17 InstructionWriteMetadata (org.opendaylight.genius.mdsalutil.instructions.InstructionWriteMetadata)16 ActionGroup (org.opendaylight.genius.mdsalutil.actions.ActionGroup)13 ActionNxConntrack (org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack)12 ActionPuntToController (org.opendaylight.genius.mdsalutil.actions.ActionPuntToController)11 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)10 NxCtAction (org.opendaylight.genius.mdsalutil.actions.ActionNxConntrack.NxCtAction)10 MatchTunnelId (org.opendaylight.genius.mdsalutil.matches.MatchTunnelId)10 MatchIpv4Destination (org.opendaylight.genius.mdsalutil.matches.MatchIpv4Destination)9