Skip to content

Commit

Permalink
rebase clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
carlmontanari committed Jul 27, 2021
1 parent f3de513 commit 330c8ff
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ In addition to native containerized NOSes, containerlab can launch traditional v
* [Cisco IOS XRv9k](https://containerlab.srlinux.dev/manual/kinds/vr-xrv9k/)
* [Arista vEOS](https://containerlab.srlinux.dev/manual/kinds/vr-veos)
* [Palo Alto PAN](https://containerlab.srlinux.dev/manual/kinds/vr-pan)
* [Cisco Nexus 9000v](https://containerlab.srlinux.dev/manual/kinds/vr-n9kv)

And, of course, containerlab is perfectly capable of wiring up arbitrary linux containers which can host your network applications, virtual functions or simply be a test client. With all that, containerlab provides a single IaaC interface to manage labs which can span contain all the needed variants of nodes:

Expand Down
1 change: 1 addition & 0 deletions clab/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ var kinds = []string{
"ceos",
"crpd",
"sonic-vs",
"vr-n9kv",
"vr-sros",
"vr-vmx",
"vr-xrv",
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ In addition to native containerized NOSes, containerlab can launch traditional v
* [Cisco IOS XRv9k](manual/kinds/vr-xrv9k.md)
* [Arista vEOS](manual/kinds/vr-veos.md)
* [Palo Alto PAN](manual/kinds/vr-pan.md)
* [Cisco Nexus 9000v](manual/kinds/vr-n9kv.md)

And, of course, containerlab is perfectly capable of wiring up arbitrary linux containers which can host your network applications, virtual functions or simply be a test client. With all that, containerlab provides a single IaaC interface to manage labs which can span all the needed variants of nodes:

Expand Down
48 changes: 48 additions & 0 deletions docs/manual/kinds/vr-n9kv.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Cisco Nexus 9000v

Cisco CSR1000v virtualized router is identified with `vr-n9kv` kind in the [topology file](../topo-def-file.md). It is built using [vrnetlab](../vrnetlab.md) project and essentially is a Qemu VM packaged in a docker container format.

vr-csr nodes launched with containerlab comes up pre-provisioned with SSH, SNMP and NETCONF services enabled.

## Managing vr-n9kv nodes

!!!note
Containers with Nexus 9000v inside will take ~4min to fully boot.
You can monitor the progress with `docker logs -f <container-name>`.

Cisco Nexus 9000v node launched with containerlab can be managed via the following interfaces:

=== "bash"
to connect to a `bash` shell of a running vr-n9kv container:
```bash
docker exec -it <container-name/id> bash
```
=== "CLI"
to connect to the Nexus 9000v CLI
```bash
ssh admin@<container-name/id>
```
=== "NETCONF"
NETCONF server is running over port 830
```bash
ssh admin@<container-name> -p 830 -s netconf
```

!!!info
Default user credentials: `admin:admin`

## Interfaces mapping
vr-n9kv container can have up to 128 interfaces and uses the following mapping rules:

* `eth0` - management interface connected to the containerlab management network
* `eth1` - first data interface, mapped to first data port of Nexus 9000v line card
* `eth2+` - second and subsequent data interface

When containerlab launches vr-n9kv node, it will assign IPv4/6 address to the `eth0` interface. These addresses can be used to reach management plane of the router.

Data interfaces `eth1+` needs to be configured with IP addressing manually using CLI/management protocols.


## Features and options
### Node configuration
vr-n9kv nodes come up with a basic configuration where only `admin` user and management interfaces such as NETCONF provisioned.
7 changes: 5 additions & 2 deletions docs/manual/vrnetlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ The following table provides a link between the version combinations that were v
| -- | [`0.2.2`](https://github.com/hellt/vrnetlab/tree/v0.2.2) | fixed serial (telnet) access to SR OS nodes |
| -- | [`0.2.3`](https://github.com/hellt/vrnetlab/tree/v0.2.3) | set default cpu/ram for SR OS images |
| `0.13.0` | [`0.3.0`](https://github.com/hellt/vrnetlab/tree/v0.3.0) | added support for Cisco CSR1000v via [`vr-csr`](kinds/vr-csr.md) and MikroTik routeros via [`vr-ros`](kinds/vr-ros.md) kind |
| | [`0.3.1`](https://github.com/hellt/vrnetlab/tree/v0.3.1) | enhanced SR OS boot sequence |
| `0.15.5` | [`0.4.0`](https://github.com/hellt/vrnetlab/tree/v0.4.0) | fixed SR OS CPU allocation and added Palo Alto PAN support [`vr-pan`](kinds/vr-pan.md) |
| -- | [`0.3.1`](https://github.com/hellt/vrnetlab/tree/v0.3.1) | enhanced SR OS boot sequence |
| -- | [`0.4.0`](https://github.com/hellt/vrnetlab/tree/v0.4.0) | fixed SR OS CPU allocation and added Palo Alto PAN support [`vr-pan`](kinds/vr-pan.md) |
| `0.15.5` | [`0.4.0`](https://github.com/hellt/vrnetlab/tree/v0.4.0) | added support for Cisco Nexus 9000v via [`vr-n9kv`](kinds/vr-n9kv.md) kind |

### Building vrnetlab images
To build a vrnetlab image compatible with containerlab users first need to ensure that the versions of both projects follow [compatibility matrix](#compatibility-matrix).
Expand Down Expand Up @@ -67,6 +68,8 @@ The images that work with containerlab will appear in the supported list gradual
| Arista vEOS | [vr-veos](kinds/vr-veos.md) | | |
| MikroTik RouterOS | [vr-ros](kinds/vr-ros.md) | | |
| Palo Alto PAN | [vr-pan](kinds/vr-pan.md) | | |
| Cisco Nexus 9000v | [vr-n9kv](kinds/vr-n9kv.md) | | |


### 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 **tc** backend[^2] which doesn't require any additional packages to be installed on the container host and supports transparent passage of LACP frames.
Expand Down
1 change: 1 addition & 0 deletions nodes/all/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
_ "github.com/srl-labs/containerlab/nodes/srl"
_ "github.com/srl-labs/containerlab/nodes/vr_csr"
_ "github.com/srl-labs/containerlab/nodes/vr_pan"
_ "github.com/srl-labs/containerlab/nodes/vr_n9kv"
_ "github.com/srl-labs/containerlab/nodes/vr_ros"
_ "github.com/srl-labs/containerlab/nodes/vr_sros"
_ "github.com/srl-labs/containerlab/nodes/vr_veos"
Expand Down
2 changes: 2 additions & 0 deletions nodes/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const (
NodeKindSRL = "srl"
NodeKindVrCSR = "vr-csr"
NodeKindVrPAN = "vr-pan"
NodeKindVrN9KV = "vr-n9kv"
NodeKindVrROS = "vr-ros"
NodeKindVrSROS = "vr-sros"
NodeKindVrVEOS = "vr-veos"
Expand Down Expand Up @@ -96,6 +97,7 @@ var DefaultConfigTemplates = map[string]string{
var DefaultCredentials = map[string][]string{
"srl": {"admin", "admin"},
"vr-pan": {"admin", "Admin@123"},
"vr-n9kv": {"admin", "admin"},
"vr-sros": {"admin", "admin"},
"vr-vmx": {"admin", "admin@123"},
"vr-xrv9k": {"clab", "clab@123"},
Expand Down
83 changes: 83 additions & 0 deletions nodes/vr_n9kv/vr-n9kv.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright 2020 Nokia
// Licensed under the BSD 3-Clause License.
// SPDX-License-Identifier: BSD-3-Clause

package vr_n9kv

import (
"context"
"fmt"

"github.com/srl-labs/containerlab/nodes"
"github.com/srl-labs/containerlab/runtime"
"github.com/srl-labs/containerlab/types"
"github.com/srl-labs/containerlab/utils"
)

func init() {
nodes.Register(nodes.NodeKindVrN9KV, func() nodes.Node {
return new(vrN9kv)
})
}

type vrN9kv struct {
cfg *types.NodeConfig
mgmt *types.MgmtNet
runtime runtime.ContainerRuntime
}

func (s *vrN9kv) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {
s.cfg = cfg
for _, o := range opts {
o(s)
}
// env vars are used to set launch.py arguments in vrnetlab container
defEnv := map[string]string{
"CONNECTION_MODE": nodes.VrDefConnMode,
"USERNAME": "admin",
"PASSWORD": "admin",
"DOCKER_NET_V4_ADDR": s.mgmt.IPv4Subnet,
"DOCKER_NET_V6_ADDR": s.mgmt.IPv6Subnet,
}
s.cfg.Env = utils.MergeStringMaps(defEnv, s.cfg.Env)

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

s.cfg.Cmd = fmt.Sprintf("--username %s --password %s --hostname %s --connection-mode %s --trace",
s.cfg.Env["USERNAME"], s.cfg.Env["PASSWORD"], s.cfg.ShortName, s.cfg.Env["CONNECTION_MODE"])
return nil
}
func (s *vrN9kv) Config() *types.NodeConfig { return s.cfg }
func (s *vrN9kv) PreDeploy(configName, labCADir, labCARoot string) error {
utils.CreateDirectory(s.cfg.LabDir, 0777)
return nil
}
func (s *vrN9kv) Deploy(ctx context.Context) error {
_, err := s.runtime.CreateContainer(ctx, s.cfg)
return err
}
func (s *vrN9kv) PostDeploy(ctx context.Context, ns map[string]nodes.Node) error {
return nil
}

func (s *vrN9kv) GetImages() map[string]string {
return map[string]string{
nodes.ImageKey: s.cfg.Image,
}
}

func (s *vrN9kv) Destroy(ctx context.Context) error { return nil }
func (s *vrN9kv) WithMgmtNet(mgmt *types.MgmtNet) { s.mgmt = mgmt }
func (s *vrN9kv) WithRuntime(r runtime.ContainerRuntime) { s.runtime = r }
func (s *vrN9kv) GetRuntime() runtime.ContainerRuntime { return s.runtime }

func (s *vrN9kv) Delete(ctx context.Context) error {
return s.runtime.DeleteContainer(ctx, s.Config().LongName)
}

func (s *vrN9kv) SaveConfig(ctx context.Context) error {
return nil
}
1 change: 1 addition & 0 deletions schemas/clab.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"vr-csr",
"vr-pan",
"vr-ros",
"vr-n9kv",
"linux",
"bridge",
"ovs-bridge",
Expand Down

0 comments on commit 330c8ff

Please sign in to comment.