Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use aip-go Join for resource names #304

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pkg/bridge/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ package bridge

import (
"context"
"fmt"
"log"
"net"
"sort"
"testing"

"github.com/philippgille/gokv/gomap"
"go.einride.tech/aip/resourcename"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/test/bufconn"
Expand All @@ -29,7 +29,10 @@ func sortLogicalBridges(bridges []*pb.LogicalBridge) {
}

func resourceIDToFullName(resourceID string) string {
return fmt.Sprintf("//network.opiproject.org/bridges/%s", resourceID)
return resourcename.Join(
"//network.opiproject.org/",
"bridges", resourceID,
)
}

// TODO: move all of this to a common place
Expand Down
7 changes: 5 additions & 2 deletions pkg/port/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ package port

import (
"context"
"fmt"
"log"
"net"
"sort"
"testing"

"github.com/philippgille/gokv/gomap"
"go.einride.tech/aip/resourcename"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/test/bufconn"
Expand All @@ -31,7 +31,10 @@ func sortBridgePorts(ports []*pb.BridgePort) {
}

func resourceIDToFullName(resourceID string) string {
return fmt.Sprintf("//network.opiproject.org/ports/%s", resourceID)
return resourcename.Join(
"//network.opiproject.org/",
"ports", resourceID,
)
}

// TODO: move all of this to a common place
Expand Down
7 changes: 5 additions & 2 deletions pkg/svi/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ package svi

import (
"context"
"fmt"
"log"
"net"
"sort"
"testing"

"github.com/philippgille/gokv/gomap"
"go.einride.tech/aip/resourcename"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/test/bufconn"
Expand All @@ -31,7 +31,10 @@ func sortSvis(svis []*pb.Svi) {
}

func resourceIDToFullName(resourceID string) string {
return fmt.Sprintf("//network.opiproject.org/svis/%s", resourceID)
return resourcename.Join(
"//network.opiproject.org/",
"svis", resourceID,
)
}

// TODO: move all of this to a common place
Expand Down
6 changes: 5 additions & 1 deletion pkg/vrf/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"testing"

"github.com/philippgille/gokv/gomap"
"go.einride.tech/aip/resourcename"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/test/bufconn"
Expand All @@ -30,7 +31,10 @@ func sortVrfs(vrfs []*pb.Vrf) {
}

func resourceIDToFullName(resourceID string) string {
return fmt.Sprintf("//network.opiproject.org/vrfs/%s", resourceID)
return resourcename.Join(
"//network.opiproject.org/",
"vrfs", resourceID,
)
}

func generateRandMAC() ([]byte, error) {
Expand Down
Loading