Skip to content

Commit

Permalink
Add vr-c8000v kind (#1960)
Browse files Browse the repository at this point in the history
* Add vr-c8000v kind

This is right now a verbatim copy of the existing vr-csr kind. I expect
they will diverge in the future though, so it is best to create a copy
now rather than encourage branching logic in the same file.

* Bump github.com/containers/podman/v4 from 4.9.3 to 4.9.4 (#1964)

Bumps [github.com/containers/podman/v4](https://github.com/containers/podman) from 4.9.3 to 4.9.4.
- [Release notes](https://github.com/containers/podman/releases)
- [Changelog](https://github.com/containers/podman/blob/v4.9.4/RELEASE_NOTES.md)
- [Commits](containers/podman@v4.9.3...v4.9.4)

---
updated-dependencies:
- dependency-name: github.com/containers/podman/v4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* cRPD: allow root ssh directive (#1967)

* cRPD: allow root ssh directive

fixing: #1966

* remove version from the config template

---------

Co-authored-by: Roman Dodin <dodin.roman@gmail.com>

* Bump go to 1.21 (#1970)

* bump go to 1.21

* change vmx link

* fix another dead link

* remove empty file

* added envrc file

* added c8000v docs

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Markus Vahlenkamp <github@vahlenkamp.net>
Co-authored-by: Roman Dodin <dodin.roman@gmail.com>
  • Loading branch information
4 people committed Apr 3, 2024
1 parent 0bf4958 commit 9b47e3a
Show file tree
Hide file tree
Showing 9 changed files with 216 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ In addition to native containerized NOSes, containerlab can launch traditional v
* [Juniper vJunosEvolved](https://containerlab.dev/manual/kinds/vr-vjunosevolved/)
* [Cisco IOS XRv9k](https://containerlab.dev/manual/kinds/vr-xrv9k/)
* [Cisco Nexus 9000v](https://containerlab.dev/manual/kinds/vr-n9kv)
* [Cisco c8000v](https://containerlab.dev/manual/kinds/vr-c8000v/)
* [Cisco CSR 1000v](https://containerlab.dev/manual/kinds/vr-csr)
* [Dell FTOS10v](https://containerlab.dev/manual/kinds/vr-ftosv)
* [Arista vEOS](https://containerlab.dev/manual/kinds/vr-veos)
Expand Down
2 changes: 2 additions & 0 deletions clab/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
sonic "github.com/srl-labs/containerlab/nodes/sonic"
srl "github.com/srl-labs/containerlab/nodes/srl"
vr_aoscx "github.com/srl-labs/containerlab/nodes/vr_aoscx"
vr_c8000v "github.com/srl-labs/containerlab/nodes/vr_c8000v"
vr_csr "github.com/srl-labs/containerlab/nodes/vr_csr"
vr_freebsd "github.com/srl-labs/containerlab/nodes/vr_freebsd"
vr_ftdv "github.com/srl-labs/containerlab/nodes/vr_ftdv"
Expand Down Expand Up @@ -62,6 +63,7 @@ func (c *CLab) RegisterNodes() {
srl.Register(c.Reg)
vr_aoscx.Register(c.Reg)
vr_csr.Register(c.Reg)
vr_c8000v.Register(c.Reg)
vr_freebsd.Register(c.Reg)
vr_ftosv.Register(c.Reg)
vr_n9kv.Register(c.Reg)
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ In addition to native containerized NOSes, containerlab can launch traditional v
* [Juniper vJunos Evolved](manual/kinds/vr-vjunosevolved.md)
* [Cisco IOS XRv9k](manual/kinds/vr-xrv9k.md)
* [Cisco Nexus 9000v](manual/kinds/vr-n9kv.md)
* [Cisco c8000v](manual/kinds/vr-c8000v.md)
* [Cisco CSR 1000v](manual/kinds/vr-csr.md)
* [Cisco FTDv](manual/kinds/vr-ftdv.md)
* [Dell FTOS10v](manual/kinds/vr-ftosv.md)
Expand Down
103 changes: 103 additions & 0 deletions docs/manual/kinds/vr-c8000v.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
search:
boost: 4
---
# Cisco c8000v

The Cisco Catalyst 8000V Edge Software (Catalyst 8000V) is a virtual-form-factor router and is identified with `cisco_c8000v` kind in the [topology file](../topo-def-file.md).

Cisco c8000v is a successor of [Cisco CSR1000v](../kinds/vr-csr.md) and is a **different** product from [Cisco 8000](../kinds/c8000.md) platform emulator.

## Hardware resource requirements

Each c8000v node is started with 1vCPU and 4GB of RAM by default.

## Managing c8000v nodes

/// note
Cisco c8000v boots process takes around 5 minutes. To monitor boot progress:

```bash
docker logs -f <container-name/id>
```

Wait for `Startup complete in: <time>` message.
///

/// tab | SSH

`ssh admin@<node-name>`
Password: `admin`
///
/// tab | bash
to connect to a `bash` shell of a running c8000v container:

```bash
docker exec -it <container-name/id> bash
```

///

/// note
Default credentials: `admin:admin`
///

## Interface naming convention

c8000v container uses the following naming convention for its management and data interfaces:

- `eth0` - management interface connected to the containerlab management network
- `eth1` - Gi2 interface
- `eth2` - Gi3 interface and so on.

When containerlab launches c8000v node, it will set the static IPv4 address for the `eth0` interface and other interfaces will appear unset.

```
node1#sh ip int br
Interface IP-Address OK? Method Status Protocol
GigabitEthernet1 10.0.0.15 YES manual up up
GigabitEthernet2 unassigned YES unset administratively down down
```

## Features and options

### Default node configuration

It is possible to launch nodes of `cisco_c8000v` kind with a basic config or to provide a custom config file that will be used as a startup config instead.

When a node is defined without `startup-config` statement present, the node will boot with a factory config

### User defined config

With a [`startup-config`](../nodes.md#startup-config) property a user sets the path to the config file that will be mounted to a container and used as a startup-config:

```yaml
name: c8000v
topology:
nodes:
c8000:
kind: cisco_c8000v
startup-config: r1.cfg
```

When a config file is passed via `startup-config` parameter it will be used during an initial lab deployment. However, a config file that might be in the lab directory of a node takes precedence over the startup-config[^1].

## Lab examples

```yaml
name: c8000v
topology:
nodes:
node1:
kind: cisco_c8000v
image: vrnetlab/vr-c8000v:17.11.01a
node2:
kind: cisco_c8000v
image: vrnetlab/vr-c8000v:17.11.01a

links:
- endpoints: ["node1:eth1", "node2:eth1"]

```

[^1]: if startup config needs to be enforced, either deploy a lab with `--reconfigure` flag, or use [`enforce-startup-config`](../nodes.md#enforce-startup-config) setting.
2 changes: 1 addition & 1 deletion docs/manual/kinds/vr-xrv9k.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ search:

Cisco XRv9k nodes launched with containerlab come up pre-provisioned with SSH, SNMP, NETCONF and gNMI (if available) services enabled.

/// note | Resource requirements
/// admonition | Resource requirements
type: warning
XRv9k node is a resource hungry image. As of XRv9k 7.2.1 version the minimum resources should be set to 2vcpu/14GB. To be safe the defaults used in containerlab are 2vCPU/16G RAM.
Image may take 25 minutes to fully boot, be patient. You can monitor the loading status with `docker logs -f <container-name>`.
Expand Down
1 change: 1 addition & 0 deletions docs/manual/vrnetlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ The following table provides a link between the version combinations:
| `0.45.0` | [`0.12.0`](https://github.com/hellt/vrnetlab/releases/tag/v0.12.0) | Added support for Juniper vJunos-switch via [`juniper_vjunosswitch`](kinds/vr-vjunosswitch.md) kind |
| `0.49.0` | [`0.14.0`](https://github.com/hellt/vrnetlab/releases/tag/v0.14.0) | Added support for [Juniper vJunos-Evolved](kinds/vr-vjunosevolved.md), [Cisco FTDv](kinds/vr-ftdv.md), [OpenBSD](kinds/openbsd.md) |
| `0.53.0` | [`0.15.0`](https://github.com/hellt/vrnetlab/releases/tag/v0.15.0) | Added support for [Fortigate](kinds/fortinet_fortigate.md), [freebsd](kinds/freebsd.md), added lots of FP5 types to Nokia SR OS and support for external cf1/2 disks |
| `0.54.0` | [`0.16.0`](https://github.com/hellt/vrnetlab/releases/tag/v0.16.0) | Added support for Cisco c8000v |

???note "how to understand version inter-dependency between containerlab and vrnetlab?"
When new VM-based platform support is added to vrnetlab, it is usually accompanied by a new containerlab version. In this case the table row will have both containerlab and vrnetlab versions.
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ nav:
- Cisco CSR1000v: manual/kinds/vr-csr.md
- Cisco Nexus 9000v: manual/kinds/vr-n9kv.md
- Cisco 8000: manual/kinds/c8000.md
- Cisco c8000v: manual/kinds/vr-c8000v.md
- Cisco FTDv: manual/kinds/vr-ftdv.md
- Cumulus VX: manual/kinds/cvx.md
- Aruba AOS-CX: manual/kinds/vr-aoscx.md
Expand Down
102 changes: 102 additions & 0 deletions nodes/vr_c8000v/vr-c8000v.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// Copyright 2020 Nokia
// Licensed under the BSD 3-Clause License.
// SPDX-License-Identifier: BSD-3-Clause

package vr_c8000v

import (
"context"
"fmt"
"path"

log "github.com/sirupsen/logrus"
"github.com/srl-labs/containerlab/netconf"
"github.com/srl-labs/containerlab/nodes"
"github.com/srl-labs/containerlab/types"
"github.com/srl-labs/containerlab/utils"
)

var (
kindnames = []string{"cisco_c8000v"}
defaultCredentials = nodes.NewCredentials("admin", "admin")
)

const (
scrapliPlatformName = "cisco_iosxe"

configDirName = "config"
startupCfgFName = "startup-config.cfg"
)

// Register registers the node in the NodeRegistry.
func Register(r *nodes.NodeRegistry) {
r.Register(kindnames, func() nodes.Node {
return new(vrC8000v)
}, defaultCredentials)
}

type vrC8000v struct {
nodes.DefaultNode
}

func (n *vrC8000v) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {
// Init DefaultNode
n.DefaultNode = *nodes.NewDefaultNode(n)
// set virtualization requirement
n.HostRequirements.VirtRequired = true

n.Cfg = cfg
for _, o := range opts {
o(n)
}
// env vars are used to set launch.py arguments in vrnetlab container
defEnv := map[string]string{
"CONNECTION_MODE": nodes.VrDefConnMode,
"USERNAME": defaultCredentials.GetUsername(),
"PASSWORD": defaultCredentials.GetPassword(),
"DOCKER_NET_V4_ADDR": n.Mgmt.IPv4Subnet,
"DOCKER_NET_V6_ADDR": n.Mgmt.IPv6Subnet,
}
n.Cfg.Env = utils.MergeStringMaps(defEnv, n.Cfg.Env)

// mount config dir to support startup-config functionality
n.Cfg.Binds = append(n.Cfg.Binds, fmt.Sprint(path.Join(n.Cfg.LabDir, configDirName), ":/config"))

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

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

return nil
}

func (s *vrC8000v) PreDeploy(_ context.Context, params *nodes.PreDeployParams) error {
utils.CreateDirectory(s.Cfg.LabDir, 0777)
_, err := s.LoadOrGenerateCertificate(params.Cert, params.TopologyName)
if err != nil {
return nil
}
return nodes.LoadStartupConfigFileVr(s, configDirName, startupCfgFName)
}

func (n *vrC8000v) SaveConfig(_ context.Context) error {
err := netconf.SaveConfig(n.Cfg.LongName,
defaultCredentials.GetUsername(),
defaultCredentials.GetPassword(),
scrapliPlatformName,
)
if err != nil {
return err
}

log.Infof("saved %s running configuration to startup configuration file\n", n.Cfg.ShortName)
return nil
}

// CheckInterfaceName checks if a name of the interface referenced in the topology file correct.
func (n *vrC8000v) CheckInterfaceName() error {
return nodes.GenericVMInterfaceCheck(n.Cfg.ShortName, n.Endpoints)
}
4 changes: 4 additions & 0 deletions schemas/clab.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"cisco_xrd",
"c8000",
"cisco_c8000",
"cisco_c8000v",
"cvx",
"cumulus_cvx",
"openbsd",
Expand Down Expand Up @@ -977,6 +978,9 @@
"c8000": {
"$ref": "#/definitions/node-config"
},
"c8000v": {
"$ref": "#/definitions/node-config"
},
"cvx": {
"$ref": "#/definitions/node-config"
},
Expand Down

0 comments on commit 9b47e3a

Please sign in to comment.