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

Update vpphelper manually #537

Merged
Merged
Show file tree
Hide file tree
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
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,23 @@ docker build .

## Environment config

* `NSM_NAME` - Name of vlan vpp responder (default: "vlan-vpp-responder")
* `NSM_BASE_DIR` - base directory (default: "./")
* `NSM_CONNECT_TO` - url to connect to (default: "unix:///var/lib/networkservicemesh/nsm.io.sock")
* `NSM_MAX_TOKEN_LIFETIME` - maximum lifetime of tokens (default: "10m")
* `NSM_REGISTRY_CLIENT_POLICIES` - paths to files and directories that contain registry client policies (default: "etc/nsm/opa/common/.*.rego,etc/nsm/opa/registry/.*.rego,etc/nsm/opa/client/.*.rego")
* `NSM_SERVICE_NAMES` - Name of provided services (default: "vlan-vpp-responder")
* `NSM_PAYLOAD` - Name of provided service payload (default: "ETHERNET")
* `NSM_LABELS` - Endpoint labels
* `NSM_DNS_CONFIGS` - DNSConfigs represents array of DNSConfig in json format. See at model definition: https://github.com/networkservicemesh/api/blob/main/pkg/api/networkservice/connectioncontext.pb.go#L426-L435 (default: "[]")
* `NSM_CIDR_PREFIX` - CIDR Prefix to assign IPs from (default: "169.254.0.0/16")
* `NSM_IDLE_TIMEOUT` - timeout for automatic shutdown when there were no requests for specified time. Set 0 to disable auto-shutdown. (default: "0")
* `NSM_REGISTER_SERVICE` - if true then registers network service on startup (default: "true")
* `NSM_OPEN_TELEMETRY_ENDPOINT` - OpenTelemetry Collector Endpoint (default: "otel-collector.observability.svc.cluster.local:4317")
* `NSM_METRICS_EXPORT_INTERVAL` - interval between mertics exports (default: "10s")
* `NSM_PPROF_ENABLED` - is pprof enabled (default: "false")
* `NSM_PPROF_LISTEN_ON` - pprof URL to ListenAndServe (default: "localhost:6060")
* `NSM_NAME` - Name of vlan vpp responder (default: "vlan-vpp-responder")
* `NSM_BASE_DIR` - base directory (default: "./")
* `NSM_CONNECT_TO` - url to connect to (default: "unix:///var/lib/networkservicemesh/nsm.io.sock")
* `NSM_MAX_TOKEN_LIFETIME` - maximum lifetime of tokens (default: "10m")
* `NSM_REGISTRY_CLIENT_POLICIES` - paths to files and directories that contain registry client policies (default: "etc/nsm/opa/common/.*.rego,etc/nsm/opa/registry/.*.rego,etc/nsm/opa/client/.*.rego")
* `NSM_SERVICE_NAMES` - Name of provided services (default: "vlan-vpp-responder")
* `NSM_PAYLOAD` - Name of provided service payload (default: "ETHERNET")
* `NSM_LABELS` - Endpoint labels
* `NSM_DNS_CONFIGS` - DNSConfigs represents array of DNSConfig in json format. See at model definition: https://github.com/networkservicemesh/api/blob/main/pkg/api/networkservice/connectioncontext.pb.go#L426-L435 (default: "[]")
* `NSM_CIDR_PREFIX` - CIDR Prefix to assign IPs from (default: "169.254.0.0/16")
* `NSM_IDLE_TIMEOUT` - timeout for automatic shutdown when there were no requests for specified time. Set 0 to disable auto-shutdown. (default: "0")
* `NSM_REGISTER_SERVICE` - if true then registers network service on startup (default: "true")
* `NSM_OPEN_TELEMETRY_ENDPOINT` - OpenTelemetry Collector Endpoint (default: "otel-collector.observability.svc.cluster.local:4317")
* `NSM_METRICS_EXPORT_INTERVAL` - interval between mertics exports (default: "10s")
* `NSM_PPROF_ENABLED` - is pprof enabled (default: "false")
* `NSM_PPROF_LISTEN_ON` - pprof URL to ListenAndServe (default: "localhost:6060")
* `NSM_VPP_MIN_OPERATION_TIMEOUT` - minimum timeout for every vpp operation

# Testing

Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ require (
github.com/kelseyhightower/envconfig v1.4.0
github.com/networkservicemesh/api v1.14.2-rc.1.0.20241209080353-bbb4cd5f8f00
github.com/networkservicemesh/govpp v0.0.0-20240328101142-8a444680fbba
github.com/networkservicemesh/sdk v0.5.1-0.20241227223757-422abe9bfbdd
github.com/networkservicemesh/sdk-sriov v0.0.0-20241227143415-9231b416bfd2
github.com/networkservicemesh/sdk-vpp v0.0.0-20241227224413-166396795a3c
github.com/networkservicemesh/vpphelper v0.0.0-20240115135903-e2b961f768b6
github.com/networkservicemesh/sdk v0.5.1-0.20241224095213-4a9b9a01615e
github.com/networkservicemesh/sdk-sriov v0.0.0-20241224095714-322cd1aa00fb
github.com/networkservicemesh/sdk-vpp v0.0.0-20241227074031-0653e4b625ea
github.com/networkservicemesh/vpphelper v0.0.0-20241209033247-bcb5c25a9f29
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
github.com/spiffe/go-spiffe/v2 v2.1.7
github.com/vishvananda/netlink v1.3.1-0.20240922070040-084abd93d350
go.fd.io/govpp v0.10.0-alpha.0.20240110141843-761adec77524
google.golang.org/grpc v1.60.1
)

Expand Down Expand Up @@ -60,7 +61,6 @@ require (
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/yashtewari/glob-intersection v0.1.0 // indirect
github.com/zeebo/errs v1.3.0 // indirect
go.fd.io/govpp v0.10.0-alpha.0.20240110141843-761adec77524 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect
go.opentelemetry.io/otel v1.20.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.43.0 // indirect
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ github.com/networkservicemesh/api v1.14.2-rc.1.0.20241209080353-bbb4cd5f8f00 h1:
github.com/networkservicemesh/api v1.14.2-rc.1.0.20241209080353-bbb4cd5f8f00/go.mod h1:GT0Yw1LYFSTxlDyJjBDhIxT82rJ2czZ0TiyzxSyKzvg=
github.com/networkservicemesh/govpp v0.0.0-20240328101142-8a444680fbba h1:7B6X6N7rwJNpnfsUlBavxuZdYqTx8nAKwxVS/AkuX1o=
github.com/networkservicemesh/govpp v0.0.0-20240328101142-8a444680fbba/go.mod h1:CwikXQ3p/y3j6+HbQQWXKv0f4LPyUd2vKTiViG93qWA=
github.com/networkservicemesh/sdk v0.5.1-0.20241227223757-422abe9bfbdd h1:p7yvEC3kZInerbyyRTjLC51uw40Kxbb3rMw+2JsoiU0=
github.com/networkservicemesh/sdk v0.5.1-0.20241227223757-422abe9bfbdd/go.mod h1:4UxNmG1wYL5v93pZHIgIn0jTsvzn4x0QioQ/v48zuD8=
github.com/networkservicemesh/sdk-sriov v0.0.0-20241227143415-9231b416bfd2 h1:DbkuALmWeZCn9JOeXq8idyoSyxGnJTascFUbiUgd9LQ=
github.com/networkservicemesh/sdk-sriov v0.0.0-20241227143415-9231b416bfd2/go.mod h1:gqRPwBXANrBt1PPuyBrn1nZKhrj5CCfqNdMMu/aN9ZA=
github.com/networkservicemesh/sdk-vpp v0.0.0-20241227224413-166396795a3c h1:sLos0zvQuAqbTjvIM0ZIJ+w0XE/RCDgrWfEz5N8zmPA=
github.com/networkservicemesh/sdk-vpp v0.0.0-20241227224413-166396795a3c/go.mod h1:UeWHbi3ozPYRxoA2nlZNWsSDnsMCr4PM5abgtJO93iM=
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/networkservicemesh/sdk v0.5.1-0.20241224095213-4a9b9a01615e h1:8ac6fDmgF332gAdvjOr1hGVSliihrP60IR6wrxb3Ftw=
github.com/networkservicemesh/sdk v0.5.1-0.20241224095213-4a9b9a01615e/go.mod h1:4UxNmG1wYL5v93pZHIgIn0jTsvzn4x0QioQ/v48zuD8=
github.com/networkservicemesh/sdk-sriov v0.0.0-20241224095714-322cd1aa00fb h1:ibisZZUh+0NbjV964acDV8WXk8XTm157dulRRKaEnIg=
github.com/networkservicemesh/sdk-sriov v0.0.0-20241224095714-322cd1aa00fb/go.mod h1:/SttuO6p7mrk9pE3+LwDKuUi+EOva46cp56g4O4eSeQ=
github.com/networkservicemesh/sdk-vpp v0.0.0-20241227074031-0653e4b625ea h1:at9ARZ0IpLCbk8MBYVuD558zv20vVgIbh/A3ntUjlCA=
github.com/networkservicemesh/sdk-vpp v0.0.0-20241227074031-0653e4b625ea/go.mod h1:Ow3qWLIXeJlFOeq+U8B7ATnN1yDVCdQWX13XjLfSaME=
github.com/networkservicemesh/vpphelper v0.0.0-20241209033247-bcb5c25a9f29 h1:hqYoTeQ9mFOIoKUMBXg779SU2yJWrrapucKgoPNZ1co=
github.com/networkservicemesh/vpphelper v0.0.0-20241209033247-bcb5c25a9f29/go.mod h1:Qc5x5poZk5cVzcHk4ZIL6+NMC95uoitsmmnl7X9V/Yw=
github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8=
github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ=
github.com/open-policy-agent/opa v0.44.0 h1:sEZthsrWBqIN+ShTMJ0Hcz6a3GkYsY4FaB2S/ou2hZk=
Expand Down
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ import (
"github.com/spiffe/go-spiffe/v2/spiffetls/tlsconfig"
"github.com/spiffe/go-spiffe/v2/svid/x509svid"
"github.com/spiffe/go-spiffe/v2/workloadapi"
"go.fd.io/govpp/api"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"

"github.com/networkservicemesh/vpphelper"
"github.com/networkservicemesh/vpphelper/extendtimeout"

"github.com/networkservicemesh/api/pkg/api/networkservice"
kernelmech "github.com/networkservicemesh/api/pkg/api/networkservice/mechanisms/kernel"
Expand Down Expand Up @@ -107,6 +109,7 @@ type Config struct {
MetricsExportInterval time.Duration `default:"10s" desc:"interval between mertics exports" split_words:"true"`
PprofEnabled bool `default:"false" desc:"is pprof enabled" split_words:"true"`
PprofListenOn string `default:"localhost:6060" desc:"pprof URL to ListenAndServe" split_words:"true"`
VPPMinOperationTimeout time.Duration `default:"2s" desc:"minimum timeout for every vpp operation" split_words:"true"`
}

// Process prints and processes env to config
Expand Down Expand Up @@ -134,7 +137,7 @@ func logPhases(ctx context.Context) {
log.FromContext(ctx).Infof("a final success message with start time duration")
}

func createNSEndpoint(ctx context.Context, source x509svid.Source, config *Config, vppConn vpphelper.Connection, ipnet *net.IPNet, cancel context.CancelFunc) (endpoint.Endpoint, ifconfig.Server) {
func createNSEndpoint(ctx context.Context, source x509svid.Source, config *Config, vppConn api.Connection, ipnet *net.IPNet, cancel context.CancelFunc) (endpoint.Endpoint, ifconfig.Server) {
sriovTokenVlanServer := getSriovTokenVlanServerChainElement(getTokenKey(ctx, tokens.FromEnv(os.Environ())))
parentIfName := getParentIfname(config.Name)
ifConfigServer := ifconfig.NewServer(ctx, parentIfName, vppConn)
Expand Down Expand Up @@ -315,6 +318,7 @@ func main() {
// ********************************************************************************
vppConn, vppErrCh := vpphelper.StartAndDialContext(ctx)
exitOnErr(ctx, cancel, vppErrCh)
vppConn = extendtimeout.NewConnection(vppConn, config.VPPMinOperationTimeout)

// ********************************************************************************
log.FromContext(ctx).Infof("executing phase 3: retrieving svid, check spire agent logs if this is the last line you see")
Expand Down
9 changes: 4 additions & 5 deletions pkg/networkservice/ifconfig/server.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) 2021-2022 Nordix Foundation.
//
// Copyright (c) 2023 Cisco Foundation.
// Copyright (c) 2023-2024 Cisco Foundation.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -30,8 +30,7 @@ import (
"github.com/golang/protobuf/ptypes/empty"
"github.com/pkg/errors"
"github.com/vishvananda/netlink"

"github.com/networkservicemesh/vpphelper"
"go.fd.io/govpp/api"

"github.com/networkservicemesh/govpp/binapi/af_packet"
"github.com/networkservicemesh/govpp/binapi/fib_types"
Expand Down Expand Up @@ -65,7 +64,7 @@ type ifConfigServer struct {
stop chan interface{}
parentIfName string
swIfIndexesMap map[string]interface_types.InterfaceIndex
vppConn vpphelper.Connection
vppConn api.Connection
clientsRefCount int
connections map[string]interface{}
mutex sync.Mutex
Expand All @@ -78,7 +77,7 @@ type Server interface {
}

// NewServer creates new ifconfig server instance
func NewServer(ctx context.Context, parentIfName string, vppConn vpphelper.Connection) Server {
func NewServer(ctx context.Context, parentIfName string, vppConn api.Connection) Server {
ifServer := &ifConfigServer{ifCtx: ctx, parentIfName: parentIfName, ifOps: make(chan ifOp, bufSize),
swIfIndexesMap: make(map[string]interface_types.InterfaceIndex), stop: make(chan interface{}),
vppConn: vppConn, connections: make(map[string]interface{})}
Expand Down
Loading