-
Notifications
You must be signed in to change notification settings - Fork 36
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
added client for setting connection context for passthrough nse #883
Conversation
37a05ef
to
d453d4a
Compare
pkg/networkservice/common/contexttranslation/set_connection_context.go
Outdated
Show resolved
Hide resolved
d41f289
to
bd04ccc
Compare
} | ||
|
||
// NewSetConnectionContextClient - returns client that changes connection context to one, provided as parameter or default if nil provided | ||
func NewSetConnectionContextClient() networkservice.NetworkServiceClient { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NewSetConnectionContextClient
func NewSetConnectionContextClient() networkservice.NetworkServiceClient { | |
func NewClient() networkservice.NetworkServiceClient { |
} | ||
|
||
func (s *setConCtxClient) Close(ctx context.Context, conn *networkservice.Connection, opts ...grpc.CallOption) (*empty.Empty, error) { | ||
return next.Client(ctx).Close(ctx, conn, opts...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we do nothing on close?
// limitations under the License. | ||
|
||
// Package injectconncontext changes connection context in client chain | ||
package injectconncontext |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we can not store this chain element near the test?
client.WithName(fmt.Sprintf("nsc-%v", uuid.New().String())), | ||
client.WithAdditionalFunctionality( | ||
checkconnection.NewClient(t, func(t *testing.T, conn *networkservice.Connection) { | ||
assert.True(t, proto.Equal(connCtx, conn.Context)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is diff missed?
checkconnection.NewClient(t, func(t *testing.T, conn *networkservice.Connection) { | ||
assert.True(t, proto.Equal(connCtx, conn.Context)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to have two checks:
- Check that contextContext is updated on backward(before translation client).
- Check that contextContext is updated on forward ( after translation client).
checkrequest.NewClient(t, func(t *testing.T, request *networkservice.NetworkServiceRequest) { | ||
if *requestCount > 0 { | ||
assert.Equal( | ||
t, | ||
connCtx.String(), | ||
request.GetConnection().Context.String(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why it is needed?
I'm a little unclear why this client for setting connection context for passthrough NSE is needed at all... |
/cc @Bolodya1997 |
Signed-off-by: Mikhail avramenkomihail15@gmail.com
#879