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