Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

Migrate examples to Go 1.14, VPP v3 and latest NSM #85

Merged
merged 8 commits into from
Mar 8, 2020
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
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ jobs:
parallelism: 2
steps:
- run:
name: Update go to 1.13
name: Update go to 1.14
working_directory: /tmp
command: |
wget https://dl.google.com/go/go1.13.linux-amd64.tar.gz
wget https://dl.google.com/go/go1.14.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.13.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.14.linux-amd64.tar.gz
- run:
name: Install kubectl
command: |
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ NSM_PATH?=${TOP}/../networkservicemesh
CLUSTER_RULES_PREFIX?=kind
PREFIX?=k8s
CONTAINER_BUILD_PREFIX?=docker
VPP_AGENT?=artembelov/vpp-agent:v2.5.1
VPP_AGENT?=ligato/vpp-agent:v3.0.1

include examples/examples.mk

Expand Down
5 changes: 4 additions & 1 deletion examples/bridge-domain/bridge/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ RUN CGO_ENABLED=0 GOOS=linux go build -ldflags '-extldflags "-static"' -o /go/bi

FROM ${VPP_AGENT} as runtime
COPY --from=build /go/bin/bridge-domain /bin/bridge-domain
RUN rm /opt/vpp-agent/dev/etcd.conf; echo 'Endpoint: "0.0.0.0:9113"' > /opt/vpp-agent/dev/grpc.conf; echo "disabled: true" > /opt/vpp-agent/dev/linux-plugin.conf; echo "disabled: true" > /opt/vpp-agent/dev/telemetry.conf
COPY ./examples/bridge-domain/bridge/etc/ /etc/
COPY ./examples/bridge-domain/bridge/etc/supervisord/supervisord.conf /opt/vpp-agent/dev/supervisor.conf
RUN rm /opt/vpp-agent/dev/etcd.conf; \
echo 'Endpoint: "localhost:9113"' > /opt/vpp-agent/dev/grpc.conf ; \
echo "disabled: true" > /opt/vpp-agent/dev/telemetry.conf; \
echo "disabled: true" > /opt/vpp-agent/dev/linux-plugin.conf
6 changes: 3 additions & 3 deletions examples/bridge-domain/bridge/cmd/composite.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import (
"github.com/networkservicemesh/networkservicemesh/sdk/endpoint"

"github.com/golang/protobuf/ptypes/empty"
"github.com/ligato/vpp-agent/api/configurator"
"github.com/ligato/vpp-agent/api/models/vpp"
l2 "github.com/ligato/vpp-agent/api/models/vpp/l2"
"github.com/networkservicemesh/networkservicemesh/controlplane/api/connection"
"github.com/networkservicemesh/networkservicemesh/controlplane/api/networkservice"
"github.com/networkservicemesh/networkservicemesh/sdk/common"
"github.com/sirupsen/logrus"
"go.ligato.io/vpp-agent/v3/proto/ligato/configurator"
"go.ligato.io/vpp-agent/v3/proto/ligato/vpp"
l2 "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/l2"
)

type vppAgentBridgeComposite struct {
Expand Down
8 changes: 4 additions & 4 deletions examples/bridge-domain/bridge/cmd/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import (
"os"
"path"

"github.com/ligato/vpp-agent/api/configurator"
vpp "github.com/ligato/vpp-agent/api/models/vpp"
interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces"
l2 "github.com/ligato/vpp-agent/api/models/vpp/l2"
"github.com/networkservicemesh/networkservicemesh/controlplane/api/connection/mechanisms/memif"
"go.ligato.io/vpp-agent/v3/proto/ligato/configurator"
vpp "go.ligato.io/vpp-agent/v3/proto/ligato/vpp"
interfaces "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/interfaces"
l2 "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/l2"

"github.com/networkservicemesh/networkservicemesh/controlplane/api/connection"
"github.com/sirupsen/logrus"
Expand Down
6 changes: 3 additions & 3 deletions examples/bridge-domain/bridge/cmd/vppagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"context"
"time"

"github.com/ligato/vpp-agent/api/configurator"
"go.ligato.io/vpp-agent/v3/proto/ligato/configurator"

"github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc"
"github.com/networkservicemesh/networkservicemesh/pkg/tools"
Expand Down Expand Up @@ -50,7 +50,7 @@ func resetVppAgent() error {

defer func() { _ = conn.Close() }()

client := configurator.NewConfiguratorClient(conn)
client := configurator.NewConfiguratorServiceClient(conn)

logrus.Infof("Resetting vppagent..., with: %v", &configurator.Config{})

Expand Down Expand Up @@ -92,7 +92,7 @@ func sendDataChangeToVppAgent(dataChange *configurator.Config) error {

defer func() { _ = conn.Close() }()

client := configurator.NewConfiguratorClient(conn)
client := configurator.NewConfiguratorServiceClient(conn)

logrus.Infof("Sending DataChange to vppagent: %v", dataChange)

Expand Down
38 changes: 38 additions & 0 deletions examples/bridge-domain/bridge/etc/govpp/govpp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Enable or disable feature to measure binary API call duration. Measured time is shown directly in log (info level).
# Measurement is taken also for certain procedures, like resync of plugin startup. Turned off by default.
trace-enabled: false

# Path to a Unix-domain socket through which configuration requests are sent to VPP.
# Used if connect-via-shm is set to false and env. variable GOVPPMUX_NOSOCK is not defined.
# Default is "/run/vpp-api.sock".
binapi-socket-path: /run/vpp-api.sock

# If enabled, govpp will access VPP for configuration requests via the shared memory
# instead of through the socket.
connect-via-shm: false

# Custom shared memory prefix for VPP. Not used by default.
# Relevant only when govpp uses shared memory to send configuration requests to VPP
# (connect-via-shm is enabled or env. variable GOVPPMUX_NOSOCK is defined)
# shm-prefix: <prefix>

# Socket path for reading VPP status, default is "/run/vpp/stats.sock"
stats-socket-path: /run/vpp/stats.sock

# If VPP lost connection, this flag allows to automatically run the whole resync procedure
# for all registered plugins after reconnection.
resync-after-reconnect: false

# Binary API requests failed because of the temporary VPP disconnect can be re-tried. Field defines number of
# retry attempts. Default is zero, meaning the feature is disabled.
retry-request-count: 0

# Defines timeout between binary API retry attempts in case some of them fails. Default value is 500ms.
# If retry-request-count is set to zero, the field has no effect.
retry-request-timeout: 500000000

# Defines max number of attempts GoVPPMux tries to reach the VPP (default is 3 attempts).
retry-connect-count: 30

# Defines time in nanoseconds between VPP connection retries (default is 1 second).
retry-connect-timeout: 1000000000
7 changes: 5 additions & 2 deletions examples/load-balancer/image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ RUN CGO_ENABLED=0 GOOS=linux go build -ldflags '-extldflags "-static"' -o /go/bi

FROM ${VPP_AGENT} as runtime
COPY --from=build /go/bin/bridge-domain /bin/bridge-domain
RUN rm /opt/vpp-agent/dev/etcd.conf; echo 'Endpoint: "0.0.0.0:9113"' > /opt/vpp-agent/dev/grpc.conf; echo "disabled: true" > /opt/vpp-agent/dev/linux-plugin.conf; echo "disabled: true" > /opt/vpp-agent/dev/telemetry.conf
COPY ./examples/load-balancer/image/bin/ /bin/
COPY ./examples/load-balancer/image/etc/ /etc/
COPY ./examples/load-balancer/image/etc/supervisord/supervisord.conf /opt/vpp-agent/dev/supervisor.conf
COPY ./examples/load-balancer/image/bin/ /bin/
RUN rm /opt/vpp-agent/dev/etcd.conf; \
echo 'Endpoint: "localhost:9113"' > /opt/vpp-agent/dev/grpc.conf ; \
echo "disabled: true" > /opt/vpp-agent/dev/telemetry.conf; \
echo "disabled: true" > /opt/vpp-agent/dev/linux-plugin.conf
6 changes: 3 additions & 3 deletions examples/load-balancer/image/cmd/composite.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import (
"github.com/networkservicemesh/networkservicemesh/sdk/endpoint"

"github.com/golang/protobuf/ptypes/empty"
"github.com/ligato/vpp-agent/api/configurator"
"github.com/ligato/vpp-agent/api/models/vpp"
l2 "github.com/ligato/vpp-agent/api/models/vpp/l2"
"github.com/networkservicemesh/networkservicemesh/controlplane/api/connection"
"github.com/networkservicemesh/networkservicemesh/controlplane/api/networkservice"
"github.com/networkservicemesh/networkservicemesh/sdk/common"
"github.com/sirupsen/logrus"
"go.ligato.io/vpp-agent/v3/proto/ligato/configurator"
"go.ligato.io/vpp-agent/v3/proto/ligato/vpp"
l2 "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/l2"
)

const defaultMacAge = 120
Expand Down
8 changes: 4 additions & 4 deletions examples/load-balancer/image/cmd/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import (
"os"
"path"

"github.com/ligato/vpp-agent/api/configurator"
vpp "github.com/ligato/vpp-agent/api/models/vpp"
interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces"
l2 "github.com/ligato/vpp-agent/api/models/vpp/l2"
"github.com/networkservicemesh/networkservicemesh/controlplane/api/connection/mechanisms/memif"
"go.ligato.io/vpp-agent/v3/proto/ligato/configurator"
vpp "go.ligato.io/vpp-agent/v3/proto/ligato/vpp"
interfaces "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/interfaces"
l2 "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/l2"

"github.com/networkservicemesh/networkservicemesh/controlplane/api/connection"
"github.com/sirupsen/logrus"
Expand Down
6 changes: 3 additions & 3 deletions examples/load-balancer/image/cmd/vppagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"context"
"time"

"github.com/ligato/vpp-agent/api/configurator"
"go.ligato.io/vpp-agent/v3/proto/ligato/configurator"

"github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc"
"github.com/networkservicemesh/networkservicemesh/pkg/tools"
Expand Down Expand Up @@ -50,7 +50,7 @@ func resetVppAgent() error {

defer func() { _ = conn.Close() }()

client := configurator.NewConfiguratorClient(conn)
client := configurator.NewConfiguratorServiceClient(conn)

logrus.Infof("Resetting vppagent..., with: %v", &configurator.Config{})

Expand Down Expand Up @@ -92,7 +92,7 @@ func sendDataChangeToVppAgent(dataChange *configurator.Config) error {

defer func() { _ = conn.Close() }()

client := configurator.NewConfiguratorClient(conn)
client := configurator.NewConfiguratorServiceClient(conn)

logrus.Infof("Sending DataChange to vppagent: %v", dataChange)

Expand Down
38 changes: 38 additions & 0 deletions examples/load-balancer/image/etc/govpp/govpp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Enable or disable feature to measure binary API call duration. Measured time is shown directly in log (info level).
# Measurement is taken also for certain procedures, like resync of plugin startup. Turned off by default.
trace-enabled: false

# Path to a Unix-domain socket through which configuration requests are sent to VPP.
# Used if connect-via-shm is set to false and env. variable GOVPPMUX_NOSOCK is not defined.
# Default is "/run/vpp-api.sock".
binapi-socket-path: /run/vpp-api.sock

# If enabled, govpp will access VPP for configuration requests via the shared memory
# instead of through the socket.
connect-via-shm: false

# Custom shared memory prefix for VPP. Not used by default.
# Relevant only when govpp uses shared memory to send configuration requests to VPP
# (connect-via-shm is enabled or env. variable GOVPPMUX_NOSOCK is defined)
# shm-prefix: <prefix>

# Socket path for reading VPP status, default is "/run/vpp/stats.sock"
stats-socket-path: /run/vpp/stats.sock

# If VPP lost connection, this flag allows to automatically run the whole resync procedure
# for all registered plugins after reconnection.
resync-after-reconnect: false

# Binary API requests failed because of the temporary VPP disconnect can be re-tried. Field defines number of
# retry attempts. Default is zero, meaning the feature is disabled.
retry-request-count: 0

# Defines timeout between binary API retry attempts in case some of them fails. Default value is 500ms.
# If retry-request-count is set to zero, the field has no effect.
retry-request-timeout: 500000000

# Defines max number of attempts GoVPPMux tries to reach the VPP (default is 3 attempts).
retry-connect-count: 30

# Defines time in nanoseconds between VPP connection retries (default is 1 second).
retry-connect-timeout: 1000000000
5 changes: 4 additions & 1 deletion examples/universal-cnf/vppagent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ RUN CGO_ENABLED=0 GOOS=linux go build -ldflags '-extldflags "-static"' -o /go/bi

FROM ${VPP_AGENT} as runtime
COPY --from=build /go/bin/cnf-vppagent /bin/cnf-vppagent
RUN rm /opt/vpp-agent/dev/etcd.conf; echo 'Endpoint: "0.0.0.0:9113"' > /opt/vpp-agent/dev/grpc.conf; echo "disabled: true" > /opt/vpp-agent/dev/linux-plugin.conf; echo "disabled: true" > /opt/vpp-agent/dev/telemetry.conf
COPY ./examples/universal-cnf/vppagent/etc/ /etc/
COPY ./examples/universal-cnf/vppagent/etc/supervisord/supervisord.conf /opt/vpp-agent/dev/supervisor.conf
RUN rm /opt/vpp-agent/dev/etcd.conf; \
echo 'Endpoint: "localhost:9113"' > /opt/vpp-agent/dev/grpc.conf ; \
echo "disabled: true" > /opt/vpp-agent/dev/telemetry.conf; \
echo "disabled: true" > /opt/vpp-agent/dev/linux-plugin.conf
2 changes: 1 addition & 1 deletion examples/universal-cnf/vppagent/cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import (
"os/exec"

"github.com/davecgh/go-spew/spew"
"github.com/ligato/vpp-agent/api/models/vpp"
"github.com/networkservicemesh/networkservicemesh/controlplane/api/connection"
"github.com/networkservicemesh/networkservicemesh/controlplane/api/connection/mechanisms/memif"
"github.com/networkservicemesh/networkservicemesh/sdk/client"
"github.com/sirupsen/logrus"
"go.ligato.io/vpp-agent/v3/proto/ligato/vpp"
"gopkg.in/yaml.v2"
)

Expand Down
6 changes: 3 additions & 3 deletions examples/universal-cnf/vppagent/cmd/vppagent/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import (
"path"
"strconv"

vpp "github.com/ligato/vpp-agent/api/models/vpp"
interfaces "github.com/ligato/vpp-agent/api/models/vpp/interfaces"
vpp_l3 "github.com/ligato/vpp-agent/api/models/vpp/l3"
"github.com/networkservicemesh/networkservicemesh/controlplane/api/connection"
"github.com/networkservicemesh/networkservicemesh/controlplane/api/connection/mechanisms/memif"
"github.com/sirupsen/logrus"
vpp "go.ligato.io/vpp-agent/v3/proto/ligato/vpp"
interfaces "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/interfaces"
vpp_l3 "go.ligato.io/vpp-agent/v3/proto/ligato/vpp/l3"
)

// UniversalCNFVPPAgentBackend is the VPP CNF backend struct
Expand Down
8 changes: 4 additions & 4 deletions examples/universal-cnf/vppagent/cmd/vppagent/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import (
"time"

"github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc"
"github.com/ligato/vpp-agent/api/configurator"
vpp "github.com/ligato/vpp-agent/api/models/vpp"
"github.com/networkservicemesh/networkservicemesh/pkg/tools"
"github.com/opentracing/opentracing-go"
"github.com/sirupsen/logrus"
"go.ligato.io/vpp-agent/v3/proto/ligato/configurator"
vpp "go.ligato.io/vpp-agent/v3/proto/ligato/vpp"
"google.golang.org/grpc"
)

Expand All @@ -51,7 +51,7 @@ func ResetVppAgent() error {

defer func() { _ = conn.Close() }()

client := configurator.NewConfiguratorClient(conn)
client := configurator.NewConfiguratorServiceClient(conn)

logrus.Infof("Resetting vppagent...")

Expand Down Expand Up @@ -95,7 +95,7 @@ func SendVppConfigToVppAgent(vppconfig *vpp.ConfigData, update bool) error {

defer func() { _ = conn.Close() }()

client := configurator.NewConfiguratorClient(conn)
client := configurator.NewConfiguratorServiceClient(conn)

logrus.Infof("Sending DataChange to vppagent: %v", dataChange)

Expand Down
38 changes: 38 additions & 0 deletions examples/universal-cnf/vppagent/etc/govpp/govpp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Enable or disable feature to measure binary API call duration. Measured time is shown directly in log (info level).
# Measurement is taken also for certain procedures, like resync of plugin startup. Turned off by default.
trace-enabled: false

# Path to a Unix-domain socket through which configuration requests are sent to VPP.
# Used if connect-via-shm is set to false and env. variable GOVPPMUX_NOSOCK is not defined.
# Default is "/run/vpp-api.sock".
binapi-socket-path: /run/vpp-api.sock

# If enabled, govpp will access VPP for configuration requests via the shared memory
# instead of through the socket.
connect-via-shm: false

# Custom shared memory prefix for VPP. Not used by default.
# Relevant only when govpp uses shared memory to send configuration requests to VPP
# (connect-via-shm is enabled or env. variable GOVPPMUX_NOSOCK is defined)
# shm-prefix: <prefix>

# Socket path for reading VPP status, default is "/run/vpp/stats.sock"
stats-socket-path: /run/vpp/stats.sock

# If VPP lost connection, this flag allows to automatically run the whole resync procedure
# for all registered plugins after reconnection.
resync-after-reconnect: false

# Binary API requests failed because of the temporary VPP disconnect can be re-tried. Field defines number of
# retry attempts. Default is zero, meaning the feature is disabled.
retry-request-count: 0

# Defines timeout between binary API retry attempts in case some of them fails. Default value is 500ms.
# If retry-request-count is set to zero, the field has no effect.
retry-request-timeout: 500000000

# Defines max number of attempts GoVPPMux tries to reach the VPP (default is 3 attempts).
retry-connect-count: 30

# Defines time in nanoseconds between VPP connection retries (default is 1 second).
retry-connect-timeout: 1000000000
5 changes: 4 additions & 1 deletion examples/vpp-icmp/vppagent-client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ RUN CGO_ENABLED=0 GOOS=linux go build -ldflags '-extldflags "-static"' -o /go/bi

FROM ${VPP_AGENT} as runtime
COPY --from=build /go/bin/vppagent-client /bin/vppagent-client
RUN rm /opt/vpp-agent/dev/etcd.conf; echo 'Endpoint: "0.0.0.0:9113"' > /opt/vpp-agent/dev/grpc.conf; echo "disabled: true" > /opt/vpp-agent/dev/linux-plugin.conf; echo "disabled: true" > /opt/vpp-agent/dev/telemetry.conf
COPY ./examples/vpp-icmp/vppagent-client/etc/ /etc/
COPY ./examples/vpp-icmp/vppagent-client/etc/supervisord/supervisord.conf /opt/vpp-agent/dev/supervisor.conf
RUN rm /opt/vpp-agent/dev/etcd.conf; \
echo 'Endpoint: "localhost:9113"' > /opt/vpp-agent/dev/grpc.conf ; \
echo "disabled: true" > /opt/vpp-agent/dev/telemetry.conf; \
echo "disabled: true" > /opt/vpp-agent/dev/linux-plugin.conf
Loading