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

Remove duplicated IPAM code #500

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/edwarnicke/grpcfd v1.1.2
github.com/kelseyhightower/envconfig v1.4.0
github.com/networkservicemesh/api v1.6.2-0.20221205183940-84c7ff837cdd
github.com/networkservicemesh/sdk v0.5.1-0.20221219152652-beec79b7ec9d
github.com/networkservicemesh/sdk v0.5.1-0.20230109230417-1492e69a650d
github.com/networkservicemesh/sdk-sriov v0.0.0-20221219180322-513bee7f52b7
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA=
github.com/miekg/dns v1.1.50/go.mod h1:e3IlAVfNqAllflbibAZEWOXOQ+Ynzk/dDozDxY7XnME=
github.com/networkservicemesh/api v1.6.2-0.20221205183940-84c7ff837cdd h1:26HR90HrJFZHIPPP3SCLGNRpPCMFoEnSSZfhHH8MPSo=
github.com/networkservicemesh/api v1.6.2-0.20221205183940-84c7ff837cdd/go.mod h1:hOF2844BSstH1311oDMDgqqXS+kdc77htZNPRKl9mf8=
github.com/networkservicemesh/sdk v0.5.1-0.20221219152652-beec79b7ec9d h1:cx0Z/xWuoW0JS3VmA+5Ckg5g+iirB7RJglGDnJzmGEo=
github.com/networkservicemesh/sdk v0.5.1-0.20221219152652-beec79b7ec9d/go.mod h1:++MSpR2wuFlCpCYoR6lELxJ4ILKd650vDQ8d9CtGAzA=
github.com/networkservicemesh/sdk v0.5.1-0.20230109230417-1492e69a650d h1:1EhczRkzfkutymvDj5XYinD68omLpFk2F2kJdhzYG+U=
github.com/networkservicemesh/sdk v0.5.1-0.20230109230417-1492e69a650d/go.mod h1:++MSpR2wuFlCpCYoR6lELxJ4ILKd650vDQ8d9CtGAzA=
github.com/networkservicemesh/sdk-sriov v0.0.0-20221219180322-513bee7f52b7 h1:warFgkj/xEmiV/KK33MQzOY/D54KHP4duCn+dSQf+0I=
github.com/networkservicemesh/sdk-sriov v0.0.0-20221219180322-513bee7f52b7/go.mod h1:uClz/S+Ty0doAV+ZKL+gg0PBkY9F6vyelPG40K4VVxw=
github.com/open-policy-agent/opa v0.44.0 h1:sEZthsrWBqIN+ShTMJ0Hcz6a3GkYsY4FaB2S/ou2hZk=
Expand Down
4 changes: 1 addition & 3 deletions internal/pkg/imports/imports_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ import (
_ "github.com/networkservicemesh/sdk/pkg/networkservice/common/onidle"
_ "github.com/networkservicemesh/sdk/pkg/networkservice/common/policyroute"
_ "github.com/networkservicemesh/sdk/pkg/networkservice/connectioncontext/dnscontext"
_ "github.com/networkservicemesh/sdk/pkg/networkservice/core/chain"
_ "github.com/networkservicemesh/sdk/pkg/networkservice/ipam/point2pointipam"
_ "github.com/networkservicemesh/sdk/pkg/networkservice/ipam/groupipam"
_ "github.com/networkservicemesh/sdk/pkg/registry/chains/client"
_ "github.com/networkservicemesh/sdk/pkg/registry/common/authorize"
_ "github.com/networkservicemesh/sdk/pkg/registry/common/begin"
Expand Down Expand Up @@ -65,7 +64,6 @@ import (
_ "google.golang.org/grpc/credentials"
_ "google.golang.org/grpc/health/grpc_health_v1"
_ "gopkg.in/yaml.v2"
_ "net"
_ "net/url"
_ "os"
_ "os/signal"
Expand Down
18 changes: 4 additions & 14 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) 2020-2022 Doc.ai and/or its affiliates.
// Copyright (c) 2021-2022 Nordix and/or its affiliates.
// Copyright (c) 2020-2023 Doc.ai and/or its affiliates.
// Copyright (c) 2021-2023 Nordix and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -24,7 +24,6 @@ import (
"context"
"crypto/tls"
"fmt"
"net"
"net/url"
"os"
"os/signal"
Expand Down Expand Up @@ -61,8 +60,7 @@ import (
"github.com/networkservicemesh/sdk/pkg/networkservice/common/onidle"
"github.com/networkservicemesh/sdk/pkg/networkservice/common/policyroute"
"github.com/networkservicemesh/sdk/pkg/networkservice/connectioncontext/dnscontext"
"github.com/networkservicemesh/sdk/pkg/networkservice/core/chain"
"github.com/networkservicemesh/sdk/pkg/networkservice/ipam/point2pointipam"
"github.com/networkservicemesh/sdk/pkg/networkservice/ipam/groupipam"
registryclient "github.com/networkservicemesh/sdk/pkg/registry/chains/client"
registryauthorize "github.com/networkservicemesh/sdk/pkg/registry/common/authorize"
"github.com/networkservicemesh/sdk/pkg/registry/common/clientinfo"
Expand Down Expand Up @@ -200,7 +198,7 @@ func main() {
log.FromContext(ctx).Infof("executing phase 3: creating icmp server ipam")
// ********************************************************************************

ipamChain := getIPAMChain(config.CidrPrefix)
ipamChain := groupipam.NewServer(config.CidrPrefix)
Copy link
Member

Choose a reason for hiding this comment

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

Please use this inline

Copy link
Contributor Author

Choose a reason for hiding this comment

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


log.FromContext(ctx).Infof("network prefixes parsed successfully")

Expand Down Expand Up @@ -405,11 +403,3 @@ type policyRoutesGetter struct {
ctx context.Context
policyRoutes atomic.Value
}

func getIPAMChain(cIDRGroups [][]*net.IPNet) networkservice.NetworkServiceServer {
var ipamchain []networkservice.NetworkServiceServer
for _, cidrGroup := range cIDRGroups {
ipamchain = append(ipamchain, point2pointipam.NewServer(cidrGroup...))
}
return chain.NewNetworkServiceServer(ipamchain...)
}
6 changes: 3 additions & 3 deletions suite_setup_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2020-2022 Doc.ai and/or its affiliates.
// Copyright (c) 2020-2023 Doc.ai and/or its affiliates.
//
// Copyright (c) 2020-2022 Cisco and/or its affiliates.
// Copyright (c) 2020-2023 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -119,7 +119,7 @@ func (f *TestSuite) SetupSuite() {
registrybegin.NewNetworkServiceEndpointRegistryServer(),
updatepath.NewNetworkServiceEndpointRegistryServer(spiffejwt.TokenGeneratorFunc(source, f.config.MaxTokenLifetime)),
authorize.NewNetworkServiceEndpointRegistryServer(),
expire.NewNetworkServiceEndpointRegistryServer(f.ctx, time.Minute),
expire.NewNetworkServiceEndpointRegistryServer(f.ctx, expire.WithDefaultExpiration(time.Minute)),
registryrecvfd.NewNetworkServiceEndpointRegistryServer(),
memrg,
)
Expand Down