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

IPContext merged in begin chain element (#1231) #1234

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 4 additions & 2 deletions pkg/networkservice/common/begin/merge.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2021 Cisco and/or its affiliates.
// Copyright (c) 2021-2022 Cisco and/or its affiliates.
// Copyright (c) 2022 Nordix Foundation
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -36,7 +37,8 @@ func mergeConnection(returnedConnection, requestedConnection, connection *networ
func mergeConnectionContext(returnedConnectionContext, requestedConnectionContext, connectioncontext *networkservice.ConnectionContext) *networkservice.ConnectionContext {
rv := proto.Clone(connectioncontext).(*networkservice.ConnectionContext)
if !proto.Equal(returnedConnectionContext, requestedConnectionContext) {
// TODO: IPContext, DNSContext, EthernetContext, do we need to do MTU?
// TODO: DNSContext, EthernetContext, do we need to do MTU?
rv.IpContext = requestedConnectionContext.IpContext
Copy link
Member

@denis-tingaikin denis-tingaikin Mar 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think we also need to do it for other contexts as you pointed in the comment.

@edwarnicke Thoughts?

Copy link
Member

@edwarnicke edwarnicke Mar 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LionelJouin Apologies for this taking so long to get back to you on. The net net is that what you did here was fine. I also realized why it took me so long to sort it out, and produced a better documented version here in #1238 that handles the merge more or less correctly (which you were doing) and also in a way that's hopefully clearer. I also provided testing. Could you have a look?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no problem, I will try it today, thank you

rv.ExtraContext = mergeMapStringString(returnedConnectionContext.GetExtraContext(), requestedConnectionContext.GetExtraContext(), connectioncontext.GetExtraContext())
}
return rv
Expand Down