Skip to content

Commit

Permalink
refactor: use aip-go Join for resource names
Browse files Browse the repository at this point in the history
Signed-off-by: Artsiom Koltun <artsiom.koltun@intel.com>
  • Loading branch information
artek-koltun authored and glimchb committed Oct 30, 2023
1 parent c5d770b commit e410075
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
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

0 comments on commit e410075

Please sign in to comment.