Skip to content

Commit

Permalink
Merge pull request #17 from ak1ra24/change-linuxbr-to-ovs
Browse files Browse the repository at this point in the history
bridge: change linux bridge to ovs
  • Loading branch information
slankdev committed Feb 2, 2020
2 parents 929f293 + 164c850 commit f5353d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions internal/pkg/shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (node *Node) DeleteNode() []string {

// DeleteSwitch Delete bridge
func (br *Switch) DeleteSwitch() string {
deleteBrCmd := fmt.Sprintf("ip link delete %s", br.Name)
deleteBrCmd := fmt.Sprintf("ovs-vsctl del-br %s", br.Name)
return deleteBrCmd
}

Expand Down Expand Up @@ -404,7 +404,7 @@ func NetnsLinkUp(netnsName string, linkName string) string {
func (bridge *Switch) CreateSwitch() []string {
var createSwitchCmds []string

addSwitchCmd := fmt.Sprintf("ip link add %s type bridge", bridge.Name)
addSwitchCmd := fmt.Sprintf("ovs-vsctl add-br %s", bridge.Name)
createSwitchCmds = append(createSwitchCmds, addSwitchCmd)

bridgeUpCmd := HostLinkUp(bridge.Name)
Expand Down Expand Up @@ -445,7 +445,7 @@ func (inf *Interface) S2nLink(nodeName string) []string {
s2nLinkCmds = append(s2nLinkCmds, s2nLinkCmd)
s2nLinkCmds = append(s2nLinkCmds, NetnsLinkUp(nodeName, nodeinf))
s2nLinkCmds = append(s2nLinkCmds, HostLinkUp(peerBrInf))
setBrLinkCmd := fmt.Sprintf("ip link set dev %s master %s", peerBrInf, peerBr)
setBrLinkCmd := fmt.Sprintf("ovs-vsctl add-port %s %s", peerBr, peerBrInf)
s2nLinkCmds = append(s2nLinkCmds, setBrLinkCmd)

return s2nLinkCmds
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/shell/shell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func TestSwitch_DeleteSwitch(t *testing.T) {
},
},
},
want: "ip link delete SW",
want: "ovs-vsctl del-br SW",
},
}
for _, tt := range tests {
Expand Down Expand Up @@ -716,7 +716,7 @@ func TestSwitch_CreateSwitch(t *testing.T) {
},
},
},
want: []string{"ip link add SW type bridge", "ip link set SW up"},
want: []string{"ovs-vsctl add-br SW", "ip link set SW up"},
},
}
for _, tt := range tests {
Expand Down Expand Up @@ -815,7 +815,7 @@ func TestInterface_S2nLink(t *testing.T) {
args: args{
nodeName: "R1",
},
want: []string{"ip link add net0 netns R1 type veth peer name SW-R1", "ip netns exec R1 ip link set net0 up", "ip link set SW-R1 up", "ip link set dev SW-R1 master SW"},
want: []string{"ip link add net0 netns R1 type veth peer name SW-R1", "ip netns exec R1 ip link set net0 up", "ip link set SW-R1 up", "ovs-vsctl add-port SW SW-R1"},
},
}
for _, tt := range tests {
Expand Down

0 comments on commit f5353d5

Please sign in to comment.