Search in sources :

Example 66 with ForwardingObjective

use of org.onosproject.net.flowobjective.ForwardingObjective in project onos by opennetworkinglab.

the class Ofdpa2Pipeline method processEgress.

/**
 * In the OF-DPA 2.0 pipeline, egress forwarding objectives go to the
 * egress tables.
 * @param fwd  the forwarding objective of type 'egress'
 * @return     a collection of flow rules to be sent to the switch. An empty
 *             collection may be returned if there is a problem in processing
 *             the flow rule
 */
protected Collection<FlowRule> processEgress(ForwardingObjective fwd) {
    log.debug("Processing egress forwarding objective:{} in dev:{}", fwd, deviceId);
    List<FlowRule> rules = new ArrayList<>();
    // Build selector
    TrafficSelector.Builder sb = DefaultTrafficSelector.builder();
    VlanIdCriterion vlanIdCriterion = (VlanIdCriterion) fwd.selector().getCriterion(Criterion.Type.VLAN_VID);
    if (vlanIdCriterion == null) {
        log.error("Egress forwarding objective:{} must include vlanId", fwd.id());
        fail(fwd, ObjectiveError.BADPARAMS);
        return rules;
    }
    Optional<Instruction> outInstr = fwd.treatment().allInstructions().stream().filter(instruction -> instruction instanceof OutputInstruction).findFirst();
    if (!outInstr.isPresent()) {
        log.error("Egress forwarding objective:{} must include output port", fwd.id());
        fail(fwd, ObjectiveError.BADPARAMS);
        return rules;
    }
    PortNumber portNumber = ((OutputInstruction) outInstr.get()).port();
    sb.matchVlanId(vlanIdCriterion.vlanId());
    OfdpaMatchActsetOutput actsetOutput = new OfdpaMatchActsetOutput(portNumber);
    sb.extension(actsetOutput, deviceId);
    sb.extension(new OfdpaMatchAllowVlanTranslation(ALLOW_VLAN_TRANSLATION), deviceId);
    // Build a flow rule for Egress VLAN Flow table
    TrafficTreatment.Builder tb = DefaultTrafficTreatment.builder();
    tb.transition(EGRESS_DSCP_PCP_REMARK_FLOW_TABLE);
    if (fwd.treatment() != null) {
        for (Instruction instr : fwd.treatment().allInstructions()) {
            if (instr instanceof L2ModificationInstruction && ((L2ModificationInstruction) instr).subtype() == L2SubType.VLAN_ID) {
                tb.immediate().add(instr);
            }
            if (instr instanceof L2ModificationInstruction && ((L2ModificationInstruction) instr).subtype() == L2SubType.VLAN_PUSH) {
                tb.immediate().pushVlan();
                EthType ethType = ((L2ModificationInstruction.ModVlanHeaderInstruction) instr).ethernetType();
                if (ethType.equals(EtherType.QINQ.ethType())) {
                    // Build a flow rule for Egress TPID Flow table
                    TrafficSelector tpidSelector = DefaultTrafficSelector.builder().extension(actsetOutput, deviceId).matchVlanId(VlanId.ANY).build();
                    TrafficTreatment tpidTreatment = DefaultTrafficTreatment.builder().extension(new Ofdpa3CopyField(COPY_FIELD_NBITS, COPY_FIELD_OFFSET, COPY_FIELD_OFFSET, OXM_ID_VLAN_VID, OXM_ID_PACKET_REG_1), deviceId).popVlan().pushVlan(EtherType.QINQ.ethType()).extension(new Ofdpa3CopyField(COPY_FIELD_NBITS, COPY_FIELD_OFFSET, COPY_FIELD_OFFSET, OXM_ID_PACKET_REG_1, OXM_ID_VLAN_VID), deviceId).build();
                    FlowRule.Builder tpidRuleBuilder = DefaultFlowRule.builder().fromApp(fwd.appId()).withPriority(fwd.priority()).forDevice(deviceId).withSelector(tpidSelector).withTreatment(tpidTreatment).makePermanent().forTable(EGRESS_TPID_FLOW_TABLE);
                    rules.add(tpidRuleBuilder.build());
                }
            }
        }
    }
    FlowRule.Builder ruleBuilder = DefaultFlowRule.builder().fromApp(fwd.appId()).withPriority(fwd.priority()).forDevice(deviceId).withSelector(sb.build()).withTreatment(tb.build()).makePermanent().forTable(EGRESS_VLAN_FLOW_TABLE);
    rules.add(ruleBuilder.build());
    return rules;
}
Also used : OfdpaPipelineUtility(org.onosproject.driver.pipeline.ofdpa.OfdpaPipelineUtility) DefaultFlowRule(org.onosproject.net.flow.DefaultFlowRule) PortNumber(org.onosproject.net.PortNumber) DeviceService(org.onosproject.net.device.DeviceService) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) OfdpaMatchActsetOutput(org.onosproject.driver.extensions.OfdpaMatchActsetOutput) ObjectiveError(org.onosproject.net.flowobjective.ObjectiveError) Executors.newSingleThreadScheduledExecutor(java.util.concurrent.Executors.newSingleThreadScheduledExecutor) FlowRuleService(org.onosproject.net.flow.FlowRuleService) Pair(org.apache.commons.lang3.tuple.Pair) Executors.newScheduledThreadPool(java.util.concurrent.Executors.newScheduledThreadPool) Port(org.onosproject.net.Port) ApplicationId(org.onosproject.core.ApplicationId) NextObjective(org.onosproject.net.flowobjective.NextObjective) L2ModificationInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction) KryoNamespaces(org.onosproject.store.serializers.KryoNamespaces) SELECT(org.onosproject.net.group.GroupDescription.Type.SELECT) MPLS_BOS(org.onosproject.net.flow.criteria.Criterion.Type.MPLS_BOS) Ofdpa3MplsType(org.onosproject.driver.extensions.Ofdpa3MplsType) L3ModificationInstruction(org.onosproject.net.flow.instructions.L3ModificationInstruction) FilteringObjective(org.onosproject.net.flowobjective.FilteringObjective) AbstractAccumulator(org.onlab.util.AbstractAccumulator) OfdpaMatchVlanVid(org.onosproject.driver.extensions.OfdpaMatchVlanVid) OfdpaMatchAllowVlanTranslation(org.onosproject.driver.extensions.OfdpaMatchAllowVlanTranslation) DeviceId(org.onosproject.net.DeviceId) L3SubType(org.onosproject.net.flow.instructions.L3ModificationInstruction.L3SubType) L2SubType(org.onosproject.net.flow.instructions.L2ModificationInstruction.L2SubType) Pipeliner(org.onosproject.net.behaviour.Pipeliner) FlowRuleOperationsContext(org.onosproject.net.flow.FlowRuleOperationsContext) OfdpaSetVlanVid(org.onosproject.driver.extensions.OfdpaSetVlanVid) KryoNamespace(org.onlab.util.KryoNamespace) NextGroup(org.onosproject.net.behaviour.NextGroup) EthCriterion(org.onosproject.net.flow.criteria.EthCriterion) AbstractHandlerBehaviour(org.onosproject.net.driver.AbstractHandlerBehaviour) ArrayList(java.util.ArrayList) Lists(com.google.common.collect.Lists) TrafficSelector(org.onosproject.net.flow.TrafficSelector) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) Criteria(org.onosproject.net.flow.criteria.Criteria) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) Criterion(org.onosproject.net.flow.criteria.Criterion) Ofdpa3CopyField(org.onosproject.driver.extensions.Ofdpa3CopyField) FlowRuleOperations(org.onosproject.net.flow.FlowRuleOperations) EthTypeCriterion(org.onosproject.net.flow.criteria.EthTypeCriterion) UdpPortCriterion(org.onosproject.net.flow.criteria.UdpPortCriterion) Instruction(org.onosproject.net.flow.instructions.Instruction) VlanId(org.onlab.packet.VlanId) GroupService(org.onosproject.net.group.GroupService) Icmpv6CodeCriterion(org.onosproject.net.flow.criteria.Icmpv6CodeCriterion) OXM_ID_VLAN_VID(org.onosproject.driver.extensions.Ofdpa3CopyField.OXM_ID_VLAN_VID) EtherType(org.onlab.packet.EthType.EtherType) Accumulator(org.onlab.util.Accumulator) NoActionInstruction(org.onosproject.net.flow.instructions.Instructions.NoActionInstruction) Objective(org.onosproject.net.flowobjective.Objective) MacAddress(org.onlab.packet.MacAddress) ArrayDeque(java.util.ArrayDeque) MplsBosCriterion(org.onosproject.net.flow.criteria.MplsBosCriterion) CoreService(org.onosproject.core.CoreService) Tools.groupedThreads(org.onlab.util.Tools.groupedThreads) Timer(java.util.Timer) PortCriterion(org.onosproject.net.flow.criteria.PortCriterion) ForwardingObjective(org.onosproject.net.flowobjective.ForwardingObjective) ServiceDirectory(org.onlab.osgi.ServiceDirectory) Ethernet(org.onlab.packet.Ethernet) OXM_ID_PACKET_REG_1(org.onosproject.driver.extensions.Ofdpa3CopyField.OXM_ID_PACKET_REG_1) SPECIFIC(org.onosproject.net.flowobjective.ForwardingObjective.Flag.SPECIFIC) Ofdpa3SetMplsType(org.onosproject.driver.extensions.Ofdpa3SetMplsType) IPCriterion(org.onosproject.net.flow.criteria.IPCriterion) PipelinerContext(org.onosproject.net.behaviour.PipelinerContext) OutputInstruction(org.onosproject.net.flow.instructions.Instructions.OutputInstruction) Collection(java.util.Collection) FlowObjectiveStore(org.onosproject.net.flowobjective.FlowObjectiveStore) Sets(com.google.common.collect.Sets) Icmpv6TypeCriterion(org.onosproject.net.flow.criteria.Icmpv6TypeCriterion) Objects(java.util.Objects) EthType(org.onlab.packet.EthType) List(java.util.List) FlowRule(org.onosproject.net.flow.FlowRule) Optional(java.util.Optional) IpPrefix(org.onlab.packet.IpPrefix) MplsCriterion(org.onosproject.net.flow.criteria.MplsCriterion) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) GroupKey(org.onosproject.net.group.GroupKey) Deque(java.util.Deque) Group(org.onosproject.net.group.Group) ImmutableList(com.google.common.collect.ImmutableList) DefaultGroupKey(org.onosproject.net.group.DefaultGroupKey) TcpPortCriterion(org.onosproject.net.flow.criteria.TcpPortCriterion) OfdpaGroupHandlerUtility(org.onosproject.driver.pipeline.ofdpa.OfdpaGroupHandlerUtility) IpAddress(org.onlab.packet.IpAddress) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) Logger(org.slf4j.Logger) ModMplsHeaderInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsHeaderInstruction) TimeUnit(java.util.concurrent.TimeUnit) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion) LoggerFactory.getLogger(org.slf4j.LoggerFactory.getLogger) Collections(java.util.Collections) OutputInstruction(org.onosproject.net.flow.instructions.Instructions.OutputInstruction) OfdpaMatchActsetOutput(org.onosproject.driver.extensions.OfdpaMatchActsetOutput) ArrayList(java.util.ArrayList) L2ModificationInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction) L2ModificationInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction) L3ModificationInstruction(org.onosproject.net.flow.instructions.L3ModificationInstruction) Instruction(org.onosproject.net.flow.instructions.Instruction) NoActionInstruction(org.onosproject.net.flow.instructions.Instructions.NoActionInstruction) OutputInstruction(org.onosproject.net.flow.instructions.Instructions.OutputInstruction) ModMplsHeaderInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsHeaderInstruction) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) EthType(org.onlab.packet.EthType) TrafficSelector(org.onosproject.net.flow.TrafficSelector) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) OfdpaMatchAllowVlanTranslation(org.onosproject.driver.extensions.OfdpaMatchAllowVlanTranslation) DefaultFlowRule(org.onosproject.net.flow.DefaultFlowRule) FlowRule(org.onosproject.net.flow.FlowRule) PortNumber(org.onosproject.net.PortNumber) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion) Ofdpa3CopyField(org.onosproject.driver.extensions.Ofdpa3CopyField)

Example 67 with ForwardingObjective

use of org.onosproject.net.flowobjective.ForwardingObjective in project onos by opennetworkinglab.

the class JuniperQfx5100Pipeliner method forward.

@Override
public void forward(ForwardingObjective forwardObjective) {
    FlowRule rule;
    FlowRuleOperations.Builder flowOpsBuilder = FlowRuleOperations.builder();
    ForwardingObjective newFwd = forwardObjective;
    Device device = deviceService.getDevice(deviceId);
    if (forwardObjective.treatment() != null && forwardObjective.treatment().clearedDeferred()) {
        log.warn("Using 'clear actions' instruction which is not supported by {}  {} {} Switch", device.id(), device.manufacturer(), device.hwVersion());
        newFwd = forwardingObjectiveWithoutCleardDef(forwardObjective).orElse(forwardObjective);
    }
    rule = processForward(newFwd);
    switch(forwardObjective.op()) {
        case ADD:
            flowOpsBuilder.add(rule);
            break;
        case REMOVE:
            flowOpsBuilder.remove(rule);
            break;
        default:
            fail(forwardObjective, ObjectiveError.UNKNOWN);
            log.warn("Unknown forwarding type {}", forwardObjective.op());
    }
    flowRuleService.apply(flowOpsBuilder.build(new FlowRuleOperationsContext() {

        @Override
        public void onSuccess(FlowRuleOperations ops) {
            pass(forwardObjective);
        }

        @Override
        public void onError(FlowRuleOperations ops) {
            fail(forwardObjective, ObjectiveError.FLOWINSTALLATIONFAILED);
        }
    }));
}
Also used : FlowRuleOperations(org.onosproject.net.flow.FlowRuleOperations) Device(org.onosproject.net.Device) DefaultFlowRule(org.onosproject.net.flow.DefaultFlowRule) FlowRule(org.onosproject.net.flow.FlowRule) ForwardingObjective(org.onosproject.net.flowobjective.ForwardingObjective) DefaultForwardingObjective(org.onosproject.net.flowobjective.DefaultForwardingObjective) FlowRuleOperationsContext(org.onosproject.net.flow.FlowRuleOperationsContext)

Example 68 with ForwardingObjective

use of org.onosproject.net.flowobjective.ForwardingObjective in project onos by opennetworkinglab.

the class AristaPipeliner method forward.

@Override
public void forward(ForwardingObjective forwardObjective) {
    ForwardingObjective newFwd = forwardObjective;
    Device device = deviceService.getDevice(deviceId);
    if (forwardObjective.treatment() != null && forwardObjective.treatment().clearedDeferred()) {
        log.warn("Using 'clear actions' instruction which is not supported by {} {} {} Switch" + " removing the clear deferred from the forwarding objective", device.id(), device.manufacturer(), device.hwVersion());
        newFwd = forwardingObjectiveWithoutCleardDef(forwardObjective).orElse(forwardObjective);
    }
    super.forward(newFwd);
}
Also used : Device(org.onosproject.net.Device) DefaultForwardingObjective(org.onosproject.net.flowobjective.DefaultForwardingObjective) ForwardingObjective(org.onosproject.net.flowobjective.ForwardingObjective)

Example 69 with ForwardingObjective

use of org.onosproject.net.flowobjective.ForwardingObjective in project onos by opennetworkinglab.

the class FlowObjectiveWebResource method createForwardingObjective.

/**
 * Creates and installs a new forwarding objective for the specified device.
 *
 * @param appId    application identifier
 * @param deviceId device identifier
 * @param stream   forwarding objective JSON
 * @return status of the request - CREATED if the JSON is correct,
 * BAD_REQUEST if the JSON is invalid
 * @onos.rsModel ForwardingObjective
 */
@POST
@Path("{deviceId}/forward")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response createForwardingObjective(@QueryParam("appId") String appId, @PathParam("deviceId") String deviceId, InputStream stream) {
    try {
        UriBuilder locationBuilder = null;
        ObjectNode jsonTree = (ObjectNode) mapper().readTree(stream);
        validateDeviceId(deviceId, jsonTree);
        if (appId != null) {
            jsonTree.put("appId", appId);
        }
        DeviceId did = DeviceId.deviceId(deviceId);
        ForwardingObjective forwardingObjective = codec(ForwardingObjective.class).decode(jsonTree, this);
        flowObjectiveService.forward(did, forwardingObjective);
        locationBuilder = uriInfo.getBaseUriBuilder().path("flowobjectives").path(did.toString()).path("forward").path(Integer.toString(forwardingObjective.id()));
        return Response.created(locationBuilder.build()).build();
    } catch (IOException e) {
        throw new IllegalArgumentException(e);
    }
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) DeviceId(org.onosproject.net.DeviceId) ForwardingObjective(org.onosproject.net.flowobjective.ForwardingObjective) IOException(java.io.IOException) UriBuilder(javax.ws.rs.core.UriBuilder) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces)

Example 70 with ForwardingObjective

use of org.onosproject.net.flowobjective.ForwardingObjective in project onos by opennetworkinglab.

the class ControlPlaneRedirectManager method updateInterfaceForwarding.

/**
 * Installs or removes the basic forwarding flows for each interface.
 *
 * @param request provisioning request containing router and interface
 * @param install true to install the objectives, false to remove them
 */
private void updateInterfaceForwarding(InterfaceProvisionRequest request, boolean install) {
    Interface intf = request.intf();
    log.debug("{} interface objectives for {}", operation(install), intf);
    DeviceId deviceId = intf.connectPoint().deviceId();
    PortNumber controlPlanePort = request.controlPlaneConnectPoint().port();
    for (InterfaceIpAddress ip : intf.ipAddressesList()) {
        // create nextObjectives for forwarding to this interface and the
        // controlPlaneConnectPoint
        int cpNextId, intfNextId;
        if (intf.vlan() == VlanId.NONE) {
            cpNextId = modifyNextObjective(deviceId, controlPlanePort, VlanId.vlanId(ASSIGNED_VLAN), true, install);
            intfNextId = modifyNextObjective(deviceId, intf.connectPoint().port(), VlanId.vlanId(ASSIGNED_VLAN), true, install);
        } else {
            cpNextId = modifyNextObjective(deviceId, controlPlanePort, intf.vlan(), false, install);
            intfNextId = modifyNextObjective(deviceId, intf.connectPoint().port(), intf.vlan(), false, install);
        }
        List<ForwardingObjective> fwdToSend = Lists.newArrayList();
        TrafficSelector selector;
        // IP traffic toward the router.
        selector = buildIPDstSelector(ip.ipAddress().toIpPrefix(), intf.connectPoint().port(), null, intf.mac(), intf.vlan());
        fwdToSend.add(buildForwardingObjective(selector, null, cpNextId, install, ACL_PRIORITY));
        // IP traffic from the router.
        selector = buildIPSrcSelector(ip.ipAddress().toIpPrefix(), controlPlanePort, intf.mac(), null, intf.vlan());
        fwdToSend.add(buildForwardingObjective(selector, null, intfNextId, install, ACL_PRIORITY));
        // We build the punt treatment.
        TrafficTreatment treatment = DefaultTrafficTreatment.builder().punt().build();
        // IPv6 traffic - we have to deal with the NDP protocol.
        if (ip.ipAddress().isIp4()) {
            // ARP traffic towards the router.
            selector = buildArpSelector(intf.connectPoint().port(), intf.vlan(), null, null);
            fwdToSend.add(buildForwardingObjective(selector, treatment, cpNextId, install, ACL_PRIORITY + 1));
            // ARP traffic from the router.
            selector = buildArpSelector(controlPlanePort, intf.vlan(), ip.ipAddress().getIp4Address(), intf.mac());
            fwdToSend.add(buildForwardingObjective(selector, treatment, intfNextId, install, ACL_PRIORITY + 1));
        } else {
            // Neighbour solicitation traffic towards the router.
            // This flow is for the global unicast address.
            selector = buildNdpSelector(intf.connectPoint().port(), intf.vlan(), null, ip.ipAddress().toIpPrefix(), NEIGHBOR_SOLICITATION, null);
            fwdToSend.add(buildForwardingObjective(selector, treatment, cpNextId, install, ACL_PRIORITY + 1));
            // Neighbour solicitation traffic towards the router.
            // This flow is for the link local address.
            selector = buildNdpSelector(intf.connectPoint().port(), intf.vlan(), null, Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(), NEIGHBOR_SOLICITATION, null);
            fwdToSend.add(buildForwardingObjective(selector, treatment, cpNextId, install, ACL_PRIORITY + 1));
            // Neighbour solicitation traffic towards the router.
            // This flow is for the solicitation node address of
            // the global unicast address.
            selector = buildNdpSelector(intf.connectPoint().port(), intf.vlan(), null, Ip6Address.valueOf(getSolicitNodeAddress(ip.ipAddress().toOctets())).toIpPrefix(), NEIGHBOR_SOLICITATION, null);
            fwdToSend.add(buildForwardingObjective(selector, treatment, cpNextId, install, ACL_PRIORITY + 1));
            // Neighbour solicitation traffic towards the router.
            // This flow is for the solicitation node address of
            // the link local address.
            selector = buildNdpSelector(intf.connectPoint().port(), intf.vlan(), null, Ip6Address.valueOf(getSolicitNodeAddress(getLinkLocalAddress(intf.mac().toBytes()))).toIpPrefix(), NEIGHBOR_SOLICITATION, null);
            fwdToSend.add(buildForwardingObjective(selector, treatment, cpNextId, install, ACL_PRIORITY + 1));
            // Neighbour solicitation traffic from the router.
            // This flow is for the global unicast address.
            selector = buildNdpSelector(controlPlanePort, intf.vlan(), ip.ipAddress().toIpPrefix(), null, NEIGHBOR_SOLICITATION, intf.mac());
            fwdToSend.add(buildForwardingObjective(selector, treatment, intfNextId, install, ACL_PRIORITY + 1));
            // Neighbour solicitation traffic from the router.
            // This flow is for the link local address.
            selector = buildNdpSelector(controlPlanePort, intf.vlan(), Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(), null, NEIGHBOR_SOLICITATION, intf.mac());
            fwdToSend.add(buildForwardingObjective(selector, treatment, intfNextId, install, ACL_PRIORITY + 1));
            // Neighbour advertisement traffic towards the router.
            // This flow is for the global unicast address
            selector = buildNdpSelector(intf.connectPoint().port(), intf.vlan(), null, ip.ipAddress().toIpPrefix(), NEIGHBOR_ADVERTISEMENT, null);
            fwdToSend.add(buildForwardingObjective(selector, treatment, cpNextId, install, ACL_PRIORITY + 1));
            // Neighbour advertisement traffic towards the router.
            // This flow is for the link local address
            selector = buildNdpSelector(intf.connectPoint().port(), intf.vlan(), null, Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(), NEIGHBOR_ADVERTISEMENT, null);
            fwdToSend.add(buildForwardingObjective(selector, treatment, cpNextId, install, ACL_PRIORITY + 1));
            // Neighbour advertisement traffic from the router.
            // This flow is for the global unicast address
            selector = buildNdpSelector(controlPlanePort, intf.vlan(), ip.ipAddress().toIpPrefix(), null, NEIGHBOR_ADVERTISEMENT, intf.mac());
            fwdToSend.add(buildForwardingObjective(selector, treatment, intfNextId, install, ACL_PRIORITY + 1));
            // Neighbour advertisement traffic from the router.
            // This flow is for the link local address
            selector = buildNdpSelector(controlPlanePort, intf.vlan(), Ip6Address.valueOf(getLinkLocalAddress(intf.mac().toBytes())).toIpPrefix(), null, NEIGHBOR_ADVERTISEMENT, intf.mac());
            fwdToSend.add(buildForwardingObjective(selector, treatment, intfNextId, install, ACL_PRIORITY + 1));
        }
        // Finally we push the fwd objectives through the flow objective service.
        fwdToSend.stream().forEach(forwardingObjective -> flowObjectiveService.forward(deviceId, forwardingObjective));
    }
}
Also used : DeviceId(org.onosproject.net.DeviceId) TrafficSelector(org.onosproject.net.flow.TrafficSelector) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) ForwardingObjective(org.onosproject.net.flowobjective.ForwardingObjective) DefaultForwardingObjective(org.onosproject.net.flowobjective.DefaultForwardingObjective) PortNumber(org.onosproject.net.PortNumber) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) Interface(org.onosproject.net.intf.Interface) InterfaceIpAddress(org.onosproject.net.host.InterfaceIpAddress)

Aggregations

ForwardingObjective (org.onosproject.net.flowobjective.ForwardingObjective)88 DefaultForwardingObjective (org.onosproject.net.flowobjective.DefaultForwardingObjective)57 TrafficSelector (org.onosproject.net.flow.TrafficSelector)50 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)48 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)38 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)37 Test (org.junit.Test)33 NextObjective (org.onosproject.net.flowobjective.NextObjective)32 Objective (org.onosproject.net.flowobjective.Objective)32 FilteringObjective (org.onosproject.net.flowobjective.FilteringObjective)28 List (java.util.List)24 DefaultFlowRule (org.onosproject.net.flow.DefaultFlowRule)20 FlowRule (org.onosproject.net.flow.FlowRule)20 DeviceId (org.onosproject.net.DeviceId)18 ObjectiveContext (org.onosproject.net.flowobjective.ObjectiveContext)18 ObjectiveError (org.onosproject.net.flowobjective.ObjectiveError)16 DefaultNextObjective (org.onosproject.net.flowobjective.DefaultNextObjective)15 GroupDescription (org.onosproject.net.group.GroupDescription)15 PiAction (org.onosproject.net.pi.runtime.PiAction)14 ArrayList (java.util.ArrayList)13