-
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.
Merge branch 'master' of github.com:srl-labs/containerlab
- Loading branch information
Showing
8 changed files
with
177 additions
and
17 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
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,43 @@ | ||
# Cisco NXOS | ||
|
||
[Cisco NXOS](https://www.cisco.com/c/en/us/products/ios-nx-os-software/nx-os/index.html) virtual appliance is identified with `vr-nxos` kind in the [topology file](../topo-def-file.md). It is built using [hellt/vrnetlab](../vrnetlab.md) project and essentially is a Qemu VM packaged in a docker container format. | ||
|
||
!!!note | ||
This is a Titanium based system, which is an older version of NX-OS. | ||
|
||
vr-nxos nodes launched with containerlab come up pre-provisioned with SSH service enabled. | ||
|
||
## Managing vr-nxos nodes | ||
Cisco NXOS node launched with containerlab can be managed via the following interfaces: | ||
|
||
=== "bash" | ||
to connect to a `bash` shell of a running vr-nxos container: | ||
```bash | ||
docker exec -it <container-name/id> bash | ||
``` | ||
=== "CLI via SSH" | ||
to connect to the NX-OS CLI | ||
```bash | ||
ssh clab@<container-name/id> | ||
``` | ||
|
||
|
||
!!!info | ||
Default user credentials: `admin:admin` | ||
|
||
## Interfaces mapping | ||
vr-nxos container can have up to 90 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 NX-OS line card | ||
* `eth2+` - second and subsequent data interface | ||
|
||
When containerlab launches vr-nxos 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-nxos nodes come up with a basic configuration where only the control plane and line cards are provisioned, as well as the `clab` user. | ||
|
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,86 @@ | ||
// Copyright 2021 Nokia | ||
// Licensed under the BSD 3-Clause License. | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
|
||
package vr_nxos | ||
|
||
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.NodeKindVrNXOS, func() nodes.Node { | ||
return new(vrNXOS) | ||
}) | ||
} | ||
|
||
type vrNXOS struct { | ||
cfg *types.NodeConfig | ||
mgmt *types.MgmtNet | ||
runtime runtime.ContainerRuntime | ||
} | ||
|
||
func (s *vrNXOS) 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{ | ||
"USERNAME": "admin", | ||
"PASSWORD": "admin", | ||
"CONNECTION_MODE": nodes.VrDefConnMode, | ||
"VCPU": "2", | ||
"RAM": "4096", | ||
"DOCKER_NET_V4_ADDR": s.mgmt.IPv4Subnet, | ||
"DOCKER_NET_V6_ADDR": s.mgmt.IPv6Subnet, | ||
} | ||
s.cfg.Env = utils.MergeStringMaps(defEnv, s.cfg.Env) | ||
|
||
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 *vrNXOS) Config() *types.NodeConfig { return s.cfg } | ||
|
||
func (s *vrNXOS) PreDeploy(configName, labCADir, labCARoot string) error { | ||
utils.CreateDirectory(s.cfg.LabDir, 0777) | ||
return nil | ||
} | ||
|
||
func (s *vrNXOS) Deploy(ctx context.Context) error { | ||
_, err := s.runtime.CreateContainer(ctx, s.cfg) | ||
return err | ||
} | ||
|
||
func (s *vrNXOS) GetImages() map[string]string { | ||
return map[string]string{ | ||
nodes.ImageKey: s.cfg.Image, | ||
} | ||
} | ||
|
||
func (s *vrNXOS) PostDeploy(ctx context.Context, ns map[string]nodes.Node) error { | ||
return nil | ||
} | ||
|
||
func (s *vrNXOS) WithMgmtNet(mgmt *types.MgmtNet) { s.mgmt = mgmt } | ||
func (s *vrNXOS) WithRuntime(r runtime.ContainerRuntime) { | ||
s.runtime = r | ||
} | ||
func (s *vrNXOS) GetRuntime() runtime.ContainerRuntime { return s.runtime } | ||
|
||
func (s *vrNXOS) Delete(ctx context.Context) error { | ||
return s.runtime.DeleteContainer(ctx, s.Config().LongName) | ||
} | ||
|
||
func (s *vrNXOS) 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 |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
"vr-vmx", | ||
"vr-xrv", | ||
"vr-xrv9k", | ||
"vr-nxos", | ||
"vr-veos", | ||
"vr-csr", | ||
"vr-pan", | ||
|