Skip to content

Commit

Permalink
Adding OCS OpenFlow Protocol Extensions from Calient
Browse files Browse the repository at this point in the history
  • Loading branch information
bocon13 committed May 28, 2015
1 parent 8bd3661 commit 58a73e3
Show file tree
Hide file tree
Showing 15 changed files with 342 additions and 2 deletions.
2 changes: 2 additions & 0 deletions c_gen/c_code_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,8 @@ def base_h_content(out):
typedef char of_desc_str_t[OF_DESC_STR_LEN];
typedef char of_serial_num_t[OF_SERIAL_NUM_LEN];
typedef char of_str64_t[64];
typedef char of_str32_t[32];
typedef char of_str6_t[6];
typedef struct of_bitmap_128_s {
uint64_t hi;
Expand Down
5 changes: 4 additions & 1 deletion c_gen/c_test_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ def var_name_map(m_type):
of_desc_str_t="desc_str",
of_serial_num_t="ser_num",
of_str64_t="str64",
of_str32_t="str32",
of_str6_t="str6",
of_mac_addr_t="mac_addr",
of_ipv6_t="ipv6",
# Non-scalars; more TBD
Expand Down Expand Up @@ -124,7 +126,8 @@ def var_name_map(m_type):
string_types = [ "of_port_name_t", "of_table_name_t",
"of_desc_str_t", "of_serial_num_t", "of_mac_addr_t",
"of_ipv6_t", "of_bitmap_128_t", "of_checksum_128_t",
"of_str64_t", "of_app_code_t", "of_bitmap_512_t"]
"of_str64_t", "of_str32_t", "of_str6_t",
"of_app_code_t", "of_bitmap_512_t"]

scalar_types = integer_types[:]
scalar_types.extend(string_types)
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 @@ -201,6 +201,8 @@
of_serial_num_t = dict(bytes=ofp_constants["OF_SERIAL_NUM_LEN"],
short_name="ser_num"),
of_str64_t = dict(bytes=64, short_name="str64"),
of_str32_t = dict(bytes=32, short_name="str32"),
of_str6_t = dict(bytes=6, short_name="str6"),
of_match_v1_t = dict(bytes=40, to_w="match_v1_hton",
from_w="match_v1_ntoh",
short_name="match_v1"),
Expand Down Expand Up @@ -228,7 +230,7 @@
"of_match_bmap_t", "of_port_name_t", "of_table_name_t",
"of_desc_str_t", "of_serial_num_t", "of_mac_addr_t",
"of_ipv6_t", "of_ipv4_t", "of_bitmap_128_t", "of_checksum_128_t",
"of_str64_t", "of_bitmap_512_t"]
"of_str64_t", "of_str32_t", "of_str6_t", "of_bitmap_512_t"]

##
# LOXI identifiers
Expand Down
2 changes: 2 additions & 0 deletions c_gen/templates/loci_dump.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ typedef int (*loci_obj_dump_f)(loci_writer_f writer, void *cookie, of_object_t *
#define LOCI_DUMP_desc_str(writer, cookie, val) LOCI_DUMP_string(writer, cookie, val)
#define LOCI_DUMP_ser_num(writer, cookie, val) LOCI_DUMP_string(writer, cookie, val)
#define LOCI_DUMP_str64(writer, cookie, val) LOCI_DUMP_string(writer, cookie, val)
#define LOCI_DUMP_str6(writer, cookie, val) LOCI_DUMP_string(writer, cookie, val)
#define LOCI_DUMP_str32(writer, cookie, val) LOCI_DUMP_string(writer, cookie, val)

int loci_dump_match(loci_writer_f writer, void* cookie, of_match_t *match);
#define LOCI_DUMP_match(writer, cookie, val) loci_dump_match(writer, cookie, &val)
Expand Down
2 changes: 2 additions & 0 deletions c_gen/templates/loci_show.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ typedef int (*loci_obj_show_f)(loci_writer_f writer,
#define LOCI_SHOW_desc_str(writer, cookie, val) LOCI_SHOW_string(writer, cookie, val)
#define LOCI_SHOW_ser_num(writer, cookie, val) LOCI_SHOW_string(writer, cookie, val)
#define LOCI_SHOW_str64(writer, cookie, val) LOCI_SHOW_string(writer, cookie, val)
#define LOCI_SHOW_str6(writer, cookie, val) LOCI_SHOW_string(writer, cookie, val)
#define LOCI_SHOW_str32(writer, cookie, val) LOCI_SHOW_string(writer, cookie, val)

int loci_show_match(loci_writer_f writer, void *cookie, of_match_t *match);
#define LOCI_SHOW_match(writer, cookie, val) loci_show_match(writer, cookie, &val)
Expand Down
46 changes: 46 additions & 0 deletions c_gen/templates/of_wire_buf.h
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,52 @@ _wbuf_octets_get(of_wire_buffer_t *wbuf, int offset, uint8_t *dst, int bytes) {
#define of_wire_buffer_checksum_128_set(buf, offset, checksum) \
(of_wire_buffer_u64_set(buf, offset, checksum.hi), of_wire_buffer_u64_set(buf, offset+8, checksum.lo))

/**
* Get a str32 string from a wire buffer
* @param wbuf The pointer to the wire buffer structure
* @param offset Offset in the wire buffer
* @param s The string
*
* Uses the octets function.
*/

#define of_wire_buffer_str32_get(buf, offset, s) \
_wbuf_octets_get(buf, offset, (uint8_t *)s, 32)

/**
* Set a str32 string in a wire buffer
* @param wbuf The pointer to the wire buffer structure
* @param offset Offset in the wire buffer
* @param s Where to store the str32
*
* Uses the octets function.
*/

#define of_wire_buffer_str32_set(buf, offset, s) \
_wbuf_octets_set(buf, offset, (uint8_t *)s, 32)

/**
* Get a str6 string from a wire buffer
* @param wbuf The pointer to the wire buffer structure
* @param offset Offset in the wire buffer
* @param s The string
*
* Uses the octets function.
*/

#define of_wire_buffer_str6_get(buf, offset, s) \
_wbuf_octets_get(buf, offset, (uint8_t *)s, 6)
/**
* Set a str6 string in a wire buffer
* @param wbuf The pointer to the wire buffer structure
* @param offset Offset in the wire buffer
* @param s Where to store the str6
*
* Uses the octets function.
*/

#define of_wire_buffer_str6_set(buf, offset, s) \
_wbuf_octets_set(buf, offset, (uint8_t *)s, 6)

/**
* Get a bitmap_512 from a wire buffer
Expand Down
4 changes: 4 additions & 0 deletions java_gen/java_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ def gen_fixed_length_string_jtype(length):
serial_num = gen_fixed_length_string_jtype(32)
table_name = gen_fixed_length_string_jtype(32)
str64 = gen_fixed_length_string_jtype(64)
str32 = gen_fixed_length_string_jtype(32)
str6 = gen_fixed_length_string_jtype(6)
ipv4 = JType("IPv4Address") \
.op(read="IPv4Address.read4Bytes(bb)", \
write="$name.write4Bytes(bb)",
Expand Down Expand Up @@ -576,6 +578,8 @@ def gen_fixed_length_string_jtype(length):
'of_port_name_t': port_name,
'of_table_name_t': table_name,
'of_str64_t': str64,
'of_str32_t': str32,
'of_str6_t': str6,
'of_ipv4_t': ipv4,
'of_ipv6_t': ipv6,
'of_wc_bmap_t': flow_wildcards,
Expand Down
2 changes: 2 additions & 0 deletions loxi_ir/ir_offset.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
of_desc_str_t = (ofp_constants["OF_DESC_STR_LEN"], True),
of_serial_num_t = (ofp_constants["OF_SERIAL_NUM_LEN"], True),
of_str64_t = (64, True),
of_str32_t = (32, True),
of_str6_t = (6, True),
of_match_v1_t = (40, True),
of_match_v2_t = (88, True),
of_match_v3_t = (8, False),
Expand Down
33 changes: 33 additions & 0 deletions openflow_input/calient
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#version 4

struct of_calient_stats_request : of_experimenter_stats_request {
uint8_t version;
uint8_t type == 18;
uint16_t length;
uint32_t xid;
uint16_t stats_type == 0xffff;
enum ofp_stats_request_flags flags;
pad(4);
uint32_t experimenter == 0x0080F958;
uint32_t subtype == ?;
};

struct of_calient_stats_reply : of_experimenter_stats_reply {
uint8_t version;
uint8_t type == 19;
uint16_t length;
uint32_t xid;
uint16_t stats_type == 0xffff;
enum ofp_stats_reply_flags flags;
pad(4);
uint32_t experimenter == 0x0080F958;
uint32_t subtype == ?;
};

enum ofp_calient_ocs_alarm(wire_type=uint8_t, bitmask=True){
OFPOCSALM_CLEAR = 1, /* Clear- no alarm */
OFPOCSALM_Minor = 2, /* loss is greater than 5.25 */
OFPOCSALM_Major = 3, /* loss is greater than 7.25 */
OFPOCSALM_Critical = 4, /* loss is greater than 10.25 */
};

84 changes: 84 additions & 0 deletions openflow_input/calient_flow_stats
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#version 4

struct of_calient_flow_stats_request : of_calient_stats_request {
uint8_t version;
uint8_t type == 18;
uint16_t length;
uint32_t xid;
uint16_t stats_type == 0xffff;
enum ofp_stats_request_flags flags;
pad(4);
uint32_t experimenter == 0x0080F958;
uint32_t subtype == 2; /* OFPEMPFS = 2 */
uint8_t table_id; /* Recommended to be set to 0. Ignored */
pad(3);
uint32_t out_port; /* Require matching entries to include this as an output port.
A value of OFPP_ANY indicates no restriction. Ignored */
uint32_t out_group; /* Require matching entries to include this as an output group.
A value of OFPP_ANY indicates no restriction. Ignored */
pad(4); /* Align to 64 bits */
uint64_t cookie; /* Ignored */
uint64_t cookie_mask; /* Ignored */
of_match_t match; /* Fields to match. Variable size */
};

enum ofp_calient_cflow_admin_state(wire_type=uint8_t, bitmask=True){
OFPCAS_InService = 1, /* when the connection is activated */
OFPCAS_UnderManagement = 2,/*Default Connection state – (when connection is not activated)*/
};


enum ofp_calient_cflow_operational_state(wire_type=uint8_t, bitmask=True){
OFPCOS_InService = 1, /* When connection is activated */
OFPCOS_OutOfService = 2,/*When connection has a critical alarm ( activated or otherwise) */
OFPCOS_Ready = 3, /*When AS state is UnderManagement */
OFPCOS_Degraded = 4, /*When connection is activated and has a Major alarm */
};

enum ofp_calient_cflow_Capability(wire_type=uint8_t, bitmask=True){
OFPCCS_Ok = 1, /* Connection has been made successfully */
OFPCCS_Failed = 2, /* Connection has Failed */
OFPCCS_Initializing = 3,/* Connection making is in progress */
};

struct of_calient_flow_stats_entry {
uint16_t length;
uint8_t table_id; /* Ignored */
pad(1);
uint32_t duration_sec; /* Not supported for now */
uint32_t duration_nsec; /* Not supported for now */
uint16_t priority; /* Not supported */
uint16_t idle_timeout; /* Set to 0 as entries must be explicitly removed */
uint16_t hard_timeout; /* Set to 0 as entries must be explicitly removed */
enum ofp_flow_mod_flags flags;
pad(4);
uint64_t cookie; /* Ignored */
enum ofp_calient_cflow_admin_state admin_status; /* AS = IS(Activated)/UMA */
enum ofp_calient_cflow_operational_state oper_status; /* OS = UMA/OOS */
enum ofp_calient_cflow_Capability oper_capability; /* OC = FAIL/OK/INIT */
enum ofp_calient_ocs_alarm alarm; /* Alarm = NA/MJ/MN/CR */
of_str6_t port_power;
pad(2);
of_str6_t connected_port_power;
pad(2);
of_str64_t cflow_name; /* Connection name */
of_match_t match;
};


struct of_calient_flow_stats_reply : of_calient_stats_reply {
uint8_t version;
uint8_t type == 19;
uint16_t length;
uint32_t xid;
uint16_t stats_type == 0xffff;
enum ofp_stats_reply_flags flags;
pad(4);
uint32_t experimenter == 0x0080F958;
uint32_t subtype == 2;
uint16_t data_length;
pad(6);
list(of_calient_flow_stats_entry_t)flow_stats;
};


92 changes: 92 additions & 0 deletions openflow_input/calient_port_desc_stats
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#version 4

struct of_calient_port_desc_stats_request : of_calient_stats_request {
uint8_t version;
uint8_t type == 18;
uint16_t length;
uint32_t xid;
uint16_t stats_type == 0xffff;
enum ofp_stats_request_flags flags;
pad(4);
uint32_t experimenter == 0x0080F958;
uint32_t subtype == 1;
};


struct of_calient_port_desc_prop {
uint16_t type == ?; /* One of OFPPDPT_*. */
uint16_t length; /* Length in bytes of this property. */
};


enum ofp_calient_optical_port_admin_state(wire_type=uint8_t, bitmask=True){
OFPAS_IN_SERVICE = 1, /*Circuit Port in Service*/
OFPAS_OUT_OF_SERVICE = 2, /*Circuit Port out of Service*/
OFPAS_OOS_NP = 3 /*Circuit Port out of Service, not provisioned*/
};

enum ofp_calient_optical_port_oper_state(wire_type=uint8_t, bitmask=True){
OFPOS_IN_SERVICE = 8, /*Circuit Port in Service*/
OFPOS_OUT_OF_SERVICE = 16 /*Circuit Port out of Service*/
};

enum ofp_calient_optical_port_oper_capability(wire_type=uint8_t, bitmask=True){
OFPCS_NoHardware = 1, /* when port is not in connection */
OFPCS_Ok = 2, /* port is in Connection which is made successfully */
OFPCS_Failed = 3, /* when port is in Connection which is Failed */
OFPCS_Initializing = 4,/* when port is in Connection which is being made */
};





struct of_calient_port_desc_prop_optical : of_calient_port_desc_prop{
uint16_t type == 2; /* OFPPDPT_OPTICAL_CIRCUIT */
uint16_t length; /* Length in bytes of this property. */
enum ofp_calient_optical_port_admin_state in_admin_status;
enum ofp_calient_optical_port_oper_state in_oper_status;
enum ofp_calient_optical_port_oper_capability in_oper_capability;
enum ofp_calient_optical_port_admin_state out_admin_status;
enum ofp_calient_optical_port_oper_state out_oper_status;
enum ofp_calient_optical_port_oper_capability out_oper_capability;
of_str6_t inport_power; /* Input Port Power */
of_str6_t outport_power; /* Output Port Power */
pad(2);
uint64_t in_peer_node; /* Peer node datapath id connected to the input optical port */
uint64_t out_peer_node; /* Peer node datapath id connected to the output optical port */
uint16_t in_peer_port; /* Peer port number connected to the input optical port */
uint16_t out_peer_port; /* Peer port number connected to the output optical port */
pad(4);
of_str32_t in_circuit_id; /* Circuit Id associated with the input port */
of_str32_t out_circuit_id; /* Circuit id associated with the output port */
of_str64_t in_alias; /* Alias(name) for the input port */
of_str64_t out_alias; /* Alias(name) for the output port */
};

struct of_calient_port_desc_stats_entry {
uint16_t length;
pad(2);
of_port_no_t port_no;
of_mac_addr_t hw_addr;
pad(2);
of_port_name_t name; /* Not used.NULL */
uint32_t config; /* Not used. Always 0. */
uint32_t state; /* Not used. Always 0. */
list(of_calient_port_desc_prop_t) properties;
};

struct of_calient_port_desc_stats_reply : of_calient_stats_reply {
uint8_t version;
uint8_t type == 19;
uint16_t length;
uint32_t xid;
uint16_t stats_type == 0xffff;
enum ofp_stats_reply_flags flags;
pad(4);
uint32_t experimenter == 0x0080F958;
uint32_t subtype == 1;
list(of_calient_port_desc_stats_entry_t)port_desc;
};


Loading

0 comments on commit 58a73e3

Please sign in to comment.