Skip to content

Commit

Permalink
defaulted to ovs backend for vr routers
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt committed Feb 16, 2021
1 parent 5c5e384 commit 8e08b41
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 6 deletions.
27 changes: 23 additions & 4 deletions clab/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,11 +570,15 @@ func (c *CLab) NewNode(nodeName string, nodeCfg NodeConfig, idx int) error {

// env vars are used to set launch.py arguments in vrnetlab container
defEnv := map[string]string{
"CONNECTION_MODE": "bridge"}
"CONNECTION_MODE": "ovs"}
node.Env = mergeStringMaps(defEnv, envs)

// mount tftpboot dir
node.Binds = append(node.Binds, fmt.Sprint(path.Join(node.LabDir, "tftpboot"), ":/tftpboot"))
if node.Env["CONNECTION_MODE"] == "macvtap" {
// mount dev dir to enable macvtap
node.Binds = append(node.Binds, "/dev:/dev")
}

node.Cmd = fmt.Sprintf("--trace --connection-mode %s --hostname %s --variant \"%s\"", node.Env["CONNECTION_MODE"], node.ShortName, node.NodeType)

Expand All @@ -588,10 +592,15 @@ func (c *CLab) NewNode(nodeName string, nodeCfg NodeConfig, idx int) error {
defEnv := map[string]string{
"USERNAME": "admin",
"PASSWORD": "admin@123",
"CONNECTION_MODE": "bridge",
"CONNECTION_MODE": "ovs",
}
node.Env = mergeStringMaps(defEnv, envs)

if node.Env["CONNECTION_MODE"] == "macvtap" {
// mount dev dir to enable macvtap
node.Binds = append(node.Binds, "/dev:/dev")
}

node.Cmd = fmt.Sprintf("--username %s --password %s --hostname %s --connection-mode %s --trace", node.Env["USERNAME"], node.Env["PASSWORD"], node.ShortName, node.Env["CONNECTION_MODE"])

case "vr-xrv":
Expand All @@ -604,10 +613,15 @@ func (c *CLab) NewNode(nodeName string, nodeCfg NodeConfig, idx int) error {
defEnv := map[string]string{
"USERNAME": "clab",
"PASSWORD": "clab@123",
"CONNECTION_MODE": "bridge",
"CONNECTION_MODE": "ovs",
}
node.Env = mergeStringMaps(defEnv, envs)

if node.Env["CONNECTION_MODE"] == "macvtap" {
// mount dev dir to enable macvtap
node.Binds = append(node.Binds, "/dev:/dev")
}

node.Cmd = fmt.Sprintf("--username %s --password %s --hostname %s --connection-mode %s --trace", node.Env["USERNAME"], node.Env["PASSWORD"], node.ShortName, node.Env["CONNECTION_MODE"])

case "vr-xrv9k":
Expand All @@ -620,12 +634,17 @@ func (c *CLab) NewNode(nodeName string, nodeCfg NodeConfig, idx int) error {
defEnv := map[string]string{
"USERNAME": "clab",
"PASSWORD": "clab@123",
"CONNECTION_MODE": "bridge",
"CONNECTION_MODE": "ovs",
"VCPU": "2",
"RAM": "12288",
}
node.Env = mergeStringMaps(defEnv, envs)

if node.Env["CONNECTION_MODE"] == "macvtap" {
// mount dev dir to enable macvtap
node.Binds = append(node.Binds, "/dev:/dev")
}

node.Cmd = fmt.Sprintf("--username %s --password %s --hostname %s --connection-mode %s --vcpu %s --ram %s --trace", node.Env["USERNAME"], node.Env["PASSWORD"], node.ShortName, node.Env["CONNECTION_MODE"], node.Env["VCPU"], node.Env["RAM"])

case "alpine", "linux":
Expand Down
28 changes: 26 additions & 2 deletions docs/manual/vrnetlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,29 @@ The [demo lab for xrv9k](../lab-examples/vr-xrv9k.md) and [demo lab for xrv](../

To build a container image with XRv9k/XRv inside users should follow [the instructions](https://github.com/hellt/vrnetlab) provided in the relevant folders and using the code of the forked version of a vrnetlab project.

### Limitations
* LACP and BPDU packets can not be delivered to/from VM's running inside the containers when launched with containerlab.

### Connection modes
Containerlab offers several ways VM based routers can be connected with the rest of the docker workloads. By default, vrnetlab integrated routers will use **Openvswitch** backend, which assumes that openvswitch is installed on the containerlab host. OVS backend allows vrnetlab based routers to use LACP/STP/LLDP protocols without restrictions.

<div class="mxgraph" style="max-width:100%;border:1px solid transparent;margin:0 auto; display:block;" data-mxgraph="{&quot;page&quot;:4,&quot;zoom&quot;:1.5,&quot;highlight&quot;:&quot;#0000ff&quot;,&quot;nav&quot;:true,&quot;check-visible-state&quot;:true,&quot;resize&quot;:true,&quot;url&quot;:&quot;https://raw.githubusercontent.com/srl-wim/container-lab/diagrams/vrnetlab.drawio&quot;}"></div>

??? "How to install openvswitch?"
Debian based systems (i.e. Ubuntu) can install ovs with `apt install openvswitch-switch` command.
Centos users can follow [this installation manual](https://gist.github.com/umardx/a31bf6a13600a55c0d07d4ca33133834).

If OVS can't be installed on containerlab host, it is possible to use **Linux Bridge** backend. Linux bridges won't pass LACP frames, but they will pass LLDP and don't require any packages to be installed on the containerlab hostgo. To use Linux Bridge backend, the users should set an environment variable like so:

```yaml
# the env variable can also be set in the defaults section
name: myTopo

topology:
nodes:
sr1:
kind: vr-sros
image: vrnetlab/vr-sros:20.10.R1
env:
CONNECTION_MODE: bridge
```
### Limitations and known issues
* When Linux Bridge connection mode is used LACP and BPDU packets can not be delivered to/from VM's running inside the containers. By default containerlab uses OVS backend, where LACP and BPDU work.

0 comments on commit 8e08b41

Please sign in to comment.