Skip to content

Commit

Permalink
fix: make br-tenant a constant
Browse files Browse the repository at this point in the history
Fixes #100

Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
  • Loading branch information
glimchb committed Aug 8, 2023
1 parent 837bd71 commit e5b6895
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 2 additions & 3 deletions pkg/evpn/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ func (s *Server) CreateLogicalBridge(_ context.Context, in *pb.CreateLogicalBrid
}
// create vxlan only if VNI is not empty
if in.LogicalBridge.Spec.Vni > 0 {
bridgeName := "br-tenant"
bridge, err := netlink.LinkByName(bridgeName)
bridge, err := netlink.LinkByName(tenantbridgeName)
if err != nil {
err := status.Errorf(codes.NotFound, "unable to find key %s", bridgeName)
err := status.Errorf(codes.NotFound, "unable to find key %s", tenantbridgeName)
log.Printf("error: %v", err)
return nil, err
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/evpn/evpn.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import (
pe "github.com/opiproject/opi-api/network/evpn-gw/v1alpha1/gen/go"
)

const (
tenantbridgeName = "br-tenant"
)

// Server represents the Server object
type Server struct {
pb.UnimplementedCloudInfraServiceServer
Expand Down
6 changes: 2 additions & 4 deletions pkg/evpn/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ func (s *Server) CreateBridgePort(_ context.Context, in *pb.CreateBridgePortRequ
return nil, status.Errorf(codes.InvalidArgument, msg)
}
// not found, so create a new one
bridgeName := "br-tenant"
// get tenant bridge device by name
bridge, err := netlink.LinkByName(bridgeName)
bridge, err := netlink.LinkByName(tenantbridgeName)
if err != nil {
err := status.Errorf(codes.NotFound, "unable to find key %s", bridgeName)
err := status.Errorf(codes.NotFound, "unable to find key %s", tenantbridgeName)
log.Printf("error: %v", err)
return nil, err
}
Expand Down

0 comments on commit e5b6895

Please sign in to comment.