Skip to content

Commit

Permalink
align chain elements
Browse files Browse the repository at this point in the history
Signed-off-by: Periyasamy Palanisamy <periyasamy.palanisamy@est.tech>
  • Loading branch information
pperiyasamy committed Aug 2, 2021
1 parent bf46d0f commit ee291fd
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 30 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ require (
github.com/golang/protobuf v1.4.3
github.com/networkservicemesh/api v1.0.1-0.20210715134717-6e4a0f8eae3e
github.com/networkservicemesh/sdk v0.5.1-0.20210725184904-92b282404ca1
github.com/networkservicemesh/sdk-kernel v0.0.0-20210727122423-52b6ec54ac4f
github.com/networkservicemesh/sdk-sriov v0.0.0-20210729153428-9d7b7ece0db0
github.com/networkservicemesh/sdk-kernel v0.0.0-20210802032320-0b6bf83339f7
github.com/networkservicemesh/sdk-sriov v0.0.0-20210802032626-e07974262d2a
github.com/ovn-org/ovn-kubernetes/go-controller v0.0.0-20210526211758-faa6b74b102b
github.com/pkg/errors v0.9.1
github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852
Expand Down
9 changes: 4 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,10 @@ github.com/networkservicemesh/api v1.0.1-0.20210715134717-6e4a0f8eae3e h1:cCRjV+
github.com/networkservicemesh/api v1.0.1-0.20210715134717-6e4a0f8eae3e/go.mod h1:B6meq/SWjWR6bGXZdXPfbOeaBK+T1JayLdtEJQCsXKU=
github.com/networkservicemesh/sdk v0.5.1-0.20210725184904-92b282404ca1 h1:yu7Xnu+KwQasCw3Vt7siN2e8Nr2gSjwicDj14Ug7/iU=
github.com/networkservicemesh/sdk v0.5.1-0.20210725184904-92b282404ca1/go.mod h1:7whufn2CIGBX+KW3U5b0IWB6f7bJJizY1vV1a5t2HXI=
github.com/networkservicemesh/sdk-kernel v0.0.0-20210725185450-edd90899d7be/go.mod h1:keuHPx4uM38mogyvKx22q3D6Pb2yYSnjazD+wAHVoh8=
github.com/networkservicemesh/sdk-kernel v0.0.0-20210727122423-52b6ec54ac4f h1:W6lWglf4oE/X0KI1jD2TxqFPOK+8pnQP+Pr9xBFBpNg=
github.com/networkservicemesh/sdk-kernel v0.0.0-20210727122423-52b6ec54ac4f/go.mod h1:keuHPx4uM38mogyvKx22q3D6Pb2yYSnjazD+wAHVoh8=
github.com/networkservicemesh/sdk-sriov v0.0.0-20210729153428-9d7b7ece0db0 h1:0pI9RJOm1COqzzRnzIsITyv9hZDlI4W4XutbdusHtGM=
github.com/networkservicemesh/sdk-sriov v0.0.0-20210729153428-9d7b7ece0db0/go.mod h1:raou4nyaHdmQ4psqB/7aXH6yBlwM1BQmCxUMBIMnYDg=
github.com/networkservicemesh/sdk-kernel v0.0.0-20210802032320-0b6bf83339f7 h1:c67BY7rI//jcpFku3p4Oo3kvDoR3ONPpF7L+LJlSnUw=
github.com/networkservicemesh/sdk-kernel v0.0.0-20210802032320-0b6bf83339f7/go.mod h1:keuHPx4uM38mogyvKx22q3D6Pb2yYSnjazD+wAHVoh8=
github.com/networkservicemesh/sdk-sriov v0.0.0-20210802032626-e07974262d2a h1:gSHuyBIZ1fSflAg5UJh26LxbXxuVxtyMJ8FWirwib84=
github.com/networkservicemesh/sdk-sriov v0.0.0-20210802032626-e07974262d2a/go.mod h1:GWk2QcPcV6NeGXLaZjwm37331pxPeikmThHmO33I8iE=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
Expand Down
49 changes: 28 additions & 21 deletions pkg/networkservice/chains/xconnectns/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ import (
"github.com/networkservicemesh/sdk/pkg/networkservice/chains/endpoint"
"github.com/networkservicemesh/sdk/pkg/networkservice/common/clienturl"
"github.com/networkservicemesh/sdk/pkg/networkservice/common/connect"
"github.com/networkservicemesh/sdk/pkg/networkservice/common/heal"
"github.com/networkservicemesh/sdk/pkg/networkservice/common/mechanisms"
"github.com/networkservicemesh/sdk/pkg/networkservice/common/mechanisms/recvfd"
"github.com/networkservicemesh/sdk/pkg/networkservice/common/mechanisms/sendfd"
"github.com/networkservicemesh/sdk/pkg/networkservice/common/mechanismtranslation"
"github.com/networkservicemesh/sdk/pkg/networkservice/core/adapters"
"github.com/networkservicemesh/sdk/pkg/networkservice/core/chain"
"github.com/networkservicemesh/sdk/pkg/networkservice/utils/metadata"
"github.com/networkservicemesh/sdk/pkg/tools/addressof"
"github.com/networkservicemesh/sdk/pkg/tools/token"
"google.golang.org/grpc"

Expand Down Expand Up @@ -76,16 +79,28 @@ func NewSriovServer(ctx context.Context, name string, authzServer networkservice
additionalFunctionality := []networkservice.NetworkServiceServer{
metadata.NewServer(),
recvfd.NewServer(),
sendfd.NewServer(),
vfconfig.NewServer(),
// Statically set the url we use to the unix file socket for the NSMgr
clienturl.NewServer(clientURL),
mechanisms.NewServer(map[string]networkservice.NetworkServiceServer{
kernelmech.MECHANISM: chain.NewNetworkServiceServer(
kernel.NewServer(bridgeName),
resourcepool.NewServer(sriov.KernelDriver, resourceLock, pciPool, resourcePool, sriovConfig),
rename.NewServer(),
),
vxlanmech.MECHANISM: vxlan.NewServer(tunnelIP, bridgeName, vxlanInterfacesMutex, vxlanInterfaces),
}),
inject.NewServer(),
connectioncontextkernel.NewServer(),
connect.NewServer(ctx,
client.NewClientFactory(
client.WithName(name),
client.WithAdditionalFunctionality(
mechanismtranslation.NewClient(),
connectioncontextkernel.NewClient(),
inject.NewClient(),
rename.NewClient(),
// mechanisms
kernel.NewClient(bridgeName),
resourcepool.NewClient(sriov.KernelDriver, resourceLock, pciPool, resourcePool, sriovConfig),
Expand All @@ -98,18 +113,7 @@ func NewSriovServer(ctx context.Context, name string, authzServer networkservice
),
connect.WithDialOptions(clientDialOptions...),
),
mechanisms.NewServer(map[string]networkservice.NetworkServiceServer{
kernelmech.MECHANISM: chain.NewNetworkServiceServer(
kernel.NewServer(bridgeName),
resourcepool.NewServer(sriov.KernelDriver, resourceLock, pciPool, resourcePool, sriovConfig),
rename.NewServer(),
),
vxlanmech.MECHANISM: vxlan.NewServer(tunnelIP, bridgeName, vxlanInterfacesMutex, vxlanInterfaces),
}),
inject.NewServer(),
connectioncontextkernel.NewServer(),
l2ovsconnect.NewServer(bridgeName),
sendfd.NewServer(),
}

rv.Endpoint = endpoint.NewServer(ctx, tokenGenerator,
Expand All @@ -135,8 +139,21 @@ func NewKernelServer(ctx context.Context, name string, authzServer networkservic
additionalFunctionality := []networkservice.NetworkServiceServer{
metadata.NewServer(),
recvfd.NewServer(),
sendfd.NewServer(),
// Statically set the url we use to the unix file socket for the NSMgr
clienturl.NewServer(clientURL),
heal.NewServer(ctx,
heal.WithOnHeal(addressof.NetworkServiceClient(adapters.NewServerToClient(rv))),
heal.WithOnRestore(heal.OnRestoreIgnore)),
mechanisms.NewServer(map[string]networkservice.NetworkServiceServer{
kernelmech.MECHANISM: chain.NewNetworkServiceServer(
kernel.NewServer(bridgeName),
rename.NewServer(),
),
vxlanmech.MECHANISM: vxlan.NewServer(tunnelIP, bridgeName, vxlanInterfacesMutex, vxlanInterfaces),
}),
inject.NewServer(),
connectioncontextkernel.NewServer(),
connect.NewServer(ctx,
client.NewClientFactory(
client.WithName(name),
Expand All @@ -153,17 +170,7 @@ func NewKernelServer(ctx context.Context, name string, authzServer networkservic
),
connect.WithDialOptions(clientDialOptions...),
),
mechanisms.NewServer(map[string]networkservice.NetworkServiceServer{
kernelmech.MECHANISM: chain.NewNetworkServiceServer(
kernel.NewServer(bridgeName),
rename.NewServer(),
),
vxlanmech.MECHANISM: vxlan.NewServer(tunnelIP, bridgeName, vxlanInterfacesMutex, vxlanInterfaces),
}),
inject.NewServer(),
connectioncontextkernel.NewServer(),
l2ovsconnect.NewServer(bridgeName),
sendfd.NewServer(),
}

rv.Endpoint = endpoint.NewServer(ctx, tokenGenerator,
Expand Down
4 changes: 2 additions & 2 deletions pkg/networkservice/mechanisms/vxlan/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ func (c *vxlanClient) Request(ctx context.Context, request *networkservice.Netwo
if err != nil {
return nil, err
}
if err = add(ctx, logger, request.Connection, c.bridgeName, c.vxlanInterfacesMutex, c.vxlanInterfacesMap, true); err != nil {
_ = remove(request.Connection, c.bridgeName, c.vxlanInterfacesMutex, c.vxlanInterfacesMap, true)
if err = add(ctx, logger, conn, c.bridgeName, c.vxlanInterfacesMutex, c.vxlanInterfacesMap, true); err != nil {
_ = remove(conn, c.bridgeName, c.vxlanInterfacesMutex, c.vxlanInterfacesMap, true)
if _, closeErr := next.Client(ctx).Close(ctx, conn, opts...); closeErr != nil {
logger.Errorf("failed to close failed connection: %s %s", conn.GetId(), closeErr.Error())
}
Expand Down

0 comments on commit ee291fd

Please sign in to comment.