-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f3de513
commit 330c8ff
Showing
9 changed files
with
143 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ var kinds = []string{ | |
"ceos", | ||
"crpd", | ||
"sonic-vs", | ||
"vr-n9kv", | ||
"vr-sros", | ||
"vr-vmx", | ||
"vr-xrv", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ | |
"vr-csr", | ||
"vr-pan", | ||
"vr-ros", | ||
"vr-n9kv", | ||
"linux", | ||
"bridge", | ||
"ovs-bridge", | ||
|