Docker nodes configuration¶
Pre-configured nodes¶
By default, 4 kind of docker nodes have been pre-configured in gonetem
router to emulate a router thanks to FRR
host to emulate a simple machine
server to emulate a server machine with DHCP/TFTP/HTTP/DNS server
p4sw to emulate a P4 switch based on the bmv2 implementation
These 3 nodes has a default configuration that can be modified in the docker.nodes
section of server configuration file. By default, this section looks like this:
docker:
nodes:
router:
image: mroy31/gonetem-frr
host:
image: mroy31/gonetem-host
server:
image: mroy31/gonetem-server
p4sw:
image: mroy31/gonetem-bmv2
with only docker image set in the configuration. However, many other options
exist and can be overriden in the server configuration file. For example, this is
the full configuration for the node host:
docker:
nodes:
host:
type: host
image: mroy31/gonetem-host
volumes: []
options:
log: true
tso: false
commands:
console: /bin/bash
shell: /bin/bash
loadConfig:
- command: network-config.py -l /tmp/custom.net.conf
checkFiles:
- /tmp/custom.net.conf
- command: /bin/bash /gonetem-init.sh
checkFiles:
- /gonetem-init.sh
saveConfig:
- command: network-config.py -s /tmp/custom.net.conf
checkFiles: []
configurationFiles:
- destSuffix: init.conf
source: /gonetem-init.sh
label: Init
- destSuffix: net.conf
source: /tmp/custom.net.conf
label: Network
- destSuffix: ntp.conf
source: /etc/ntpsec/ntp.conf
label: NTP
List of parameters:
type(string): type of node (used in the topology file to declare a docker node)image(string): docker image used to launch the containervolumes(string list): Allow to bind host path in container filesystem (like -v option indocker run`). The syntax is/host/path:/container/pathand can be completed in the topology definition.optionslog(boolean): show output messages of loadConfig commandstso(boolean): set to false to disable TSO (TCP Segmentation Offload) on interfaces node
commands: list of commands needed by gonetem to manage the nodeconsole: command used by gonetem when a console is launchshell: command used by gonetem when a shell is launchloadConfig: list of commands used by gonetem when the node is started to load the configurationcommand: command executed on the nodecheckFiles: list of files that have to exist to launch the command
saveConfig: list of commands used by gonetem when the save command is required by the userconfigurationFiles: list of files save in the .gnet project for this kind of node
Define new nodes¶
It is also possible to declare a new kind of node than can be used in topology file, in the server
configuration file (section docker.extraNodes as a list). The parameters are exactly the same than
the integrated nodes in gonetem. Example:
docker:
extraNodes:
- type: myhost
image: mydocker-img
volumes: []
options:
log: false
tso: true
commands:
console: /bin/myconsole
shell: /bin/bash
loadConfig:
- command: my-load-script.sh
checkFiles: []
saveConfig:
- command: my-save-script.sh
checkFiles: []
configurationFiles:
- destSuffix: myappconf.conf
source: /path/myconf.conf
label: MyConf
Once define in the server configuration file, you can use this new node in the topology like that:
nodes:
Host:
type: docker.myhost
VyOS¶
A concrete example of this feature is the possibility to use VyOS router with gonetem. To do that:
Build VyOS docker image compatible with gonetem (look at the
docker/README.mdfile to do that)Add this extra node configuration in the server configuration file
docker:
extraNodes:
- type: vyos
image: gonetem-vyos:1.4
options:
log: false
tso: true
commands:
console: su - vyos
shell: /bin/bash
loadConfig:
- command: /bin/bash /usr/bin/start-vyos.sh
checkFiles: []
saveConfig:
- command: /bin/bash /usr/bin/save-vyos-config.sh
checkFiles: []
configurationFiles:
- destSuffix: vyos.conf
source: /opt/vyatta/etc/config/config.boot
label: VyOS
Finally, restart gonetem server and after you can use docker.vyos node in your topology.