Search in sources :

Example 1 with EthType

use of org.onlab.packet.EthType in project onos by opennetworkinglab.

the class BasicHostConfigTest method testConstruction.

/**
 * Tests construction, setters and getters of a BasicHostConfig object.
 */
@Test
public void testConstruction() {
    BasicHostConfig config = new BasicHostConfig();
    ConfigApplyDelegate delegate = configApply -> {
    };
    ObjectMapper mapper = new ObjectMapper();
    HostId hostId = NetTestTools.hid("12:34:56:78:90:ab/1");
    IpAddress ip1 = IpAddress.valueOf("1.1.1.1");
    IpAddress ip2 = IpAddress.valueOf("1.1.1.2");
    IpAddress ip3 = IpAddress.valueOf("1.1.1.3");
    Set<IpAddress> ips = ImmutableSet.of(ip1, ip2, ip3);
    HostLocation loc1 = new HostLocation(NetTestTools.connectPoint("d1", 1), System.currentTimeMillis());
    HostLocation loc2 = new HostLocation(NetTestTools.connectPoint("d2", 2), System.currentTimeMillis());
    Set<HostLocation> locs = ImmutableSet.of(loc1, loc2);
    HostLocation loc3 = new HostLocation(NetTestTools.connectPoint("d3", 1), System.currentTimeMillis());
    HostLocation loc4 = new HostLocation(NetTestTools.connectPoint("d4", 2), System.currentTimeMillis());
    Set<HostLocation> auxLocations = ImmutableSet.of(loc3, loc4);
    VlanId vlanId = VlanId.vlanId((short) 10);
    EthType ethType = EthType.EtherType.lookup((short) 0x88a8).ethType();
    config.init(hostId, "KEY", JsonNodeFactory.instance.objectNode(), mapper, delegate);
    config.setIps(ips).setLocations(locs).setAuxLocations(auxLocations).setInnerVlan(vlanId).setOuterTpid(ethType);
    assertThat(config.isValid(), is(true));
    assertThat(config.name(), is("-"));
    assertThat(config.ipAddresses(), hasSize(3));
    assertThat(config.ipAddresses(), hasItems(ip1, ip2, ip3));
    assertThat(config.locations(), hasSize(2));
    assertThat(config.locations(), hasItems(loc1, loc2));
    assertThat(config.auxLocations(), hasSize(2));
    assertThat(config.auxLocations(), hasItems(loc3, loc4));
    assertThat(config.innerVlan(), is(vlanId));
    assertThat(config.outerTpid(), is(ethType));
}
Also used : ImmutableSet(com.google.common.collect.ImmutableSet) HostLocation(org.onosproject.net.HostLocation) ConfigApplyDelegate(org.onosproject.net.config.ConfigApplyDelegate) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) VlanId(org.onlab.packet.VlanId) Set(java.util.Set) Test(org.junit.Test) Matchers.hasItems(org.hamcrest.Matchers.hasItems) EthType(org.onlab.packet.EthType) NetTestTools(org.onosproject.net.NetTestTools) JsonNodeFactory(com.fasterxml.jackson.databind.node.JsonNodeFactory) Matchers.hasSize(org.hamcrest.Matchers.hasSize) Matchers.is(org.hamcrest.Matchers.is) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) HostId(org.onosproject.net.HostId) IpAddress(org.onlab.packet.IpAddress) EthType(org.onlab.packet.EthType) HostLocation(org.onosproject.net.HostLocation) IpAddress(org.onlab.packet.IpAddress) HostId(org.onosproject.net.HostId) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) VlanId(org.onlab.packet.VlanId) ConfigApplyDelegate(org.onosproject.net.config.ConfigApplyDelegate) Test(org.junit.Test)

Example 2 with EthType

use of org.onlab.packet.EthType in project onos by opennetworkinglab.

the class OvsOfdpaPipeline method processDoubleVlanIdFilter.

/**
 * Internal implementation of processDoubleVlanIdFilter.
 *
 * @param portCriterion       port on device for which this filter is programmed
 * @param innerVidCriterion   inner vlan
 * @param outerVidCriterion   outer vlan
 * @param popVlan             true if outer vlan header needs to be removed
 * @param applicationId       for application programming this filter
 * @return flow rules for port-vlan filters
 */
private List<FlowRule> processDoubleVlanIdFilter(PortCriterion portCriterion, VlanIdCriterion innerVidCriterion, VlanIdCriterion outerVidCriterion, boolean popVlan, ApplicationId applicationId) {
    List<FlowRule> rules = new ArrayList<>();
    TrafficSelector.Builder outerSelector = DefaultTrafficSelector.builder();
    TrafficTreatment.Builder outerTreatment = DefaultTrafficTreatment.builder();
    TrafficSelector.Builder innerSelector = DefaultTrafficSelector.builder();
    TrafficTreatment.Builder innerTreatment = DefaultTrafficTreatment.builder();
    VlanId outerVlanId = outerVidCriterion.vlanId();
    VlanId innerVlanId = innerVidCriterion.vlanId();
    PortNumber portNumber = portCriterion.port();
    // Check arguments
    if (PortNumber.ALL.equals(portNumber) || outerVlanId.equals(VlanId.NONE) || innerVlanId.equals(VlanId.NONE)) {
        log.warn("Incomplete Filtering Objective. " + "VLAN Table cannot be programmed for {}", deviceId);
        return ImmutableList.of();
    } else {
        outerSelector.matchInPort(portNumber);
        innerSelector.matchInPort(portNumber);
        outerTreatment.transition(VLAN_1_TABLE);
        innerTreatment.transition(TMAC_TABLE);
        outerTreatment.writeMetadata(outerVlanId.toShort(), 0xFFF);
        outerSelector.matchVlanId(outerVlanId);
        innerSelector.matchVlanId(innerVlanId);
        // force recompilation
        // FIXME might be issue due tu /fff mask
        innerSelector.matchMetadata(outerVlanId.toShort());
        if (popVlan) {
            outerTreatment.popVlan();
        }
    }
    // NOTE: for double-tagged packets, restore original outer vlan
    // before sending it to the controller.
    GroupKey groupKey = popVlanPuntGroupKey();
    Group group = groupService.getGroup(deviceId, groupKey);
    if (group != null) {
        // push outer vlan and send to controller
        TrafficSelector.Builder sbuilder = DefaultTrafficSelector.builder().matchInPort(portNumber).matchVlanId(innerVlanId);
        Host host = handler().get(HostService.class).getConnectedHosts(ConnectPoint.deviceConnectPoint(deviceId + "/" + portNumber.toLong())).stream().filter(h -> h.vlan().equals(outerVlanId)).findFirst().orElse(null);
        EthType vlanType = EthType.EtherType.VLAN.ethType();
        if (host != null) {
            vlanType = host.tpid();
        }
        TrafficTreatment.Builder tbuilder = DefaultTrafficTreatment.builder().pushVlan(vlanType).setVlanId(outerVlanId).punt();
        rules.add(DefaultFlowRule.builder().forDevice(deviceId).withSelector(sbuilder.build()).withTreatment(tbuilder.build()).withPriority(PacketPriority.CONTROL.priorityValue()).fromApp(driverId).makePermanent().forTable(PUNT_TABLE).build());
    } else {
        log.info("popVlanPuntGroup not found in dev:{}", deviceId);
        return Collections.emptyList();
    }
    FlowRule outerRule = DefaultFlowRule.builder().forDevice(deviceId).withSelector(outerSelector.build()).withTreatment(outerTreatment.build()).withPriority(DEFAULT_PRIORITY).fromApp(applicationId).makePermanent().forTable(VLAN_TABLE).build();
    FlowRule innerRule = DefaultFlowRule.builder().forDevice(deviceId).withSelector(innerSelector.build()).withTreatment(innerTreatment.build()).withPriority(DEFAULT_PRIORITY).fromApp(applicationId).makePermanent().forTable(VLAN_1_TABLE).build();
    rules.add(outerRule);
    rules.add(innerRule);
    return rules;
}
Also used : NextGroup(org.onosproject.net.behaviour.NextGroup) Group(org.onosproject.net.group.Group) HostService(org.onosproject.net.host.HostService) ArrayList(java.util.ArrayList) GroupKey(org.onosproject.net.group.GroupKey) DefaultGroupKey(org.onosproject.net.group.DefaultGroupKey) Host(org.onosproject.net.Host) 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) DefaultFlowRule(org.onosproject.net.flow.DefaultFlowRule) FlowRule(org.onosproject.net.flow.FlowRule) PortNumber(org.onosproject.net.PortNumber) VlanId(org.onlab.packet.VlanId)

Example 3 with EthType

use of org.onlab.packet.EthType in project onos by opennetworkinglab.

the class OvsOfdpaPipeline 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
 */
@Override
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 Instructions.OutputInstruction).findFirst();
    if (!outInstr.isPresent()) {
        log.error("Egress forwarding objective:{} must include output port", fwd.id());
        fail(fwd, ObjectiveError.BADPARAMS);
        return rules;
    }
    PortNumber portNumber = ((Instructions.OutputInstruction) outInstr.get()).port();
    sb.matchVlanId(vlanIdCriterion.vlanId());
    OfdpaMatchActsetOutput actsetOutput = new OfdpaMatchActsetOutput(portNumber);
    sb.extension(actsetOutput, deviceId);
    // Build a flow rule for Egress VLAN Flow table
    TrafficTreatment.Builder tb = DefaultTrafficTreatment.builder();
    tb.transition(UNICAST_ROUTING_TABLE_1);
    if (fwd.treatment() != null) {
        for (Instruction instr : fwd.treatment().allInstructions()) {
            if (instr instanceof L2ModificationInstruction && ((L2ModificationInstruction) instr).subtype() == L2ModificationInstruction.L2SubType.VLAN_ID) {
                tb.immediate().add(instr);
            }
            if (instr instanceof L2ModificationInstruction && ((L2ModificationInstruction) instr).subtype() == L2ModificationInstruction.L2SubType.VLAN_PUSH) {
                EthType ethType = ((L2ModificationInstruction.ModVlanHeaderInstruction) instr).ethernetType();
                tb.immediate().pushVlan(ethType);
            }
        }
    }
    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_IN_INGRESS);
    rules.add(ruleBuilder.build());
    return rules;
}
Also used : MplsBosCriterion(org.onosproject.net.flow.criteria.MplsBosCriterion) OfdpaPipelineUtility(org.onosproject.driver.pipeline.ofdpa.OfdpaPipelineUtility) DefaultFlowRule(org.onosproject.net.flow.DefaultFlowRule) PortNumber(org.onosproject.net.PortNumber) Tools.groupedThreads(org.onlab.util.Tools.groupedThreads) PortCriterion(org.onosproject.net.flow.criteria.PortCriterion) ForwardingObjective(org.onosproject.net.flowobjective.ForwardingObjective) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) ConnectPoint(org.onosproject.net.ConnectPoint) OfdpaMatchActsetOutput(org.onosproject.driver.extensions.OfdpaMatchActsetOutput) ObjectiveError(org.onosproject.net.flowobjective.ObjectiveError) Ethernet(org.onlab.packet.Ethernet) Port(org.onosproject.net.Port) ApplicationId(org.onosproject.core.ApplicationId) L2ModificationInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction) IPCriterion(org.onosproject.net.flow.criteria.IPCriterion) NONE(org.onlab.packet.MacAddress.NONE) PipelinerContext(org.onosproject.net.behaviour.PipelinerContext) OutputInstruction(org.onosproject.net.flow.instructions.Instructions.OutputInstruction) ImmutableSet(com.google.common.collect.ImmutableSet) L3ModificationInstruction(org.onosproject.net.flow.instructions.L3ModificationInstruction) FilteringObjective(org.onosproject.net.flowobjective.FilteringObjective) VLAN_VID(org.onosproject.net.flow.criteria.Criterion.Type.VLAN_VID) Collection(java.util.Collection) Executors(java.util.concurrent.Executors) Objects(java.util.Objects) EthType(org.onlab.packet.EthType) List(java.util.List) FlowRule(org.onosproject.net.flow.FlowRule) GroupBuckets(org.onosproject.net.group.GroupBuckets) Optional(java.util.Optional) Queue(java.util.Queue) DeviceId(org.onosproject.net.DeviceId) DefaultGroupDescription(org.onosproject.net.group.DefaultGroupDescription) GroupDescription(org.onosproject.net.group.GroupDescription) IpPrefix(org.onlab.packet.IpPrefix) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) MplsCriterion(org.onosproject.net.flow.criteria.MplsCriterion) FlowRuleOperationsContext(org.onosproject.net.flow.FlowRuleOperationsContext) BROADCAST(org.onlab.packet.MacAddress.BROADCAST) Host(org.onosproject.net.Host) GroupBucket(org.onosproject.net.group.GroupBucket) NextGroup(org.onosproject.net.behaviour.NextGroup) GroupKey(org.onosproject.net.group.GroupKey) Deque(java.util.Deque) HostService(org.onosproject.net.host.HostService) EthCriterion(org.onosproject.net.flow.criteria.EthCriterion) Group(org.onosproject.net.group.Group) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) TrafficSelector(org.onosproject.net.flow.TrafficSelector) ImmutableList(com.google.common.collect.ImmutableList) DefaultGroupKey(org.onosproject.net.group.DefaultGroupKey) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) OfdpaGroupHandlerUtility(org.onosproject.driver.pipeline.ofdpa.OfdpaGroupHandlerUtility) Criteria(org.onosproject.net.flow.criteria.Criteria) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) Criterion(org.onosproject.net.flow.criteria.Criterion) IpAddress(org.onlab.packet.IpAddress) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) FlowRuleOperations(org.onosproject.net.flow.FlowRuleOperations) Instructions(org.onosproject.net.flow.instructions.Instructions) Logger(org.slf4j.Logger) ReentrantLock(java.util.concurrent.locks.ReentrantLock) EthTypeCriterion(org.onosproject.net.flow.criteria.EthTypeCriterion) Instruction(org.onosproject.net.flow.instructions.Instruction) VlanId(org.onlab.packet.VlanId) DefaultGroupBucket(org.onosproject.net.group.DefaultGroupBucket) TimeUnit(java.util.concurrent.TimeUnit) NoActionInstruction(org.onosproject.net.flow.instructions.Instructions.NoActionInstruction) GroupId(org.onosproject.core.GroupId) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion) LoggerFactory.getLogger(org.slf4j.LoggerFactory.getLogger) MacAddress(org.onlab.packet.MacAddress) PacketPriority(org.onosproject.net.packet.PacketPriority) 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) OutputInstruction(org.onosproject.net.flow.instructions.Instructions.OutputInstruction) L3ModificationInstruction(org.onosproject.net.flow.instructions.L3ModificationInstruction) Instruction(org.onosproject.net.flow.instructions.Instruction) NoActionInstruction(org.onosproject.net.flow.instructions.Instructions.NoActionInstruction) 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) DefaultFlowRule(org.onosproject.net.flow.DefaultFlowRule) FlowRule(org.onosproject.net.flow.FlowRule) PortNumber(org.onosproject.net.PortNumber) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion)

Example 4 with EthType

use of org.onlab.packet.EthType in project onos by opennetworkinglab.

the class NetworkConfigHostProvider method readInitialConfig.

private void readInitialConfig() {
    networkConfigRegistry.getSubjects(HostId.class).forEach(hostId -> {
        MacAddress mac = hostId.mac();
        VlanId vlan = hostId.vlanId();
        BasicHostConfig hostConfig = networkConfigRegistry.getConfig(hostId, BasicHostConfig.class);
        Set<IpAddress> ipAddresses = hostConfig.ipAddresses();
        Set<HostLocation> locs = hostConfig.locations();
        if (locs != null) {
            Set<HostLocation> locations = locs.stream().map(hostLocation -> new HostLocation(hostLocation, System.currentTimeMillis())).collect(Collectors.toSet());
            // auxLocations allows to be null
            Set<HostLocation> auxLocations = hostConfig.auxLocations();
            if (auxLocations != null) {
                auxLocations = auxLocations.stream().map(auxLocation -> new HostLocation(auxLocation, System.currentTimeMillis())).collect(Collectors.toSet());
            }
            VlanId innerVlan = hostConfig.innerVlan();
            EthType outerTpid = hostConfig.outerTpid();
            addHost(mac, vlan, locations, auxLocations, ipAddresses, innerVlan, outerTpid);
        } else {
            log.warn("Host {} configuration {} is missing locations", hostId, hostConfig);
        }
    });
}
Also used : NetworkConfigRegistry(org.onosproject.net.config.NetworkConfigRegistry) HostLocation(org.onosproject.net.HostLocation) HostProviderRegistry(org.onosproject.net.host.HostProviderRegistry) Host(org.onosproject.net.Host) CoreService(org.onosproject.core.CoreService) NetworkConfigEvent(org.onosproject.net.config.NetworkConfigEvent) LoggerFactory(org.slf4j.LoggerFactory) HostProviderService(org.onosproject.net.host.HostProviderService) Component(org.osgi.service.component.annotations.Component) DefaultHostDescription(org.onosproject.net.host.DefaultHostDescription) ApplicationId(org.onosproject.core.ApplicationId) BasicHostConfig(org.onosproject.net.config.basics.BasicHostConfig) Activate(org.osgi.service.component.annotations.Activate) HostId(org.onosproject.net.HostId) IpAddress(org.onlab.packet.IpAddress) AbstractProvider(org.onosproject.net.provider.AbstractProvider) Logger(org.slf4j.Logger) Deactivate(org.osgi.service.component.annotations.Deactivate) HostProvider(org.onosproject.net.host.HostProvider) VlanId(org.onlab.packet.VlanId) Set(java.util.Set) ProviderId(org.onosproject.net.provider.ProviderId) Collectors(java.util.stream.Collectors) ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality) EthType(org.onlab.packet.EthType) MacAddress(org.onlab.packet.MacAddress) Reference(org.osgi.service.component.annotations.Reference) HostDescription(org.onosproject.net.host.HostDescription) NetworkConfigListener(org.onosproject.net.config.NetworkConfigListener) Collections(java.util.Collections) EthType(org.onlab.packet.EthType) HostLocation(org.onosproject.net.HostLocation) IpAddress(org.onlab.packet.IpAddress) HostId(org.onosproject.net.HostId) MacAddress(org.onlab.packet.MacAddress) VlanId(org.onlab.packet.VlanId) BasicHostConfig(org.onosproject.net.config.basics.BasicHostConfig)

Example 5 with EthType

use of org.onlab.packet.EthType in project onos by opennetworkinglab.

the class FlowEntryBuilder method configureTreatmentBuilder.

/**
 * Configures traffic treatment builder with a given collection of actions.
 *
 * @param actions a set of OpenFlow actions
 * @param builder traffic treatment builder
 * @param driverHandler driver handler
 * @param deviceId device identifier
 * @return configured traffic treatment builder
 */
public static TrafficTreatment.Builder configureTreatmentBuilder(List<OFAction> actions, TrafficTreatment.Builder builder, DriverHandler driverHandler, DeviceId deviceId) {
    ExtensionTreatmentInterpreter interpreter;
    if (driverHandler.hasBehaviour(ExtensionTreatmentInterpreter.class)) {
        interpreter = driverHandler.behaviour(ExtensionTreatmentInterpreter.class);
    } else {
        interpreter = null;
    }
    for (OFAction act : actions) {
        switch(act.getType()) {
            case OUTPUT:
                OFActionOutput out = (OFActionOutput) act;
                builder.setOutput(PortNumber.portNumber(out.getPort().getPortNumber()));
                break;
            case SET_VLAN_VID:
                OFActionSetVlanVid vlan = (OFActionSetVlanVid) act;
                builder.setVlanId(VlanId.vlanId(vlan.getVlanVid().getVlan()));
                break;
            case SET_VLAN_PCP:
                OFActionSetVlanPcp pcp = (OFActionSetVlanPcp) act;
                builder.setVlanPcp(pcp.getVlanPcp().getValue());
                break;
            case SET_DL_DST:
                OFActionSetDlDst dldst = (OFActionSetDlDst) act;
                builder.setEthDst(MacAddress.valueOf(dldst.getDlAddr().getLong()));
                break;
            case SET_DL_SRC:
                OFActionSetDlSrc dlsrc = (OFActionSetDlSrc) act;
                builder.setEthSrc(MacAddress.valueOf(dlsrc.getDlAddr().getLong()));
                break;
            case SET_NW_DST:
                OFActionSetNwDst nwdst = (OFActionSetNwDst) act;
                IPv4Address di = nwdst.getNwAddr();
                builder.setIpDst(Ip4Address.valueOf(di.getInt()));
                break;
            case SET_NW_SRC:
                OFActionSetNwSrc nwsrc = (OFActionSetNwSrc) act;
                IPv4Address si = nwsrc.getNwAddr();
                builder.setIpSrc(Ip4Address.valueOf(si.getInt()));
                break;
            case EXPERIMENTER:
                OFActionExperimenter exp = (OFActionExperimenter) act;
                if (exp.getExperimenter() == 0x80005A06 || exp.getExperimenter() == 0x748771) {
                    OFActionCircuit ct = (OFActionCircuit) exp;
                    CircuitSignalID circuitSignalID = ((OFOxmOchSigid) ct.getField()).getValue();
                    builder.add(Instructions.modL0Lambda(Lambda.ochSignal(lookupGridType(circuitSignalID.getGridType()), lookupChannelSpacing(circuitSignalID.getChannelSpacing()), circuitSignalID.getChannelNumber(), circuitSignalID.getSpectralWidth())));
                } else if (interpreter != null) {
                    builder.extension(interpreter.mapAction(exp), deviceId);
                } else {
                    log.warn("Unsupported OFActionExperimenter {}", exp.getExperimenter());
                }
                break;
            case SET_FIELD:
                OFActionSetField setField = (OFActionSetField) act;
                handleSetField(builder, setField, driverHandler, deviceId);
                break;
            case POP_MPLS:
                OFActionPopMpls popMpls = (OFActionPopMpls) act;
                builder.popMpls(new EthType(popMpls.getEthertype().getValue()));
                break;
            case PUSH_MPLS:
                builder.pushMpls();
                break;
            case COPY_TTL_IN:
                builder.copyTtlIn();
                break;
            case COPY_TTL_OUT:
                builder.copyTtlOut();
                break;
            case DEC_MPLS_TTL:
                builder.decMplsTtl();
                break;
            case DEC_NW_TTL:
                builder.decNwTtl();
                break;
            case GROUP:
                OFActionGroup group = (OFActionGroup) act;
                builder.group(new GroupId(group.getGroup().getGroupNumber()));
                break;
            case SET_QUEUE:
                OFActionSetQueue setQueue = (OFActionSetQueue) act;
                builder.setQueue(setQueue.getQueueId());
                break;
            case ENQUEUE:
                OFActionEnqueue enqueue = (OFActionEnqueue) act;
                builder.setQueue(enqueue.getQueueId(), PortNumber.portNumber(enqueue.getPort().getPortNumber()));
                break;
            case STRIP_VLAN:
            case POP_VLAN:
                builder.popVlan();
                break;
            case PUSH_VLAN:
                OFActionPushVlan pushVlan = (OFActionPushVlan) act;
                builder.pushVlan(new EthType((short) pushVlan.getEthertype().getValue()));
                break;
            case METER:
                OFActionMeter actionMeter = (OFActionMeter) act;
                builder.meter(MeterId.meterId(actionMeter.getMeterId()));
                break;
            case SET_TP_DST:
            case SET_TP_SRC:
            case POP_PBB:
            case PUSH_PBB:
            case SET_MPLS_LABEL:
            case SET_MPLS_TC:
            case SET_MPLS_TTL:
            case SET_NW_ECN:
            case SET_NW_TOS:
            case SET_NW_TTL:
            default:
                log.warn("Action type {} not yet implemented.", act.getType());
        }
    }
    return builder;
}
Also used : OFActionOutput(org.projectfloodlight.openflow.protocol.action.OFActionOutput) OFOxmOchSigid(org.projectfloodlight.openflow.protocol.oxm.OFOxmOchSigid) OFActionSetQueue(org.projectfloodlight.openflow.protocol.action.OFActionSetQueue) OFActionSetDlSrc(org.projectfloodlight.openflow.protocol.action.OFActionSetDlSrc) OFActionPopMpls(org.projectfloodlight.openflow.protocol.action.OFActionPopMpls) OFAction(org.projectfloodlight.openflow.protocol.action.OFAction) OFActionExperimenter(org.projectfloodlight.openflow.protocol.action.OFActionExperimenter) OFActionEnqueue(org.projectfloodlight.openflow.protocol.action.OFActionEnqueue) CircuitSignalID(org.projectfloodlight.openflow.types.CircuitSignalID) OFActionPushVlan(org.projectfloodlight.openflow.protocol.action.OFActionPushVlan) OFActionSetDlDst(org.projectfloodlight.openflow.protocol.action.OFActionSetDlDst) OFActionGroup(org.projectfloodlight.openflow.protocol.action.OFActionGroup) OFActionSetVlanPcp(org.projectfloodlight.openflow.protocol.action.OFActionSetVlanPcp) IPv4Address(org.projectfloodlight.openflow.types.IPv4Address) ExtensionTreatmentInterpreter(org.onosproject.openflow.controller.ExtensionTreatmentInterpreter) GroupId(org.onosproject.core.GroupId) OFActionSetVlanVid(org.projectfloodlight.openflow.protocol.action.OFActionSetVlanVid) OFActionMeter(org.projectfloodlight.openflow.protocol.action.OFActionMeter) OFActionSetNwDst(org.projectfloodlight.openflow.protocol.action.OFActionSetNwDst) EthType(org.onlab.packet.EthType) OFActionSetNwSrc(org.projectfloodlight.openflow.protocol.action.OFActionSetNwSrc) OFActionSetField(org.projectfloodlight.openflow.protocol.action.OFActionSetField) OFActionCircuit(org.projectfloodlight.openflow.protocol.action.OFActionCircuit)

Aggregations

EthType (org.onlab.packet.EthType)15 VlanId (org.onlab.packet.VlanId)8 FlowRule (org.onosproject.net.flow.FlowRule)7 EthTypeCriterion (org.onosproject.net.flow.criteria.EthTypeCriterion)6 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)5 PortNumber (org.onosproject.net.PortNumber)5 DefaultFlowRule (org.onosproject.net.flow.DefaultFlowRule)5 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)5 TrafficSelector (org.onosproject.net.flow.TrafficSelector)5 Criterion (org.onosproject.net.flow.criteria.Criterion)5 EthCriterion (org.onosproject.net.flow.criteria.EthCriterion)5 IPCriterion (org.onosproject.net.flow.criteria.IPCriterion)5 VlanIdCriterion (org.onosproject.net.flow.criteria.VlanIdCriterion)5 Group (org.onosproject.net.group.Group)5 Logger (org.slf4j.Logger)5 ImmutableList (com.google.common.collect.ImmutableList)4 HashSet (java.util.HashSet)4 List (java.util.List)4 Set (java.util.Set)4