Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
bocon13 committed May 28, 2015
2 parents 78e24b9 + 858abb8 commit 8bd3661
Show file tree
Hide file tree
Showing 49 changed files with 820 additions and 136 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ LOXI_PY_FILES=$(shell find . \( -name loxi_output -prune \
\) -a -name '*.py')
LOXI_TEMPLATE_FILES=$(shell find */templates -type f -a \
\! \( -name '*.cache' -o -name '.*' \))
JAVA_PRE_WRITTEN_FILES=$(shell find java_gen/pre-written -type f)
INPUT_FILES = $(wildcard openflow_input/*)
TEST_DATA = $(shell find test_data -name '*.data')
OPENFLOWJ_OUTPUT_DIR = ${LOXI_OUTPUT_DIR}/openflowj
Expand Down Expand Up @@ -75,7 +76,7 @@ java: .loxi_ts.java
rsync --checksum --delete -rv ${LOXI_OUTPUT_DIR}/openflowj/gen-src/ ${OPENFLOWJ_ECLIPSE_WORKSPACE}/gen-src; \
fi

.loxi_ts.java: ${LOXI_PY_FILES} ${LOXI_TEMPLATE_FILES} ${INPUT_FILES} ${TEST_DATA}
.loxi_ts.java: ${LOXI_PY_FILES} ${LOXI_TEMPLATE_FILES} ${INPUT_FILES} ${TEST_DATA} ${JAVA_PRE_WRITTEN_FILES}
./loxigen.py --install-dir=${LOXI_OUTPUT_DIR} --lang=java
touch $@

Expand Down
3 changes: 1 addition & 2 deletions c_gen/c_test_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ 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_str64_t", "of_bitmap_512_t"]
"of_str64_t", "of_app_code_t", "of_bitmap_512_t"]

scalar_types = integer_types[:]
scalar_types.extend(string_types)
Expand Down
87 changes: 7 additions & 80 deletions c_gen/templates/of_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,87 +601,14 @@ of_object_wire_init(of_object_t *obj, of_object_id_t base_object_id,
}

/*
* Set member:
* get_wbuf_extent
* find offset of start of member
* if offset is at wbuf_extent (append new data)
* copy data at extent
* update parent length
* else
* find length of current entry
* move from end of current to extent to create (or remove) space
* copy data to offset
* update my length -- NEED LOCAL INFO TO DO THIS for some cases
*/

/* Also need: get offset of member for all combinations */
/* Also need: get length of member for all combinations */
#if 0
/**
* Append the wire buffer data from src to the end of dst's wire buffer
*/
int
of_object_append_buffer(of_object_t *dst, of_object_t *src)
{
of_wire_buffer_t *s_wbuf, *d_wbuf;
int orig_len, dst_offset, src_offset;

d_wbuf = OF_OBJECT_TO_WBUF(dst);
s_wbuf = OF_OBJECT_TO_WBUF(src);
dst_offset = dst->obj_offset + dst_length;
src_offset = src->obj_offset;
OF_WIRE_BUFFER_INIT_CHECK(d_wbuf, dst_offset + src->length);
MEMCPY(OF_WBUF_BUFFER_POINTER(d_wbuf, dst_offset),
OF_WBUF_BUFFER_POINTER(s_wbuf, 0), src->length);

orig_len = dst->length;
dst->length += src->length;

return OF_ERROR_NONE;
}

/**
* Set the length of the actions object in a packet_in object
*/

int
of_packet_out_actions_length_set(of_packet_t *obj, int len)
{
if (obj == NULL || obj->object_id != OF_PACKET_IN ||
obj->wbuf == NULL) {
return OF_ERROR_PARAM;
}

obj->actions_len_set(obj, len);
}

int
_packet_out_data_offset_get(of_packet_t *obj)
{
if (obj == NULL || obj->object_id != OF_PACKET_IN ||
obj->wbuf == NULL) {
return -1;
}

return OF_PACKET_OUT_FIXED_LENGTH + _packet_out_actions_length_get(obj);
}


/**
* Simple length derivation function
* Truncate an object to its initial length.
*
* Most variable length fields are alone at the end of a structure.
* Their length is a simple calculation, just the total length of
* the parent minus the length of the non-variable part of the
* parent's class type.
*
* @param parent The parent object
* @param length (out) Where to store the length of the final
* variable length member
* This allows the caller to reuse a single allocated object even if
* it has been appended to.
*/
int
of_object_simple_length_derive(of_object_t *obj, int *length)
void
of_object_truncate(of_object_t *obj)
{

of_object_init_map[obj->object_id](obj, obj->version, -1, 0);
obj->wbuf->current_bytes = obj->length;
}
#endif
2 changes: 2 additions & 0 deletions c_gen/templates/of_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ int of_object_can_grow(of_object_t *obj, int new_len);

void of_object_parent_length_update(of_object_t *obj, int delta);

void of_object_truncate(of_object_t *obj);

struct of_object_s {
/** A pointer to the underlying buffer's management structure. */
of_wire_buffer_t *wbuf;
Expand Down
12 changes: 12 additions & 0 deletions java_gen/java_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,9 @@ def gen_fixed_length_string_jtype(length):
'of_oxm_bsn_egr_port_group_id' : { 'value' : class_id },
'of_oxm_bsn_egr_port_group_id_masked' : { 'value' : class_id, 'value_mask' : class_id },

'of_oxm_bsn_ingress_port_group_id' : { 'value' : class_id },
'of_oxm_bsn_ingress_port_group_id_masked' : { 'value' : class_id, 'value_mask' : class_id },

'of_oxm_bsn_udf0' : { 'value' : udf },
'of_oxm_bsn_udf0_masked' : { 'value' : udf, 'value_mask' : udf },

Expand Down Expand Up @@ -708,6 +711,15 @@ def gen_fixed_length_string_jtype(length):
'of_oxm_bsn_l2_cache_hit' : { 'value' : boolean_value },
'of_oxm_bsn_l2_cache_hit_masked' : { 'value' : boolean_value, 'value_mask' : boolean_value },

'of_oxm_bsn_vxlan_network_id' : { 'value' : u32obj },
'of_oxm_bsn_vxlan_network_id_masked' : { 'value' : u32obj, 'value_mask' : u32obj },

'of_oxm_bsn_inner_eth_dst' : { 'value' : mac_addr },
'of_oxm_bsn_inner_eth_dst_masked' : { 'value' : mac_addr, 'value_mask' : mac_addr },

'of_oxm_bsn_inner_eth_src' : { 'value' : mac_addr },
'of_oxm_bsn_inner_eth_src_masked' : { 'value' : mac_addr, 'value_mask' : mac_addr },

'of_table_stats_entry': { 'wildcards': table_stats_wildcards },
'of_match_v1': { 'vlan_vid' : vlan_vid_match, 'vlan_pcp': vlan_pcp,
'eth_type': eth_type, 'ip_dscp': ip_dscp, 'ip_proto': ip_proto,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* construction. Such a class can be freely shared between threads and does not
* require defensive copying (don't call clone).
*
* @author Andreas Wundsam <[email protected]>
* @author Andreas Wundsam {@literal <}[email protected]{@literal >}
*/
public @interface Immutable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public interface Match extends OFObject {

/**
* True if and only if this field is currently partially specified in the match, i.e, the
* match will only select packets that match (p.value & getMask(field)) == getValue(field),
* match will only select packets that match (p.value &amp; getMask(field)) == getValue(field),
* and getMask(field) != 0.
*
* @param field Match field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ private MatchField(final String name, final MatchFields id, Prerequisite<?>... p
public final static MatchField<ClassId> BSN_EGR_PORT_GROUP_ID =
new MatchField<ClassId>("bsn_egr_port_group_id", MatchFields.BSN_EGR_PORT_GROUP_ID);

public final static MatchField<ClassId> BSN_INGRESS_PORT_GROUP_ID =
new MatchField<ClassId>("bsn_ingress_port_group_id", MatchFields.BSN_INGRESS_PORT_GROUP_ID);

public final static MatchField<UDF> BSN_UDF0 =
new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF0);

Expand Down Expand Up @@ -277,6 +280,15 @@ private MatchField(final String name, final MatchFields id, Prerequisite<?>... p
public final static MatchField<OFBooleanValue> BSN_L2_CACHE_HIT =
new MatchField<OFBooleanValue>("bsn_l2_cache_hit", MatchFields.BSN_L2_CACHE_HIT);

public final static MatchField<U32> BSN_VXLAN_NETWORK_ID =
new MatchField<U32>("bsn_vxlan_network_id", MatchFields.BSN_VXLAN_NETWORK_ID);

public final static MatchField<MacAddress> BSN_INNER_ETH_DST =
new MatchField<MacAddress>("bsn_inner_eth_dst", MatchFields.BSN_INNER_ETH_DST);

public final static MatchField<MacAddress> BSN_INNER_ETH_SRC =
new MatchField<MacAddress>("bsn_inner_eth_src", MatchFields.BSN_INNER_ETH_SRC);

public String getName() {
return name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public enum MatchFields {
BSN_TCP_FLAGS,
BSN_VLAN_XLATE_PORT_GROUP_ID,
BSN_L2_CACHE_HIT,
BSN_INGRESS_PORT_GROUP_ID,
BSN_VXLAN_NETWORK_ID,
BSN_INNER_ETH_DST,
BSN_INNER_ETH_SRC,
OCH_SIGTYPE,
OCH_SIGTYPE_BASIC,
OCH_SIGID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Abstraction of a datapath ID that can be set and/or accessed as either a
* long value or a colon-separated string. Immutable
*
* @author Rob Vaterlaus <[email protected]>
* @author Rob Vaterlaus {@literal <}[email protected]{@literal >}
*/
@Immutable
public class DatapathId implements PrimitiveSinkable, Comparable<DatapathId> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public static EthType of(int type) {

@Override
public String toString() {
return Integer.toHexString(rawValue);
return "0x" + Integer.toHexString(rawValue);
}

public void write2Bytes(ChannelBuffer c) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/** a hash value that supports bit-wise combinations, mainly to calculate hash values for
* reconciliation operations.
*
* @author Andreas Wundsam <[email protected]>
* @author Andreas Wundsam {@literal <}[email protected]{@literal >}
*
* @param <H> - this type, for return type safety.
*/
Expand Down Expand Up @@ -53,7 +53,7 @@ public interface HashValue<H extends HashValue<H>> {
* operations on a hashv value without the associated cost of object
* reallocation.
*
* @author Andreas Wundsam <[email protected]>
* @author Andreas Wundsam {@literal <}[email protected]{@literal >}
*
* @param <H> - the hashvalue
*/
Expand Down Expand Up @@ -99,4 +99,4 @@ public interface Builder<H> {
/** @return the hash value */
public H build();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,30 @@ public abstract class IPAddress<F extends IPAddress<F>> implements OFValueType<F
*/
public abstract boolean isBroadcast();


/**
* Checks if the IPAddress is the multicast address
* @return boolean true or false
*/
public abstract boolean isMulticast();

/**
* Perform a low level AND operation on the bits of two IPAddress<?> objects
* @param other IPAddress<?>
* @return new IPAddress<?> object after the AND oper
* Perform a low level AND operation on the bits of two IPAddress objects
* @param other IPAddress
* @return new IPAddress object after the AND oper
*/
public abstract F and(F other);

/**
* Perform a low level OR operation on the bits of two IPAddress<?> objects
* @param other IPAddress<?>
* @return new IPAddress<?> object after the AND oper
* Perform a low level OR operation on the bits of two IPAddress objects
* @param other IPAddress
* @return new IPAddress object after the AND oper
*/
public abstract F or(F other);

/**
* Returns a new IPAddress object with the bits inverted
* @return IPAddress<?>
* @return IPAddress
*/
public abstract F not();

Expand All @@ -79,13 +86,14 @@ public abstract class IPAddress<F extends IPAddress<F>> implements OFValueType<F
* @param cidrMaskLength the prefix length of the CIDR subnet mask
* (i.e. the number of leading one-bits),
* where <code>
* 0 <= cidrMaskLength <= (F.getLength() * 8)
* 0 {@literal <=} cidrMaskLength {@literal <=} (F.getLength() * 8)
* </code>
* @return an {@code IPAddressWithMask<F>} object that
* represents this IP address masked by the CIDR
* subnet mask of the given prefix length
* @throws IllegalArgumentException if the given prefix length was invalid
* @see #ofCidrMaskLength(int)
* @see org.projectfloodlight.openflow.types.IPv4Address#ofCidrMaskLength(int)
* @see org.projectfloodlight.openflow.types.IPv6Address#ofCidrMaskLength(int)
*/
@Nonnull
public abstract IPAddressWithMask<F> withMaskOfLength(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
/**
* Wrapper around an IPv4Address address
*
* @author Andreas Wundsam <[email protected]>
* @author Andreas Wundsam {@literal <}[email protected]{@literal >}
*/
public class IPv4Address extends IPAddress<IPv4Address> implements Writeable {
static final int LENGTH = 4;
Expand Down Expand Up @@ -90,6 +90,14 @@ public boolean isBroadcast() {
return this.equals(NO_MASK);
}

/**
* IPv4 multicast addresses are defined by the leading address bits of 1110
*/
@Override
public boolean isMulticast() {
return ((rawValue >>> 24) & 0xF0) == 0xE0;
}

@Override
public IPv4Address and(IPv4Address other) {
Preconditions.checkNotNull(other, "other must not be null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public IPVersion getIpVersion() {
* the given raw IP address masked by the given raw IP
* address mask
* @deprecated replaced by {@link IPv4Address#of(int)} and
* {@link IPv4Address#withMask(IPv4Address), e.g. <code>
* {@link IPv4Address#withMask(IPv4Address)}, e.g. <code>
* IPv4Address.of(int).withMask(IPv4Address.of(int))
* </code>
*/
Expand Down Expand Up @@ -68,7 +68,7 @@ public static IPv4AddressWithMask of(
* the given string in CIDR notation or other acceptable notations.
* <p>
* The following notations are accepted.
* <table><tr>
* <table summary=""><tr>
* <th>Notation</th><th>Example</th><th>Notes</th>
* </tr><tr>
* <td>IPv4 address only</td><td>{@code 1.2.3.4}</td><td>The subnet mask of
Expand Down
Loading

0 comments on commit 8bd3661

Please sign in to comment.