Add flags to bsn_vport_l2gre.
diff --git a/c_gen/templates/loci_show.h b/c_gen/templates/loci_show.h
index b21665d..88fd029 100644
--- a/c_gen/templates/loci_show.h
+++ b/c_gen/templates/loci_show.h
@@ -406,5 +406,6 @@
#define LOCI_SHOW_u8_dscp(writer, cookie, val) LOCI_SHOW_u8(writer, cookie, val)
#define LOCI_SHOW_u8_ttl(writer, cookie, val) LOCI_SHOW_u8(writer, cookie, val)
#define LOCI_SHOW_u32_vpn(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
+#define LOCI_SHOW_u32_flags(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
#endif /* _LOCI_SHOW_H_ */
diff --git a/openflow_input/bsn_vport b/openflow_input/bsn_vport
index 97316b4..82d9d33 100644
--- a/openflow_input/bsn_vport
+++ b/openflow_input/bsn_vport
@@ -42,17 +42,12 @@
OF_BSN_VPORT_Q_IN_Q_UNTAGGED = 0xffff,
};
-enum ofp_bsn_vport_l2gre_dscp_mode(wire_type=uint8_t) {
- OF_BSN_VPORT_L2GRE_DSCP_ASSIGN = 0,
- OF_BSN_VPORT_L2GRE_DSCP_COPY = 1,
-};
+enum ofp_bsn_vport_l2gre_flags(wire_type=uint32_t, bitmask=True) {
+ OF_BSN_VPORT_L2GRE_LOCAL_MAC_IS_VALID = 0x1,
-enum ofp_bsn_vport_l2gre_dscp_dont_care(wire_type=uint8_t, complete=False) {
- OF_BSN_VPORT_L2GRE_DSCP_DONT_CARE = 0xff,
-};
-
-enum ofp_bsn_vport_l2gre_ttl_dont_care(wire_type=uint8_t, complete=False) {
- OF_BSN_VPORT_L2GRE_TTL_DONT_CARE = 0xff,
+ /* DSCP flags are mutually exclusive */
+ OF_BSN_VPORT_L2GRE_DSCP_ASSIGN = 0x2,
+ OF_BSN_VPORT_L2GRE_DSCP_COPY = 0x4,
};
// BSN Virtual port object header
@@ -83,15 +78,15 @@
struct of_bsn_vport_l2gre : of_bsn_vport {
uint16_t type == 1;
uint16_t length;
+ enum ofp_bsn_vport_l2gre_flags flags;
of_port_no_t port_no; /* OF port number of parent */
of_mac_addr_t local_mac; /* Local MAC */
of_mac_addr_t nh_mac; /* Next Hop MAC */
of_ipv4_t src_ip; /* Source IP */
of_ipv4_t dst_ip; /* Destination IP */
- enum ofp_bsn_vport_l2gre_dscp_mode dscp_mode;
uint8_t dscp;
uint8_t ttl;
- pad(1);
+ pad(2);
uint32_t vpn; /* VPN ID (for GRE Key) */
of_port_name_t if_name; /* Virtual Interface Name */
};
diff --git a/test_data/of13/bsn_vport_create_request__l2gre.data b/test_data/of13/bsn_vport_create_request__l2gre.data
index f879651..95f4a7b 100644
--- a/test_data/of13/bsn_vport_create_request__l2gre.data
+++ b/test_data/of13/bsn_vport_create_request__l2gre.data
@@ -1,28 +1,29 @@
-- binary
04 04 # version, type
-00 44 # len
+00 48 # len
01 02 03 04 # xid
00 5c 16 c7 # experimenter
00 00 00 0f # subtype
00 01 # vport type
-00 34 # vport len
+00 38 # vport len
+00 00 00 03 # vport flags
00 00 00 01 # vport port no
0a 0b 0c 0d 0e 0f # local mac
01 02 03 04 05 06 # next hop mac
c0 00 00 02 # src ip
c0 00 10 02 # dst ip
-00 01 40 00 # dscp mode, dscp, ttl, pad
+01 40 00 00 # dscp, ttl, pad(2)
00 00 be ef # vpn
66 6f 6f 00 00 00 00 00 00 00 00 00 00 00 00 00 # vport if name
-- python
ofp.message.bsn_virtual_port_create_request(
xid=0x01020304, vport=ofp.bsn_vport_l2gre(
+flags=ofp.OF_BSN_VPORT_L2GRE_LOCAL_MAC_IS_VALID | ofp.OF_BSN_VPORT_L2GRE_DSCP_ASSIGN,
port_no=1,
local_mac=[0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f],
nh_mac=[0x01, 0x02, 0x03, 0x04, 0x05, 0x06],
src_ip=0xc0000002,
dst_ip=0xc0001002,
-dscp_mode=0,
dscp=1,
ttl=64,
vpn=0xbeef,
@@ -37,12 +38,14 @@
of_port_name_t if_name = "foo";
of_mac_addr_t local_mac = { { 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f } };
of_mac_addr_t nh_mac = { { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 } };
+ of_bsn_vport_l2gre_flags_set(vport,
+ OF_BSN_VPORT_L2GRE_LOCAL_MAC_IS_VALID |
+ OF_BSN_VPORT_L2GRE_DSCP_ASSIGN);
of_bsn_vport_l2gre_port_no_set(vport, 1);
of_bsn_vport_l2gre_local_mac_set(vport, local_mac);
of_bsn_vport_l2gre_nh_mac_set(vport, nh_mac);
of_bsn_vport_l2gre_src_ip_set(vport, 0xc0000002);
of_bsn_vport_l2gre_dst_ip_set(vport, 0xc0001002);
- of_bsn_vport_l2gre_dscp_mode_set(vport, 0);
of_bsn_vport_l2gre_dscp_set(vport, 1);
of_bsn_vport_l2gre_ttl_set(vport, 64);
of_bsn_vport_l2gre_vpn_set(vport, 0xbeef);