|
|
|
# Webhook
|
|
|
|
|
|
|
|
This page describes how to get a individual test environment with a goSDN and three CEOS Containers, by calling a webhook. At the current stage you get a port to communicate with the goSDN instance over HTTP and GRPC. The goSDN is connected to all three CEOS instances via a separate management subnet. All connection endpoints are displayed as output of the webhook.
|
|
|
|
|
|
|
|
The webhook uses the tool [Containerlab](https://containerlab.srlinux.dev/) to setup the test environments
|
|
|
|
|
|
|
|
## Dependencies:
|
|
|
|
These tools are optional but are used in the examples.
|
|
|
|
- jo (https://github.com/jpmens/jo)
|
|
|
|
- curl
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Create a simple test environment. You need to supply a custom name through a query parameter (?name=<lab-name>). At the current stage it is recommended to use a name that is not very generic because it is possible to override a different setup with the same name. Executing the command multiple times resets the environment:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
curl 'http://141.100.70.178:9000/hooks/lab-deploy?name='
|
|
|
|
```
|
|
|
|
|
|
|
|
It is also possible to define the container tag of the goSDN container through query parameter. The Tag must exist in the container repository.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
curl 'http://141.100.70.178:9000/hooks/lab-deploy?name=<lab-name>&tag=latest'
|
|
|
|
```
|
|
|
|
|
|
|
|
It is possible to supply a custom goSDN config file packaged with json. The jo tool generates the json payload and encodes the file as base64.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
jo config=%config.toml | curl -X POST -H "Content-Type:application/json" 'http://141.100.70.178:9000/hooks/lab-deploy?name=<lab-name>' -d @-
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
############## CONTAINERLAB DEPLOY WEBHOOK ##############
|
|
|
|
|
|
|
|
|
|
|
|
############## TOPOLOGY FILE ##############
|
|
|
|
# topology documentation: http://containerlab.srlinux.dev/lab-examples/srl-ceos/
|
|
|
|
name: sort1
|
|
|
|
|
|
|
|
mgmt:
|
|
|
|
network: sort1
|
|
|
|
ipv4_subnet: 172.65.17.0/24
|
|
|
|
|
|
|
|
topology:
|
|
|
|
kinds:
|
|
|
|
ceos:
|
|
|
|
image: registry.code.fbi.h-da.de/danet/gosdn/ceos:latest
|
|
|
|
nodes:
|
|
|
|
ceos1:
|
|
|
|
kind: ceos
|
|
|
|
ceos2:
|
|
|
|
kind: ceos
|
|
|
|
ceos3:
|
|
|
|
kind: ceos
|
|
|
|
|
|
|
|
gosdn:
|
|
|
|
kind: linux
|
|
|
|
image: registry.code.fbi.h-da.de/danet/gosdn:develop
|
|
|
|
ports:
|
|
|
|
- :8080
|
|
|
|
- :55055
|
|
|
|
|
|
|
|
links:
|
|
|
|
- endpoints: ["ceos1:eth1", "ceos2:eth1"]
|
|
|
|
- endpoints: ["ceos1:eth2", "ceos3:eth1"]
|
|
|
|
- endpoints: ["ceos2:eth2", "ceos3:eth2"]
|
|
|
|
###########################################
|
|
|
|
|
|
|
|
############## PULL IMAGES ##############
|
|
|
|
latest: Pulling from danet/gosdn/ceos
|
|
|
|
Digest: sha256:c95bdd98ed8e5338fb813ad466200b4e876913e80b92c78ce109a5c6cdb9bfd7
|
|
|
|
Status: Image is up to date for registry.code.fbi.h-da.de/danet/gosdn/ceos:latest
|
|
|
|
registry.code.fbi.h-da.de/danet/gosdn/ceos:latest
|
|
|
|
develop: Pulling from danet/gosdn
|
|
|
|
Digest: sha256:63426375f11d8d2d4c3bdb0940d6ab0d731a415b548d79f9f0bd8d9e7f4b6a81
|
|
|
|
Status: Image is up to date for registry.code.fbi.h-da.de/danet/gosdn:develop
|
|
|
|
registry.code.fbi.h-da.de/danet/gosdn:develop
|
|
|
|
#########################################
|
|
|
|
|
|
|
|
############## DEPLOY ##############
|
|
|
|
time="2021-07-29T18:04:34Z" level=info msg="Parsing & checking topology file: sort1.clab.yml"
|
|
|
|
time="2021-07-29T18:04:34Z" level=info msg="Removing /var/webhook/clab-sort1 directory..."
|
|
|
|
time="2021-07-29T18:04:34Z" level=info msg="Creating lab directory: /var/webhook/clab-sort1"
|
|
|
|
time="2021-07-29T18:04:34Z" level=info msg="Creating docker network: Name='sort1', IPv4Subnet='172.65.17.0/24', IPv6Subnet='', MTU='1500'"
|
|
|
|
time="2021-07-29T18:04:34Z" level=info msg="Creating container: gosdn"
|
|
|
|
time="2021-07-29T18:04:34Z" level=info msg="Creating container: ceos3"
|
|
|
|
time="2021-07-29T18:04:34Z" level=info msg="Creating container: ceos1"
|
|
|
|
time="2021-07-29T18:04:34Z" level=info msg="Creating container: ceos2"
|
|
|
|
time="2021-07-29T18:04:37Z" level=info msg="Creating virtual wire: ceos1:eth1 <--> ceos2:eth1"
|
|
|
|
time="2021-07-29T18:04:37Z" level=info msg="Creating virtual wire: ceos2:eth2 <--> ceos3:eth2"
|
|
|
|
time="2021-07-29T18:04:37Z" level=info msg="Creating virtual wire: ceos1:eth2 <--> ceos3:eth1"
|
|
|
|
time="2021-07-29T18:04:37Z" level=info msg="Writing /etc/hosts file"
|
|
|
|
+---+------------------+--------------+---------------------------------------------------+-------+-------+---------+----------------+--------------+
|
|
|
|
| # | Name | Container ID | Image | Kind | Group | State | IPv4 Address | IPv6 Address |
|
|
|
|
+---+------------------+--------------+---------------------------------------------------+-------+-------+---------+----------------+--------------+
|
|
|
|
| 1 | clab-sort1-ceos1 | 228406b988c9 | registry.code.fbi.h-da.de/danet/gosdn/ceos:latest | ceos | | running | 172.65.17.5/24 | NA |
|
|
|
|
| 2 | clab-sort1-ceos2 | cfb7aa4933eb | registry.code.fbi.h-da.de/danet/gosdn/ceos:latest | ceos | | running | 172.65.17.2/24 | NA |
|
|
|
|
| 3 | clab-sort1-ceos3 | 8a26c7c66b32 | registry.code.fbi.h-da.de/danet/gosdn/ceos:latest | ceos | | running | 172.65.17.3/24 | NA |
|
|
|
|
| 4 | clab-sort1-gosdn | 9004d233389a | registry.code.fbi.h-da.de/danet/gosdn:develop | linux | | running | 172.65.17.4/24 | NA |
|
|
|
|
+---+------------------+--------------+---------------------------------------------------+-------+-------+---------+----------------+--------------+
|
|
|
|
####################################
|
|
|
|
|
|
|
|
############## PORTS ##############
|
|
|
|
GOSDN_HTTP_PORT=49314
|
|
|
|
GOSDN_GRPC_PORT=49313
|
|
|
|
###################################
|
|
|
|
``` |
|
|
|
\ No newline at end of file |