blob: 0ff49024dc954e7f7fdced095fcf91c4efe7287e [file] [log] [blame]
Rich Lane374942e2014-10-10 16:25:36 -07001-- binary
205 13 # version/type
300 d8 # length
400 00 00 05 # xid
500 04 # stats_type
600 00 # flags
700 00 00 00 # pad
800 78 # entries[0].length
900 00 # pad
1000 00 00 01 # entries[0].port_no
1100 00 00 00 # entries[0].duration_sec
1200 00 00 00 # entries[0].duration_nsec
1300 00 00 00 00 00 00 01 # entries[0].rx_packets
1400 00 00 00 00 00 00 00 # entries[0].tx_packets
1500 00 00 00 00 00 00 00 # entries[0].rx_bytes
1600 00 00 00 00 00 00 00 # entries[0].tx_bytes
1700 00 00 00 00 00 00 00 # entries[0].rx_dropped
1800 00 00 00 00 00 00 00 # entries[0].tx_dropped
1900 00 00 00 00 00 00 00 # entries[0].rx_errors
2000 00 00 00 00 00 00 02 # entries[0].tx_errors
2100 00 # entries[0].properties[0].type (ethernet)
2200 28 # entries[0].properties[0].length
2300 00 00 00 # pad
2400 00 00 00 00 00 00 01 # entries[0].properties[0].rx_frame_err
2500 00 00 00 00 00 00 02 # entries[0].properties[0].rx_over_err
2600 00 00 00 00 00 00 03 # entries[0].properties[0].rx_crc_err
2700 00 00 00 00 00 00 04 # entries[0].properties[0].collisions
2800 50 # entries[1].length
2900 00 # pad
30ff ff ff fe # entries[1].port_no
3100 00 00 00 # entries[1].duration_sec
3200 00 00 00 # entries[1].duration_nsec
3300 00 00 00 00 00 00 03 # entries[1].rx_packets
3400 00 00 00 00 00 00 00 # entries[1].tx_packets
3500 00 00 00 00 00 00 00 # entries[1].rx_bytes
3600 00 00 00 00 00 00 00 # entries[1].tx_bytes
3700 00 00 00 00 00 00 00 # entries[1].rx_dropped
3800 00 00 00 00 00 00 00 # entries[1].tx_dropped
3900 00 00 00 00 00 00 00 # entries[1].rx_errors
4000 00 00 00 00 00 00 04 # entries[1].tx_errors
41-- python
42ofp.message.port_stats_reply(
43 xid=5, flags=0, entries=[
44 ofp.port_stats_entry(port_no=1, rx_packets=1, tx_errors=2,
45 properties=[
46 ofp.port_stats_prop.ethernet(
47 rx_frame_err=1,
48 rx_over_err=2,
49 rx_crc_err=3,
50 collisions=4)]),
51 ofp.port_stats_entry(port_no=ofp.OFPP_LOCAL, rx_packets=3, tx_errors=4)])
52-- c
53obj = of_port_stats_reply_new(OF_VERSION_1_4);
54{
55 of_object_t list;
56 of_port_stats_reply_entries_bind(obj, &list);
57 {
58 of_object_t *obj = of_port_stats_entry_new(OF_VERSION_1_4);
59 of_port_stats_entry_port_no_set(obj, 1);
60 of_port_stats_entry_rx_packets_set(obj, 1);
61 of_port_stats_entry_tx_packets_set(obj, 0);
62 of_port_stats_entry_rx_bytes_set(obj, 0);
63 of_port_stats_entry_tx_bytes_set(obj, 0);
64 of_port_stats_entry_rx_dropped_set(obj, 0);
65 of_port_stats_entry_tx_dropped_set(obj, 0);
66 of_port_stats_entry_rx_errors_set(obj, 0);
67 of_port_stats_entry_tx_errors_set(obj, 2);
Rich Lane244fdce2014-10-14 12:01:36 -070068
69 /* Append property */
70 {
71 of_object_t list;
72 of_port_stats_entry_properties_bind(obj, &list);
73 {
74 of_object_t *obj = of_port_stats_prop_ethernet_new(OF_VERSION_1_4);
75 of_port_stats_prop_ethernet_rx_frame_err_set(obj, 1);
76 of_port_stats_prop_ethernet_rx_over_err_set(obj, 2);
77 of_port_stats_prop_ethernet_rx_crc_err_set(obj, 3);
78 of_port_stats_prop_ethernet_collisions_set(obj, 4);
79 of_list_append(&list, obj);
80 of_object_delete(obj);
81 }
82 }
83
84
Rich Lane374942e2014-10-10 16:25:36 -070085 of_list_append(&list, obj);
86 of_object_delete(obj);
87 }
88 {
89 of_object_t *obj = of_port_stats_entry_new(OF_VERSION_1_4);
90 of_port_stats_entry_port_no_set(obj, OF_PORT_DEST_LOCAL);
91 of_port_stats_entry_rx_packets_set(obj, 3);
92 of_port_stats_entry_tx_packets_set(obj, 0);
93 of_port_stats_entry_rx_bytes_set(obj, 0);
94 of_port_stats_entry_tx_bytes_set(obj, 0);
95 of_port_stats_entry_rx_dropped_set(obj, 0);
96 of_port_stats_entry_tx_dropped_set(obj, 0);
97 of_port_stats_entry_rx_errors_set(obj, 0);
98 of_port_stats_entry_tx_errors_set(obj, 4);
99 of_list_append(&list, obj);
100 of_object_delete(obj);
101 }
102}
103of_port_stats_reply_flags_set(obj, 0);
104of_port_stats_reply_xid_set(obj, 5);