Skip to content

Commit

Permalink
Add decode for OpenFlow counter structure
Browse files Browse the repository at this point in the history
  • Loading branch information
sflow committed Mar 8, 2017
1 parent 5c0adb5 commit 883e330
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/sflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -1440,6 +1440,15 @@ typedef struct _SFLLACP_counters {

#define XDRSIZ_LACP_COUNTERS 56

/* openflow port */
/* opaque = counter_data; enterprise = 0; format = 1004 */
typedef struct {
uint64_t datapath_id;
uint32_t port_no;
} SFLOFPort;

#define XDRSIZ_OFPORT 12

/* port name */
/* opaque = counter_data; enterprise = 0; format = 1005 */
typedef struct {
Expand Down Expand Up @@ -1489,6 +1498,7 @@ enum SFLCounters_type_tag {
SFLCOUNTERS_SFP = 10,
SFLCOUNTERS_PROCESSOR = 1001,
SFLCOUNTERS_RADIO = 1002,
SFLCOUNTERS_OFPORT = 1004,
SFLCOUNTERS_PORTNAME = 1005,
SFLCOUNTERS_HOST_HID = 2000, /* host id */
SFLCOUNTERS_ADAPTORS = 2001, /* host adaptors */
Expand Down
15 changes: 14 additions & 1 deletion src/sflowtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -3135,7 +3135,19 @@ static void readCounters_radio(SFSample *sample)
sf_log_next32(sample, "radio_on_channel_time");
sf_log_next32(sample, "radio_on_channel_busy_time");
}


/*_________________---------------------------__________________
_________________ readCounters_OFPort __________________
-----------------___________________________------------------
*/

static void readCounters_OFPort(SFSample *sample)
{
uint64_t dpid = getData64(sample);
sf_log(sample, "openflow_datapath_id %016"PRIx64"\n", dpid);
sf_log_next32(sample, "openflow_port");
}

/*_________________---------------------------__________________
_________________ readCounters_portName __________________
-----------------___________________________------------------
Expand Down Expand Up @@ -3937,6 +3949,7 @@ static void readCountersSample(SFSample *sample, int expanded)
case SFLCOUNTERS_SFP: readCounters_SFP(sample); break;
case SFLCOUNTERS_PROCESSOR: readCounters_processor(sample); break;
case SFLCOUNTERS_RADIO: readCounters_radio(sample); break;
case SFLCOUNTERS_OFPORT: readCounters_OFPort(sample); break;
case SFLCOUNTERS_PORTNAME: readCounters_portName(sample); break;
case SFLCOUNTERS_HOST_HID: readCounters_host_hid(sample); break;
case SFLCOUNTERS_ADAPTORS: readCounters_adaptors(sample); break;
Expand Down

0 comments on commit 883e330

Please sign in to comment.