diff options
author | Carsten Koester <ckoester@cisco.com> | 2016-02-23 19:27:01 -0500 |
---|---|---|
committer | Carsten Koester <ckoester@cisco.com> | 2016-03-08 16:33:30 -0500 |
commit | f9e2ef4af9dee2220d4ee2ebeae5012de84a83fe (patch) | |
tree | ebe0894be10d1626648e9fa6dbe993f8e20b1967 /resources/tools/virl/topologies/simple-ring.virl | |
parent | da8aebf2e722f2c441a03b300de71f9143d010a3 (diff) |
Add VIRL server-side framework and topology templates.
Change-Id: I02e7f85e3259dc0a5b2c7d0098747921a75fa5ea
Signed-off-by: Carsten Koester <ckoester@cisco.com>
Diffstat (limited to 'resources/tools/virl/topologies/simple-ring.virl')
-rw-r--r-- | resources/tools/virl/topologies/simple-ring.virl | 300 |
1 files changed, 300 insertions, 0 deletions
diff --git a/resources/tools/virl/topologies/simple-ring.virl b/resources/tools/virl/topologies/simple-ring.virl new file mode 100644 index 0000000000..04babe5e99 --- /dev/null +++ b/resources/tools/virl/topologies/simple-ring.virl @@ -0,0 +1,300 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<topology xmlns="http://www.cisco.com/VIRL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" schemaVersion="0.9" xsi:schemaLocation="http://www.cisco.com/VIRL https://raw.github.com/CiscoVIRL/schema/v0.9/virl.xsd"> + <extensions> + <entry key="management_network" type="String">flat</entry> + </extensions> + <node name="tg1" type="SIMPLE" subtype="server" location="570,238" vmImage="server-java"> + <extensions> + <entry key="config" type="String">#cloud-config
 +bootcmd:
 +- ln -s -t /etc/rc.d /etc/rc.local
 +hostname: tg1
 +manage_etc_hosts: true
 +nfs_server_scratch: $$NFS_SERVER_SCRATCH$$ +nfs_server_common: $$NFS_SERVER_COMMON$$ +runcmd:
 +- start ttyS0
 +- systemctl start getty@ttyS0.service
 +- systemctl start rc-local
 +- touch /tmp/before-sed
 +- sed -i 's/^\s*PasswordAuthentication\s\+no/PasswordAuthentication yes/' /etc/ssh/sshd_config
 +- echo "UseDNS no" >> /etc/ssh/sshd_config
 +- service ssh restart
 +- service sshd restart
 +users:
 +- default
 +- gecos: User configured by VIRL Configuration Engine 0.21.4
 + lock-passwd: false
 + name: cisco
 + plain-text-passwd: cisco
 + shell: /bin/bash
 + ssh-authorized-keys:
 + - VIRL-USER-SSH-PUBLIC-KEY
 + - VIRL-USER-SSH-PUBLIC-KEY
 + sudo: ALL=(ALL) NOPASSWD:ALL
 +write_files:
 +- path: /etc/init/ttyS0.conf
 + owner: root:root
 + content: |
 + # ttyS0 - getty
 + # This service maintains a getty on ttyS0 from the point the system is
 + # started until it is shut down again.
 + start on stopped rc or RUNLEVEL=[12345]
 + stop on runlevel [!12345]
 + respawn
 + exec /sbin/getty -L 115200 ttyS0 vt102
 + permissions: '0644'
 +- path: /etc/systemd/system/dhclient@.service
 + content: |
 + [Unit]
 + Description=Run dhclient on %i interface
 + After=network.target
 + [Service]
 + Type=oneshot
 + ExecStart=/sbin/dhclient %i -pf /var/run/dhclient.%i.pid -lf /var/lib/dhclient/dhclient.%i.lease
 + RemainAfterExit=yes
 + owner: root:root
 + permissions: '0644'
 +- path: /usr/local/sbin/cloud-instance-name + content: | + #!/usr/bin/python + import pickle + print pickle.loads(open('/var/lib/cloud/instance/obj.pkl').read()).metadata['name'] + owner: root:root + permissions: '0755' +- path: /etc/rc.local
 + owner: root:root
 + permissions: '0755'
 + content: |-
 + #!/bin/sh
 + ifconfig eth1 up 10.0.0.6 netmask 255.255.255.252
 + ifconfig eth2 up 10.0.0.14 netmask 255.255.255.252
 + + grep -q nfs_server_scratch /var/lib/cloud/instance/user-data.txt || exit 1 + grep -q nfs_server_common /var/lib/cloud/instance/user-data.txt || exit 1 + nfs_server_scratch=$(grep -E '^nfs_server_scratch:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }') + nfs_server_common=$(grep -E '^nfs_server_common:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }') + instance_name=$(/usr/local/sbin/cloud-instance-name | cut -f 3 -d '<' | cut -f 1 -d '>') + echo My instance name is $instance_name + + MAXCOUNT=12 + RETRY=5 + + mkdir -p /scratch + mkdir -p /mnt/common + + echo "Mounting NFS directories" + count=0 + while [ $count -lt $MAXCOUNT ] && ! mount -t nfs "${nfs_server_scratch}/${instance_name}" /scratch + do + sleep 5 + count=$[$count+1] + done + + mount -t nfs "${nfs_server_common}" /mnt/common + + mkdir /scratch/$(hostname) + + exit 0
 +</entry> + <entry key="Auto-generate config" type="Boolean">false</entry> + </extensions> + <interface id="0" name="eth1" ipv4="10.0.0.6" netPrefixLenV4="30"/> + <interface id="1" name="eth2" ipv4="10.0.0.14" netPrefixLenV4="30"/> + </node> + <node name="sut1" type="SIMPLE" subtype="vPP" location="425,26" vmImage="server-java"> + <extensions> + <entry key="config" type="string">#cloud-config +bootcmd: +- ln -s -t /etc/rc.d /etc/rc.local +hostname: sut1 +manage_etc_hosts: true +nfs_server_scratch: $$NFS_SERVER_SCRATCH$$ +nfs_server_common: $$NFS_SERVER_COMMON$$ +runcmd: +- start ttyS0 +- systemctl start getty@ttyS0.service +- systemctl start rc-local +- sed -i '/^\s*PasswordAuthentication\s\+no/d' /etc/ssh/sshd_config +- echo "UseDNS no" >> /etc/ssh/sshd_config +- service ssh restart +- service sshd restart +- sed -i 's/no-pci//' /opt/cisco/vpe/etc/qn.conf +- sed -i 's/1024/1024 decimal-interface-names/g' /opt/cisco/vpe/etc/qn.conf +users: +- default +- gecos: User configured by VIRL Configuration Engine 0.21.4 + lock-passwd: false + name: cisco + plain-text-passwd: cisco + shell: /bin/bash + ssh-authorized-keys: + - VIRL-USER-SSH-PUBLIC-KEY + - VIRL-USER-SSH-PUBLIC-KEY + sudo: ALL=(ALL) NOPASSWD:ALL +write_files: +- path: /etc/init/ttyS0.conf + owner: root:root + content: | + # ttyS0 - getty + # This service maintains a getty on ttyS0 from the point the system is + # started until it is shut down again. + start on stopped rc or RUNLEVEL=[12345] + stop on runlevel [!12345] + respawn + exec /sbin/getty -L 115200 ttyS0 vt102 + permissions: '0644' +- path: /etc/systemd/system/dhclient@.service + content: | + [Unit] + Description=Run dhclient on %i interface + After=network.target + [Service] + Type=oneshot + ExecStart=/sbin/dhclient %i -pf /var/run/dhclient.%i.pid -lf /var/lib/dhclient/dhclient.%i.lease + RemainAfterExit=yes + owner: root:root + permissions: '0644' +- path: /usr/local/sbin/cloud-instance-name + content: | + #!/usr/bin/python + import pickle + print pickle.loads(open('/var/lib/cloud/instance/obj.pkl').read()).metadata['name'] + owner: root:root + permissions: '0755' +- path: /etc/rc.local
 + owner: root:root
 + permissions: '0755'
 + content: |-
 + #!/bin/sh
 + grep -q nfs_server_scratch /var/lib/cloud/instance/user-data.txt || exit 1 + grep -q nfs_server_common /var/lib/cloud/instance/user-data.txt || exit 1 + nfs_server_scratch=$(grep -E '^nfs_server_scratch:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }') + nfs_server_common=$(grep -E '^nfs_server_common:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }') + instance_name=$(/usr/local/sbin/cloud-instance-name | cut -f 3 -d '<' | cut -f 1 -d '>') + echo My instance name is $instance_name + + MAXCOUNT=12 + RETRY=5 + + mkdir -p /scratch + mkdir -p /mnt/common + + echo "Mounting NFS directories" + count=0 + while [ $count -lt $MAXCOUNT ] && ! mount -t nfs "${nfs_server_scratch}/${instance_name}" /scratch + do + sleep 5 + count=$[$count+1] + done + + mount -t nfs "${nfs_server_common}" /mnt/common + + mkdir /scratch/$(hostname) + + exit 0
 +</entry> + </extensions> + <interface id="0" name="GigabitEthernet0/4/0" ipv4="10.0.0.9" netPrefixLenV4="30"/> + <interface id="1" name="GigabitEthernet0/5/0" ipv4="10.0.0.5" netPrefixLenV4="30"/> + </node> + <node name="sut2" type="SIMPLE" subtype="vPP" location="748,26" vmImage="server-java"> + <extensions> + <entry key="config" type="string">#cloud-config +bootcmd: +- ln -s -t /etc/rc.d /etc/rc.local +hostname: sut2 +manage_etc_hosts: true +nfs_server_scratch: $$NFS_SERVER_SCRATCH$$ +nfs_server_common: $$NFS_SERVER_COMMON$$ +runcmd: +- start ttyS0 +- systemctl start getty@ttyS0.service +- systemctl start rc-local +- sed -i '/^\s*PasswordAuthentication\s\+no/d' /etc/ssh/sshd_config +- echo "UseDNS no" >> /etc/ssh/sshd_config +- service ssh restart +- service sshd restart +- sed -i 's/no-pci//' /opt/cisco/vpe/etc/qn.conf +- sed -i 's/1024/1024 decimal-interface-names/g' /opt/cisco/vpe/etc/qn.conf +users: +- default +- gecos: User configured by VIRL Configuration Engine 0.21.4 + lock-passwd: false + name: cisco + plain-text-passwd: cisco + shell: /bin/bash + ssh-authorized-keys: + - VIRL-USER-SSH-PUBLIC-KEY + - VIRL-USER-SSH-PUBLIC-KEY + sudo: ALL=(ALL) NOPASSWD:ALL +write_files: +- path: /etc/init/ttyS0.conf + owner: root:root + content: | + # ttyS0 - getty + # This service maintains a getty on ttyS0 from the point the system is + # started until it is shut down again. + start on stopped rc or RUNLEVEL=[12345] + stop on runlevel [!12345] + respawn + exec /sbin/getty -L 115200 ttyS0 vt102 + permissions: '0644' +- path: /etc/systemd/system/dhclient@.service + content: | + [Unit] + Description=Run dhclient on %i interface + After=network.target + [Service] + Type=oneshot + ExecStart=/sbin/dhclient %i -pf /var/run/dhclient.%i.pid -lf /var/lib/dhclient/dhclient.%i.lease + RemainAfterExit=yes + owner: root:root + permissions: '0644' +- path: /usr/local/sbin/cloud-instance-name + content: | + #!/usr/bin/python + import pickle + print pickle.loads(open('/var/lib/cloud/instance/obj.pkl').read()).metadata['name'] + owner: root:root + permissions: '0755' +- path: /etc/rc.local
 + owner: root:root
 + permissions: '0755'
 + content: |-
 + #!/bin/sh
 + grep -q nfs_server_scratch /var/lib/cloud/instance/user-data.txt || exit 1 + grep -q nfs_server_common /var/lib/cloud/instance/user-data.txt || exit 1 + nfs_server_scratch=$(grep -E '^nfs_server_scratch:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }') + nfs_server_common=$(grep -E '^nfs_server_common:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }') + instance_name=$(/usr/local/sbin/cloud-instance-name | cut -f 3 -d '<' | cut -f 1 -d '>') + echo My instance name is $instance_name + + MAXCOUNT=12 + RETRY=5 + + mkdir -p /scratch + mkdir -p /mnt/common + + echo "Mounting NFS directories" + count=0 + while [ $count -lt $MAXCOUNT ] && ! mount -t nfs "${nfs_server_scratch}/${instance_name}" /scratch + do + sleep 5 + count=$[$count+1] + done + + mount -t nfs "${nfs_server_common}" /mnt/common + + mkdir /scratch/$(hostname) + + exit 0
 +</entry> + </extensions> + <interface id="0" name="GigabitEthernet0/4/0" ipv4="10.0.0.13" netPrefixLenV4="30"/> + <interface id="1" name="GigabitEthernet0/5/0" ipv4="10.0.0.10" netPrefixLenV4="30"/> + </node> + <connection dst="/virl:topology/virl:node[1]/virl:interface[2]" src="/virl:topology/virl:node[3]/virl:interface[1]"/> + <connection dst="/virl:topology/virl:node[2]/virl:interface[2]" src="/virl:topology/virl:node[1]/virl:interface[1]"/> + <connection dst="/virl:topology/virl:node[3]/virl:interface[2]" src="/virl:topology/virl:node[2]/virl:interface[1]"/> +</topology> |