https://github.com/mweisel/cisco-catalyst-8kv-vagrant-libvirt
A procedure for creating a Cisco Catalyst 8000V Vagrant box for the libvirt provider.
https://github.com/mweisel/cisco-catalyst-8kv-vagrant-libvirt
cisco-ios-xe libvirt-provider vagrant-box
Last synced: over 1 year ago
JSON representation
A procedure for creating a Cisco Catalyst 8000V Vagrant box for the libvirt provider.
- Host: GitHub
- URL: https://github.com/mweisel/cisco-catalyst-8kv-vagrant-libvirt
- Owner: mweisel
- License: mit
- Created: 2021-03-05T21:52:02.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-08-07T18:32:41.000Z (almost 4 years ago)
- Last Synced: 2024-03-22T23:46:50.445Z (about 2 years ago)
- Topics: cisco-ios-xe, libvirt-provider, vagrant-box
- Language: Shell
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# Cisco Catalyst 8000V Vagrant box
A procedure for creating a Cisco Catalyst 8000V Vagrant box for the [libvirt](https://libvirt.org) provider.
## Prerequisites
* [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)
* [Telnet](https://en.wikipedia.org/wiki/Telnet)
* [Vagrant](https://www.vagrantup.com) >= 2.2.19
* [vagrant-libvirt](https://github.com/vagrant-libvirt/vagrant-libvirt)
## Steps
0\. Verify the prerequisite tools are installed.
$ which git python ansible libvirtd virsh qemu-system-x86_64 expect telnet vagrant
$ vagrant plugin list
vagrant-libvirt (0.9.0, global)
1\. Log in and download the Cisco Catalyst 8000V Edge Software software (Cupertino-17.8.1a or later) from your [Cisco](https://software.cisco.com/download/home/286327102/type) account. Save the file to your `Downloads` directory.
2\. Copy (and rename) the disk image file to the `/var/lib/libvirt/images` directory.
$ sudo cp $HOME/Downloads/c8000v-universalk9_8G_serial.17.08.01a.qcow2 /var/lib/libvirt/images/cisco-cat8kv.qcow2
3\. 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-cat8kv.qcow2
$ sudo chmod u+x /var/lib/libvirt/images/cisco-cat8kv.qcow2
> Arch Linux
$ sudo chown nobody:kvm /var/lib/libvirt/images/cisco-cat8kv.qcow2
$ sudo chmod u+x /var/lib/libvirt/images/cisco-cat8kv.qcow2
4\. Create the `boxes` directory.
$ mkdir -p $HOME/boxes
5\. Start the `vagrant-libvirt` network (if not already started).
$ virsh -c qemu:///system net-list
$ virsh -c qemu:///system net-start vagrant-libvirt
6\. Clone this GitHub repo and _cd_ into the directory.
$ git clone https://github.com/mweisel/cisco-catalyst-8kv-vagrant-libvirt
$ cd cisco-catalyst-8kv-vagrant-libvirt
7\. Run the Ansible playbook.
$ ansible-playbook main.yml
8\. Copy (and rename) the Vagrant box artifact to the `boxes` directory.
$ cp cisco-cat8kv.box $HOME/boxes/cisco-cat8000v-17.08.01a.box
9\. Copy the box metadata file to the `boxes` directory.
$ cp ./files/cisco-cat8000v.json $HOME/boxes/
10\. Change the current working directory to `boxes`.
$ cd $HOME/boxes
11\. Substitute the `HOME` placeholder string in the box metadata file.
$ awk '/url/{gsub(/^ */,"");print}' cisco-cat8000v.json
"url": "file://HOME/boxes/cisco-cat8000v-VER.box"
$ sed -i "s|HOME|${HOME}|" cisco-cat8000v.json
$ awk '/url/{gsub(/^ */,"");print}' cisco-cat8000v.json
"url": "file:///home/marc/boxes/cisco-cat8000v-VER.box"
12\. Also, substitute the `VER` placeholder string with the Cisco IOS XE version you're using.
$ awk '/VER/{gsub(/^ */,"");print}' cisco-cat8000v.json
"version": "VER",
"url": "file:///home/marc/boxes/cisco-cat8000v-VER.box"
$ sed -i 's/VER/17.08.01a/g' cisco-cat8000v.json
$ awk '/\<version\>|url/{gsub(/^ */,"");print}' cisco-cat8000v.json
"version": "17.08.01a",
"url": "file:///home/marc/boxes/cisco-cat8000v-17.08.01a.box"
13\. Add the Vagrant box to the local inventory.
$ vagrant box add --box-version 17.08.01a cisco-cat8000v.json
## Debug
To view the telnet session output for the `expect` task:
$ tail -f ~/cat8kv-console.explog
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details