Skip to content

Commit

Permalink
# This is a combination of 3 commits.
Browse files Browse the repository at this point in the history
# This is the 1st commit message:

Listing bridges

# This is the commit message srl-labs#2:

Listing bridges

# This is the commit message srl-labs#3:

Listing bridges
  • Loading branch information
Pat Dumais authored and hellt committed Aug 22, 2023
1 parent b03c1fc commit 656e4c1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion nodes/ovs/ovs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
goOvs "github.com/digitalocean/go-openvswitch/ovs"
log "github.com/sirupsen/logrus"
cExec "github.com/srl-labs/containerlab/clab/exec"
"github.com/srl-labs/containerlab/internal/slices"
"github.com/srl-labs/containerlab/links"
"github.com/srl-labs/containerlab/nodes"
"github.com/srl-labs/containerlab/nodes/state"
Expand Down Expand Up @@ -54,7 +55,14 @@ func (n *ovs) CheckDeploymentConditions(_ context.Context) error {
goOvs.Sudo(),
)

if _, err := c.VSwitch.Get.Bridge(n.Cfg.ShortName); err != nil {
// We were previously doing c.VSwitch.Get.Bridge() but it doesn't work
// when the bridge has a propotocol version higher than 1.0
// So listing the bridges is safer
bridges, err := c.VSwitch.ListBridges()
if err != nil {
return fmt.Errorf("error while looking for ovs bridge %q: %v", n.Cfg.ShortName, err)
}
if !slices.Contains(bridges, n.Cfg.ShortName) {
return fmt.Errorf("could not find ovs bridge %q", n.Cfg.ShortName)
}

Expand Down

0 comments on commit 656e4c1

Please sign in to comment.