From 2f75863ba9bff2d2f3488b70e441b5eefc91dfd2 Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Tue, 5 Nov 2019 00:16:25 +0100 Subject: Begin development of next release 0.3.0 - update info in package ./version - update to Go 1.13 - regenerate ./examples/binapi for latest VPP: 19.08.1-release - clean code in proxy - refactor Makefile Change-Id: Ibf5c2682c2f4b3cbbea4aa1e35d3f02175d40a9b Signed-off-by: Ondrej Fabry --- .gitignore | 5 +- .travis.yml | 6 +- CHANGELOG.md | 6 +- Makefile | 130 +++++++++++++++------------- doc.go | 14 +++ examples/binapi/interfaces/interfaces.ba.go | 27 +++--- examples/binapi/ip/ip.ba.go | 63 ++++++++------ examples/binapi/vpe/vpe.ba.go | 40 ++++----- go.sum | 2 - proxy/client.go | 2 +- proxy/log.go | 5 +- proxy/proxy.go | 3 +- proxy/server.go | 4 +- version/version.go | 2 +- 14 files changed, 174 insertions(+), 135 deletions(-) diff --git a/.gitignore b/.gitignore index 99fb65e..81b7a5c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,8 +5,11 @@ .idea/ -# cmds +/bin/ + +# cmd cmd/binapi-generator/binapi-generator +cmd/vpp-proxy/vpp-proxy # examples examples/perf-bench/perf-bench diff --git a/.travis.yml b/.travis.yml index ecb8211..872eb54 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ services: docker language: go go: - - "1.12.x" + - "1.13.x" go_import_path: git.fd.io/govpp.git @@ -14,12 +14,12 @@ env: before_script: - export VPP_IMG="ligato/vpp-base:latest" - docker pull $VPP_IMG - - GO111MODULE=on go mod download + - go mod download script: + - make lint || true - make test - make build - - make examples - make gen-binapi-docker notifications: diff --git a/CHANGELOG.md b/CHANGELOG.md index 95d80e3..8c1c2ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ This file lists changes for the GoVPP releases. +## 0.3.0 +> _in development_ + +// TO BE ADDED + ## 0.2.0 > _04 November 2019_ @@ -18,7 +23,6 @@ This file lists changes for the GoVPP releases. - migrate to Go modules - print info for users when sockets are missing - ## 0.1.0 > _03 July 2019_ diff --git a/Makefile b/Makefile index 5354609..1c4f97b 100644 --- a/Makefile +++ b/Makefile @@ -1,74 +1,94 @@ -SHELL = /bin/bash - -GO ?= GO111MODULE=on go -GOVPP_PKG := $(shell go list) +SHELL := /usr/bin/env bash -o pipefail VERSION ?= $(shell git describe --always --tags --dirty) COMMIT ?= $(shell git rev-parse HEAD) BUILD_STAMP ?= $(shell git log -1 --format="%ct") BUILD_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) + BUILD_HOST ?= $(shell hostname) BUILD_USER ?= $(shell id -un) -VPP_VERSION = $(shell dpkg-query -f '\${Version}' -W vpp) - -VPP_IMG ?= ligato/vpp-base:latest -BINAPI_DIR ?= ./examples/binapi +GO ?= go -LDFLAGS = -w -s \ +GOVPP_PKG := $(shell go list) +LDFLAGS = \ -X ${GOVPP_PKG}/version.version=$(VERSION) \ -X ${GOVPP_PKG}/version.commitHash=$(COMMIT) \ -X ${GOVPP_PKG}/version.buildStamp=$(BUILD_STAMP) \ -X ${GOVPP_PKG}/version.buildBranch=$(BUILD_BRANCH) \ -X ${GOVPP_PKG}/version.buildUser=$(BUILD_USER) \ -X ${GOVPP_PKG}/version.buildHost=$(BUILD_HOST) +ifeq ($(NOSTRIP),) +LDFLAGS += -w -s +endif + +GO_BUILD_TAGS ?= novpp GO_BUILD_ARGS = -ldflags "${LDFLAGS}" -ifeq ($(V),1) -GO_BUILD_ARGS += -v -endif ifneq ($(GO_BUILD_TAGS),) GO_BUILD_ARGS += -tags="${GO_BUILD_TAGS}" endif +ifneq ($(GO_NOTRIM),0) +GO_BUILD_ARGS += -trimpath +endif +ifeq ($(V),1) +GO_BUILD_ARGS += -v +endif + +VPP_VERSION = $(shell dpkg-query -f '\${Version}' -W vpp) + +VPP_IMG ?= ligato/vpp-base:latest +BINAPI_DIR ?= ./examples/binapi + +help: + @echo "List of make targets:" + grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +.DEFAULT = help + +bin: + mkdir -p bin + +build: ## Build all + @echo "# building ${VERSION}" + $(GO) build ${GO_BUILD_ARGS} ./... + +cmd: bin ## Build commands + $(GO) build ${GO_BUILD_ARGS} -o bin ./cmd/... + +examples: bin ## Build examples + $(GO) build ${GO_BUILD_ARGS} -o bin ./examples/... + +clean: ## Clean all + @echo "# cleaning" + $(GO) clean -v ./... + +test: ## Run unit tests + @echo "# running tests" + $(GO) test -tags="${GO_BUILD_TAGS}" ./... -all: test build examples +integration: ## Run integration tests + @echo "# running integration tests" + $(GO) test -tags="integration ${GO_BUILD_TAGS}" ./test/integration -install: - @echo "=> installing binapi-generator ${VERSION}" +lint: ## Run code linter + @echo "# running linter" + @golint ./... + +install-generator: ## Install binapi-generator + @echo "# installing binapi-generator ${VERSION}" $(GO) install ${GO_BUILD_ARGS} ./cmd/binapi-generator -build: - @echo "=> building binapi-generator ${VERSION}" - cd cmd/binapi-generator && $(GO) build ${GO_BUILD_ARGS} - -examples: - @echo "=> building examples" - cd examples/perf-bench && $(GO) build ${GO_BUILD_ARGS} -v - cd examples/rpc-service && $(GO) build ${GO_BUILD_ARGS} -v - cd examples/simple-client && $(GO) build ${GO_BUILD_ARGS} -v - cd examples/stats-client && $(GO) build ${GO_BUILD_ARGS} -v - cd examples/union-example && $(GO) build ${GO_BUILD_ARGS} -v - -clean: - @echo "=> cleaning" - go clean -v ./cmd/... - go clean -v ./examples/... - -test: - @echo "=> running tests" - $(GO) test ${GO_BUILD_ARGS} ./cmd/... - $(GO) test ${GO_BUILD_ARGS} ./ ./api ./adapter ./codec ./core - -test-integration: - @echo "=> running integration tests" - $(GO) test ${GO_BUILD_ARGS} ./test/integration - -lint: - @echo "=> running linter" - @golint ./... | grep -v vendor | grep -v /binapi/ || true - -gen-binapi-docker: install - @echo "=> generating binapi in docker image ${VPP_IMG}" +generate: ## Generate code + @echo "# generating code" + $(GO) generate -x ./... + +generate-binapi: install-generator + @echo "# generating binapi VPP $(VPP_VERSION)" + $(GO) generate -x "$(BINAPI_DIR)" + +gen-binapi-docker: install-generator + @echo "# generating binapi in docker image ${VPP_IMG}" $(eval cmds := $(shell go generate -n $(BINAPI_DIR) 2>&1 | tr "\n" ";")) docker run -t --rm \ -v "$(shell which gofmt):/usr/local/bin/gofmt:ro" \ @@ -78,19 +98,13 @@ gen-binapi-docker: install "${VPP_IMG}" \ sh -xc "cd $(BINAPI_DIR) && $(cmds)" -generate-binapi: install - @echo "=> generating binapi VPP $(VPP_VERSION)" - $(GO) generate -x "$(BINAPI_DIR)" - -generate: - @echo "=> generating code" - $(GO) generate -x ./... - extras: @make -C extras -.PHONY: all \ - install build examples clean test test-integration lint \ - generate generate-binapi gen-binapi-docker \ +.PHONY: help \ + build cmd examples clean \ + lint test integration \ + install-generator generate generate-binapi gen-binapi-docker \ extras + diff --git a/doc.go b/doc.go index 3344d5a..9718db6 100644 --- a/doc.go +++ b/doc.go @@ -1,3 +1,17 @@ +// Copyright (c) 2019 Cisco and/or its affiliates. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at: +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Package govpp provides the entry point to govpp functionality. It provides the API for connecting the govpp core // to VPP either using the default VPP adapter, or using the adapter previously set by SetAdapter function // (useful mostly just for unit/integration tests with mocked VPP adapter). diff --git a/examples/binapi/interfaces/interfaces.ba.go b/examples/binapi/interfaces/interfaces.ba.go index b0eb978..4e650ed 100644 --- a/examples/binapi/interfaces/interfaces.ba.go +++ b/examples/binapi/interfaces/interfaces.ba.go @@ -24,9 +24,9 @@ const ( // ModuleName is the name of this module. ModuleName = "interface" // APIVersion is the API version of this module. - APIVersion = "2.3.1" + APIVersion = "3.1.1" // VersionCrc is the CRC of this module. - VersionCrc = 0x6aab37be + VersionCrc = 0xbfceada9 ) // InterfaceIndex represents VPP binary API alias 'interface_index'. @@ -394,7 +394,6 @@ type SwInterfaceDetails struct { SupSwIfIndex uint32 L2AddressLength uint32 L2Address []byte `struc:"[8]byte"` - InterfaceName []byte `struc:"[64]byte"` AdminUpDown uint8 LinkUpDown uint8 LinkDuplex uint8 @@ -415,19 +414,20 @@ type SwInterfaceDetails struct { VtrPushDot1q uint32 VtrTag1 uint32 VtrTag2 uint32 - Tag []byte `struc:"[64]byte"` OuterTag uint16 BDmac []byte `struc:"[6]byte"` BSmac []byte `struc:"[6]byte"` BVlanid uint16 ISid uint32 + InterfaceName string `struc:"[64]byte"` + Tag string `struc:"[64]byte"` } func (*SwInterfaceDetails) GetMessageName() string { return "sw_interface_details" } func (*SwInterfaceDetails) GetCrcString() string { - return "e4ee7eb6" + return "52a9262e" } func (*SwInterfaceDetails) GetMessageType() api.MessageType { return api.ReplyMessage @@ -435,16 +435,17 @@ func (*SwInterfaceDetails) GetMessageType() api.MessageType { // SwInterfaceDump represents VPP binary API message 'sw_interface_dump'. type SwInterfaceDump struct { - SwIfIndex InterfaceIndex - NameFilterValid uint8 - NameFilter []byte `struc:"[49]byte"` + SwIfIndex InterfaceIndex + NameFilterValid bool + XXX_NameFilterLen uint32 `struc:"sizeof=NameFilter"` + NameFilter string } func (*SwInterfaceDump) GetMessageName() string { return "sw_interface_dump" } func (*SwInterfaceDump) GetCrcString() string { - return "052753c5" + return "aa610c27" } func (*SwInterfaceDump) GetMessageType() api.MessageType { return api.RequestMessage @@ -821,16 +822,16 @@ func (*SwInterfaceSetUnnumberedReply) GetMessageType() api.MessageType { // SwInterfaceTagAddDel represents VPP binary API message 'sw_interface_tag_add_del'. type SwInterfaceTagAddDel struct { - IsAdd uint8 - SwIfIndex uint32 - Tag []byte `struc:"[64]byte"` + IsAdd bool + SwIfIndex InterfaceIndex + Tag string `struc:"[64]byte"` } func (*SwInterfaceTagAddDel) GetMessageName() string { return "sw_interface_tag_add_del" } func (*SwInterfaceTagAddDel) GetCrcString() string { - return "14cc636c" + return "426f8bc1" } func (*SwInterfaceTagAddDel) GetMessageType() api.MessageType { return api.RequestMessage diff --git a/examples/binapi/ip/ip.ba.go b/examples/binapi/ip/ip.ba.go index 3bdb551..62e5741 100644 --- a/examples/binapi/ip/ip.ba.go +++ b/examples/binapi/ip/ip.ba.go @@ -6,7 +6,7 @@ Package ip is a generated VPP binary API for 'ip' module. It consists of: 9 enums - 3 aliases + 6 aliases 17 types 1 union 93 messages @@ -29,7 +29,7 @@ const ( // APIVersion is the API version of this module. APIVersion = "3.0.0" // VersionCrc is the CRC of this module. - VersionCrc = 0x902699f5 + VersionCrc = 0x251fc559 ) // AddressFamily represents VPP binary API enum 'address_family'. @@ -416,12 +416,21 @@ func (x MfibItfFlags) String() string { return strconv.Itoa(int(x)) } +// AddressWithPrefix represents VPP binary API alias 'address_with_prefix'. +type AddressWithPrefix Prefix + // IP4Address represents VPP binary API alias 'ip4_address'. type IP4Address [4]uint8 +// IP4AddressWithPrefix represents VPP binary API alias 'ip4_address_with_prefix'. +type IP4AddressWithPrefix IP4Prefix + // IP6Address represents VPP binary API alias 'ip6_address'. type IP6Address [16]uint8 +// IP6AddressWithPrefix represents VPP binary API alias 'ip6_address_with_prefix'. +type IP6AddressWithPrefix IP6Prefix + // MacAddress represents VPP binary API alias 'mac_address'. type MacAddress [6]uint8 @@ -745,7 +754,7 @@ func (*IP4ArpEvent) GetMessageName() string { return "ip4_arp_event" } func (*IP4ArpEvent) GetCrcString() string { - return "72cdde7c" + return "efad00cd" } func (*IP4ArpEvent) GetMessageType() api.MessageType { return api.EventMessage @@ -764,7 +773,7 @@ func (*IP6NdEvent) GetMessageName() string { return "ip6_nd_event" } func (*IP6NdEvent) GetCrcString() string { - return "3a23e7d4" + return "d676f6ca" } func (*IP6NdEvent) GetMessageType() api.MessageType { return api.EventMessage @@ -788,7 +797,7 @@ func (*IP6RaEvent) GetMessageName() string { return "ip6_ra_event" } func (*IP6RaEvent) GetCrcString() string { - return "34c9ddac" + return "170493ab" } func (*IP6RaEvent) GetMessageType() api.MessageType { return api.EventMessage @@ -805,7 +814,7 @@ func (*IP6ndProxyAddDel) GetMessageName() string { return "ip6nd_proxy_add_del" } func (*IP6ndProxyAddDel) GetCrcString() string { - return "bff10d55" + return "b431d174" } func (*IP6ndProxyAddDel) GetMessageType() api.MessageType { return api.RequestMessage @@ -836,7 +845,7 @@ func (*IP6ndProxyDetails) GetMessageName() string { return "ip6nd_proxy_details" } func (*IP6ndProxyDetails) GetCrcString() string { - return "bbbd7894" + return "46bfb684" } func (*IP6ndProxyDetails) GetMessageType() api.MessageType { return api.ReplyMessage @@ -893,14 +902,14 @@ func (*IP6ndSendRouterSolicitationReply) GetMessageType() api.MessageType { // IPAddressDetails represents VPP binary API message 'ip_address_details'. type IPAddressDetails struct { SwIfIndex uint32 - Prefix Prefix + Prefix AddressWithPrefix } func (*IPAddressDetails) GetMessageName() string { return "ip_address_details" } func (*IPAddressDetails) GetCrcString() string { - return "2f1dbc7d" + return "7002eee7" } func (*IPAddressDetails) GetMessageType() api.MessageType { return api.ReplyMessage @@ -933,7 +942,7 @@ func (*IPContainerProxyAddDel) GetMessageName() string { return "ip_container_proxy_add_del" } func (*IPContainerProxyAddDel) GetCrcString() string { - return "5ba831f3" + return "630352c5" } func (*IPContainerProxyAddDel) GetMessageType() api.MessageType { return api.RequestMessage @@ -964,7 +973,7 @@ func (*IPContainerProxyDetails) GetMessageName() string { return "ip_container_proxy_details" } func (*IPContainerProxyDetails) GetCrcString() string { - return "2f1dbc7d" + return "550a6c28" } func (*IPContainerProxyDetails) GetMessageType() api.MessageType { return api.ReplyMessage @@ -1025,7 +1034,7 @@ func (*IPMrouteAddDel) GetMessageName() string { return "ip_mroute_add_del" } func (*IPMrouteAddDel) GetCrcString() string { - return "997baab2" + return "edbca49e" } func (*IPMrouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage @@ -1056,7 +1065,7 @@ func (*IPMrouteDetails) GetMessageName() string { return "ip_mroute_details" } func (*IPMrouteDetails) GetCrcString() string { - return "39405e5a" + return "c1cb4b44" } func (*IPMrouteDetails) GetMessageType() api.MessageType { return api.ReplyMessage @@ -1115,7 +1124,7 @@ func (*IPNeighborAddDel) GetMessageName() string { return "ip_neighbor_add_del" } func (*IPNeighborAddDel) GetCrcString() string { - return "7a68a3c4" + return "029dad44" } func (*IPNeighborAddDel) GetMessageType() api.MessageType { return api.RequestMessage @@ -1146,7 +1155,7 @@ func (*IPNeighborDetails) GetMessageName() string { return "ip_neighbor_details" } func (*IPNeighborDetails) GetCrcString() string { - return "4a05f212" + return "c1a190ed" } func (*IPNeighborDetails) GetMessageType() api.MessageType { return api.ReplyMessage @@ -1178,7 +1187,7 @@ func (*IPProbeNeighbor) GetMessageName() string { return "ip_probe_neighbor" } func (*IPProbeNeighbor) GetCrcString() string { - return "2736142d" + return "37bc128d" } func (*IPProbeNeighbor) GetMessageType() api.MessageType { return api.RequestMessage @@ -1241,7 +1250,7 @@ func (*IPPuntRedirect) GetMessageName() string { return "ip_punt_redirect" } func (*IPPuntRedirect) GetCrcString() string { - return "70b793c6" + return "f9ea79a8" } func (*IPPuntRedirect) GetMessageType() api.MessageType { return api.RequestMessage @@ -1256,7 +1265,7 @@ func (*IPPuntRedirectDetails) GetMessageName() string { return "ip_punt_redirect_details" } func (*IPPuntRedirectDetails) GetCrcString() string { - return "07e504f8" + return "d6441360" } func (*IPPuntRedirectDetails) GetMessageType() api.MessageType { return api.ReplyMessage @@ -1405,7 +1414,7 @@ func (*IPRouteAddDel) GetMessageName() string { return "ip_route_add_del" } func (*IPRouteAddDel) GetCrcString() string { - return "83e086ce" + return "5ceee41c" } func (*IPRouteAddDel) GetMessageType() api.MessageType { return api.RequestMessage @@ -1436,7 +1445,7 @@ func (*IPRouteDetails) GetMessageName() string { return "ip_route_details" } func (*IPRouteDetails) GetCrcString() string { - return "acdee858" + return "d1ffaae1" } func (*IPRouteDetails) GetMessageType() api.MessageType { return api.ReplyMessage @@ -1506,7 +1515,7 @@ func (*IPSourceAndPortRangeCheckAddDel) GetMessageName() string { return "ip_source_and_port_range_check_add_del" } func (*IPSourceAndPortRangeCheckAddDel) GetCrcString() string { - return "b50ed159" + return "97e10a78" } func (*IPSourceAndPortRangeCheckAddDel) GetMessageType() api.MessageType { return api.RequestMessage @@ -1697,7 +1706,7 @@ func (*MfibSignalDetails) GetMessageName() string { return "mfib_signal_details" } func (*MfibSignalDetails) GetCrcString() string { - return "cd461bfa" + return "697ab6b4" } func (*MfibSignalDetails) GetMessageType() api.MessageType { return api.ReplyMessage @@ -1726,7 +1735,7 @@ func (*ProxyArpAddDel) GetMessageName() string { return "proxy_arp_add_del" } func (*ProxyArpAddDel) GetCrcString() string { - return "93a0e853" + return "320b4c54" } func (*ProxyArpAddDel) GetMessageType() api.MessageType { return api.RequestMessage @@ -1756,7 +1765,7 @@ func (*ProxyArpDetails) GetMessageName() string { return "proxy_arp_details" } func (*ProxyArpDetails) GetCrcString() string { - return "2515902a" + return "9228c150" } func (*ProxyArpDetails) GetMessageType() api.MessageType { return api.ReplyMessage @@ -2057,7 +2066,7 @@ func (*SwInterfaceIP6ndRaPrefix) GetMessageName() string { return "sw_interface_ip6nd_ra_prefix" } func (*SwInterfaceIP6ndRaPrefix) GetCrcString() string { - return "0f759f82" + return "6449c040" } func (*SwInterfaceIP6ndRaPrefix) GetMessageType() api.MessageType { return api.RequestMessage @@ -2089,7 +2098,7 @@ func (*WantIP4ArpEvents) GetMessageName() string { return "want_ip4_arp_events" } func (*WantIP4ArpEvents) GetCrcString() string { - return "70fd7195" + return "2678f421" } func (*WantIP4ArpEvents) GetMessageType() api.MessageType { return api.RequestMessage @@ -2121,7 +2130,7 @@ func (*WantIP6NdEvents) GetMessageName() string { return "want_ip6_nd_events" } func (*WantIP6NdEvents) GetCrcString() string { - return "ba330719" + return "08283da1" } func (*WantIP6NdEvents) GetMessageType() api.MessageType { return api.RequestMessage diff --git a/examples/binapi/vpe/vpe.ba.go b/examples/binapi/vpe/vpe.ba.go index 1d4e9db..129f868 100644 --- a/examples/binapi/vpe/vpe.ba.go +++ b/examples/binapi/vpe/vpe.ba.go @@ -26,9 +26,9 @@ const ( // ModuleName is the name of this module. ModuleName = "vpe" // APIVersion is the API version of this module. - APIVersion = "1.5.0" + APIVersion = "1.6.0" // VersionCrc is the CRC of this module. - VersionCrc = 0x2521f24d + VersionCrc = 0x1bf55581 ) // LogLevel represents VPP binary API enum 'log_level'. @@ -169,7 +169,7 @@ func (*CliInband) GetMessageName() string { return "cli_inband" } func (*CliInband) GetCrcString() string { - return "b1ad59b3" + return "f8377302" } func (*CliInband) GetMessageType() api.MessageType { return api.RequestMessage @@ -186,7 +186,7 @@ func (*CliInbandReply) GetMessageName() string { return "cli_inband_reply" } func (*CliInbandReply) GetCrcString() string { - return "6d3c80a4" + return "05879051" } func (*CliInbandReply) GetMessageType() api.MessageType { return api.ReplyMessage @@ -394,19 +394,17 @@ func (*GetNodeIndexReply) GetMessageType() api.MessageType { // LogDetails represents VPP binary API message 'log_details'. type LogDetails struct { - Timestamp Timestamp - Level LogLevel - XXX_MsgClassLen uint32 `struc:"sizeof=MsgClass"` - MsgClass string `binapi:",limit=32"` - XXX_MessageLen uint32 `struc:"sizeof=Message"` - Message string `binapi:",limit=256"` + Timestamp Timestamp + Level LogLevel + MsgClass string `struc:"[32]byte"` + Message string `struc:"[256]byte"` } func (*LogDetails) GetMessageName() string { return "log_details" } func (*LogDetails) GetCrcString() string { - return "4aea1f4d" + return "255827a1" } func (*LogDetails) GetMessageType() api.MessageType { return api.ReplyMessage @@ -421,7 +419,7 @@ func (*LogDump) GetMessageName() string { return "log_dump" } func (*LogDump) GetCrcString() string { - return "e4a022b6" + return "6ab31753" } func (*LogDump) GetMessageType() api.MessageType { return api.RequestMessage @@ -472,22 +470,18 @@ func (*ShowVersion) GetMessageType() api.MessageType { // ShowVersionReply represents VPP binary API message 'show_version_reply'. type ShowVersionReply struct { - Retval int32 - XXX_ProgramLen uint32 `struc:"sizeof=Program"` - Program string `binapi:",limit=32"` - XXX_VersionLen uint32 `struc:"sizeof=Version"` - Version string `binapi:",limit=32"` - XXX_BuildDateLen uint32 `struc:"sizeof=BuildDate"` - BuildDate string `binapi:",limit=32"` - XXX_BuildDirectoryLen uint32 `struc:"sizeof=BuildDirectory"` - BuildDirectory string `binapi:",limit=256"` + Retval int32 + Program string `struc:"[32]byte"` + Version string `struc:"[32]byte"` + BuildDate string `struc:"[32]byte"` + BuildDirectory string `struc:"[256]byte"` } func (*ShowVersionReply) GetMessageName() string { return "show_version_reply" } func (*ShowVersionReply) GetCrcString() string { - return "b9bcf6df" + return "c919bde1" } func (*ShowVersionReply) GetMessageType() api.MessageType { return api.ReplyMessage @@ -516,7 +510,7 @@ func (*ShowVpeSystemTimeReply) GetMessageName() string { return "show_vpe_system_time_reply" } func (*ShowVpeSystemTimeReply) GetCrcString() string { - return "3b12fb3f" + return "7ffd8193" } func (*ShowVpeSystemTimeReply) GetMessageType() api.MessageType { return api.ReplyMessage diff --git a/go.sum b/go.sum index 0974b09..b43459a 100644 --- a/go.sum +++ b/go.sum @@ -15,8 +15,6 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lunixbochs/struc v0.0.0-20180408203800-02e4c2afbb2a h1:axFx97V2Lyke5LbeygrJlzc07mwVhHt2ZHeI/Nv8Aq4= -github.com/lunixbochs/struc v0.0.0-20180408203800-02e4c2afbb2a/go.mod h1:iOJu9pApjjmEmNq7PqlA5R9mDu/HMF5EM3llWKX/TyA= github.com/lunixbochs/struc v0.0.0-20190916212049-a5c72983bc42 h1:PzBD7QuxXSgSu61TKXxRwVGzWO5d9QZ0HxFFpndZMCg= github.com/lunixbochs/struc v0.0.0-20190916212049-a5c72983bc42/go.mod h1:vy1vK6wD6j7xX6O6hXe621WabdtNkou2h7uRtTfRMyg= github.com/onsi/ginkgo v1.8.0 h1:VkHVNpR4iVnU8XQR6DBm8BqYjN7CRzw+xKUbVVbbW9w= diff --git a/proxy/client.go b/proxy/client.go index 7f92946..6f29c71 100644 --- a/proxy/client.go +++ b/proxy/client.go @@ -16,12 +16,12 @@ package proxy import ( "fmt" - "git.fd.io/govpp.git/core" "net/rpc" "reflect" "time" "git.fd.io/govpp.git/api" + "git.fd.io/govpp.git/core" ) type Client struct { diff --git a/proxy/log.go b/proxy/log.go index 2810528..d53e532 100644 --- a/proxy/log.go +++ b/proxy/log.go @@ -1,8 +1,9 @@ package proxy import ( - "github.com/sirupsen/logrus" "os" + + "github.com/sirupsen/logrus" ) var ( @@ -27,4 +28,4 @@ func SetLogger(l *logrus.Logger) { // SetLogLevel sets global logger level to lvl. func SetLogLevel(lvl logrus.Level) { log.Level = lvl -} \ No newline at end of file +} diff --git a/proxy/proxy.go b/proxy/proxy.go index 33cf05f..6656ee5 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -83,10 +83,11 @@ func (p *Server) ListenAndServe(addr string) error { l, e := net.Listen("tcp", addr) if e != nil { - return fmt.Errorf("listen error:", e) + return fmt.Errorf("listen failed: %v", e) } defer l.Close() log.Printf("proxy serving on: %v", addr) + return http.Serve(l, nil) } diff --git a/proxy/server.go b/proxy/server.go index ecb0e8d..472ad16 100644 --- a/proxy/server.go +++ b/proxy/server.go @@ -92,7 +92,7 @@ func (s *StatsRPC) watchConnection() { s.mu.Lock() if err := s.statsConn.GetSystemStats(prev); err != nil { atomic.StoreUint32(&s.available, 0) - log.Warnf("disabling statsRPC service, reason:", err) + log.Warnf("disabling statsRPC service, reason: %v", err) } s.mu.Unlock() @@ -110,7 +110,7 @@ func (s *StatsRPC) watchConnection() { s.mu.Lock() if err := s.statsConn.GetSystemStats(curr); err != nil { atomic.StoreUint32(&s.available, 0) - log.Warnf("disabling statsRPC service, reason:", err) + log.Warnf("disabling statsRPC service, reason: %v", err) } s.mu.Unlock() diff --git a/version/version.go b/version/version.go index 8f3e82b..36eaa3a 100644 --- a/version/version.go +++ b/version/version.go @@ -23,7 +23,7 @@ import ( var ( name = "govpp" - version = "v0.2.0" + version = "v0.3.0-dev" commitHash = "unknown" buildBranch = "HEAD" buildStamp = "" -- cgit 1.2.3-korg