From: Ben Pfaff Date: Thu, 10 Mar 2011 22:59:06 +0000 (-0800) Subject: ofp-print: Consistently print priority only if it is not default. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbc7ed06a7fd67f30b13489b0d3ba07adb037cf5;p=openvswitch ofp-print: Consistently print priority only if it is not default. In NXST_FLOW replies, the priority was printed only if it was not OFP_DEFAULT_PRIORITY, but it was always printed in OFPST_FLOW replies. This commit changes OFPST_FLOW replies to match NXST_FLOW replies. --- diff --git a/lib/ofp-print.c b/lib/ofp-print.c index b4e69180..3dd1624e 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -1129,7 +1129,9 @@ ofp_print_ofpst_flow_reply(struct ds *string, const struct ofp_header *oh, ofp_print_duration(string, ntohl(fs->duration_sec), ntohl(fs->duration_nsec)); ds_put_format(string, ", table_id=%"PRIu8", ", fs->table_id); - ds_put_format(string, "priority=%"PRIu16", ", ntohs(fs->priority)); + if (fs->priority != htons(OFP_DEFAULT_PRIORITY)) { + ds_put_format(string, "priority=%"PRIu16", ", ntohs(fs->priority)); + } ds_put_format(string, "n_packets=%"PRIu64", ", ntohll(get_32aligned_be64(&fs->packet_count))); ds_put_format(string, "n_bytes=%"PRIu64", ", diff --git a/tests/ofp-print.at b/tests/ofp-print.at index d9ec6e88..c4d53d22 100644 --- a/tests/ofp-print.at +++ b/tests/ofp-print.at @@ -437,10 +437,10 @@ c0 a8 00 01 00 00 00 00 00 00 00 04 10 b0 76 00 \ ff ff 00 05 00 00 00 00 00 00 00 00 00 00 00 00 \ 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 \ 00 00 00 3c 00 00 00 08 00 03 00 00 00 60 00 00 \ -00 00 00 00 00 03 50 54 00 00 00 05 50 54 00 00 \ +00 00 00 01 00 03 50 54 00 00 00 05 50 54 00 00 \ 00 06 ff ff 00 00 08 00 00 01 00 00 c0 a8 00 01 \ c0 a8 00 02 00 08 00 00 00 00 00 09 05 b8 d8 00 \ -ff ff 00 05 00 00 00 00 00 00 00 00 00 00 00 00 \ +80 00 00 05 00 00 00 00 00 00 00 00 00 00 00 00 \ 00 00 00 00 00 00 00 00 00 00 00 0d 00 00 00 00 \ 00 00 04 fa 00 00 00 08 00 01 00 00 \ "], [0], [dnl @@ -448,7 +448,7 @@ OFPST_FLOW reply (xid=0x4): cookie=0x0, duration=4.2s, table_id=0, priority=65535, n_packets=1, n_bytes=60, idle_timeout=5,arp,in_port=3,dl_vlan=65535,dl_vlan_pcp=0,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,opcode=2,nw_tos=0,tp_src=0,tp_dst=0 actions=output:1 cookie=0x0, duration=8.9s, table_id=0, priority=65535, n_packets=13, n_bytes=1274, idle_timeout=5,icmp,in_port=1,dl_vlan=65535,dl_vlan_pcp=0,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,nw_tos=0,icmp_type=0,icmp_code=0 actions=output:3 cookie=0x0, duration=4.28s, table_id=0, priority=65535, n_packets=1, n_bytes=60, idle_timeout=5,arp,in_port=1,dl_vlan=65535,dl_vlan_pcp=0,dl_src=50:54:00:00:00:06,dl_dst=50:54:00:00:00:05,nw_src=192.168.0.2,nw_dst=192.168.0.1,opcode=1,nw_tos=0,icmp_type=0,icmp_code=0 actions=output:3 - cookie=0x0, duration=9.096s, table_id=0, priority=65535, n_packets=13, n_bytes=1274, idle_timeout=5,icmp,in_port=3,dl_vlan=65535,dl_vlan_pcp=0,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,icmp_type=8,icmp_code=0 actions=output:1 + cookie=0x0, duration=9.096s, table_id=0, n_packets=13, n_bytes=1274, idle_timeout=5,icmp,in_port=*,dl_vlan=65535,dl_vlan_pcp=0,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:06,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,icmp_type=8,icmp_code=0 actions=output:1 ]) AT_CLEANUP