https://github.com/mweisel/cisco-iosxrv-vagrant-libvirt
A procedure for creating a Cisco IOS XRv Vagrant box for the libvirt provider.
https://github.com/mweisel/cisco-iosxrv-vagrant-libvirt
cisco-ios-xr libvirt-provider vagrant-box
Last synced: 3 months ago
JSON representation
A procedure for creating a Cisco IOS XRv Vagrant box for the libvirt provider.
- Host: GitHub
- URL: https://github.com/mweisel/cisco-iosxrv-vagrant-libvirt
- Owner: mweisel
- License: mit
- Created: 2019-12-30T22:15:41.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-23T19:38:51.000Z (about 4 years ago)
- Last Synced: 2024-03-22T23:46:50.431Z (about 1 year ago)
- Topics: cisco-ios-xr, libvirt-provider, vagrant-box
- Language: Shell
- Homepage:
- Size: 18.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cisco IOS XRv Vagrant box
A procedure for creating a Cisco IOS XRv Vagrant box for the [libvirt](https://libvirt.org) provider.
## Prerequisites
* [Cisco Modeling Labs - Personal](https://learningnetworkstore.cisco.com/cisco-modeling-labs-personal) subscription
* [Git](https://git-scm.com)
* [Python](https://www.python.org)
* [Ansible](https://docs.ansible.com/ansible/latest/index.html) >= 2.7
* [libvirt](https://libvirt.org) with client tools
* [QEMU](https://www.qemu.org)
* [Expect](https://en.wikipedia.org/wiki/Expect)
* [sshpass](https://linux.die.net/man/1/sshpass)
* [Telnet](https://en.wikipedia.org/wiki/Telnet)
* [Vagrant](https://www.vagrantup.com) >= 2.2.10
* [vagrant-libvirt](https://github.com/vagrant-libvirt/vagrant-libvirt)> Vagrant version **2.2.16** introduced a bug that *breaks* SSH connectivity - [#12344](https://github.com/hashicorp/vagrant/issues/12344)
## Steps
0\. Verify the prerequisite tools are installed.
$ which git python ansible libvirtd virsh qemu-system-x86_64 expect sshpass telnet vagrant
$ vagrant plugin list
vagrant-libvirt (0.4.1, global)1\. Log in and download the CML-P reference platform ISO file to your `Downloads` directory.
2\. Create a mount point directory.
$ sudo mkdir -p /mnt/iso3\. Mount the ISO file.
$ cd $HOME/Downloads
$ sudo mount -o loop refplat-20201110-fcs.iso /mnt/iso4\. Copy (and rename) the Cisco IOS XRv disk image file to the `/var/lib/libvirt/images` directory.
$ sudo cp /mnt/iso/virl-base-images/iosxrv-6-3-1/iosxrv-k9-demo-6.3.1.qcow2 /var/lib/libvirt/images/cisco-iosxrv.qcow25\. Unmount the ISO file.
$ sudo umount /mnt/iso6\. Modify the file ownership and permissions. Note the owner may differ between Linux distributions.
> Ubuntu 18.04
$ sudo chown libvirt-qemu:kvm /var/lib/libvirt/images/cisco-iosxrv.qcow2
$ sudo chmod u+x /var/lib/libvirt/images/cisco-iosxrv.qcow2> Arch Linux
$ sudo chown nobody:kvm /var/lib/libvirt/images/cisco-iosxrv.qcow2
$ sudo chmod u+x /var/lib/libvirt/images/cisco-iosxrv.qcow27\. Create the `boxes` directory.
$ mkdir -p $HOME/boxes8\. Start the `vagrant-libvirt` network (if not already started).
$ virsh -c qemu:///system net-list
$ virsh -c qemu:///system net-start vagrant-libvirt9\. Clone this GitHub repo and _cd_ into the directory.
$ git clone https://github.com/mweisel/cisco-iosxrv-vagrant-libvirt
$ cd cisco-iosxrv-vagrant-libvirt10\. Run the Ansible playbook.
$ ansible-playbook main.yml11\. Copy (and rename) the Vagrant box artifact to the `boxes` directory.
$ cp cisco-iosxrv.box $HOME/boxes/cisco-iosxrv-631.box12\. Copy the box metadata file to the `boxes` directory.
$ cp ./files/cisco-iosxrv.json $HOME/boxes/13\. Change the current working directory to `boxes`.
$ cd $HOME/boxes14\. Substitute the `HOME` placeholder string in the box metadata file.
$ awk '/url/{gsub(/^ */,"");print}' cisco-iosxrv.json
"url": "file://HOME/boxes/cisco-iosxrv-631.box"$ sed -i "s|HOME|${HOME}|" cisco-iosxrv.json
$ awk '/url/{gsub(/^ */,"");print}' cisco-iosxrv.json
"url": "file:///home/marc/boxes/cisco-iosxrv-631.box"15\. Add the Vagrant box to the local inventory.
$ vagrant box add cisco-iosxrv.json## Debug
View the telnet session output for the `expect` task:
$ tail -f ~/iosxrv-console.explog## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details