Skip to content

Commit

Permalink
refactor: rename files for clarity
Browse files Browse the repository at this point in the history
Signed-off-by: Boris Glimcher <[email protected]>
  • Loading branch information
glimchb committed Oct 19, 2023
1 parent 3ad107b commit 800603a
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
7 changes: 7 additions & 0 deletions pkg/bridge/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"
"log"
"net"
"sort"

"google.golang.org/grpc"
"google.golang.org/grpc/codes"
Expand All @@ -19,6 +20,12 @@ import (
pb "github.com/opiproject/opi-api/network/evpn-gw/v1alpha1/gen/go"
)

func sortLogicalBridges(bridges []*pb.LogicalBridge) {
sort.Slice(bridges, func(i int, j int) bool {
return bridges[i].Name < bridges[j].Name
})
}

// TODO: move all of this to a common place
const (
tenantbridgeName = "br-tenant"
Expand Down
7 changes: 0 additions & 7 deletions pkg/bridge/bridge.go → pkg/bridge/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"context"
"fmt"
"log"
"sort"
"strings"

"github.com/google/uuid"
Expand All @@ -24,12 +23,6 @@ import (
"google.golang.org/protobuf/types/known/emptypb"
)

func sortLogicalBridges(bridges []*pb.LogicalBridge) {
sort.Slice(bridges, func(i int, j int) bool {
return bridges[i].Name < bridges[j].Name
})
}

// CreateLogicalBridge executes the creation of the LogicalBridge
func (s *Server) CreateLogicalBridge(ctx context.Context, in *pb.CreateLogicalBridgeRequest) (*pb.LogicalBridge, error) {
// check input correctness
Expand Down
7 changes: 7 additions & 0 deletions pkg/port/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"
"log"
"net"
"sort"

"google.golang.org/grpc"
"google.golang.org/grpc/codes"
Expand All @@ -20,6 +21,12 @@ import (
pc "github.com/opiproject/opi-api/network/opinetcommon/v1alpha1/gen/go"
)

func sortBridgePorts(ports []*pb.BridgePort) {
sort.Slice(ports, func(i int, j int) bool {
return ports[i].Name < ports[j].Name
})
}

// TODO: move all of this to a common place
const (
tenantbridgeName = "br-tenant"
Expand Down
7 changes: 0 additions & 7 deletions pkg/port/port.go → pkg/port/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"fmt"
"log"
"path"
"sort"
"strings"

"github.com/google/uuid"
Expand All @@ -25,12 +24,6 @@ import (
"google.golang.org/protobuf/types/known/emptypb"
)

func sortBridgePorts(ports []*pb.BridgePort) {
sort.Slice(ports, func(i int, j int) bool {
return ports[i].Name < ports[j].Name
})
}

// CreateBridgePort executes the creation of the port
func (s *Server) CreateBridgePort(ctx context.Context, in *pb.CreateBridgePortRequest) (*pb.BridgePort, error) {
// check input correctness
Expand Down
7 changes: 7 additions & 0 deletions pkg/svi/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"
"log"
"net"
"sort"

"google.golang.org/grpc"
"google.golang.org/grpc/codes"
Expand All @@ -20,6 +21,12 @@ import (
pc "github.com/opiproject/opi-api/network/opinetcommon/v1alpha1/gen/go"
)

func sortSvis(svis []*pb.Svi) {
sort.Slice(svis, func(i int, j int) bool {
return svis[i].Name < svis[j].Name
})
}

// TODO: move all of this to a common place
const (
tenantbridgeName = "br-tenant"
Expand Down
7 changes: 0 additions & 7 deletions pkg/svi/svi.go → pkg/svi/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"fmt"
"log"
"path"
"sort"
"strings"

"github.com/google/uuid"
Expand All @@ -25,12 +24,6 @@ import (
"google.golang.org/protobuf/types/known/emptypb"
)

func sortSvis(svis []*pb.Svi) {
sort.Slice(svis, func(i int, j int) bool {
return svis[i].Name < svis[j].Name
})
}

// CreateSvi executes the creation of the VLAN
func (s *Server) CreateSvi(ctx context.Context, in *pb.CreateSviRequest) (*pb.Svi, error) {
// check input correctness
Expand Down
7 changes: 7 additions & 0 deletions pkg/vrf/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"fmt"
"log"
"net"
"sort"

"google.golang.org/grpc"
"google.golang.org/grpc/codes"
Expand All @@ -20,6 +21,12 @@ import (
pb "github.com/opiproject/opi-api/network/evpn-gw/v1alpha1/gen/go"
)

func sortVrfs(vrfs []*pb.Vrf) {
sort.Slice(vrfs, func(i int, j int) bool {
return vrfs[i].Name < vrfs[j].Name
})
}

// TODO: move all of this to a common place
func resourceIDToFullName(_ string, resourceID string) string {
return fmt.Sprintf("//network.opiproject.org/vrfs/%s", resourceID)
Expand Down
7 changes: 0 additions & 7 deletions pkg/vrf/vrf.go → pkg/vrf/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"log"
"math"
"path"
"sort"
"strings"

"github.com/google/uuid"
Expand All @@ -26,12 +25,6 @@ import (
"google.golang.org/protobuf/types/known/emptypb"
)

func sortVrfs(vrfs []*pb.Vrf) {
sort.Slice(vrfs, func(i int, j int) bool {
return vrfs[i].Name < vrfs[j].Name
})
}

// CreateVrf executes the creation of the VRF
func (s *Server) CreateVrf(ctx context.Context, in *pb.CreateVrfRequest) (*pb.Vrf, error) {
// check input correctness
Expand Down

0 comments on commit 800603a

Please sign in to comment.