diff options
author | Justin Pettit <jpettit@nicira.com> | 2010-01-21 17:34:05 -0800 |
---|---|---|
committer | Justin Pettit <jpettit@nicira.com> | 2010-02-20 02:22:28 -0800 |
commit | 834377ea559d665520910968358c522f30d3eb93 (patch) | |
tree | 89b7c16a94cb916b066d08a402ecaa77bb82851b /tests | |
parent | 26c3f94a553be66dd037159148f30b47ef2c6f4b (diff) |
ofproto: Match on IP ToS/DSCP bits (OpenFlow 1.0)
OpenFlow 1.0 adds support for matching on IP ToS/DSCP bits.
NOTE: OVS at this point is not wire-compatible with OpenFlow 1.0 until
the final commit in this OpenFlow 1.0 set.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/flowgen.pl | 9 | ||||
-rw-r--r-- | tests/test-classifier.c | 10 |
2 files changed, 15 insertions, 4 deletions
diff --git a/tests/flowgen.pl b/tests/flowgen.pl index 74738d23..bbb6f11d 100755 --- a/tests/flowgen.pl +++ b/tests/flowgen.pl @@ -1,6 +1,6 @@ #! /usr/bin/perl -# Copyright (c) 2009 Nicira Networks. +# Copyright (c) 2009, 2010 Nicira Networks. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -60,6 +60,7 @@ sub output { $flow{DL_SRC} = "00:02:e3:0f:80:a4"; $flow{DL_DST} = "00:1a:92:40:ac:05"; $flow{NW_PROTO} = 0; + $flow{NW_TOS} = 0; $flow{NW_SRC} = '0.0.0.0'; $flow{NW_DST} = '0.0.0.0'; $flow{TP_SRC} = 0; @@ -78,6 +79,7 @@ sub output { $flow{DL_TYPE} = 0x0800; # ETH_TYPE_IP $flow{NW_SRC} = '10.0.2.15'; $flow{NW_DST} = '192.168.1.20'; + $flow{NW_TOS} = 44; if ($attrs{TP_PROTO} eq 'other') { $flow{NW_PROTO} = 42; } elsif ($attrs{TP_PROTO} eq 'TCP' || @@ -124,7 +126,7 @@ sub output { if ($attrs{DL_TYPE} eq 'ip') { my $ip = pack('CCnnnCCnNN', (4 << 4) | 5, # version, hdrlen - 0, # type of service + $flow{NW_TOS}, # type of service 0, # total length (filled in later) 65432, # id 0, # frag offset @@ -203,10 +205,11 @@ sub output { 1); # in_port print FLOWS pack_ethaddr($flow{DL_SRC}); print FLOWS pack_ethaddr($flow{DL_DST}); - print FLOWS pack('nCxnCxxxNNnn', + print FLOWS pack('nCxnCCxxNNnn', $flow{DL_VLAN}, 0, # DL_VLAN_PCP $flow{DL_TYPE}, + $flow{NW_TOS}, $flow{NW_PROTO}, inet_aton($flow{NW_SRC}), inet_aton($flow{NW_DST}), diff --git a/tests/test-classifier.c b/tests/test-classifier.c index f488ac66..6c81cd60 100644 --- a/tests/test-classifier.c +++ b/tests/test-classifier.c @@ -250,6 +250,7 @@ static uint8_t dl_src_values[][6] = { { 0x00, 0x02, 0xe3, 0x0f, 0x80, 0xa4 }, static uint8_t dl_dst_values[][6] = { { 0x4a, 0x27, 0x71, 0xae, 0x64, 0xc1 }, { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } }; static uint8_t nw_proto_values[] = { IP_TYPE_TCP, IP_TYPE_ICMP }; +static uint8_t nw_tos_values[] = { 49, 0 }; static void *values[CLS_N_FIELDS][2]; @@ -283,6 +284,9 @@ init_values(void) values[CLS_F_IDX_NW_PROTO][0] = &nw_proto_values[0]; values[CLS_F_IDX_NW_PROTO][1] = &nw_proto_values[1]; + values[CLS_F_IDX_NW_TOS][0] = &nw_tos_values[0]; + values[CLS_F_IDX_NW_TOS][1] = &nw_tos_values[1]; + values[CLS_F_IDX_TP_SRC][0] = &tp_src_values[0]; values[CLS_F_IDX_TP_SRC][1] = &tp_src_values[1]; @@ -301,6 +305,7 @@ init_values(void) #define N_DL_SRC_VALUES ARRAY_SIZE(dl_src_values) #define N_DL_DST_VALUES ARRAY_SIZE(dl_dst_values) #define N_NW_PROTO_VALUES ARRAY_SIZE(nw_proto_values) +#define N_NW_TOS_VALUES ARRAY_SIZE(nw_tos_values) #define N_FLOW_VALUES (N_NW_SRC_VALUES * \ N_NW_DST_VALUES * \ @@ -312,7 +317,8 @@ init_values(void) N_TP_DST_VALUES * \ N_DL_SRC_VALUES * \ N_DL_DST_VALUES * \ - N_NW_PROTO_VALUES) + N_NW_PROTO_VALUES * \ + N_NW_TOS_VALUES) static unsigned int get_value(unsigned int *x, unsigned n_values) @@ -366,6 +372,8 @@ compare_classifiers(struct classifier *cls, struct tcls *tcls) memcpy(flow.dl_dst, dl_dst_values[get_value(&x, N_DL_DST_VALUES)], ETH_ADDR_LEN); flow.nw_proto = nw_proto_values[get_value(&x, N_NW_PROTO_VALUES)]; + flow.nw_tos = nw_tos_values[get_value(&x, N_NW_TOS_VALUES)]; + memset(flow.reserved, 0, sizeof flow.reserved); for (include = 1; include <= 3; include++) { cr0 = lookup_with_include_bits(cls, &flow, include); |