If NXFMF_OWN is set then full updates should be sent.
Prior to this change an abbreviated update is always sent
to the controller to which a monitor belongs, that is,
the NXFMF_OWN flag is ignored.

Also:
* Update existing flow tests for this chagne
* Add a test to exercise NX flow monitor with !own

I noticed this while working on support for OpenFlow1.4 flow monitors.

Signed-off-by: Simon Horman <ho...@verge.net.au>

v2
* As pointed out by Ben Phaff
  - I had the sense of the NXFMF_OWN bit inverted
* Include updates to test
  - Needed as bit sense is inverted
* Include !own test
  - Previously in a separate patch
---
 ofproto/connmgr.c |  3 ++-
 tests/ofproto.at  | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index 7d313c7..20c0b76 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -2125,7 +2125,8 @@ ofmonitor_report(struct connmgr *mgr, struct rule *rule,
                 ofconn->sent_abbrev_update = false;
             }
 
-            if (ofconn != abbrev_ofconn || ofconn->monitor_paused) {
+            if ((flags & NXFMF_OWN) || ofconn != abbrev_ofconn
+                || ofconn->monitor_paused) {
                 struct ofputil_flow_update fu;
                 struct match match;
 
diff --git a/tests/ofproto.at b/tests/ofproto.at
index f1c1774..8c6379e 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -2230,6 +2230,48 @@ NXST_FLOW_MONITOR reply (xid=0x0):
 OFPT_BARRIER_REPLY:
 ])
 
+# Check that our own changes are reported as full updates.
+ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
+ovs-ofctl add-flow br0 in_port=1,actions=output:2
+ovs-ofctl add-flow br0 in_port=2,actions=output:1
+ovs-appctl -t ovs-ofctl ofctl/barrier
+ovs-appctl -t ovs-ofctl ofctl/send 
010e004812345678003fffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000ffffffffffff0000
+ovs-appctl -t ovs-ofctl ofctl/barrier
+AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [NXST_FLOW reply:
+])
+AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log | 
multiline_sort], [0],
+[NXST_FLOW_MONITOR reply (xid=0x0):
+ event=ADDED table=0 cookie=0 in_port=1 actions=output:2
+NXST_FLOW_MONITOR reply (xid=0x0):
+ event=ADDED table=0 cookie=0 in_port=2 actions=output:1
+OFPT_BARRIER_REPLY:
+send: OFPT_FLOW_MOD: DEL priority=0 actions=drop
+NXST_FLOW_MONITOR reply (xid=0x0):
+ event=DELETED reason=delete table=0 cookie=0 in_port=1 actions=output:2
+ event=DELETED reason=delete table=0 cookie=0 in_port=2 actions=output:1
+OFPT_BARRIER_REPLY:
+])
+
+ovs-appctl -t ovs-ofctl exit
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
+AT_SETUP([ofproto - flow monitoring with !own])
+AT_KEYWORDS([monitor])
+OVS_VSWITCHD_START
+
+ovs-ofctl add-flow br0 in_port=0,dl_vlan=123,actions=output:1
+
+# Start a monitor watching the flow table and check the initial reply.
+ovs-ofctl monitor br0 watch:\!own --detach --no-chdir --pidfile >monitor.log 
2>&1
+AT_CAPTURE_FILE([monitor.log])
+ovs-appctl -t ovs-ofctl ofctl/barrier
+AT_CHECK([sed 's/ (xid=0x[[1-9a-fA-F]][[0-9a-fA-F]]*)//' monitor.log], [0],
+  [NXST_FLOW_MONITOR reply:
+ event=ADDED table=0 cookie=0 in_port=0,dl_vlan=123 actions=output:1
+OFPT_BARRIER_REPLY:
+])
+
 # Check that our own changes are reported as abbreviations.
 ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log
 ovs-ofctl add-flow br0 in_port=1,actions=output:2
-- 
2.0.0.rc2

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to