diff --git a/pkg/evpn/bridge.go b/pkg/evpn/bridge.go index 2e444ff4..e3b66428 100644 --- a/pkg/evpn/bridge.go +++ b/pkg/evpn/bridge.go @@ -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 } diff --git a/pkg/evpn/evpn.go b/pkg/evpn/evpn.go index 133935e5..fc56c510 100644 --- a/pkg/evpn/evpn.go +++ b/pkg/evpn/evpn.go @@ -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 diff --git a/pkg/evpn/port.go b/pkg/evpn/port.go index 0f03d60a..6709f8df 100644 --- a/pkg/evpn/port.go +++ b/pkg/evpn/port.go @@ -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 }