From 14c21a2f885d6e8035d92238de1c97a2c30395ce Mon Sep 17 00:00:00 2001 From: Nikita Skrynnik <93182827+NikitaSkrynnik@users.noreply.github.com> Date: Wed, 17 Jan 2024 20:36:11 +1100 Subject: [PATCH] Update chain elements in cmd-forwarder-vpp (#1036) * Update chain elements in cmd-forwarder-vpp Signed-off-by: Nikita Skrynnik * fix linter issues Signed-off-by: Nikita Skrynnik --------- Signed-off-by: Nikita Skrynnik --- go.mod | 2 +- go.sum | 4 ++-- internal/imports/imports_linux.go | 2 +- internal/xconnectns/options.go | 12 ++++++------ internal/xconnectns/server.go | 4 ++-- main.go | 10 +++++----- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index aa791441..5f0ea5d2 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/networkservicemesh/sdk-k8s v0.0.0-20240111114041-996d3021ed14 github.com/networkservicemesh/sdk-kernel v1.11.2 github.com/networkservicemesh/sdk-sriov v0.0.0-20240116093619-dfb213a67f2b - github.com/networkservicemesh/sdk-vpp v1.11.2 + github.com/networkservicemesh/sdk-vpp v0.0.0-20240116093629-ba25c4516e9d github.com/networkservicemesh/vpphelper v0.0.0-20240115135903-e2b961f768b6 github.com/pkg/errors v0.9.1 github.com/safchain/ethtool v0.3.0 diff --git a/go.sum b/go.sum index 4ef2d186..23bdac87 100644 --- a/go.sum +++ b/go.sum @@ -150,8 +150,8 @@ github.com/networkservicemesh/sdk-kernel v1.11.2 h1:txgWevJoaBInZC5cYGZVSpltoBrd github.com/networkservicemesh/sdk-kernel v1.11.2/go.mod h1:a1AP3RteVHTQ/+/wSDrzsiEkWecveL8BJBrHMYUozbo= github.com/networkservicemesh/sdk-sriov v0.0.0-20240116093619-dfb213a67f2b h1:mf7DFY6IzRFTS9EhjTiyVB2DacMB7pswZ1sScE2UIpE= github.com/networkservicemesh/sdk-sriov v0.0.0-20240116093619-dfb213a67f2b/go.mod h1:YxlSacji2lmmGHPX7iVotcUT8GZgd/jIIXLvj5h/x7A= -github.com/networkservicemesh/sdk-vpp v1.11.2 h1:/5NEQ1areHyNW+XyE4lXmxZ9km+6/uXDrgTB/rqMj6I= -github.com/networkservicemesh/sdk-vpp v1.11.2/go.mod h1:7HlvdwrNYaNeYdkTXFg3qYwK1ArgkjqGdDDs+0bV5fA= +github.com/networkservicemesh/sdk-vpp v0.0.0-20240116093629-ba25c4516e9d h1:Y9FZrcHP0M7ATVYOL39hIZRY8F/9VMFfeGrRNM80iC0= +github.com/networkservicemesh/sdk-vpp v0.0.0-20240116093629-ba25c4516e9d/go.mod h1:4DytlENum+hsz8/Deo+7mzXdjdPquy/N1UnuPiaclpA= github.com/networkservicemesh/vpphelper v0.0.0-20240115135903-e2b961f768b6 h1:o+enN5yCikNXZN+hO+JjE+aLxBWq9+GMVF9GSQtpwMI= github.com/networkservicemesh/vpphelper v0.0.0-20240115135903-e2b961f768b6/go.mod h1:n6+8PnoDvWj6WMryfU3J8HOCusgysFjQ0kGLfrcsDEM= github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= diff --git a/internal/imports/imports_linux.go b/internal/imports/imports_linux.go index 2f327ba1..0c2f63a5 100644 --- a/internal/imports/imports_linux.go +++ b/internal/imports/imports_linux.go @@ -53,8 +53,8 @@ import ( _ "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/mechanisms/memif" _ "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/mechanisms/vxlan" _ "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/mechanisms/wireguard" + _ "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/metrics" _ "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/pinhole" - _ "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/stats" _ "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/tag" _ "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/up" _ "github.com/networkservicemesh/sdk-vpp/pkg/tools/types" diff --git a/internal/xconnectns/options.go b/internal/xconnectns/options.go index a990fc70..3735b213 100644 --- a/internal/xconnectns/options.go +++ b/internal/xconnectns/options.go @@ -1,4 +1,4 @@ -// Copyright (c) 2022 Cisco and/or its affiliates. +// Copyright (c) 2022-2024 Cisco and/or its affiliates. // // SPDX-License-Identifier: Apache-2.0 // @@ -26,7 +26,7 @@ import ( "github.com/networkservicemesh/api/pkg/api/networkservice" "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/mechanisms/vxlan" - "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/stats" + "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/metrics" "github.com/networkservicemesh/sdk/pkg/networkservice/common/cleanup" ) @@ -38,7 +38,7 @@ type xconnOptions struct { dialTimeout time.Duration domain2Device map[string]string mechanismPrioriyList []string - statsOpts []stats.Option + metricsOpts []metrics.Option cleanupOpts []cleanup.Option vxlanOpts []vxlan.Option dialOpts []grpc.DialOption @@ -95,10 +95,10 @@ func WithVlanDomain2Device(domain2Device map[string]string) Option { } } -// WithStatsOptions sets stats options -func WithStatsOptions(opts ...stats.Option) Option { +// WithMetricsOptions sets metrics options +func WithMetricsOptions(opts ...metrics.Option) Option { return func(o *xconnOptions) { - o.statsOpts = opts + o.metricsOpts = opts } } diff --git a/internal/xconnectns/server.go b/internal/xconnectns/server.go index f707711a..2a3de57f 100644 --- a/internal/xconnectns/server.go +++ b/internal/xconnectns/server.go @@ -1,6 +1,6 @@ // Copyright (c) 2021-2022 Doc.ai and/or its affiliates. // -// Copyright (c) 2022 Cisco and/or its affiliates. +// Copyright (c) 2022-2024 Cisco and/or its affiliates. // // SPDX-License-Identifier: Apache-2.0 // @@ -82,7 +82,7 @@ func NewServer( vppforwarder.WithVlanDomain2Device(xconnOpts.domain2Device), vppforwarder.WithMechanismPriority(xconnOpts.mechanismPrioriyList), vppforwarder.WithCleanupOptions(xconnOpts.cleanupOpts...), - vppforwarder.WithStatsOptions(xconnOpts.statsOpts...), + vppforwarder.WithStatsOptions(xconnOpts.metricsOpts...), vppforwarder.WithVxlanOptions(xconnOpts.vxlanOpts...), vppforwarder.WithDialOptions(xconnOpts.dialOpts...)) if sriovConfig == nil { diff --git a/main.go b/main.go index e2b1fe28..dcea1705 100644 --- a/main.go +++ b/main.go @@ -1,4 +1,4 @@ -// Copyright (c) 2020-2023 Cisco and/or its affiliates. +// Copyright (c) 2020-2024 Cisco and/or its affiliates. // // SPDX-License-Identifier: Apache-2.0 // @@ -64,7 +64,7 @@ import ( "github.com/networkservicemesh/sdk/pkg/tools/tracing" "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/mechanisms/vxlan" - "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/stats" + "github.com/networkservicemesh/sdk-vpp/pkg/networkservice/metrics" "github.com/networkservicemesh/cmd-forwarder-vpp/internal/config" "github.com/networkservicemesh/cmd-forwarder-vpp/internal/devicecfg" @@ -156,7 +156,7 @@ func main() { var vppConn vpphelper.Connection var vppErrCh <-chan error - var statsOpts []stats.Option + var metricsOpts []metrics.Option cleanupDoneCh := make(chan struct{}) cleanupOpts := []cleanup.Option{ cleanup.WithoutGRPCCall(), @@ -168,7 +168,7 @@ func main() { close(errCh) vppErrCh = errCh dir, _ := path.Split(cfg.VppAPISocket) - statsOpts = append(statsOpts, stats.WithSocket(path.Join(dir, "stats.sock"))) + metricsOpts = append(metricsOpts, metrics.WithSocket(path.Join(dir, "stats.sock"))) cleanupOpts = append(cleanupOpts, cleanup.WithDoneChan(cleanupDoneCh)) log.FromContext(ctx).Info("external vpp is being used") @@ -255,7 +255,7 @@ func main() { xconnectns.WithMechanismPriority(cfg.MechanismPriority), xconnectns.WithClientURL(&cfg.ConnectTo), xconnectns.WithDialTimeout(cfg.DialTimeout), - xconnectns.WithStatsOptions(statsOpts...), + xconnectns.WithMetricsOptions(metricsOpts...), xconnectns.WithCleanupOptions(cleanupOpts...), xconnectns.WithVxlanOptions(vxlan.WithPort(cfg.VxlanPort)), xconnectns.WithDialOptions(dialOptions...),