Add symlink to nodes on Virl
[csit.git] / resources / tools / virl / topologies / double-ring-nested.centos7.virl
1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2 <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">
3     <extensions>
4         <entry key="management_network" type="String">flat</entry>
5     </extensions>
6     <node name="tg1" type="SIMPLE" subtype="server" location="570,238" vmImage="$$VM_IMAGE$$">
7         <extensions>
8             <entry key="config" type="String">#cloud-config
9 hostname: tg1
10 manage_etc_hosts: true
11 nfs_server_scratch: $$NFS_SERVER_SCRATCH$$
12 nfs_server_common: $$NFS_SERVER_COMMON$$
13 runcmd:
14 - systemctl start rc-local
15 - touch /tmp/before-sed
16 - sed -i 's/^\s*PasswordAuthentication\s\+no/PasswordAuthentication yes/' /etc/ssh/sshd_config
17 - echo "UseDNS no" &gt;&gt; /etc/ssh/sshd_config
18 - service ssh restart
19 - service sshd restart
20 - ln -s /sbin/lspci /usr/bin/lspci
21 - ln -s /sbin/pidof /usr/bin/pidof
22 users:
23 - default
24 - gecos: User configured by VIRL Configuration Engine 0.21.4
25   lock-passwd: false
26   name: cisco
27   plain-text-passwd: cisco
28   shell: /bin/bash
29   ssh-authorized-keys:
30   - VIRL-USER-SSH-PUBLIC-KEY
31   - VIRL-USER-SSH-PUBLIC-KEY
32   sudo: ALL=(ALL) NOPASSWD:ALL
33 write_files:
34 - path: /usr/local/sbin/cloud-instance-name
35   content: |
36     #!/usr/bin/python2.7
37     import pickle
38     print pickle.loads(open('/var/lib/cloud/instance/obj.pkl', 'rb').read()).metadata['name']
39   owner: root:root
40   permissions: '0755'
41 - path: /etc/rc.local
42   owner: root:root
43   permissions: '0755'
44   content: |-
45     #!/bin/sh
46     grep -q nfs_server_scratch /var/lib/cloud/instance/user-data.txt || exit 1
47     grep -q nfs_server_common /var/lib/cloud/instance/user-data.txt || exit 1
48     nfs_server_scratch=$(grep -E '^nfs_server_scratch:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }')
49     nfs_server_common=$(grep -E '^nfs_server_common:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }')
50     instance_name=$(/usr/local/sbin/cloud-instance-name | cut -f 3 -d '&lt;' | cut -f 1 -d '&gt;')
51     echo My instance name is $instance_name
52
53     MAXCOUNT=12
54     RETRY=5
55
56     mkdir -p /scratch
57     mkdir -p /mnt/common
58
59     echo "Mounting NFS directories"
60     count=0
61     while [ $count -lt $MAXCOUNT ] &amp;&amp; ! mount -t nfs "${nfs_server_scratch}/${instance_name}" /scratch
62     do
63       sleep 5
64       count=$[$count+1]
65     done
66
67     mount -t nfs "${nfs_server_common}" /mnt/common
68
69     mkdir /scratch/$(hostname)
70     cp /VERSION /scratch/$(hostname)/
71
72     exit 0
73 </entry>
74             <entry key="Auto-generate config" type="Boolean">false</entry>
75         </extensions>
76         <interface id="0" name="eth1"/>
77         <interface id="1" name="eth2"/>
78         <interface id="2" name="eth3"/>
79         <interface id="3" name="eth4"/>
80         <interface id="4" name="eth5"/>
81         <interface id="5" name="eth6"/>
82     </node>
83     <node name="sut1" type="SIMPLE" subtype="vPP" location="425,26" vmImage="$$VM_IMAGE$$">
84         <extensions>
85             <entry key="config" type="string">#cloud-config
86 hostname: sut1
87 manage_etc_hosts: true
88 nfs_server_scratch: $$NFS_SERVER_SCRATCH$$
89 nfs_server_common: $$NFS_SERVER_COMMON$$
90 runcmd:
91 - systemctl start rc-local
92 - sed -i 's/^\s*PasswordAuthentication\s\+no/PasswordAuthentication yes/' /etc/ssh/sshd_config
93 - echo "UseDNS no" &gt;&gt; /etc/ssh/sshd_config
94 - service ssh restart
95 - service sshd restart
96 - sed -i 's/no-pci//' /opt/cisco/vpe/etc/qn.conf
97 - sed -i 's/1024/1024 decimal-interface-names/g' /opt/cisco/vpe/etc/qn.conf
98 - ln -s /dev/null /etc/sysctl.d/80-vpp.conf
99 - ln -s /sbin/pidof /usr/bin/pidof
100 - ln -s /usr/libexec/qemu-kvm /usr/bin/qemu-system-x86_64
101 - ln -s /sbin/fuser /usr/bin/fuser
102 users:
103 - default
104 - gecos: User configured by VIRL Configuration Engine 0.21.4
105   lock-passwd: false
106   name: cisco
107   plain-text-passwd: cisco
108   shell: /bin/bash
109   ssh-authorized-keys:
110   - VIRL-USER-SSH-PUBLIC-KEY
111   - VIRL-USER-SSH-PUBLIC-KEY
112   sudo: ALL=(ALL) NOPASSWD:ALL
113 write_files:
114 - path: /usr/local/sbin/cloud-instance-name
115   content: |
116     #!/usr/bin/python2.7
117     import pickle
118     print pickle.loads(open('/var/lib/cloud/instance/obj.pkl', 'rb').read()).metadata['name']
119   owner: root:root
120   permissions: '0755'
121 - path: /etc/rc.local
122   owner: root:root
123   permissions: '0755'
124   content: |-
125     #!/bin/sh
126     grep -q nfs_server_scratch /var/lib/cloud/instance/user-data.txt || exit 1
127     grep -q nfs_server_common /var/lib/cloud/instance/user-data.txt || exit 1
128     nfs_server_scratch=$(grep -E '^nfs_server_scratch:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }')
129     nfs_server_common=$(grep -E '^nfs_server_common:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }')
130     instance_name=$(/usr/local/sbin/cloud-instance-name | cut -f 3 -d '&lt;' | cut -f 1 -d '&gt;')
131     echo My instance name is $instance_name
132
133     MAXCOUNT=12
134     RETRY=5
135
136     mkdir -p /scratch
137     mkdir -p /mnt/common
138
139     echo "Mounting NFS directories"
140     count=0
141     while [ $count -lt $MAXCOUNT ] &amp;&amp; ! mount -t nfs "${nfs_server_scratch}/${instance_name}" /scratch
142     do
143       sleep 5
144       count=$[$count+1]
145     done
146
147     mount -t nfs "${nfs_server_common}" /mnt/common
148
149     # Overwrite nested VM image with latest as per NFS
150     if [ -f /mnt/common/nested-vm-current.img ]
151     then
152       rm -f /var/lib/vm/vhost-nested.img
153       cp /mnt/common/nested-vm-current.img /var/lib/vm/vhost-nested.img
154     fi
155
156     mkdir /scratch/$(hostname)
157     cp /VERSION /scratch/$(hostname)/
158     cat /var/lib/vm/vhost-nested.img | strings | grep NESTED_VERSION= > /scratch/$(hostname)/NESTED_VERSION
159
160     exit 0
161 - path: /etc/sysctl.d/90-csit.conf
162   owner: root:root
163   content: |
164     # Number of 2MB hugepages desired
165     vm.nr_hugepages=1024
166
167     # Must be greater than or equal to (2 * vm.nr_hugepages).
168     vm.max_map_count=20000
169
170     # All groups allowed to access hugepages
171     vm.hugetlb_shm_group=0
172
173     # Shared Memory Max must be greator or equal to the total size of hugepages.
174     # For 2MB pages, TotalHugepageSize = vm.nr_hugepages * 2 * 1024 * 1024
175     # If the existing kernel.shmmax setting  (cat /sys/proc/kernel/shmmax)
176     # is greater than the calculated TotalHugepageSize then set this parameter
177     # to current shmmax value.
178     kernel.shmmax=2147483648
179 </entry>
180         </extensions>
181         <interface id="0" name="GigabitEthernet0/4/0"/>
182         <interface id="1" name="GigabitEthernet0/5/0"/>
183         <interface id="2" name="GigabitEthernet0/6/0"/>
184         <interface id="3" name="GigabitEthernet0/7/0"/>
185     </node>
186     <node name="sut2" type="SIMPLE" subtype="vPP" location="748,26" vmImage="$$VM_IMAGE$$">
187         <extensions>
188             <entry key="config" type="string">#cloud-config
189 hostname: sut2
190 manage_etc_hosts: true
191 nfs_server_scratch: $$NFS_SERVER_SCRATCH$$
192 nfs_server_common: $$NFS_SERVER_COMMON$$
193 runcmd:
194 - systemctl start rc-local
195 - sed -i 's/^\s*PasswordAuthentication\s\+no/PasswordAuthentication yes/' /etc/ssh/sshd_config
196 - echo "UseDNS no" &gt;&gt; /etc/ssh/sshd_config
197 - service ssh restart
198 - service sshd restart
199 - sed -i 's/no-pci//' /opt/cisco/vpe/etc/qn.conf
200 - sed -i 's/1024/1024 decimal-interface-names/g' /opt/cisco/vpe/etc/qn.conf
201 - ln -s /dev/null /etc/sysctl.d/80-vpp.conf
202 - ln -s /sbin/pidof /usr/bin/pidof
203 - ln -s /usr/libexec/qemu-kvm /usr/bin/qemu-system-x86_64
204 - ln -s /sbin/fuser /usr/bin/fuser
205 users:
206 - default
207 - gecos: User configured by VIRL Configuration Engine 0.21.4
208   lock-passwd: false
209   name: cisco
210   plain-text-passwd: cisco
211   shell: /bin/bash
212   ssh-authorized-keys:
213   - VIRL-USER-SSH-PUBLIC-KEY
214   - VIRL-USER-SSH-PUBLIC-KEY
215   sudo: ALL=(ALL) NOPASSWD:ALL
216 write_files:
217 - path: /usr/local/sbin/cloud-instance-name
218   content: |
219     #!/usr/bin/python2.7
220     import pickle
221     print pickle.loads(open('/var/lib/cloud/instance/obj.pkl', 'rb').read()).metadata['name']
222   owner: root:root
223   permissions: '0755'
224 - path: /etc/rc.local
225   owner: root:root
226   permissions: '0755'
227   content: |-
228     #!/bin/sh
229     grep -q nfs_server_scratch /var/lib/cloud/instance/user-data.txt || exit 1
230     grep -q nfs_server_common /var/lib/cloud/instance/user-data.txt || exit 1
231     nfs_server_scratch=$(grep -E '^nfs_server_scratch:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }')
232     nfs_server_common=$(grep -E '^nfs_server_common:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }')
233     instance_name=$(/usr/local/sbin/cloud-instance-name | cut -f 3 -d '&lt;' | cut -f 1 -d '&gt;')
234     echo My instance name is $instance_name
235
236     MAXCOUNT=12
237     RETRY=5
238
239     mkdir -p /scratch
240     mkdir -p /mnt/common
241
242     echo "Mounting NFS directories"
243     count=0
244     while [ $count -lt $MAXCOUNT ] &amp;&amp; ! mount -t nfs "${nfs_server_scratch}/${instance_name}" /scratch
245     do
246       sleep 5
247       count=$[$count+1]
248     done
249
250     mount -t nfs "${nfs_server_common}" /mnt/common
251
252     # Overwrite nested VM image with latest as per NFS
253     if [ -f /mnt/common/nested-vm-current.img ]
254     then
255       rm -f /var/lib/vm/vhost-nested.img
256       cp /mnt/common/nested-vm-current.img /var/lib/vm/vhost-nested.img
257     fi
258
259     mkdir /scratch/$(hostname)
260     cp /VERSION /scratch/$(hostname)/
261     cat /var/lib/vm/vhost-nested.img | strings | grep NESTED_VERSION= > /scratch/$(hostname)/NESTED_VERSION
262
263     exit 0
264 - path: /etc/sysctl.d/90-csit.conf
265   owner: root:root
266   content: |
267     # Number of 2MB hugepages desired
268     vm.nr_hugepages=1024
269
270     # Must be greater than or equal to (2 * vm.nr_hugepages).
271     vm.max_map_count=20000
272
273     # All groups allowed to access hugepages
274     vm.hugetlb_shm_group=0
275
276     # Shared Memory Max must be greator or equal to the total size of hugepages.
277     # For 2MB pages, TotalHugepageSize = vm.nr_hugepages * 2 * 1024 * 1024
278     # If the existing kernel.shmmax setting  (cat /sys/proc/kernel/shmmax)
279     # is greater than the calculated TotalHugepageSize then set this parameter
280     # to current shmmax value.
281     kernel.shmmax=2147483648
282 </entry>
283         </extensions>
284         <interface id="0" name="GigabitEthernet0/4/0"/>
285         <interface id="1" name="GigabitEthernet0/5/0"/>
286         <interface id="2" name="GigabitEthernet0/6/0"/>
287         <interface id="3" name="GigabitEthernet0/7/0"/>
288     </node>
289     <connection dst="/virl:topology/virl:node[1]/virl:interface[3]" src="/virl:topology/virl:node[2]/virl:interface[1]"/>
290     <connection dst="/virl:topology/virl:node[1]/virl:interface[4]" src="/virl:topology/virl:node[2]/virl:interface[2]"/>
291     <connection dst="/virl:topology/virl:node[2]/virl:interface[3]" src="/virl:topology/virl:node[3]/virl:interface[3]"/>
292     <connection dst="/virl:topology/virl:node[2]/virl:interface[4]" src="/virl:topology/virl:node[3]/virl:interface[4]"/>
293     <connection dst="/virl:topology/virl:node[1]/virl:interface[5]" src="/virl:topology/virl:node[3]/virl:interface[1]"/>
294     <connection dst="/virl:topology/virl:node[1]/virl:interface[6]" src="/virl:topology/virl:node[3]/virl:interface[2]"/>
295 </topology>