User Tools

Site Tools


virtualization:containerlab

This is an old revision of the document!


RUN NETLAB INSTANCE IN OCI CLOUD

  • Create the instance in OCI. Use the following shape. It doesn't consume credit when turned off.




  • Add the public ssh key
  • connect to the instance. USer is 'ubuntu', you can find it the 'Instance access' in OCI instance section.
  • Follow the ubuntu server installation: External Link
  • Create a folder for images and upload cEOS
mkdir images
scp cEOS-lab-4.28.1F.tar.xz ubuntu@x.x.x.x:/home/ubuntu/images/cEOS-lab-4.28.1F.tar.xz
sudo docker import ../images/cEOS-lab-4.28.1F.tar.xz ceos:4.28.1F
sudo docker image ls    # verify the image is there and the TAG is correct
alias c='netlab connect'

create a simple topology file. This is an example but be sure the ceos version corresponds to the one we imported. In our case ceos:4.28.1F

netlab up
sudo
sudo containerlab destroy -t clab.yml
netlab up    # and configuration will be persistent

LIFECYCLE NETLAB PROJECT - CONTAINERLAB
! First use

netlab create ./topology.yml
containerlab deploy -t clab.yml
netlab initial
! work on the lab, saving all work with 'wr mem'
containerlab destroy -t clab.yml

! here I come back to work on the lab

containerlab deploy -t clab.yml
! work on the lab, saving all work with 'wr mem'
containerlab destroy -t clab.yml

To run containerlab in its simplest way, we just define the topology file (clab.yml) and the we start it with:

containerlab deploy --topo clab.yml
docker ps -q | xargs -n 1 docker inspect --format '{{ .Name }} {{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' | sed 's#^/##';    # This just to show/remember the mgmt IPs
With docker run -it I connect to the container itself
ssh admin@the-ip , you connect to vEOS
containerlab destroy --topo evpn-multivendor.yml

For the topology file syntax we resource to the lab-examples


Create lab for containerized Arista EOS (ceos):

! FIRST, WE INSTALL ALL REQUIRED COMPONENTS
! all under root
! Download the ceos image
sudo apt install python3-pip -y 
sudo python3 -m pip install netsim-tools
! install docker engine
sudo docker import cEOS-lab-4.27.0F.tar ceos:4.27.0F
netlab install ubuntu ansible containerlab
# bash -c "$(curl -sL https://get-clab.srlinux.dev)"    # this installs containerlab
# export PATH="netsim-tools:$PATH"
# source <(containerlab completion bash)
!
! HERE TO CREATE OUR SPECIFIC LAB (we defined in our new topology file)
netlab create ./topology.yml    # topology to have " defaults.devices.eos.clab.image: ceos:4.27.0F "
containerlab deploy -t clab.yml
netlab initial
!
netlab connect dis01
! we modify the lab here. Then we save it as below. Contents in 'config' folder (.cfg files)
netlab collect
netlab down
!
! TO GO BACK TO THE LAB WE HAVE BEEN WORKING ON. Basically creates the cEOS instances again and pushes the configuration you saved before via ansible
containerlab deploy -t clab.yml
sed -i 's/interface Management1/interface Management0/g' config/*    # solves issues with config push between vEOS > cEOS
netlab initial
ansible-playbook -i hosts.yml pusheos.yml
!
! pusheos.yml is a simple ansible playbook to push the configurations:
---
- hosts: eos
  gather_facts: True
  tasks:
    - name: load configuration from files
      eos_config:
        src: config/{{inventory_hostname}}.cfg
!! END

Create lab for FRR:

! all under root
sudo apt install python3-pip -y 
sudo python3 -m pip install netsim-tools
! install docker engine
netlab install ubuntu ansible
bash -c "$(curl -sL https://get-clab.srlinux.dev)"
export PATH="netsim-tools:$PATH"
source <(containerlab completion bash)
! Add the topology file with provider: clab and device: frr
netlab create ./topology.yml
containerlab deploy -t clab.yml
! If issues starting, do this https://jtechclass.com/containerlab-the-future-of-your-virtual-network-lab-part-2/
netlab initial
netlab connect dis01
netlab down

Create lab for Aristas EOS (vr-veos (vm in container)):

git clone https://github.com/hellt/vrnetlab && cd vrnetlab
git checkout v0.2.3
cat README.md
!
netlab create ./topology.yml
! change 
    kind: vr-veos
    image: vrnetlab/vr-veos:4.27.0F
!
containerlab deploy -t clab.yml
docker logs -f clab-netsim-project-d-dis51 ! to follow the booting

* [[https://containerlab.srlinux.dev/manual/kinds/vr-veos/]]

virtualization/containerlab.1677586066.txt.gz · Last modified: (external edit) · Currently locked by: 216.73.216.48