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