Skip to content

Instantly share code, notes, and snippets.

@hellt
Last active March 5, 2021 14:03
Show Gist options
  • Save hellt/0fc6395b20ae31eabe459825fba48d37 to your computer and use it in GitHub Desktop.
Save hellt/0fc6395b20ae31eabe459825fba48d37 to your computer and use it in GitHub Desktop.
sros bootstrap

Documentation

SR OS documentation can be fetched from this handy site: https://bit.ly/iondoc Open the 7750 section and choose the needed version.

Documents which require login are marked with "key" icon. The rest can be opened by anyone.

vSIM installation guide provides the details on how to launch virtualized SR OS and its configuration options.

Create disk images

To save on disk space the guide uses libvirt backing store technique, which allows a user to use a common disk image for every guest and each gues will have its own disk image with deltas only.

If the SR OS qcow2 disk image is located at var/sros.qcow2 then the following command will create a snapshot of the original disk image for R1 router that we will start later on.

# sros.qcow2 - original disk image you got from Nokia rep.
# r1.qcow2 - snapshot that using hda.qcow2 as a backing image
qemu-img create -f qcow2 -b /var/sros.qcow2 /var/lib/libvirt/images/r1test/r1.qcow2

The r1.qcow2 disk image will be referenced in the R1 VM that we about to define and start.

Create the R1 domain definition file using the template

<domain type="kvm">
  <name>R1</name> <!-- Name of the virtual machine -->
  <uuid>85f24527-c381-450e-9268-92441835ad7f</uuid> <!-- VM UUID must match the one in license file -->
  <memory unit='KiB'>6194304</memory>
  <currentMemory unit='KiB'>6194304</currentMemory>
  <vcpu current="2">2</vcpu>
  <sysinfo type='smbios'>
    <system>
      <entry name="product">TiMOS: slot=A chassis=sr-1s card=cpm-1s slot=1 card=xcm-1s mda/1=s36-100gb-qsfp28 license-file=cf3:/lic.txt</entry>
    </system>
  </sysinfo>
  <os>
    <type arch="x86_64" machine="pc">hvm</type>
    <smbios mode="sysinfo"/>
  </os>
  <cpu mode='host-passthrough'/>
  <clock offset="utc">
    <timer name="pit" tickpolicy="delay"/>
    <timer name="rtc" tickpolicy="delay"/>
  </clock>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator> <!-- qemu path. On RHEL-based:/usr/libexec/qemu-kvm On Deb based: /usr/bin/qemu-system-x86_64 -->
    <!-- DISK CONFIG -->
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/var/lib/libvirt/images/r1test/r1.qcow2'/> <!-- path to the disk image we created before -->
      <target dev='hda' bus='virtio'/>
    </disk>
    <!-- INTERFACES CONFIG -->
    <interface type='bridge'>  <!-- first interface is a management OOB interface (BOF) -->
      <source bridge='pnet0'/>
      <model type='virtio'/>
    </interface>
    <interface type='bridge'>  <!-- starting from 2nd interface are the data ports -->
      <source bridge='pnet1'/>
      <model type='virtio'/>
    </interface>
    <console type='pty' tty='/dev/pts/1'>
      <source path='/dev/pts/1'/>
    </console>
  </devices>
  <seclabel type="none"/>
</domain>

Adding a license to the base image

Download the license file and save it on the local disk under lic.txt name. Copy in the license to the base qcow2 image, so that license will be there once the image starts.

guestfish --rw -a /var/sros.qcow2 -m /dev/sda1 copy-in lic.txt /

It is possible to skip this step, and add the license contents manually once the node finishes its boot sequence. Adding a file with guestfish, though, is easier.

Define and launch virsh domain

virsh define r1.xml
virsh start R1
virsh console R1

The equivalent qemu string for that domain will be:

/usr/bin/qemu-system-x86_64 -name R1 -S -machine pc-i440fx-2.5,accel=kvm,usb=off -cpu host -m 6050 -realtime mlock=off -smp 2,sockets=2,cores=1,threads=1 -uuid 85f24527-c381-450e-9268-92441835ad7f -smbios type=1,product=TiMOS: slot=A chassis=sr-1s card=cpm-1s slot=1 card=xcm-1s mda/1=s36-100gb-qsfp28 license-file=cf3:/lic.txt -nographic -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-R1/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -global kvm-pit.lost_tick_policy=discard -no-shutdown -boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/var/lib/libvirt/images/r1test/r1.qcow2,format=qcow2,if=none,id=drive-virtio-disk0,cache=none -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,fd=26,id=hostnet0,vhost=on,vhostfd=28 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:17:67:c7,bus=pci.0,addr=0x2 -netdev tap,fd=29,id=hostnet1,vhost=on,vhostfd=30 -device virtio-net-pci,netdev=hostnet1,id=net1,mac=52:54:00:7d:c5:3f,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -msg timestamp=on

Provision the SR OS

Once the image has started login to the SR OS (admin:admin) and verify that the license has been applied succesfully:

show system license

===============================================================================
System License
===============================================================================
License status : monitoring, valid license record
Time remaining : 90 days 5 hours
-------------------------------------------------------------------------------
License name   : NOKIA
License uuid   : 85f24527-xxxx-450e-xxxx-92441835ad7f
Machine uuid   : 85f24527-xxxx-450e-xxxx-92441835ad7f
License desc   : 
License prod   : Virtual-SIM
License sros   : TiMOS-[BC]-20.*
Current date   : TUE JUL 07 19:45:52 UTC 2020
Issue   date   : TUE JUL 07 14:30:55 UTC 2020
Start   date   : n/a
End     date   : MON OCT 05 23:59:59 UTC 2020
===============================================================================

The SR OS is ready to be used!

Provisioning the management interface

To configure IP address of the management interface do the following:

bof address 10.0.0.1/24 "active"
bof save

if needed, static routes can be configured in the management VRF with

bof static-route 172.17.0.0/16 next-hop 10.0.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment