Skip to content

Commit b1006dc

Browse files
committed
Add CHANGELOG and update README
Change-Id: I2d6f5eacae0cc71e659f904aa604ff0519daa79c Signed-off-by: Ondrej Fabry <[email protected]>
1 parent 15334aa commit b1006dc

File tree

2 files changed

+73
-59
lines changed

2 files changed

+73
-59
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Changelog
2+
3+
This file lists changes for the GoVPP releases.
4+
5+
## 0.1.0
6+
> _03 July 2019_
7+
8+
The first release that introduces versioning for GoVPP.
9+
10+
### VPP compatibility
11+
12+
| VPP | Status | Notes |
13+
|---|---|---|
14+
| 19.08-rc0 || preliminary support (`19.08-rc0~478-g2f5f` recommended) |
15+
| 19.04 || latest release (preffered) |
16+
| 19.01 || limited capabilities (dropping soon) |

README.md

Lines changed: 57 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# GoVPP
22

3-
This set of packages provide the API for communication with VPP from Go.
3+
The GoVPP projects provides the API for communication with VPP from Go.
44

55
It consists of the following packages:
6-
- [adapter](adapter/): adapter between GoVPP core and the VPP binary API
7-
- [api](api/api.go): API for communication with GoVPP core
8-
- [binapi-generator](cmd/binapi-generator/): generator for the VPP binary API definitions in JSON format to Go code
6+
- [adapter](adapter/): adapter between GoVPP core and the VPP binary/stats API
7+
- [api](api/): API for communication with GoVPP core
8+
- [cmd/binapi-generator](cmd/binapi-generator/): generator for the VPP binary API definitions in JSON format to Go code
99
- [codec](codec/): handles encoding/decoding of generated messages into binary form
10-
- [core](core/): main functionality of the GoVPP
10+
- [core](core/): essential functionality of the GoVPP
1111
- [examples](examples/): examples that use the GoVPP API in real use-cases of VPP management application
1212
- [extras](extras/): contains Go implementation for libmemif library
1313
- [govpp](govpp.go): provides the entry point to GoVPP functionality
1414

15-
The design with separated GoVPP [API package](api/api.go) and the GoVPP [core package](core/) enables
15+
The design with separated GoVPP [API package](api/) and the GoVPP [core package](core/) enables
1616
plugin-based infrastructure, where one entity acts as a master responsible for talking with VPP and multiple
1717
entities act as clients that are using the master for the communication with VPP.
1818
The clients can be built into standalone shared libraries without the need
@@ -21,120 +21,115 @@ of linking the GoVPP core and all its dependencies into them.
2121
```
2222
+--------------+
2323
+--------------+ | |
24-
| | | App plugin |
24+
| | | plugin |
2525
| | | |
2626
| App | +--------------+
2727
| | +------+ GoVPP API |
2828
| | | +--------------+
29-
+--------------+ Go |
29+
+--------------+ GoVPP |
3030
| | channels | +--------------+
3131
| GoVPP core +------------+ | |
32-
| | | | App plugin |
32+
| | | | plugin |
3333
+------+-------+ | | |
3434
| | +--------------+
35-
binary API | +------+ GoVPP API |
36-
(shmem) | +--------------+
35+
| +------+ GoVPP API |
36+
| binary API +--------------+
3737
|
3838
+------+-------+
3939
| |
40-
| VPP process |
40+
| VPP process |
4141
| |
4242
+--------------+
4343
```
4444

4545
## Quick Start
4646

47-
#### Code Generator
47+
#### Generate binapi (Go bindings)
48+
49+
Generating Go bindings for VPP binary API from the JSON files located in the
50+
`/usr/share/vpp/api/` directory into the Go packages that will be created
51+
inside of the `binapi` directory:
4852

49-
Generating Go bindings from the JSON files located in the `/usr/share/vpp/api/` directory
50-
into the Go packages that will be created inside of the `bin_api` directory:
5153
```
52-
binapi-generator --input-dir=/usr/share/vpp/api/ --output-dir=bin_api
54+
binapi-generator --input-dir=/usr/share/vpp/api/ --output-dir=binapi
5355
```
5456

5557
#### Example Usage
5658

57-
Usage of the generated bindings:
59+
Here is a usage sample of the generated binapi messages:
5860

5961
```go
6062
func main() {
63+
// Connect to VPP
6164
conn, _ := govpp.Connect()
6265
defer conn.Disconnect()
6366

67+
// Open channel
6468
ch, _ := conn.NewAPIChannel()
6569
defer ch.Close()
66-
67-
req := &acl.ACLAddReplace{
68-
ACLIndex: ^uint32(0),
69-
Tag: []byte("access list 1"),
70-
R: []acl.ACLRule{
71-
{
72-
IsPermit: 1,
73-
SrcIPAddr: net.ParseIP("10.0.0.0").To4(),
74-
SrcIPPrefixLen: 8,
75-
DstIPAddr: net.ParseIP("192.168.1.0").To4(),
76-
DstIPPrefixLen: 24,
77-
Proto: 6,
78-
},
79-
{
80-
IsPermit: 1,
81-
SrcIPAddr: net.ParseIP("8.8.8.8").To4(),
82-
SrcIPPrefixLen: 32,
83-
DstIPAddr: net.ParseIP("172.16.0.0").To4(),
84-
DstIPPrefixLen: 16,
85-
Proto: 6,
86-
},
87-
},
88-
}
89-
reply := &acl.ACLAddReplaceReply{}
9070

71+
// Prepare messages
72+
req := &vpe.ShowVersion{}
73+
reply := &vpe.ShowVersionReply{}
74+
75+
// Send the request
9176
err := ch.SendRequest(req).ReceiveReply(reply)
9277
}
9378
```
9479

95-
The example above uses simple wrapper API over underlying go channels,
80+
The example above uses GoVPP API to communicate over underlying go channels,
9681
see [example client](examples/simple-client/simple_client.go)
9782
for more examples, including the example on how to use the Go channels directly.
9883

99-
## Build & Installation Procedure
84+
## Build & Install
85+
86+
### Using pure Go adapters (recommended)
87+
88+
GoVPP now supports pure Go implementation for VPP binary API. This does
89+
not depend on CGo or any VPP library and can be easily compiled.
90+
91+
There are two packages providing pure Go implementations in GoVPP:
92+
- [`socketclient`](adapter/socketclient) - for VPP binary API (via unix socket)
93+
- [`statsclient`](adapter/statsclient) - for VPP stats API (via shared memory)
10094

101-
GoVPP uses `vppapiclient` library from VPP codebase to communicate with VPP.
102-
To build GoVPP, vpp-dev package must be installed,
103-
either [from packages](https://wiki.fd.io/view/VPP/Installing_VPP_binaries_from_packages) or
104-
[from sources](https://wiki.fd.io/view/VPP/Build,_install,_and_test_images#Build_A_VPP_Package).
95+
### Using vppapiclient library wrapper (requires CGo)
96+
97+
GoVPP also provides vppapiclient package which actually uses
98+
`vppapiclient.so` library from VPP codebase to communicate with VPP API.
99+
To build GoVPP, `vpp-dev` package must be installed,
100+
either [from packages][from-packages] or [from sources][from-sources].
105101

106102
To build & install `vpp-dev` from sources:
107103

108-
```
104+
```sh
109105
git clone https://gerrit.fd.io/r/vpp
110106
cd vpp
111107
make install-dep
112-
make bootstrap
113108
make pkg-deb
114109
cd build-root
115110
sudo dpkg -i vpp*.deb
116111
```
117112

118-
To build & install all GoVPP binaries into your `$GOPATH`:
113+
To build & install GoVPP:
119114

120-
```
121-
go get git.fd.io/govpp.git
115+
```sh
116+
go get -u git.fd.io/govpp.git
122117
cd $GOPATH/src/git.fd.io/govpp.git
123-
make
118+
make test
124119
make install
125120
```
126121

127-
## Building Go bindings from VPP binary APIs
122+
## Generating Go bindings with binapi-generator
128123

129-
Once you have `binapi-generator` installed in your `$GOPATH`, you can use it to generate Go bindings from
130-
VPP APis in JSON format. The JSON input can be specified as a single file (`input-file` argument), or
124+
Once you have `binapi-generator` installed, you can use it to generate Go bindings for VPP binary API
125+
using VPP APIs in JSON format. The JSON input can be specified as a single file (`input-file` argument), or
131126
as a directory that will be scanned for all `.json` files (`input-dir`). The generated Go bindings will
132127
be placed into `output-dir` (by default current working directory), where each Go package will be placed into
133128
a separated directory, e.g.:
134129

135-
```
136-
binapi-generator --input-file=examples/bin_api/acl.api.json --output-dir=examples/bin_api
137-
binapi-generator --input-dir=examples/bin_api --output-dir=examples/bin_api
130+
```sh
131+
binapi-generator --input-file=acl.api.json --output-dir=binapi
132+
binapi-generator --input-dir=/usr/share/vpp/api/core --output-dir=binapi
138133
```
139134

140135
In Go, [go generate](https://blog.golang.org/generate) tool can be leveraged to ease the code generation
@@ -145,3 +140,6 @@ that are dependent on generated code using special comments, e.g. the one from
145140
```go
146141
//go:generate binapi-generator --input-dir=bin_api --output-dir=bin_api
147142
```
143+
144+
[from-packages]: https://wiki.fd.io/view/VPP/Installing_VPP_binaries_from_packages
145+
[from-sources]: https://wiki.fd.io/view/VPP/Build,_install,_and_test_images#Build_A_VPP_Package

0 commit comments

Comments
 (0)