examples/

directory
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2017 License: Apache-2.0

README

VPP Agent examples

This folder contains several examples that illustrate various aspects of VPP Agent's functionality. Each example is structured as an individual executable with its own main.go file. Each example focuses on a very simple use case. All examples use ETCD, GOVPP and Kafka, so please make sure there are running instances of ETCD, Kafka and VPP before starting an example.

Current examples:

  • govpp_call is an example of a plugin with a configurator and a channel to send/receive data to VPP. The example shows how to transform northbound model data to VPP binary API calls.

  • idx_mapping_lookup shows the usage of the name-to-index mapping (registration, read by name/index, un-registration)

  • idx_mapping_watcher shows how to watch on changes in a name-to-index mapping

  • localclient_vpp demonstrates how to use the localclient package to push example configuration into VPP plugins that run in the same agent instance (i.e. in the same OS process). Behind the scenes, configuration data is transported via go channels.

  • localclient_linux demonstrates how to use the localclient package to push example configuration into linux and VPP plugins running within the same agent instance (i.e. within the same OS process). Behind the scenes the configuration data is transported via go channels.

  • remoteclient_grpc_vpp demonstrates how to use the remoteclient package to push example configuration into VPP default plugins running within different vpp-agent OS process.

  • CN-Infra examples demonstrate how to use the CN-Infra platform plugins.

How to run an example

1. Start the ETCD server on localhost

sudo docker run -p 2379:2379 --name etcd --rm 
quay.io/coreos/etcd:v3.1.0 /usr/local/bin/etcd \
-advertise-client-urls http://0.0.0.0:2379 \
-listen-client-urls http://0.0.0.0:2379

2. Start Kafka on localhost

sudo docker run -p 2181:2181 -p 9092:9092 --name kafka --rm \
 --env ADVERTISED_HOST=172.17.0.1 --env ADVERTISED_PORT=9092 spotify/kafka

3. Start VPP

vpp unix { interactive } plugins { plugin dpdk_plugin.so { disable } }

4. Start desired example

Example can be started now from particular directory.

go run main.go  \
--etcdv3-config=/opt/vpp-agent/dev/etcd.conf \
--kafka-config=/opt/vpp-agent/dev/kafka.conf

Directories

Path Synopsis
Example govpp_call shows how to use govpp library to communicate with VPP over the binary API.
Example govpp_call shows how to use govpp library to communicate with VPP over the binary API.
Example idx_bd_cache demonstrates the use of "bridge-domain name-to-index cache" to watch for bridge-domain config changes across agents.
Example idx_bd_cache demonstrates the use of "bridge-domain name-to-index cache" to watch for bridge-domain config changes across agents.
Example idx_iface_cache demonstrates the use of "interface name-to-index cache" to watch for VPP interface config changes across agents.
Example idx_iface_cache demonstrates the use of "interface name-to-index cache" to watch for VPP interface config changes across agents.
Example idx_mapping_lookup shows how to use the name-to-index mapping registry to create a new mapping and how to add and lookup mapping items.
Example idx_mapping_lookup shows how to use the name-to-index mapping registry to create a new mapping and how to add and lookup mapping items.
Example idx_mapping_watcher shows how to watch on changes done in name-to-index mapping registry.
Example idx_mapping_watcher shows how to watch on changes done in name-to-index mapping registry.
Example idx_veth_cache demonstrates the use of the "VETH name-to-index cache" to watch Linux VETH interface config changes across agents.
Example idx_veth_cache demonstrates the use of the "VETH name-to-index cache" to watch Linux VETH interface config changes across agents.
Example localclient_linux demonstrates local Linux and VPP config management via clientv1.
Example localclient_linux demonstrates local Linux and VPP config management via clientv1.
Example localclient_vpp demonstrates local VPP config management via clientv1.
Example localclient_vpp demonstrates local VPP config management via clientv1.
Example remoteclient_vpp demonstrates remote VPP config management via clientv1 (using GPRC transport).
Example remoteclient_vpp demonstrates remote VPP config management via clientv1 (using GPRC transport).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL