Skip to content

Commit

Permalink
List OVS bridges to allow for OF version >1.0 (#1539)
Browse files Browse the repository at this point in the history
* # This is a combination of 3 commits.
# This is the 1st commit message:

Listing bridges

# This is the commit message #2:

Listing bridges

# This is the commit message #3:

Listing bridges

* listing ovs bridges

Co-authored-by: pdumais <github@dumais.io>

---------

Co-authored-by: Pat Dumais <githum@dumais.io>
Co-authored-by: Roman Dodin <dodin.roman@gmail.com>
  • Loading branch information
3 people committed Aug 22, 2023
1 parent 513437a commit 6ef4b49
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/rn/0.44.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ Read more about this feature in the [Certificates Management](../manual/cert.md#

* fixing CLAB_INTFS env var #1547
* fixing node filtering functionality #1549
* fixing ovs bridges and openflow 1.3 #1539
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 protocol version higher than 1.0
// So listing the bridges is safer
bridges, err := c.VSwitch.ListBridges()
if err != nil {
return fmt.Errorf("error while listing ovs bridges: %v", 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 6ef4b49

Please sign in to comment.