diff --git a/pkg/networkservice/chains/nsmgr/suite_test.go b/pkg/networkservice/chains/nsmgr/suite_test.go index d315d793fb..042565ab1a 100644 --- a/pkg/networkservice/chains/nsmgr/suite_test.go +++ b/pkg/networkservice/chains/nsmgr/suite_test.go @@ -161,7 +161,7 @@ func (s *nsmgrSuite) Test_SelectsRestartingEndpointUsecase() { }) require.NoError(t, err) - nseRegistryClient := registryclient.NewNetworkServiceEndpointRegistryClient(ctx, s.domain.Nodes[0].NSMgr.URL, + nseRegistryClient := registryclient.NewNetworkServiceEndpointRegistryClient(ctx, s.domain.Nodes[0].URL(), registryclient.WithDialOptions(sandbox.DefaultDialOptions(sandbox.GenerateTestToken)...)) nseReg, err = nseRegistryClient.Register(ctx, nseReg) @@ -725,7 +725,7 @@ func newPassThroughEndpoint( var additionalFunctionality []networkservice.NetworkServiceServer if hasClientFunctionality { - additionalFunctionality = additionalFunctionalityChain(ctx, node.NSMgr.URL, name, labels) + additionalFunctionality = additionalFunctionalityChain(ctx, node.URL(), name, labels) } if counter != nil { diff --git a/pkg/networkservice/chains/nsmgrproxy/server_test.go b/pkg/networkservice/chains/nsmgrproxy/server_test.go index 5faddb1a10..2a456120b9 100644 --- a/pkg/networkservice/chains/nsmgrproxy/server_test.go +++ b/pkg/networkservice/chains/nsmgrproxy/server_test.go @@ -488,7 +488,7 @@ func Test_Interdomain_PassThroughUsecase(t *testing.T) { // Passtrough to the node i-1 additionalFunctionality = []networkservice.NetworkServiceServer{ chain.NewNetworkServiceServer( - clienturl.NewServer(clusters[i].Nodes[0].NSMgr.URL), + clienturl.NewServer(clusters[i].Nodes[0].URL()), connect.NewServer(ctx, client.NewClientFactory(client.WithAdditionalFunctionality( newPassTroughClient(fmt.Sprintf("my-service-remote-%v@cluster%v", i-1, i-1)), diff --git a/pkg/networkservice/common/connect/server_cancel_test.go b/pkg/networkservice/common/connect/server_cancel_test.go index 9483fa63b4..d4727c2eec 100644 --- a/pkg/networkservice/common/connect/server_cancel_test.go +++ b/pkg/networkservice/common/connect/server_cancel_test.go @@ -102,7 +102,7 @@ func TestConnect_CancelDuringRequest(t *testing.T) { } domain.Nodes[0].NewEndpoint(ctx, nseReg2, sandbox.GenerateTestToken, chain.NewNetworkServiceServer( - clienturl.NewServer(domain.Nodes[0].NSMgr.URL), + clienturl.NewServer(domain.Nodes[0].URL()), connect.NewServer(ctx, clientFactory, connect.WithDialTimeout(sandbox.DialTimeout), diff --git a/pkg/registry/common/heal/find_test.go b/pkg/registry/common/heal/find_test.go index 83968b313f..12a0d82d96 100644 --- a/pkg/registry/common/heal/find_test.go +++ b/pkg/registry/common/heal/find_test.go @@ -55,7 +55,7 @@ func TestHealClient_FindTest(t *testing.T) { // 1. Create NS, NSE find clients findCtx, findCancel := context.WithCancel(ctx) - nsRegistryClient := registryclient.NewNetworkServiceRegistryClient(ctx, domain.Nodes[0].NSMgr.URL, + nsRegistryClient := registryclient.NewNetworkServiceRegistryClient(ctx, domain.Nodes[0].URL(), registryclient.WithDialOptions(sandbox.DefaultDialOptions(sandbox.GenerateTestToken)...)) nsStream, err := nsRegistryClient.Find(findCtx, ®istry.NetworkServiceQuery{ @@ -64,7 +64,7 @@ func TestHealClient_FindTest(t *testing.T) { }) require.NoError(t, err) - nseRegistryClient := registryclient.NewNetworkServiceEndpointRegistryClient(ctx, domain.Nodes[0].NSMgr.URL, + nseRegistryClient := registryclient.NewNetworkServiceEndpointRegistryClient(ctx, domain.Nodes[0].URL(), registryclient.WithDialOptions(sandbox.DefaultDialOptions(sandbox.GenerateTestToken)...)) nseStream, err := nseRegistryClient.Find(findCtx, ®istry.NetworkServiceEndpointQuery{ diff --git a/pkg/tools/sandbox/node.go b/pkg/tools/sandbox/node.go index 4b39d48305..5ad505fa10 100644 --- a/pkg/tools/sandbox/node.go +++ b/pkg/tools/sandbox/node.go @@ -48,6 +48,13 @@ type Node struct { NSMgr *NSMgrEntry } +// URL returns node NSMgr URL +func (n *Node) URL() *url.URL { + u := new(url.URL) + *u = *n.NSMgr.URL + return u +} + // NewNSMgr creates a new NSMgr func (n *Node) NewNSMgr( ctx context.Context, @@ -108,7 +115,7 @@ func (n *Node) NewForwarder( entry := new(EndpointEntry) additionalFunctionality = append(additionalFunctionality, - clienturl.NewServer(n.NSMgr.URL), + clienturl.NewServer(n.URL()), heal.NewServer(ctx, heal.WithOnHeal(addressof.NetworkServiceClient(adapters.NewServerToClient(entry))), heal.WithOnRestore(heal.OnRestoreIgnore)), @@ -128,7 +135,7 @@ func (n *Node) NewForwarder( ctx, nse, generatorFunc, - registryclient.NewNetworkServiceEndpointRegistryInterposeClient(ctx, n.NSMgr.URL, + registryclient.NewNetworkServiceEndpointRegistryInterposeClient(ctx, n.URL(), registryclient.WithDialOptions(dialOptions...)), additionalFunctionality..., ) @@ -151,7 +158,7 @@ func (n *Node) NewEndpoint( ctx, nse, generatorFunc, - registryclient.NewNetworkServiceEndpointRegistryClient(ctx, n.NSMgr.URL, + registryclient.NewNetworkServiceEndpointRegistryClient(ctx, n.URL(), registryclient.WithDialOptions(DefaultDialOptions(generatorFunc)...)), additionalFunctionality..., ) @@ -200,7 +207,7 @@ func (n *Node) NewClient( ) networkservice.NetworkServiceClient { return client.NewClient( ctx, - n.NSMgr.URL, + n.URL(), client.WithDialOptions(DefaultDialOptions(generatorFunc)...), client.WithDialTimeout(DialTimeout), client.WithAuthorizeClient(authorize.NewClient(authorize.Any())), diff --git a/pkg/tools/sandbox/types.go b/pkg/tools/sandbox/types.go index e790a09b2d..ba81bfdbd0 100644 --- a/pkg/tools/sandbox/types.go +++ b/pkg/tools/sandbox/types.go @@ -92,7 +92,7 @@ func (d *Domain) NewNSRegistryClient(ctx context.Context, generatorFunc token.Ge case d.Registry != nil: registryURL = d.Registry.URL case len(d.Nodes) != 0: - registryURL = d.Nodes[0].NSMgr.URL + registryURL = d.Nodes[0].URL() default: return nil }