summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNiti Rohilla <niti.rohilla@tcs.com>2015-09-09 17:33:42 +0530
committerBen Pfaff <blp@nicira.com>2015-09-09 13:17:23 -0700
commit3c35db62d0ebdf6191c60aae0ccadbb40ac933ba (patch)
tree5b00bf8df1a1ec8f2c472e85aebb55a125b6cd20 /tests
parent3514c765179a92f57508885a41356cda940bed0c (diff)
downloadopenvswitch-3c35db62d0ebdf6191c60aae0ccadbb40ac933ba.tar.gz
ofproto: Implement OF1.4 Group & Meter change notification messages
This patch adds support for Openflow1.4 Group & meter change notification messages. In a multi controller environment, when a controller modifies the state of group and meter table, the request that successfully modifies this state is forwarded to other controllers. Other controllers are informed with the OFPT_REQUESTFORWARD message. Request forwarding is enabled on a per controller channel basis using the Set Asynchronous Configuration Message. Signed-off-by: Niti Rohilla <niti.rohilla@tcs.com> Co-authored-by: Ben Pfaff <blp@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/ofp-print.at46
-rw-r--r--tests/ofproto.at91
2 files changed, 137 insertions, 0 deletions
diff --git a/tests/ofp-print.at b/tests/ofp-print.at
index 35a626246..8cdceade0 100644
--- a/tests/ofp-print.at
+++ b/tests/ofp-print.at
@@ -2675,6 +2675,52 @@ OFPT_ROLE_STATUS (OF1.4) (xid=0xa): role=master generation_id=16 reason=configur
])
AT_CLEANUP
+AT_SETUP([OFP_REQUESTFORWARD - OF1.4])
+AT_KEYWORDS([ofp-print])
+AT_CHECK([ovs-ofctl ofp-print "\
+05 20 00 18 00 00 00 02 \
+05 0f 00 10 02 00 00 00 \
+00 00 00 00 00 00 00 01 \
+"], [0], [dnl
+OFPT_REQUESTFORWARD (OF1.4) (xid=0x2): reason=group_mod
+ ADD group_id=1,type=all
+])
+AT_CLEANUP
+
+AT_SETUP([OFP_REQUESTFORWARD - OF1.4])
+AT_KEYWORDS([ofp-print])
+AT_CHECK([ovs-ofctl ofp-print "\
+05 20 00 18 00 00 00 02 \
+05 0f 00 10 02 00 00 00 \
+00 01 01 00 00 00 00 01 \
+"], [0], [dnl
+OFPT_REQUESTFORWARD (OF1.4) (xid=0x2): reason=group_mod
+ MOD group_id=1,type=select
+])
+AT_CLEANUP
+
+AT_SETUP([OFP_REQUESTFORWARD - OF1.4])
+AT_KEYWORDS([ofp-print])
+AT_CHECK([ovs-ofctl ofp-print "\
+05 20 00 18 00 00 00 02 \
+05 1d 00 10 02 00 00 00 \
+00 00 00 00 00 00 00 01 \
+"], [0], [dnl
+OFPT_REQUESTFORWARD (OF1.4) (xid=0x2): reason=meter_mod ADD meter=1 bands=
+])
+AT_CLEANUP
+
+AT_SETUP([OFP_REQUESTFORWARD - OF1.4])
+AT_KEYWORDS([ofp-print])
+AT_CHECK([ovs-ofctl ofp-print "\
+05 20 00 18 00 00 00 02 \
+05 1d 00 10 02 00 00 00 \
+00 01 01 00 00 00 00 01 \
+"], [0], [dnl
+OFPT_REQUESTFORWARD (OF1.4) (xid=0x2): reason=meter_mod MOD meter=1 flags:0x100 bands=
+])
+AT_CLEANUP
+
AT_SETUP([NXT_SET_PACKET_IN])
AT_KEYWORDS([ofp-print])
AT_CHECK([ovs-ofctl ofp-print "\
diff --git a/tests/ofproto.at b/tests/ofproto.at
index 507fe91d1..7e80293cf 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -2899,6 +2899,97 @@ done
OVS_VSWITCHD_STOP
AT_CLEANUP
+dnl This test checks the Group and meter notifications when a group mod
+dnl command is sent from one controller and the reply is received by
+dnl other controllers.
+AT_SETUP([ofproto - requestforward (OpenFlow 1.4)])
+OVS_VSWITCHD_START
+on_exit 'kill `cat c1.pid c2.pid c3.pid`'
+
+# Start two ovs-ofctl controller processes.
+AT_CAPTURE_FILE([monitor1.log])
+AT_CAPTURE_FILE([expout1])
+AT_CAPTURE_FILE([monitor2.log])
+AT_CAPTURE_FILE([expout2])
+AT_CAPTURE_FILE([monitor3.log])
+AT_CAPTURE_FILE([expout3])
+
+ovs-ofctl -O OpenFlow15 monitor br0 --detach --no-chdir --pidfile=`pwd`/c1.pid --unixctl=`pwd`/c1
+ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c2.pid --unixctl=`pwd`/c2
+ovs-ofctl -O OpenFlow14 monitor br0 --detach --no-chdir --pidfile=`pwd`/c3.pid --unixctl=`pwd`/c3
+
+check_async () {
+ for i in 1 3; do
+ ovs-appctl -t `pwd`/c$i ofctl/barrier
+ ovs-appctl -t `pwd`/c$i ofctl/set-output-file monitor$i.log
+ : > expout$i
+ done
+
+ printf '\n\n--- check_async %d ---\n\n\n' $1
+ INDEX=$1
+ shift
+
+ # OFPGC_ADD
+ ovs-appctl -t `pwd`/c2 ofctl/send 050f0010000000020000000000000001
+ if test X"$1" = X"OFPGC_ADD"; then shift;
+ echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
+ ADD group_id=1,type=all"
+ echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
+ ADD group_id=1,type=all"
+ echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
+ ADD group_id=1,type=all"
+ fi
+
+ # OFPGC_MODIFY
+ ovs-appctl -t `pwd`/c2 ofctl/send 050f0010000000020001010000000001
+ if test X"$1" = X"OFPGC_MODIFY"; then shift;
+ echo >>expout2 "send: OFPT_GROUP_MOD (OF1.4):
+ MOD group_id=1,type=select"
+ echo >>expout1 "OFPT_REQUESTFORWARD (OF1.5): reason=group_mod
+ MOD group_id=1,type=select"
+ echo >>expout3 "OFPT_REQUESTFORWARD (OF1.4): reason=group_mod
+ MOD group_id=1,type=select"
+ fi
+
+ ovs-appctl -t `pwd`/c1 ofctl/barrier
+ echo >>expout1 "OFPT_BARRIER_REPLY (OF1.5):"
+ ovs-appctl -t `pwd`/c2 ofctl/barrier
+ echo >>expout2 "OFPT_BARRIER_REPLY (OF1.4):"
+ ovs-appctl -t `pwd`/c3 ofctl/barrier
+ echo >>expout3 "OFPT_BARRIER_REPLY (OF1.4):"
+
+ # Check output.
+ for i in 1 3; do
+ cp expout$i expout
+ AT_CHECK(
+ [[sed '
+s/ (xid=0x[0-9a-fA-F]*)//'< monitor$i.log]],
+ [0], [expout])
+ done
+}
+
+# controller 1: Become slave
+ovs-appctl -t `pwd`/c1 ofctl/send 061800180000000300000003000000008000000000000002
+
+# controller 2: Become master
+ovs-appctl -t `pwd`/c2 ofctl/send 051800180000000300000002000000008000000000000003
+
+# controller 1: Become slave
+ovs-appctl -t `pwd`/c3 ofctl/send 051800180000000300000003000000008000000000000004
+
+# controller 1: Enabled requestforward using set Asynchronous message
+ovs-appctl -t `pwd`/c1 ofctl/send 061c00280000000200000008000000050002000800000002000400080000001a000a000800000003
+
+# controller 2: Enabled requestforward using set Asynchronous message
+ovs-appctl -t `pwd`/c2 ofctl/send 051c002800000002000100080000000200030008000000050005000800000005000b000800000003
+
+# controller 1: Enabled requestforward using set Asynchronous message
+ovs-appctl -t `pwd`/c3 ofctl/send 051c00280000000200000008000000050002000800000002000400080000001a000a000800000003
+check_async 1 OFPGC_ADD OFPGC_MODIFY
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
dnl This test checks that OFPT_PACKET_OUT accepts both OFPP_NONE (as
dnl specified by OpenFlow 1.0) and OFPP_CONTROLLER (used by some
dnl controllers despite the spec) as meaning a packet that was generated