blob: 9b135baa0647ccf439face731d6af987a536d309 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.onlab.onos.net.flow;
import java.util.List;
import org.onlab.onos.net.PortNumber;
import org.onlab.onos.net.flow.instructions.Instruction;
import org.onlab.packet.IpPrefix;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
/**
* Abstraction of network traffic treatment.
*/
public interface TrafficTreatment {
/**
* Returns list of instructions on how to treat traffic.
*
* @return list of treatment instructions
*/
List<Instruction> instructions();
/**
* Builder of traffic treatment entities.
*/
public interface Builder {
/**
* Adds an instruction to the builder.
* @param instruction an instruction
* @return a treatment builder
*/
Builder add(Instruction instruction);
/**
* Adds a drop instruction and does not return a builder.
*/
public void drop();
/**
* Set the output port.
* @param number the out port
* @return a treatment builder
*/
public Builder setOutput(PortNumber number);
/**
* Sets the src l2 address.
* @param addr a macaddress
* @return a treatment builder
*/
public Builder setEthSrc(MacAddress addr);
/**
* Sets the dst l2 address.
* @param addr a macaddress
* @return a treatment builder
*/
public Builder setEthDst(MacAddress addr);
/**
* Sets the vlan id.
* @param id a vlanid
* @return a treatment builder
*/
public Builder setVlanId(VlanId id);
/**
* Sets the vlan priority.
* @param pcp a vlan priority
* @return a treatment builder
*/
public Builder setVlanPcp(Byte pcp);
/**
* Sets the src l3 address.
* @param addr an ip
* @return a treatment builder
*/
public Builder setIpSrc(IpPrefix addr);
/**
* Sets the dst l3 address.
* @param addr an ip
* @return a treatment builder
*/
public Builder setIpDst(IpPrefix addr);
/**
* Sets the optical channel ID or lambda.
* @param lambda optical channel ID
* @return a treatment builder
*/
public Builder setLambda(short lambda);
/**
* Builds an immutable traffic treatment descriptor.
*
* @return traffic treatment
*/
TrafficTreatment build();
}
}