mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-21 20:31:00 +02:00
Support for setting the MPLS BOS indicator bit.
Change-Id: Ib42747445113aadb62fd161a1c79ca59783884af
This commit is contained in:
parent
f2ab6f3ac8
commit
73a7dd4033
@ -342,6 +342,11 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
|
||||
return add(Instructions.modMplsLabel(mplsLabel));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder setMplsBos(boolean mplsBos) {
|
||||
return add(Instructions.modMplsBos(mplsBos));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder decMplsTtl() {
|
||||
return add(Instructions.decMplsTtl());
|
||||
|
@ -226,6 +226,14 @@ public interface TrafficTreatment {
|
||||
*/
|
||||
Builder setMpls(MplsLabel mplsLabel);
|
||||
|
||||
/**
|
||||
* Sets the mpls bottom-of-stack indicator bit.
|
||||
*
|
||||
* @param mplsBos boolean to set BOS=1 (true) or BOS=0 (false).
|
||||
* @return a treatment builder.
|
||||
*/
|
||||
Builder setMplsBos(boolean mplsBos);
|
||||
|
||||
/**
|
||||
* Decrement MPLS TTL.
|
||||
*
|
||||
|
@ -175,6 +175,16 @@ public final class Instructions {
|
||||
return new L2ModificationInstruction.ModMplsLabelInstruction(mplsLabel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MPLS BOS bit modification.
|
||||
*
|
||||
* @param mplsBos MPLS BOS bit to set (true) or unset (false)
|
||||
* @return a L2 Modification
|
||||
*/
|
||||
public static L2ModificationInstruction modMplsBos(boolean mplsBos) {
|
||||
return new L2ModificationInstruction.ModMplsBosInstruction(mplsBos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MPLS decrement TTL modification.
|
||||
*
|
||||
@ -673,6 +683,7 @@ public final class Instructions {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -84,9 +84,14 @@ public abstract class L2ModificationInstruction implements Instruction {
|
||||
VLAN_PUSH,
|
||||
|
||||
/**
|
||||
* Tunnle id modification.
|
||||
* Tunnel id modification.
|
||||
*/
|
||||
TUNNEL_ID
|
||||
TUNNEL_ID,
|
||||
|
||||
/**
|
||||
* MPLS BOS instruction.
|
||||
*/
|
||||
MPLS_BOS
|
||||
}
|
||||
|
||||
// TODO: Create factory class 'Instructions' that will have various factory
|
||||
@ -370,6 +375,51 @@ public abstract class L2ModificationInstruction implements Instruction {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a MPLS BOS modification.
|
||||
*/
|
||||
public static final class ModMplsBosInstruction
|
||||
extends L2ModificationInstruction {
|
||||
|
||||
private final boolean mplsBos;
|
||||
|
||||
ModMplsBosInstruction(boolean mplsBos) {
|
||||
this.mplsBos = mplsBos;
|
||||
}
|
||||
|
||||
public boolean mplsBos() {
|
||||
return mplsBos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2SubType subtype() {
|
||||
return L2SubType.MPLS_BOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return toStringHelper(subtype().toString()).add("bos", mplsBos)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(type(), subtype(), mplsBos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj instanceof ModMplsBosInstruction) {
|
||||
ModMplsBosInstruction that = (ModMplsBosInstruction) obj;
|
||||
return Objects.equals(mplsBos, that.mplsBos());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a MPLS TTL modification.
|
||||
*/
|
||||
|
@ -404,6 +404,11 @@ public class FlowEntryBuilder {
|
||||
OFOxm<U32> labelId = (OFOxm<U32>) oxm;
|
||||
builder.setMpls(MplsLabel.mplsLabel((int) labelId.getValue().getValue()));
|
||||
break;
|
||||
case MPLS_BOS:
|
||||
@SuppressWarnings("unchecked")
|
||||
OFOxm<U8> mplsBos = (OFOxm<U8>) oxm;
|
||||
builder.setMplsBos(mplsBos.getValue() == U8.ZERO ? false : true);
|
||||
break;
|
||||
case TUNNEL_ID:
|
||||
@SuppressWarnings("unchecked")
|
||||
OFOxm<U64> tunnelId = (OFOxm<U64>) oxm;
|
||||
|
@ -31,6 +31,7 @@ import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModLambda
|
||||
import org.onosproject.net.flow.instructions.L0ModificationInstruction.ModOchSignalInstruction;
|
||||
import org.onosproject.net.flow.instructions.L2ModificationInstruction;
|
||||
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModEtherInstruction;
|
||||
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsBosInstruction;
|
||||
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsLabelInstruction;
|
||||
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction;
|
||||
import org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanPcpInstruction;
|
||||
@ -58,6 +59,7 @@ import org.projectfloodlight.openflow.types.IPv4Address;
|
||||
import org.projectfloodlight.openflow.types.IPv6Address;
|
||||
import org.projectfloodlight.openflow.types.IPv6FlowLabel;
|
||||
import org.projectfloodlight.openflow.types.MacAddress;
|
||||
import org.projectfloodlight.openflow.types.OFBooleanValue;
|
||||
import org.projectfloodlight.openflow.types.OFBufferId;
|
||||
import org.projectfloodlight.openflow.types.OFGroup;
|
||||
import org.projectfloodlight.openflow.types.OFPort;
|
||||
@ -343,6 +345,12 @@ public class FlowModBuilderVer13 extends FlowModBuilder {
|
||||
oxm = factory().oxms().mplsLabel(U32.of(mplsLabel.label()
|
||||
.longValue()));
|
||||
break;
|
||||
case MPLS_BOS:
|
||||
ModMplsBosInstruction mplsBos = (ModMplsBosInstruction) l2m;
|
||||
oxm = factory().oxms()
|
||||
.mplsBos(mplsBos.mplsBos() ? OFBooleanValue.TRUE
|
||||
: OFBooleanValue.FALSE);
|
||||
break;
|
||||
case DEC_MPLS_TTL:
|
||||
return factory().actions().decMplsTtl();
|
||||
case VLAN_POP:
|
||||
|
@ -56,6 +56,7 @@ import org.projectfloodlight.openflow.protocol.oxm.OFOxmOchSigidBasic;
|
||||
import org.projectfloodlight.openflow.types.IPv4Address;
|
||||
import org.projectfloodlight.openflow.types.OFVlanVidMatch;
|
||||
import org.projectfloodlight.openflow.types.U32;
|
||||
import org.projectfloodlight.openflow.types.U8;
|
||||
import org.projectfloodlight.openflow.types.VlanPcp;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@ -277,6 +278,11 @@ public class GroupBucketEntryBuilder {
|
||||
OFOxm<U32> labelId = (OFOxm<U32>) oxm;
|
||||
builder.setMpls(MplsLabel.mplsLabel((int) labelId.getValue().getValue()));
|
||||
break;
|
||||
case MPLS_BOS:
|
||||
@SuppressWarnings("unchecked")
|
||||
OFOxm<U8> mplsBos = (OFOxm<U8>) oxm;
|
||||
builder.setMplsBos(mplsBos.getValue() == U8.ZERO ? false : true);
|
||||
break;
|
||||
case ARP_OP:
|
||||
case ARP_SHA:
|
||||
case ARP_SPA:
|
||||
|
@ -44,6 +44,7 @@ import org.projectfloodlight.openflow.types.IPv4Address;
|
||||
import org.projectfloodlight.openflow.types.IPv6Address;
|
||||
import org.projectfloodlight.openflow.types.IPv6FlowLabel;
|
||||
import org.projectfloodlight.openflow.types.MacAddress;
|
||||
import org.projectfloodlight.openflow.types.OFBooleanValue;
|
||||
import org.projectfloodlight.openflow.types.OFGroup;
|
||||
import org.projectfloodlight.openflow.types.OFPort;
|
||||
import org.projectfloodlight.openflow.types.OFVlanVidMatch;
|
||||
@ -286,6 +287,13 @@ public final class GroupModBuilder {
|
||||
oxm = factory.oxms().mplsLabel(U32.of(mplsLabel.label()
|
||||
.longValue()));
|
||||
break;
|
||||
case MPLS_BOS:
|
||||
L2ModificationInstruction.ModMplsBosInstruction mplsBos =
|
||||
(L2ModificationInstruction.ModMplsBosInstruction) l2m;
|
||||
oxm = factory.oxms()
|
||||
.mplsBos(mplsBos.mplsBos() ? OFBooleanValue.TRUE
|
||||
: OFBooleanValue.FALSE);
|
||||
break;
|
||||
case DEC_MPLS_TTL:
|
||||
return factory.actions().decMplsTtl();
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user