Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
do-msingh committed Oct 17, 2024
1 parent 4ad8dcf commit e1c0033
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
16 changes: 8 additions & 8 deletions ovs/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ type LearnedFlow struct {

// A PerFlowStats is meant for fetching FlowStats per flow
type PerFlowStats struct {
Protocol Protocol
InPort int
Table int
Cookie uint64
IfName string
Stats FlowStats
Protocol Protocol
InPort int
Table int
Cookie uint64
IfName string
Stats FlowStats
}

var _ error = &FlowError{}
Expand Down Expand Up @@ -509,9 +509,9 @@ func (f *PerFlowStats) UnmarshalText(b []byte) error {
// Try to read as integer port numbers first
port, err := strconv.ParseInt(s, 10, 0)
if err != nil {
f.IfName = s
f.IfName = s
} else {
f.InPort = int(port)
f.InPort = int(port)
}
continue
case table:
Expand Down
20 changes: 10 additions & 10 deletions ovs/flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1341,22 +1341,22 @@ func TestPerFlowStatsUnmarshalText(t *testing.T) {
desc: "Flow string with interface name",
s: "priority=10,in_port=eth0,table=0,actions=drop",
f: &PerFlowStats{
InPort: 0,
IfName: "eth0",
Table: 0,
InPort: 0,
IfName: "eth0",
Table: 0,
},
},
{
desc: "Flow string with flow stats",
s: "n_packets=13256, n_bytes=1287188, priority=10,in_port=eth0,table=0,actions=drop",
f: &PerFlowStats{
InPort: 0,
IfName: "eth0",
Table: 0,
Stats: FlowStats{
PacketCount: 13256,
ByteCount: 1287188,
},
InPort: 0,
IfName: "eth0",
Table: 0,
Stats: FlowStats{
PacketCount: 13256,
ByteCount: 1287188,
},
},
},
}
Expand Down
44 changes: 22 additions & 22 deletions ovs/openflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1366,10 +1366,10 @@ func TestClientOpenFlowDumpFlowStatsWithFlowArgsInterfaceNames(t *testing.T) {
`,
want: []*PerFlowStats{
{
InPort: PortLOCAL,
Table: 45,
Cookie: 1,
Stats: FlowStats{
InPort: PortLOCAL,
Table: 45,
Cookie: 1,
Stats: FlowStats{
PacketCount: 6,
ByteCount: 480,
},
Expand All @@ -1390,27 +1390,27 @@ func TestClientOpenFlowDumpFlowStatsWithFlowArgsInterfaceNames(t *testing.T) {
`,
want: []*PerFlowStats{
{
InPort: PortLOCAL,
Table: 45,
Cookie: 0,
Stats: FlowStats{
InPort: PortLOCAL,
Table: 45,
Cookie: 0,
Stats: FlowStats{
PacketCount: 6,
ByteCount: 480,
},
},
{
Protocol: ProtocolIPv4,
Table: 45,
Stats: FlowStats{
Table: 45,
Stats: FlowStats{
PacketCount: 0,
ByteCount: 0,
},
},
{
IfName: "eth0",
Table: 45,
Cookie: 0,
Stats: FlowStats{
IfName: "eth0",
Table: 45,
Cookie: 0,
Stats: FlowStats{
PacketCount: 56,
ByteCount: 1480,
},
Expand Down Expand Up @@ -1481,19 +1481,19 @@ func TestClientOpenFlowDumpFlowStatsWithFlowArgsPortNumbers(t *testing.T) {
`,
want: []*PerFlowStats{
{
InPort: PortLOCAL,
Table: 45,
Cookie: 0,
Stats: FlowStats{
InPort: PortLOCAL,
Table: 45,
Cookie: 0,
Stats: FlowStats{
PacketCount: 6,
ByteCount: 480,
},
},
{
InPort: 20,
Table: 45,
Cookie: 0,
Stats: FlowStats{
InPort: 20,
Table: 45,
Cookie: 0,
Stats: FlowStats{
PacketCount: 56,
ByteCount: 1480,
},
Expand Down

0 comments on commit e1c0033

Please sign in to comment.