4dd5885281ea4ddda76f549698de17015ae6c5d6
[csit.git] / resources / tools / virl / topologies / double-ring-nested.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&#xD;
9 bootcmd:&#xD;
10 - ln -s -t /etc/rc.d /etc/rc.local&#xD;
11 hostname: tg1&#xD;
12 manage_etc_hosts: true&#xD;
13 nfs_server_scratch: $$NFS_SERVER_SCRATCH$$
14 nfs_server_common: $$NFS_SERVER_COMMON$$
15 runcmd:&#xD;
16 - start ttyS0&#xD;
17 - systemctl start getty@ttyS0.service&#xD;
18 - systemctl start rc-local&#xD;
19 - touch /tmp/before-sed&#xD;
20 - sed -i 's/^\s*PasswordAuthentication\s\+no/PasswordAuthentication yes/' /etc/ssh/sshd_config&#xD;
21 - echo "UseDNS no" &gt;&gt; /etc/ssh/sshd_config&#xD;
22 - service ssh restart&#xD;
23 - service sshd restart&#xD;
24 users:&#xD;
25 - default&#xD;
26 - gecos: User configured by VIRL Configuration Engine 0.21.4&#xD;
27   lock-passwd: false&#xD;
28   name: cisco&#xD;
29   plain-text-passwd: cisco&#xD;
30   shell: /bin/bash&#xD;
31   ssh-authorized-keys:&#xD;
32   - VIRL-USER-SSH-PUBLIC-KEY&#xD;
33   - VIRL-USER-SSH-PUBLIC-KEY&#xD;
34   sudo: ALL=(ALL) NOPASSWD:ALL&#xD;
35 write_files:&#xD;
36 - path: /etc/init/ttyS0.conf&#xD;
37   owner: root:root&#xD;
38   content: |&#xD;
39     # ttyS0 - getty&#xD;
40     # This service maintains a getty on ttyS0 from the point the system is&#xD;
41     # started until it is shut down again.&#xD;
42     start on stopped rc or RUNLEVEL=[12345]&#xD;
43     stop on runlevel [!12345]&#xD;
44     respawn&#xD;
45     exec /sbin/getty -L 115200 ttyS0 vt102&#xD;
46   permissions: '0644'&#xD;
47 - path: /etc/systemd/system/dhclient@.service&#xD;
48   content: |&#xD;
49     [Unit]&#xD;
50     Description=Run dhclient on %i interface&#xD;
51     After=network.target&#xD;
52     [Service]&#xD;
53     Type=oneshot&#xD;
54     ExecStart=/sbin/dhclient %i -pf /var/run/dhclient.%i.pid -lf /var/lib/dhclient/dhclient.%i.lease&#xD;
55     RemainAfterExit=yes&#xD;
56   owner: root:root&#xD;
57   permissions: '0644'&#xD;
58 - path: /usr/local/sbin/cloud-instance-name
59   content: |
60     #!/usr/bin/python
61     import pickle
62     print pickle.loads(open('/var/lib/cloud/instance/obj.pkl').read()).metadata['name']
63   owner: root:root
64   permissions: '0755'
65 - path: /etc/rc.local&#xD;
66   owner: root:root&#xD;
67   permissions: '0755'&#xD;
68   content: |-&#xD;
69     #!/bin/sh&#xD;
70     grep -q nfs_server_scratch /var/lib/cloud/instance/user-data.txt || exit 1
71     grep -q nfs_server_common /var/lib/cloud/instance/user-data.txt || exit 1
72     nfs_server_scratch=$(grep -E '^nfs_server_scratch:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }')
73     nfs_server_common=$(grep -E '^nfs_server_common:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }')
74     instance_name=$(/usr/local/sbin/cloud-instance-name | cut -f 3 -d '&lt;' | cut -f 1 -d '&gt;')
75     echo My instance name is $instance_name
76
77     MAXCOUNT=12
78     RETRY=5
79
80     mkdir -p /scratch
81     mkdir -p /mnt/common
82
83     echo "Mounting NFS directories"
84     count=0
85     while [ $count -lt $MAXCOUNT ] &amp;&amp; ! mount -t nfs "${nfs_server_scratch}/${instance_name}" /scratch
86     do
87       sleep 5
88       count=$[$count+1]
89     done
90
91     mount -t nfs "${nfs_server_common}" /mnt/common
92
93     mkdir /scratch/$(hostname)
94     cp /VERSION /scratch/$(hostname)/
95
96     exit 0&#xD;
97 </entry>
98             <entry key="Auto-generate config" type="Boolean">false</entry>
99         </extensions>
100         <interface id="0" name="eth1"/>
101         <interface id="1" name="eth2"/>
102         <interface id="2" name="eth3"/>
103         <interface id="3" name="eth4"/>
104         <interface id="4" name="eth5"/>
105         <interface id="5" name="eth6"/>
106     </node>
107     <node name="sut1" type="SIMPLE" subtype="vPP" location="425,26" vmImage="$$VM_IMAGE$$">
108         <extensions>
109             <entry key="config" type="string">#cloud-config
110 bootcmd:
111 - ln -s -t /etc/rc.d /etc/rc.local
112 hostname: sut1
113 manage_etc_hosts: true
114 nfs_server_scratch: $$NFS_SERVER_SCRATCH$$
115 nfs_server_common: $$NFS_SERVER_COMMON$$
116 runcmd:
117 - start ttyS0
118 - systemctl start getty@ttyS0.service
119 - systemctl start rc-local
120 - sed -i '/^\s*PasswordAuthentication\s\+no/d' /etc/ssh/sshd_config
121 - echo "UseDNS no" &gt;&gt; /etc/ssh/sshd_config
122 - service ssh restart
123 - service sshd restart
124 - sed -i 's/no-pci//' /opt/cisco/vpe/etc/qn.conf
125 - sed -i 's/1024/1024 decimal-interface-names/g' /opt/cisco/vpe/etc/qn.conf
126 users:
127 - default
128 - gecos: User configured by VIRL Configuration Engine 0.21.4
129   lock-passwd: false
130   name: cisco
131   plain-text-passwd: cisco
132   shell: /bin/bash
133   ssh-authorized-keys:
134   - VIRL-USER-SSH-PUBLIC-KEY
135   - VIRL-USER-SSH-PUBLIC-KEY
136   sudo: ALL=(ALL) NOPASSWD:ALL
137 write_files:
138 - path: /etc/init/ttyS0.conf
139   owner: root:root
140   content: |
141     # ttyS0 - getty
142     # This service maintains a getty on ttyS0 from the point the system is
143     # started until it is shut down again.
144     start on stopped rc or RUNLEVEL=[12345]
145     stop on runlevel [!12345]
146     respawn
147     exec /sbin/getty -L 115200 ttyS0 vt102
148   permissions: '0644'
149 - path: /etc/systemd/system/dhclient@.service
150   content: |
151     [Unit]
152     Description=Run dhclient on %i interface
153     After=network.target
154     [Service]
155     Type=oneshot
156     ExecStart=/sbin/dhclient %i -pf /var/run/dhclient.%i.pid -lf /var/lib/dhclient/dhclient.%i.lease
157     RemainAfterExit=yes
158   owner: root:root
159   permissions: '0644'
160 - path: /usr/local/sbin/cloud-instance-name
161   content: |
162     #!/usr/bin/python
163     import pickle
164     print pickle.loads(open('/var/lib/cloud/instance/obj.pkl').read()).metadata['name']
165   owner: root:root
166   permissions: '0755'
167 - path: /etc/rc.local&#xD;
168   owner: root:root&#xD;
169   permissions: '0755'&#xD;
170   content: |-&#xD;
171     #!/bin/sh&#xD;
172     grep -q nfs_server_scratch /var/lib/cloud/instance/user-data.txt || exit 1
173     grep -q nfs_server_common /var/lib/cloud/instance/user-data.txt || exit 1
174     nfs_server_scratch=$(grep -E '^nfs_server_scratch:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }')
175     nfs_server_common=$(grep -E '^nfs_server_common:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }')
176     instance_name=$(/usr/local/sbin/cloud-instance-name | cut -f 3 -d '&lt;' | cut -f 1 -d '&gt;')
177     echo My instance name is $instance_name
178
179     MAXCOUNT=12
180     RETRY=5
181
182     mkdir -p /scratch
183     mkdir -p /mnt/common
184
185     echo "Mounting NFS directories"
186     count=0
187     while [ $count -lt $MAXCOUNT ] &amp;&amp; ! mount -t nfs "${nfs_server_scratch}/${instance_name}" /scratch
188     do
189       sleep 5
190       count=$[$count+1]
191     done
192
193     mount -t nfs "${nfs_server_common}" /mnt/common
194
195     # Overwrite nested VM image with latest as per NFS
196     if [ -f /mnt/common/nested-vm-current.img ]
197     then
198       rm -f /var/lib/vm/vhost-nested.img
199       cp /mnt/common/nested-vm-current.img /var/lib/vm/vhost-nested.img
200     fi
201
202     mkdir /scratch/$(hostname)
203     cp /VERSION /scratch/$(hostname)/
204     cat /var/lib/vm/vhost-nested.img | strings | grep NESTED_VERSION= > /scratch/$(hostname)/NESTED_VERSION
205
206     exit 0&#xD;
207 </entry>
208         </extensions>
209         <interface id="0" name="GigabitEthernet0/4/0"/>
210         <interface id="1" name="GigabitEthernet0/5/0"/>
211         <interface id="2" name="GigabitEthernet0/6/0"/>
212         <interface id="3" name="GigabitEthernet0/7/0"/>
213     </node>
214     <node name="sut2" type="SIMPLE" subtype="vPP" location="748,26" vmImage="$$VM_IMAGE$$">
215         <extensions>
216             <entry key="config" type="string">#cloud-config
217 bootcmd:
218 - ln -s -t /etc/rc.d /etc/rc.local
219 hostname: sut2
220 manage_etc_hosts: true
221 nfs_server_scratch: $$NFS_SERVER_SCRATCH$$
222 nfs_server_common: $$NFS_SERVER_COMMON$$
223 runcmd:
224 - start ttyS0
225 - systemctl start getty@ttyS0.service
226 - systemctl start rc-local
227 - sed -i '/^\s*PasswordAuthentication\s\+no/d' /etc/ssh/sshd_config
228 - echo "UseDNS no" &gt;&gt; /etc/ssh/sshd_config
229 - service ssh restart
230 - service sshd restart
231 - sed -i 's/no-pci//' /opt/cisco/vpe/etc/qn.conf
232 - sed -i 's/1024/1024 decimal-interface-names/g' /opt/cisco/vpe/etc/qn.conf
233 users:
234 - default
235 - gecos: User configured by VIRL Configuration Engine 0.21.4
236   lock-passwd: false
237   name: cisco
238   plain-text-passwd: cisco
239   shell: /bin/bash
240   ssh-authorized-keys:
241   - VIRL-USER-SSH-PUBLIC-KEY
242   - VIRL-USER-SSH-PUBLIC-KEY
243   sudo: ALL=(ALL) NOPASSWD:ALL
244 write_files:
245 - path: /etc/init/ttyS0.conf
246   owner: root:root
247   content: |
248     # ttyS0 - getty
249     # This service maintains a getty on ttyS0 from the point the system is
250     # started until it is shut down again.
251     start on stopped rc or RUNLEVEL=[12345]
252     stop on runlevel [!12345]
253     respawn
254     exec /sbin/getty -L 115200 ttyS0 vt102
255   permissions: '0644'
256 - path: /etc/systemd/system/dhclient@.service
257   content: |
258     [Unit]
259     Description=Run dhclient on %i interface
260     After=network.target
261     [Service]
262     Type=oneshot
263     ExecStart=/sbin/dhclient %i -pf /var/run/dhclient.%i.pid -lf /var/lib/dhclient/dhclient.%i.lease
264     RemainAfterExit=yes
265   owner: root:root
266   permissions: '0644'
267 - path: /usr/local/sbin/cloud-instance-name
268   content: |
269     #!/usr/bin/python
270     import pickle
271     print pickle.loads(open('/var/lib/cloud/instance/obj.pkl').read()).metadata['name']
272   owner: root:root
273   permissions: '0755'
274 - path: /etc/rc.local&#xD;
275   owner: root:root&#xD;
276   permissions: '0755'&#xD;
277   content: |-&#xD;
278     #!/bin/sh&#xD;
279     grep -q nfs_server_scratch /var/lib/cloud/instance/user-data.txt || exit 1
280     grep -q nfs_server_common /var/lib/cloud/instance/user-data.txt || exit 1
281     nfs_server_scratch=$(grep -E '^nfs_server_scratch:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }')
282     nfs_server_common=$(grep -E '^nfs_server_common:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }')
283     instance_name=$(/usr/local/sbin/cloud-instance-name | cut -f 3 -d '&lt;' | cut -f 1 -d '&gt;')
284     echo My instance name is $instance_name
285
286     MAXCOUNT=12
287     RETRY=5
288
289     mkdir -p /scratch
290     mkdir -p /mnt/common
291
292     echo "Mounting NFS directories"
293     count=0
294     while [ $count -lt $MAXCOUNT ] &amp;&amp; ! mount -t nfs "${nfs_server_scratch}/${instance_name}" /scratch
295     do
296       sleep 5
297       count=$[$count+1]
298     done
299
300     mount -t nfs "${nfs_server_common}" /mnt/common
301
302     # Overwrite nested VM image with latest as per NFS
303     if [ -f /mnt/common/nested-vm-current.img ]
304     then
305       rm -f /var/lib/vm/vhost-nested.img
306       cp /mnt/common/nested-vm-current.img /var/lib/vm/vhost-nested.img
307     fi
308
309     mkdir /scratch/$(hostname)
310     cp /VERSION /scratch/$(hostname)/
311     cat /var/lib/vm/vhost-nested.img | strings | grep NESTED_VERSION= > /scratch/$(hostname)/NESTED_VERSION
312
313     exit 0&#xD;
314 </entry>
315         </extensions>
316         <interface id="0" name="GigabitEthernet0/4/0"/>
317         <interface id="1" name="GigabitEthernet0/5/0"/>
318         <interface id="2" name="GigabitEthernet0/6/0"/>
319         <interface id="3" name="GigabitEthernet0/7/0"/>
320     </node>
321     <connection dst="/virl:topology/virl:node[1]/virl:interface[3]" src="/virl:topology/virl:node[2]/virl:interface[1]"/>
322     <connection dst="/virl:topology/virl:node[1]/virl:interface[4]" src="/virl:topology/virl:node[2]/virl:interface[2]"/>
323     <connection dst="/virl:topology/virl:node[2]/virl:interface[3]" src="/virl:topology/virl:node[3]/virl:interface[3]"/>
324     <connection dst="/virl:topology/virl:node[2]/virl:interface[4]" src="/virl:topology/virl:node[3]/virl:interface[4]"/>
325     <connection dst="/virl:topology/virl:node[1]/virl:interface[5]" src="/virl:topology/virl:node[3]/virl:interface[1]"/>
326     <connection dst="/virl:topology/virl:node[1]/virl:interface[6]" src="/virl:topology/virl:node[3]/virl:interface[2]"/>
327 </topology>