Skip to content

Commit

Permalink
run go fmt to fix style
Browse files Browse the repository at this point in the history
Signed-off-by: Date Huang <date.huang@suse.com>
  • Loading branch information
Date Huang committed Feb 10, 2022
1 parent 4bac0dd commit ea3a18d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
28 changes: 14 additions & 14 deletions plugins/main/bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
"net"
"os"
"runtime"
"sort"
"syscall"
"time"
"sort"

"github.com/j-keck/arping"
"github.com/vishvananda/netlink"
Expand All @@ -49,17 +49,17 @@ const defaultBrName = "cni0"

type NetConf struct {
types.NetConf
BrName string `json:"bridge"`
IsGW bool `json:"isGateway"`
IsDefaultGW bool `json:"isDefaultGateway"`
ForceAddress bool `json:"forceAddress"`
IPMasq bool `json:"ipMasq"`
MTU int `json:"mtu"`
HairpinMode bool `json:"hairpinMode"`
PromiscMode bool `json:"promiscMode"`
Vlan int `json:"vlan"`
BrName string `json:"bridge"`
IsGW bool `json:"isGateway"`
IsDefaultGW bool `json:"isDefaultGateway"`
ForceAddress bool `json:"forceAddress"`
IPMasq bool `json:"ipMasq"`
MTU int `json:"mtu"`
HairpinMode bool `json:"hairpinMode"`
PromiscMode bool `json:"promiscMode"`
Vlan int `json:"vlan"`
VlanTrunk []*VlanTrunk `json:"vlanTrunk,omitempty"`
MacSpoofChk bool `json:"macspoofchk,omitempty"`
MacSpoofChk bool `json:"macspoofchk,omitempty"`

Args struct {
Cni BridgeArgs `json:"cni,omitempty"`
Expand All @@ -68,7 +68,7 @@ type NetConf struct {
Mac string `json:"mac,omitempty"`
} `json:"runtimeConfig,omitempty"`

mac string
mac string
vlans []int
}

Expand Down Expand Up @@ -142,7 +142,7 @@ func loadNetConf(bytes []byte, envArgs string) (*NetConf, string, error) {
// This method is copied from https://github.com/k8snetworkplumbingwg/ovs-cni/blob/main/pkg/plugin/plugin.go
func collectVlanTrunk(vlanTrunk []*VlanTrunk) ([]int, error) {
if vlanTrunk == nil {
return nil, nil
return nil, nil
}

vlanMap := make(map[int]bool)
Expand Down Expand Up @@ -175,7 +175,7 @@ func collectVlanTrunk(vlanTrunk []*VlanTrunk) ([]int, error) {
if item.ID != nil {
ID = *item.ID
if ID < 0 || ID > 4094 {
return nil, errors.New("incorrect trunk id parameter")
return nil, errors.New("incorrect trunk id parameter")
}
vlanMap[ID] = true
}
Expand Down
12 changes: 6 additions & 6 deletions plugins/main/bridge/bridge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ func (tester *testerV10x) cmdAddTest(tc testCase, dataDir string) (types.Result,
}
}
}

// Check that the bridge has a different mac from the veth
// If not, it means the bridge has an unstable mac and will change
// as ifs are added and removed
Expand Down Expand Up @@ -910,7 +910,7 @@ func (tester *testerV04x) cmdAddTest(tc testCase, dataDir string) (types.Result,
Expect(isExist).To(BeTrue())
Expect(checkVlan(tc.vlan, vlans)).To(BeTrue())
}

// check VlanTrunks exist on the veth interface
if tc.vlanTrunk != nil {
interfaceMap, err := netlink.BridgeVlanList()
Expand Down Expand Up @@ -1229,7 +1229,7 @@ func (tester *testerV03x) cmdAddTest(tc testCase, dataDir string) (types.Result,
Expect(isExist).To(BeTrue())
Expect(checkVlan(tc.vlan, vlans)).To(BeTrue())
}

// check VlanTrunks exist on the veth interface
if tc.vlanTrunk != nil {
interfaceMap, err := netlink.BridgeVlanList()
Expand Down Expand Up @@ -1836,14 +1836,14 @@ var _ = Describe("bridge Operations", func() {
isLayer2: true,
vlan: 100,
vlanTrunk: []*VlanTrunk{
{ ID: &id },
{ID: &id},
{
MinID: &minID,
MaxID: &maxID,
},
},
AddErr020: "cannot convert: no valid IP addresses",
AddErr010: "cannot convert: no valid IP addresses",
AddErr020: "cannot convert: no valid IP addresses",
AddErr010: "cannot convert: no valid IP addresses",
}
cmdAddDelTest(originalNS, targetNS, tc, dataDir)
})
Expand Down

0 comments on commit ea3a18d

Please sign in to comment.