Skip to content

Commit

Permalink
Huawei n40e (#2197)
Browse files Browse the repository at this point in the history
* format

* add huawei_n40e

* rename to huawei vrp

* added startup docs

* added more docs
  • Loading branch information
hellt authored Oct 14, 2024
1 parent 37a111e commit 7c511e0
Show file tree
Hide file tree
Showing 15 changed files with 298 additions and 92 deletions.
2 changes: 1 addition & 1 deletion .mk/lint.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GOFUMPT_CMD := docker run --rm -it -e GOFUMPT_SPLIT_LONG_LINES=on -v $(CURDIR):/work ghcr.io/hellt/gofumpt:0.3.1
GOFUMPT_CMD := docker run --rm -it -e GOFUMPT_SPLIT_LONG_LINES=on -v $(CURDIR):/work ghcr.io/hellt/gofumpt:v0.7.0
GOFUMPT_FLAGS := -l -w .

GODOT_CMD := docker run --rm -it -v $(CURDIR):/work ghcr.io/hellt/godot:1.4.11
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ In addition to native containerized NOSes, containerlab can launch traditional v
* [Check Point Cloudguard](https://containerlab.dev/manual/kinds/checkpoint_cloudguard/)
* [Fortinet Fortigate](https://containerlab.dev/manual/kinds/fortinet_fortigate/)
* [Aruba AOS-CX](https://containerlab.dev/manual/kinds/vr-aoscx)
* [Huawei VRP](https://containerlab.dev/manual/kinds/huawei_vrp)
* [OpenBSD](https://containerlab.dev/manual/kinds/openbsd)
* [FreeBSD](https://containerlab.dev/manual/kinds/freebsd)

Expand Down
19 changes: 10 additions & 9 deletions clab/config/transport/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ func NewSSHTransport(node *types.NodeConfig, options ...SSHTransportOption) (*SS

// InChannel creates the channel reading the SSH connection.
//
// The first prompt is saved in LoginMessages
// # The first prompt is saved in LoginMessages
//
// - The channel read the SSH session, splits on PromptChar
// - Uses SSHKind's PromptParse to split the received data in *result* and *prompt* parts
// (if no valid prompt was found, prompt will simply be empty and result contain all the data)
// - Emit data.
// - The channel read the SSH session, splits on PromptChar
// - Uses SSHKind's PromptParse to split the received data in *result* and *prompt* parts
// (if no valid prompt was found, prompt will simply be empty and result contain all the data)
// - Emit data.
func (t *SSHTransport) InChannel() {
// Ensure we have a working channel
t.in = make(chan SSHReply)
Expand Down Expand Up @@ -370,10 +370,11 @@ func (ses *SSHSession) Close() {
}

// LogString will include the entire SSHReply
// Each field will be prefixed by a character.
// # - command sent
// | - result received
// ? - prompt part of the result
//
// Each field will be prefixed by a character.
// # - command sent
// | - result received
// ? - prompt part of the result
func (r *SSHReply) LogString(node string, linefeed, debug bool) string { // skipcq: RVV-A0005
ind := 12 + len(node)
prefix := "\n" + strings.Repeat(" ", ind)
Expand Down
1 change: 0 additions & 1 deletion clab/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func (c *CLab) GenerateInventories() error {
}

err = c.generateAnsibleInventory(f)

if err != nil {
return err
}
Expand Down
4 changes: 3 additions & 1 deletion clab/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import (
checkpoint_cloudguard "github.com/srl-labs/containerlab/nodes/checkpoint_cloudguard"
crpd "github.com/srl-labs/containerlab/nodes/crpd"
cvx "github.com/srl-labs/containerlab/nodes/cvx"
"github.com/srl-labs/containerlab/nodes/dell_sonic"
dell_sonic "github.com/srl-labs/containerlab/nodes/dell_sonic"
ext_container "github.com/srl-labs/containerlab/nodes/ext_container"
fortinet_fortigate "github.com/srl-labs/containerlab/nodes/fortinet_fortigate"
generic_vm "github.com/srl-labs/containerlab/nodes/generic_vm"
host "github.com/srl-labs/containerlab/nodes/host"
huawei_vrp "github.com/srl-labs/containerlab/nodes/huawei_vrp"
cisco_iol "github.com/srl-labs/containerlab/nodes/iol"
ipinfusion_ocnos "github.com/srl-labs/containerlab/nodes/ipinfusion_ocnos"
k8s_kind "github.com/srl-labs/containerlab/nodes/k8s_kind"
Expand Down Expand Up @@ -95,4 +96,5 @@ func (c *CLab) RegisterNodes() {
border0.Register(c.Reg)
k8s_kind.Register(c.Reg)
cisco_iol.Register(c.Reg)
huawei_vrp.Register(c.Reg)
}
6 changes: 4 additions & 2 deletions cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ import (
var mgmtNetName string

// IPv4/6 address range for container management network.
var mgmtIPv4Subnet net.IPNet
var mgmtIPv6Subnet net.IPNet
var (
mgmtIPv4Subnet net.IPNet
mgmtIPv6Subnet net.IPNet
)

// reconfigure flag.
var reconfigure bool
Expand Down
1 change: 0 additions & 1 deletion cmd/vxlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ var vxlanDeleteCmd = &cobra.Command{
var err error

ls, err = utils.GetLinksByNamePrefix(delPrefix)

if err != nil {
return err
}
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ In addition to native containerized NOSes, containerlab can launch traditional v
* [Check Point Cloudguard](manual/kinds/checkpoint_cloudguard.md)
* [Fortinet Fortigate](manual/kinds/fortinet_fortigate.md)
* [Aruba AOS-CX](manual/kinds/vr-aoscx.md)
* [Huawei VRP](manual/kinds/huawei_vrp.md)
* [OpenBSD](manual/kinds/openbsd.md)
* [FreeBSD](manual/kinds/freebsd.md)
* [SONiC](manual/kinds/sonic-vm.md)
Expand Down
88 changes: 88 additions & 0 deletions docs/manual/kinds/huawei_vrp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
search:
boost: 4
kind_code_name: huawei_vrp
kind_display_name: Huawei VRP
---
# [[[ kind_display_name ]]]

[[[ kind_display_name ]]] virtualized router is identified with `[[[ kind_code_name ]]]` 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.

[[[ kind_display_name ]]] currently supports Huawei N40e and CE12800 variants, the same kind value - `[[[ kind_code_name ]]]` - is used for both.

[[[ kind_display_name ]]] nodes launched with containerlab comes up pre-provisioned with SSH, NETCONF services enabled.

## Managing [[[ kind_display_name ]]] nodes

/// note
Containers with [[[ kind_display_name ]]] inside will take ~3min to fully boot without a startup config file. And ~5-7 minute if the startup config file is provided, since a node will undergo a reboot.
You can monitor the progress with `docker logs -f <container-name>`.
///

[[[ kind_display_name ]]] node launched with containerlab can be managed via the following interfaces:

/// tab | CLI
to connect to the [[[ kind_display_name ]]] CLI

```bash
ssh admin@<container-name/id>
```

///
/// tab | bash
to connect to a `bash` shell of a running [[[ kind_display_name ]]] container:

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

///

/// tab | NETCONF
NETCONF server is running over port 830

```bash
ssh admin@<container-name> -p 830 -s netconf
```

///

## Credentials

Default user credentials: `admin:admin`

## Interface naming

The example ports above would be mapped to the following Linux interfaces inside the container running the [[[ kind_display_name ]]] VM:

* `eth0` - management interface connected to the containerlab management network (rendered as `GigabitEthernet0/0/0` in the VRP config)
* `eth1` - first data interface, mapped to the first data port of the VM (rendered as `Ethernet1/0/0`)
* `eth2+` - second and subsequent data interfaces, mapped to the second and subsequent data ports of the VM (rendered as `Ethernet1/0/1` and so on)

When containerlab launches [[[ kind_display_name ]]] node the management interface of the VM gets assigned `10.0.0.15/24` address from the QEMU DHCP server. This interface is transparently stitched with container's `eth0` interface such that users can reach the management plane of the [[[ kind_display_name ]]] using containerlab's assigned IP.

Data interfaces `Ethernet1/0/0+` need to be configured with IP addressing manually using CLI or other available management interfaces.

## Features and options

### Node configuration

[[[ kind_display_name ]]] nodes come up with a basic configuration where only `admin` user and management interfaces such as SSH and NETCONF provisioned.

#### Startup configuration

It is possible to make [[[ kind_display_name ]]] nodes boot up with a user-defined startup-config instead of a built-in one. With a [`startup-config`](../nodes.md#startup-config) property of the node/kind user sets the path to the config file that will be mounted to a container and used as a startup-config:

```yaml
topology:
nodes:
node:
kind: [[[ kind_code_name ]]]
startup-config: myconfig.txt
```
With this knob containerlab is instructed to take a file `myconfig.txt` from the directory that hosts the topology file, and copy it to the lab directory for that specific node under the `/config/startup-config.cfg` name. Then the directory that hosts the startup-config dir is mounted to the container. This will result in this config being applied at startup by the node.

Configuration is applied after the node is started, thus it can contain both partial configuration snippets that you desire to add on top of the default config that a node boots up with as well as the full configuration extracted from the VRP.

When startup config is provided the node will undergo a reboot cycle after applying the bootstrap config, thus the startup time will be twice as long as the node boots up without a config.
89 changes: 47 additions & 42 deletions docs/manual/kinds/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ name: srlceos01
topology:
nodes:
node1:
kind: nokia_srlinux # node1 is of srl kind
# node1 is of nokia_srlinux kind
kind: nokia_srlinux
type: ixrd2l
image: ghcr.io/nokia/srlinux
node2:
kind: ceos # node2 is of ceos kind
# node2 is of ceos kind
kind: arista_ceos
image: ceos:4.32.0F

links:
Expand All @@ -31,45 +33,48 @@ Containerlab supports a fixed number of platforms. Most platforms are identified

Within each predefined kind, we store the necessary information that is used to successfully launch the container. The following kinds are supported by containerlab:

| Name | Short/Long kind name | Status | Packaging |
| -------------------------- | --------------------------------------------------------------- | --------- | :-------: |
| **Nokia SR Linux** | [`srl/nokia_srlinux`](srl.md) | supported | container |
| **Nokia SR OS** | [`vr-sros/nokia_sros`](vr-sros.md) | supported | VM |
| **Arista cEOS** | [`ceos/arista_ceos`](ceos.md) | supported | container |
| **Arista vEOS** | [`vr-veos/vr-arista_veos`](vr-veos.md) | supported | VM |
| **Juniper cRPD** | [`crpd/juniper_crpd`](crpd.md) | supported | container |
| **Juniper vMX** | [`vr-vmx/vr-juniper_vmx`](vr-vmx.md) | supported | VM |
| **Juniper vQFX** | [`vr-vqfx/vr-juniper_vqfx`](vr-vqfx.md) | supported | VM |
| **Juniper vSRX** | [`vr-vsrx/vr-juniper_vsrx`](vr-vsrx.md) | supported | VM |
| **Juniper vJunos-router** | [`vr-vjunosrouter/juniper_vjunosrouter`](vr-vjunosrouter.md) | supported | VM |
| **Juniper vJunos-switch** | [`vr-vjunosswitch/juniper_vjunosswitch`](vr-vjunosswitch.md) | supported | VM |
| **Juniper vJunosEvolved** | [`vr-vjunosevolved/juniper_vjunosevolved`](vr-vjunosevolved.md) | supported | VM |
| **Cisco XRd** | [`xrd/cisco_xrd`](xrd.md) | supported | container |
| **Cisco XRv9k** | [`vr-xrv9k/vr-cisco_xrv9k`](vr-xrv9k.md) | supported | VM |
| **Cisco XRv** | [`vr-xrv/vr-cisco_xrv`](vr-xrv.md) | supported | VM |
| **Cisco CSR1000v** | [`vr-csr/vr-cisco_csr1000v`](vr-csr.md) | supported | VM |
| **Cisco Nexus 9000v** | [`vr-n9kv/vr-cisco_n9kv`](vr-n9kv.md) | supported | VM |
| **Cisco 8000** | [`c8000/cisco_c8000`](c8000.md) | supported | VM+ |
| **Cisco Catalyst 9000v** | [`cat9kv/vr-cisco_cat9kv`](vr-cat9kv.md) | supported | VM |
| **Cisco IOL** | [`cisco_iol`](cisco_iol.md) | supported | container |
| **Cisco FTDv** | [`cisco_ftdv`](vr-ftdv.md) | supported | VM |
| **Cumulus VX** | [`cvx/cumulus_cvx`](cvx.md) | supported | container |
| **Aruba ArubaOS-CX** | [`vr-aoscx/vr-aruba_aoscx`](vr-aoscx.md) | supported | VM |
| **SONiC** | [`sonic`](sonic-vs.md) | supported | container |
| **Dell FTOS10v** | [`vr-ftosv/vr-dell_ftos`](vr-ftosv.md) | supported | VM |
| **Mikrotik RouterOS** | [`vr-ros/vr-mikrotik_ros`](vr-ros.md) | supported | VM |
| **IPInfusion OcNOS** | [`ipinfusion_ocnos`](ipinfusion-ocnos.md) | supported | VM |
| **OpenBSD** | [`openbsd`](openbsd.md) | supported | VM |
| **Keysight ixia-c-one** | [`keysight_ixia-c-one`](keysight_ixia-c-one.md) | supported | container |
| **Ostinato** | [`linux`](ostinato.md) | supported | container |
| **Check Point Cloudguard** | [`checkpoint_cloudguard`](checkpoint_cloudguard.md) | supported | VM |
| **Fortinet Fortigate** | [`fortinet_fortigate`](fortinet_fortigate.md) | supported | VM |
| **Palo Alto PAN** | [`vr-panos/vr-paloalto_panos`](vr-pan.md) | supported | VM |
| **Linux bridge** | [`bridge`](bridge.md) | supported | N/A |
| **Linux container** | [`linux`](linux.md) | supported | container |
| **RARE/freeRtr** | [`rare`](rare-freertr.md) | supported | container |
| **Openvswitch bridge** | [`ovs-bridge`](ovs-bridge.md) | supported | N/A |
| **External container** | [`ext-container`](ext-container.md) | supported | container |
| **Host** | [`host`](host.md) | supported | N/A |
| Name | Short/Long kind name | Status | Packaging |
| -------------------------- | --------------------------------------------------- | --------- | :-------: |
| **Nokia SR Linux** | [`nokia_srlinux`](srl.md) | supported | container |
| **Nokia SR OS** | [`nokia_sros`](vr-sros.md) | supported | VM |
| **Arista cEOS** | [`arista_ceos`](ceos.md) | supported | container |
| **Arista vEOS** | [`arista_veos`](vr-veos.md) | supported | VM |
| **Juniper cRPD** | [`juniper_crpd`](crpd.md) | supported | container |
| **Juniper vMX** | [`juniper_vmx`](vr-vmx.md) | supported | VM |
| **Juniper vQFX** | [`juniper_vqfx`](vr-vqfx.md) | supported | VM |
| **Juniper vSRX** | [`juniper_vsrx`](vr-vsrx.md) | supported | VM |
| **Juniper vJunos-router** | [`juniper_vjunosrouter`](vr-vjunosrouter.md) | supported | VM |
| **Juniper vJunos-switch** | [`juniper_vjunosswitch`](vr-vjunosswitch.md) | supported | VM |
| **Juniper vJunosEvolved** | [`juniper_vjunosevolved`](vr-vjunosevolved.md) | supported | VM |
| **Cisco XRd** | [`cisco_xrd`](xrd.md) | supported | container |
| **Cisco XRv9k** | [`cisco_xrv9k`](vr-xrv9k.md) | supported | VM |
| **Cisco XRv** | [`cisco_xrv`](vr-xrv.md) | supported | VM |
| **Cisco CSR1000v** | [`cisco_csr1000v`](vr-csr.md) | supported | VM |
| **Cisco Nexus 9000v** | [`cisco_n9kv`](vr-n9kv.md) | supported | VM |
| **Cisco 8000** | [`cisco_c8000`](c8000.md) | supported | VM+ |
| **Cisco Catalyst 9000v** | [`cisco_cat9kv`](vr-cat9kv.md) | supported | VM |
| **Cisco IOL** | [`cisco_iol`](cisco_iol.md) | supported | container |
| **Cisco FTDv** | [`cisco_ftdv`](vr-ftdv.md) | supported | VM |
| **Cumulus VX** | [`cumulus_cvx`](cvx.md) | supported | container |
| **Aruba ArubaOS-CX** | [`aruba_aoscx`](vr-aoscx.md) | supported | VM |
| **SONiC** | [`sonic`](sonic-vs.md) | supported | container |
| **SONiC VM** | [`sonic_vm`](sonic-vm.md) | supported | VM |
| **Dell FTOS10v** | [`dell_ftos`](vr-ftosv.md) | supported | VM |
| **Dell SONiC** | [`dell_sonic`](dell_sonic.md) | supported | VM |
| **Mikrotik RouterOS** | [`mikrotik_ros`](vr-ros.md) | supported | VM |
| **Huawei VRP** | [`huawei_vrp`](huawei_vrp.md) | supported | VM |
| **IPInfusion OcNOS** | [`ipinfusion_ocnos`](ipinfusion-ocnos.md) | supported | VM |
| **OpenBSD** | [`openbsd`](openbsd.md) | supported | VM |
| **Keysight ixia-c-one** | [`keysight_ixia-c-one`](keysight_ixia-c-one.md) | supported | container |
| **Ostinato** | [`linux`](ostinato.md) | supported | container |
| **Check Point Cloudguard** | [`checkpoint_cloudguard`](checkpoint_cloudguard.md) | supported | VM |
| **Fortinet Fortigate** | [`fortinet_fortigate`](fortinet_fortigate.md) | supported | VM |
| **Palo Alto PAN** | [`paloalto_panos`](vr-pan.md) | supported | VM |
| **Linux bridge** | [`bridge`](bridge.md) | supported | N/A |
| **Linux container** | [`linux`](linux.md) | supported | container |
| **RARE/freeRtr** | [`rare`](rare-freertr.md) | supported | container |
| **Openvswitch bridge** | [`ovs-bridge`](ovs-bridge.md) | supported | N/A |
| **External container** | [`ext-container`](ext-container.md) | supported | container |
| **Host** | [`host`](host.md) | supported | N/A |

Refer to a specific kind documentation article for kind-specific details.
Loading

0 comments on commit 7c511e0

Please sign in to comment.