hellt / vrnetlab

Make VM-based Network OSes run in Containerlab
https://containerlab.dev
MIT License
129 stars 88 forks source link

Initial support for Nokia Mag-C CMG Linux. #216

Closed gusman closed 4 months ago

gusman commented 4 months ago

Introduction

CMG Linux is utilized as a DB VM as one of Nokia MAG-C VMs. The image of CMG Linux is released in qcow2 format. Since some of MAG-C tools in CMG Linux are written with systemd or systemctl utilization, then CMG Linux cannot be containerized because docker does not run systemd inside the container. Given this reasoning, the approach to containerized CMG Linux is to create a container to run a CMG Linux VM in the same way Vrnetlab has done.

Config Drive setup

Without config_drive binding

Initial config is carried out via cloud-init. By default CMG-Linux boots by using a pre-defined cloud-init config drive.

With config_drive binding

Custom configuration can be added by binding the local config_drive directory to /config_drive directory in the container. The accepted structure of config_driveis shown below. Any other directories or files not specified below are ignored.

config_drive/
└── openstack/
    ├── latest/
    │   ├── meta_data.json
    │   └── user_data
    └── content/
        ├── 0000 (referenced content files)
        ├── 0001
        └── ....

The internal launch.py script also modifies the content of user_data to add clabas default user with password clab@123. Moreover, it also modifies user_data to configure the management network interface.

Example containerlab topology

name: test_cmglinux
prefix: __lab-name
topology:
  nodes:
    cmg-1:
      kind: generic_vm
      image: vrnetlab/vr-cmglinux:24.3.R3
      binds:
        - config_drive_cmg1:/config_drive
    cmg-2:
      kind: generic_vm
      image: vrnetlab/vr-cmglinux:24.3.R1
      binds:
        - config_drive_cmg2:/config_drive
    alpine:
      kind: linux
      image: alpine:dev
  links:
  - endpoints:
      - cmg-1:eth1
      - alpine:eth1
  - endpoints:
      - cmg-1:eth2
      - alpine:eth2
  - endpoints:
      - cmg-1:eth3
      - alpine:eth3
  - endpoints:
      - cmg-2:eth1
      - alpine:eth4
  - endpoints:
      - cmg-2:eth2
      - alpine:eth5
hellt commented 4 months ago

thanks @gusman !