Skip to content

Commit e136fdd

Browse files
author
Milan Lenco
committed
ODPM 606: Clean up docs, flavors, cmd.
1 parent 24f4423 commit e136fdd

File tree

7 files changed

+119
-105
lines changed

7 files changed

+119
-105
lines changed

cmd/README.md

+8-7
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ This package groups executables that can be built from sources in the VPP
44
Agent repository:
55

66
- [vpp-agent](vpp-agent/main.go) - the default off-the-shelf VPP Agent
7-
executable (i.e. no app or extension plugins) that can be bundled with an
8-
off-the-shelf VPP to form a simple cloud-native VNF, such as a vswitch.
9-
- [agentctl](agentctl/agentctl.go) - CLI tool that allows to show the state
10-
and to configure VPP Agents connected to etcd
11-
- [vpp-agent-ctl](vpp-agent-ctl/main.go) - a utility for testing VPP Agent
12-
configuration. It contains a set of hard-wired configurations that can
13-
be invoked using command line flags and sent to the VPP Agent.
7+
executable (i.e. no app or extension plugins) that can be bundled with
8+
an off-the-shelf VPP to form a simple cloud-native VNF,
9+
such as a vswitch.
10+
- [agentctl](agentctl/agentctl.go) - CLI tool that allows to show
11+
the state and to configure VPP Agents connected to etcd
12+
- [vpp-agent-ctl](vpp-agent-ctl/main.go) - a utility for testing VPP
13+
Agent configuration. It contains a set of hard-wired configurations
14+
that can be invoked using command line flags and sent to the VPP Agent.

cmd/vpp-agent/main.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ import (
2828

2929
// main is the main entry point into the VPP Agent. First, a new CN-Infra
3030
// Agent (app) is created using the set of plugins defined in vpp_flavor
31-
// (github.com/ligato/vpp-agent/flavors/vpp). Second, function call to
32-
// EventLoopWithInterrupt()) initializes and starts all plugins and then
33-
// waits for the user to terminate the VPP Agent process. All VPP Agent's
34-
// work from now on is performed by the plugins.
31+
// (../../flavors/vpp). Second, the function calls EventLoopWithInterrupt()
32+
// which initializes and starts all plugins and then waits for the user
33+
// to terminate the VPP Agent process with SIGINT. All VPP Agent's work between
34+
// the initialization and termination is performed by the plugins.
3535
func main() {
3636

3737
f := vpp_flavor.Flavor{}

docs/Deployment.md

+27-24
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# Deployment
22

3-
VPP Agent can run on any server where VPP is installed. It can run on bare
4-
metal, in a VM, or in a container.
3+
VPP Agent can run on any server where VPP is installed. It can run
4+
on a bare metal, in a VM, or in a container.
55

6-
Benefits of putting a VPP-based VNF (bascially, just VPP and the VPP Agent)
7-
into a container are:
8-
* simplified upgrades and bringup/shutdown, and better scaling
9-
* Container-based VNFs are in essence data plane lightweight and reusable
10-
data plane microservices which can be used to build lrger systems and
11-
applications
6+
Benefits of putting a VPP-based VNF (basically just a combination of VPP
7+
and the VPP Agent) into a container are:
8+
* simplified upgrades and startup/shutdown, which results in improved
9+
scalability
10+
* Container-based VNFs are in essence lightweight and reusable
11+
data-plane microservices which can be used to build larger systems
12+
and applications
1213
* supports container healing
1314

1415
## K8s integration
@@ -21,39 +22,41 @@ The following diagram shows VPP deployement in:
2122
![K8s integration](imgs/k8s_deployment.png "VPP Agent - K8s integration")
2223

2324
K8s:
24-
- starts/stops the containers on multiple hosts
25-
- checks containers health (using probes - HTTP calls)
25+
- starts/stops the containers running on multiple hosts
26+
- checks health of the individual containers (using probes - HTTP calls)
2627

27-
## NB (Nort-bound) configuration vs. deployment
28+
## NB (North-bound) configuration vs. deployment
2829
VPP + Agent can be deployed in different environments. Several deployment
29-
alternatives are briefly described in the following sub-chapters. Regardless
30-
of the deployment, the VPP Agent can be configured using the same Client v1
31-
interface. There are three different implementations of the interface:
30+
alternatives are briefly described in the following sub-chapters.
31+
Regardless of the deployment, the VPP Agent can be configured using
32+
the same Client v1 interface. There are three different implementations
33+
of the interface:
3234
- local client
3335
- remote client using Data Broker
3436
- remote client using GRPC
3537

3638
### Key Value Data Store for NB
37-
The Control Plane using remote client writes configuration to the Data Store
38-
(tested with ETCD, Redis). VPP Agent watches particular key prefixes in Data
39-
Store using dbsync package.
39+
The Control Plane writes configuration to the Data Store using a remote
40+
client (tested with ETCD, Redis). VPP Agent watches dedicated key
41+
prefixes in Data Store using dbsync package.
4042

4143
![deployment with data store](imgs/deployment_with_data_store.png)
4244
TBD links to the code
4345

44-
### GRPC
45-
The Control Plane using remote client sends configuration to the Data Store
46-
(tested with ETCD, Redis). VPP Agent watches particular key prefixes in Data
46+
### GRPC
47+
The Control Plane using remote client sends configuration to the Data
48+
Store (tested with ETCD, Redis). VPP Agent watches particular key prefixes in Data
4749
Store using grpcsync package.
4850

4951
![grpc northbound](imgs/deployment_nb_grpc.png)
5052
TBD links to the code
5153

5254
### Embedded deployment
53-
VPP Agent can be embedded in a different project. For integration with
54-
[Contiv](http://contiv.github.io/) we use the embedded deployment. In this
55-
case the VPP Agent gets the configuration from Local client v1 through
56-
in-memory calls (Go API).
55+
VPP Agent can be directly embedded into a different project.
56+
For integration with [Contiv](http://contiv.github.io/) we decided to
57+
embed the VPP Agent directly into the netplugin process as a new driver
58+
for VPP-based networking. Using the Local client v1 the driver is able
59+
to propagate the configuration into the Agent via Go channels.
5760

5861
![embeded deployment](imgs/deployment_embeded.png)
5962
TBD links to the code

docs/Design.md

+45-44
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,35 @@
33

44
Brief description:
55
* **SFC Controller** - renders a logical network topology (which defines
6-
how VNF are logically interconnected) onto a given physical network, and
7-
VNF placement; the rednering process creates configuration for VNFs and
8-
network devices.
6+
how VNF are logically interconnected) onto a given physical network
7+
and VNF placement; the rendering process creates configuration for VNFs
8+
and network devices.
99

1010
* **Control Plane Apps** - renders specific VPP configuration for multiple
1111
agents to the Data Store
1212

13-
* **Clientv1** - VPP Agent clients clients(app, tools, the control plane)
14-
can use the clientv1 library to interact with one or more VPP Agents. The
15-
clientv1 library is based on generated GO structures from protobuf
16-
messages. The library contais helper methods for working with KV Data
17-
Stores used for generation of keys and storing/retrieving data in the
18-
Data Store under a given key.
13+
* **Clientv1** - VPP Agent clients (control plane apps & tools)
14+
can use the clientv1 library to interact with one or more VPP Agents.
15+
The clientv1 library is based on generated GO structures from protobuf
16+
messages. The library contains helper methods for working with KV Data
17+
Stores, used for generation of keys and storage/retrieval
18+
of configuration data to/from Data Store under a given key.
1919

20-
* **Data Store** (ETCD, Redis, etc.) to:
21-
* Store VPP configuration; this data is put into the Data Store by one
20+
* **Data Store** (ETCD, Redis, etc.) is used to:
21+
* store VPP configuration; this data is put into the Data Store by one
2222
or more orchestrator apps and retrieved by one or more VPP Agents.
23-
* Store operational state, such as network counters /statistics or errors;
24-
this data is put into the Data Store by one or more VPP Agents and
25-
retrieved by one or more monitoring/analytics applications.
23+
* store operational state, such as network counters /statistics
24+
or errors; this data is put into the Data Store by one or more VPP
25+
Agents and retrieved by one or more monitoring/analytics applications.
2626

27-
* **VPP vSwitch** - privileged container that cross connects multiple VNFs
27+
* **VPP vSwitch** - privileged container that cross-connects multiple VNFs
2828

2929
* **VPP VNF** - a container with a Virtual Network Function implementation
30-
based on VPP
30+
based on VPP
3131

3232
* **Non VPP VNF** - container with a non-VPP based Virtual Network Function;
33-
that can nevertheless interact with VPP containers (see below MEMIFs, VETH)
33+
that can nevertheless interact with VPP containers (see below MEMIFs,
34+
VETH)
3435

3536
* **Messaging** - AD-HOC events (e.g. link UP/Down)
3637

@@ -42,55 +43,55 @@ The VPP Agent was designed to meet the following requirements:
4243
* Rapid deployment
4344
* High performance & minimal footprint
4445

45-
4646
## Modular design with API contract
47-
The VPP Agent code base is a collection of plugins. Each plugin provides
48-
a specific service defined by the service's API. VPP Agent's functionality
49-
can be easily extended by introducing new plugins. Well-defined API
50-
contracts facilitate integration of new plugins into the VPP Agent or
51-
integration of multiple plugins into a new application.
47+
The VPP Agent codebase is basically a collection of plugins.
48+
Each plugin provides a specific service defined by the service's API.
49+
VPP Agent's functionality can be easily extended by introducing new
50+
plugins. Well-defined API contracts facilitate seamless integration
51+
of new plugins into the VPP Agent or integration of multiple plugins
52+
into a new application.
5253

5354
## Cloud native
54-
Assumption: both data plane and control plane can be implemented as a set
55-
of microservices, where each microservice is independent of other
56-
microservices. Therefore, the overall configuration of a system may be
57-
incomplete at times, since one object may refer to another object owned by
58-
a service that has not been instantiated yet. The VPP agent can handle this
59-
use - at first it skips incomplete part of configuration, and later, when
60-
the configuration is updated, it tries again to configure what was skipped.
55+
*Assumption*: both data plane and control plane can be implemented as
56+
a set of microservices independent of each other. Therefore, the overall
57+
configuration of a system may be incomplete at times, since one object
58+
may refer to another object owned by a service that has not been
59+
instantiated yet. The VPP agent can handle this case - at first it skips
60+
the incomplete parts of the overall configuration, and later, when
61+
the configuration is updated, it tries again to configure what has been
62+
previously skipped.
6163

6264
The VPP Agent is usually deployed in a container together with VPP. There
6365
can be many of these containers in a given cloud or in a more complex data
6466
plane implementation. Containers can be used in many different
6567
infrastructures (on-premise, hybrid, or public cloud). The VPP + VPP Agent
6668
containers have been tested with [Kubernetes](https://kubernetes.io/).
6769

68-
6970
Control Plane microservices do not really depend on the current lifecycle
7071
phase of the VPP Agents. Control Plane can render config data for one or
7172
more VPP Agents and store it in the KV Data Store even if (some of) the
7273
VPP Agents have not been started yet. This is possible because:
73-
- The Control Plane does not access the VPP Agents directly, but it rather
74-
accesses the KV Data Store; the VPP Agents are responsible for downloading
75-
their data from the Data Store.
74+
- The Control Plane does not access the VPP Agents directly, instead it
75+
accesses the KV Data Store; the VPP Agents are responsible
76+
for downloading their data from the Data Store.
7677
- Data structures in configuration files use logical object names, not
7778
internal identifiers of the VPP). See the
7879
[protobuf](https://developers.google.com/protocol-buffers/)
7980
definitions in the `model` sub folders in various VPP Agent plugins.
8081

81-
## Fault tolerant
82+
## Fault tolerance
8283
Each microservice has its own lifecycle, therefore the VPP Agent is
8384
designed to recover from HA events even when some subset of microservices
8485
(e.g. db, message bus...) are temporary unavailable.
8586

8687
The same principle can be applied also for the VPP Agent process and the
8788
VPP process inside one container. The VPP Agent checks the VPP actual
88-
configuration and does data synchronization by polling latest configuration
89-
from the KV Data Store.
89+
configuration and does data synchronization by polling latest
90+
configuration from the KV Data Store.
9091

9192
VPP Agent also reports status of the VPP in probes & Status Check Plugin.
9293

93-
In general VPP Agents:
94+
In general, VPP Agents:
9495
* propagate errors to upper layers & report to the Status Check Plugin
9596
* fault recovery is performed with two different strategies:
9697
* easily recoverable errors: retry data synchronization (Data Store
@@ -101,13 +102,13 @@ In general VPP Agents:
101102
## Rapid deployment
102103

103104
Containers allow to reduce deployment time to seconds. This is due to the
104-
fact that containers are created at process level and there is no need to
105-
boot the OS. More over K8s helps with (un)deploying different version of
106-
multiple instances of microservices.
105+
fact that containers are created at process level and there is no need to
106+
boot an OS. Moreover, K8s helps with the (un)deployment of possibly
107+
different versions of multiple microservice instances.
107108

108109
## High performance & minimal footprint
109-
Performance optimization is currently work in progress. Several bottlenecks
110-
that can be optimized have been identified:
110+
Performance optimization is currently a work-in-progress.
111+
Several bottlenecks that can be optimized have been identified:
111112
- GOVPP
112113
- minimize context switching
113-
- replace blocking calls to non-blocking calls
114+
- replace blocking calls to non-blocking (asynchronous) calls

docs/Extensibility.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
2-
31
# Extensibility
42
The following code snippet illustrates how to start a new flavor of plugins.
53
The complete code can be found [here](https://github.com/ligato/cn-infra/blob/master/examples/simple-agent/agent.go).
64

75
```
86
func main() {
7+
logroot.StandardLogger().SetLevel(logging.DebugLevel)
8+
9+
connectors := connectors.AllConnectorsFlavor{}
10+
rpcs := rpc.FlavorRPC{}
11+
agent := core.NewAgent(logroot.StandardLogger(), 15*time.Second, append(
12+
connectors.Plugins(), rpcs.Plugins()...)...)
13+
14+
err := core.EventLoopWithInterrupt(agent, nil)
15+
if err != nil {
16+
os.Exit(1)
917
}
1018
```

flavors/local/local_flavor.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ import (
2727
"github.com/ligato/vpp-agent/plugins/linuxplugin"
2828
)
2929

30-
// FlavorVppLocal glues together multiple plugins to mange VPP and linux interfaces configuration using local client.
30+
// FlavorVppLocal glues together multiple plugins to manage VPP and Linux
31+
// configuration using the local client.
3132
type FlavorVppLocal struct {
3233
*local.FlavorLocal
3334
LinuxLocalClient localclient.Plugin
@@ -38,7 +39,7 @@ type FlavorVppLocal struct {
3839
injected bool
3940
}
4041

41-
// Inject sets object references
42+
// Inject sets inter-plugin references.
4243
func (f *FlavorVppLocal) Inject() error {
4344
if f.injected {
4445
return nil
@@ -60,7 +61,7 @@ func (f *FlavorVppLocal) Inject() error {
6061
return nil
6162
}
6263

63-
// Plugins combines Generic Plugins and Standard VPP Plugins
64+
// Plugins combines all Plugins in the flavor to a list.
6465
func (f *FlavorVppLocal) Plugins() []*core.NamedPlugin {
6566
f.Inject()
6667
return core.ListPluginsInFlavor(f)

0 commit comments

Comments
 (0)