Skip to content

Commit

Permalink
optical circuit experimenter changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Praseed Balakrishnan committed Oct 9, 2014
1 parent 7f71878 commit 2ed6da0
Show file tree
Hide file tree
Showing 10 changed files with 181 additions and 45 deletions.
4 changes: 1 addition & 3 deletions c_gen/c_test_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,8 @@ def var_name_map(m_type):
of_bitmap_128_t="bitmap_128",
of_checksum_128_t="checksum_128",
#Circuit extensions
oxm_of_och_sig_id_t="sig_id",
of_app_code_t="app_code",
#of_port_optical_transport_application_code_t="tappcode",
of_port_desc_prop_optical_transport_t="desc1",
of_sig_id_t="sig_id",
)

if m_type.find("of_list_") == 0:
Expand Down
4 changes: 3 additions & 1 deletion c_gen/of_g_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
OF_DESC_STR_LEN = 256,
OF_SERIAL_NUM_LEN = 32,
OF_APP_CODE_LEN = 15,
OF_SIGID_LEN=6,
)

## List of mixed data types
Expand Down Expand Up @@ -211,7 +212,8 @@
of_checksum_128_t = dict(bytes=16, short_name="checksum_128"),
of_app_code_t = dict(bytes=ofp_constants["OF_APP_CODE_LEN"],
short_name="app_code"),

of_sig_id_t = dict(bytes=ofp_constants["OF_SIGID_LEN"],
short_name="sig_id"),
)

of_scalar_types = ["char", "uint8_t", "uint16_t", "uint32_t", "uint64_t",
Expand Down
8 changes: 8 additions & 0 deletions java_gen/java_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,9 @@ def gen_fixed_length_string_jtype(length):
.op(read="OFBufferId.of(bb.readInt())", write="bb.writeInt($name.getInt())", default="OFBufferId.NO_BUFFER")
lag_id = JType("LagId") \
.op(version=ANY, read="LagId.read4Bytes(bb)", write="$name.write4Bytes(bb)", default="LagId.NONE")

sig_id = JType("CircuitSignalID") \
.op(version=ANY, read="CircuitSignalID.read6Bytes(bb)", write="$name.write6Bytes(bb)", default="CircuitSignalID.NONE")
vrf = JType("VRF") \
.op(version=ANY, read="VRF.read4Bytes(bb)", write="$name.write4Bytes(bb)", default="VRF.ZERO")
class_id = JType("ClassId") \
Expand Down Expand Up @@ -551,6 +554,7 @@ def gen_fixed_length_string_jtype(length):
'of_checksum_128_t': u128,
'of_bsn_vport_t': bsn_vport,
'of_app_code_t': app_code,
'of_sig_id_t': sig_id,
}

## Map that defines exceptions from the standard loxi->java mapping scheme
Expand Down Expand Up @@ -698,6 +702,10 @@ def gen_fixed_length_string_jtype(length):
'of_bsn_log': { 'data': var_string },

'of_features_reply' : { 'auxiliary_id' : of_aux_id},
'of_oxm_och_sigtype' : { 'value' : u8obj },
'of_oxm_och_sigtype_basic' : { 'value' : u8obj },
'of_oxm_och_sigid' : {'value' : sig_id},
'of_oxm_och_sigid_basic' : {'value' : sig_id},
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.projectfloodlight.openflow.types.UDF;
import org.projectfloodlight.openflow.types.VRF;
import org.projectfloodlight.openflow.types.VlanPcp;
import org.projectfloodlight.openflow.types.CircuitSignalID;

@SuppressWarnings("unchecked")
public class MatchField<F extends OFValueType<F>> {
Expand Down Expand Up @@ -235,15 +236,24 @@ private MatchField(final String name, final MatchFields id, Prerequisite<?>... p
public final static MatchField<ClassId> BSN_VLAN_XLATE_PORT_GROUP_ID =
new MatchField<ClassId>("bsn_vlan_xlate_port_group_id", MatchFields.BSN_VLAN_XLATE_PORT_GROUP_ID);


public final static MatchField<U64> OCH_SIGID =
new MatchField<U64>("och_sigid",
public final static MatchField<CircuitSignalID> OCH_SIGID =
new MatchField<CircuitSignalID>("och_sigid",
MatchFields.OCH_SIGID);

public final static MatchField<U64> OCH_SIGTYPE =
new MatchField<U64>("och_sigid",
public final static MatchField<U8> OCH_SIGTYPE =
new MatchField<U8>("och_sigtype",
MatchFields.OCH_SIGTYPE);

public final static MatchField<CircuitSignalID> OCH_SIGID_BASIC =
new MatchField<CircuitSignalID>("och_sigid_basic",
MatchFields.OCH_SIGID);

public final static MatchField<U8> OCH_SIGTYPE_BASIC =
new MatchField<U8>("och_sigtype_basic",
MatchFields.OCH_SIGTYPE_BASIC);


public String getName() {
return name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,8 @@ public enum MatchFields {
BSN_TCP_FLAGS,
BSN_VLAN_XLATE_PORT_GROUP_ID,
OCH_SIGID,
OCH_SIGTYPE;
OCH_SIGTYPE,
OCH_SIGID_BASIC,
OCH_SIGTYPE_BASIC,
;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
package org.projectfloodlight.openflow.types;

import com.google.common.collect.ComparisonChain;
import org.jboss.netty.buffer.ChannelBuffer;
import org.projectfloodlight.openflow.exceptions.OFParseError;

import com.google.common.hash.PrimitiveSink;


public class CircuitSignalID implements OFValueType<CircuitSignalID> {
static final int length = 6;

private byte gridType;
private byte channelSpacing ;
private short channelNumber;
private short spectralWidth;

public static final CircuitSignalID NONE = new CircuitSignalID((byte)0,
(byte)0,
(short)0,
(short)0);


public CircuitSignalID(byte gridType, byte channelSpacing,
short channelNumber,
short spectralWidth)
{
this.gridType = gridType;
this.channelSpacing = channelSpacing;
this.channelNumber = channelNumber;
this.spectralWidth = spectralWidth;

}

@Override
public int getLength() {
return length;
}


public void write6Bytes(ChannelBuffer c) {
c.writeByte(gridType);
c.writeByte(channelSpacing);
c.writeShort(channelNumber);
c.writeShort(spectralWidth);
}

public static CircuitSignalID read6Bytes(ChannelBuffer c) throws OFParseError {
return new CircuitSignalID((byte)c.readUnsignedByte(),
(byte)c.readUnsignedByte(),
(short)c.readUnsignedShort(),
(short)c.readUnsignedShort());
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

CircuitSignalID that = (CircuitSignalID) o;

if (channelNumber != that.channelNumber) return false;
if (channelSpacing != that.channelSpacing) return false;
if (gridType != that.gridType) return false;
if (spectralWidth != that.spectralWidth) return false;

return true;
}

@Override
public int hashCode() {
int result = (int) gridType;
result = 31 * result + (int) channelSpacing;
result = 31 * result + (int) channelNumber;
result = 31 * result + (int) spectralWidth;
return result;
}

@Override
public String toString() {
return "CircuitSignalID{" +
"gridType=" + gridType +
", channelSpacing=" + channelSpacing +
", channelNumber=" + channelNumber +
", spectralWidth=" + spectralWidth +
'}';
}

@Override
public CircuitSignalID applyMask(CircuitSignalID mask) {
return new CircuitSignalID((byte) (this.gridType & mask.gridType),
(byte) (this.channelSpacing & mask
.channelSpacing),
(short) (this.channelNumber & mask
.channelNumber),
(short) (this.spectralWidth & mask
.spectralWidth));
}


@Override
public int compareTo(CircuitSignalID o) {
return ComparisonChain.start()
.compare(gridType,o.gridType)
.compare(channelSpacing,o.channelSpacing)
.compare(channelNumber,o.channelNumber)
.compare(spectralWidth,o.spectralWidth)
.result();
}


@Override
public void putTo(PrimitiveSink sink) {
sink.putByte(gridType);
sink.putByte(channelSpacing);
sink.putShort(channelNumber);
sink.putShort(spectralWidth);
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.projectfloodlight.openflow.protocol.OFVersion;
import org.projectfloodlight.openflow.protocol.match.Match;
import org.projectfloodlight.openflow.protocol.match.MatchField;
import org.projectfloodlight.openflow.types.U64;
import org.projectfloodlight.openflow.types.U8;

public class MatchFieldIteration13Test extends MatchFieldIterationBase {
public MatchFieldIteration13Test() {
Expand All @@ -16,7 +16,7 @@ public MatchFieldIteration13Test() {
public void matchCircuitFields()
{
Match.Builder builder = factory.buildMatchV3().setExact(MatchField
.OCH_SIGTYPE, U64.ZERO);
.OCH_SIGTYPE, U8.ZERO);

}
}
1 change: 1 addition & 0 deletions loxi_ir/ir_offset.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
of_bitmap_128_t = (16, True),
of_checksum_128_t = (16, True),
of_app_code_t = (15,True),
of_sig_id_t = (6, True),
)

def type_dec_to_count_base(m_type):
Expand Down
42 changes: 25 additions & 17 deletions openflow_input/circuit
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ enum ofp_och_signal_type {
OFPOCHT_FLEX_GRID = 2,
};


struct oxm_of_och_sig_id {

// Not used .. just for info on structure.
struct ofp_och_signal_id {
uint8_t grid; //Type of WDM grid - OFPGRIDT_*
uint8_t cs; //Channel Spacing - OFPCS_*
uint16_t n; // Used to calculate frequency as in [ITU G.694.1]
Expand All @@ -57,26 +56,35 @@ struct oxm_of_och_sig_id {
// For fix grid networks, m=1
};

// circuit extension message
struct of_circuit_header : of_experimenter {
uint8_t version;
uint8_t type == 4;
uint16_t length;
uint32_t xid;
uint32_t experimenter == 0xffff;
uint32_t subtype == ?;
uint8_t sigtype;
oxm_of_och_sig_id_t sig_id;
struct of_oxm_och_sigtype : of_oxm {
uint32_t type_len == 0x00085801;
uint8_t value;
};

struct of_oxm_och_sigid : of_oxm {
uint32_t type_len == 0x00085A06;
of_sig_id_t value;
};

struct of_oxm_och_sigtype_basic : of_oxm {
uint32_t type_len == 0x80005801;
uint8_t value;
};

// circuit extension action
struct of_action_circuit: of_action_experimenter {
struct of_oxm_och_sigid_basic : of_oxm {
uint32_t type_len == 0x80005A06;
of_sig_id_t value;
};


struct of_action_circuit : of_action_experimenter {
uint16_t type == 65535;
uint16_t len;
uint32_t experimenter == 0xffff;

uint32_t experimenter == 0x748771;
uint16_t subtype == 25;
uint16_t hlength == 16; // fix length of OXM field
of_oxm_t field;
pad(2);
};


Expand Down
16 changes: 0 additions & 16 deletions openflow_input/oxm-1.3
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,3 @@ struct of_oxm_tunnel_id_masked : of_oxm {
uint64_t value;
uint64_t value_mask;
};

struct of_oxm_och_sigtype : of_oxm {
uint32_t type_len == 0x80005c08;
uint64_t value;
};


struct of_oxm_och_sigid : of_oxm {
uint32_t type_len == 0x80005d10;
uint64_t value;
};





0 comments on commit 2ed6da0

Please sign in to comment.