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