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

    MAXCOUNT=12
    RETRY=5

    mkdir -p /scratch
    mkdir -p /mnt/common

    echo "Mounting NFS directories"
    count=0
    while [ $count -lt $MAXCOUNT ] &amp;&amp; ! mount -t nfs "${nfs_server_scratch}/${instance_name}" /scratch
    do
      sleep 5
      count=$[$count+1]
    done

    mount -t nfs "${nfs_server_common}" /mnt/common

    mkdir /scratch/$(hostname)

    exit 0&#xD;
</entry>
            <entry key="Auto-generate config" type="Boolean">false</entry>
        </extensions>
        <interface id="0" name="eth1"/>
        <interface id="1" name="eth2"/>
    </node>
    <node name="sut1" type="SIMPLE" subtype="vPP" location="425,26" vmImage="server-java-nested">
        <extensions>
            <entry key="config" type="string">#cloud-config
bootcmd:
- ln -s -t /etc/rc.d /etc/rc.local
hostname: sut1
manage_etc_hosts: true
nfs_server_scratch: $$NFS_SERVER_SCRATCH$$
nfs_server_common: $$NFS_SERVER_COMMON$$
runcmd:
- start ttyS0
- systemctl start getty@ttyS0.service
- systemctl start rc-local
- sed -i '/^\s*PasswordAuthentication\s\+no/d' /etc/ssh/sshd_config
- echo "UseDNS no" &gt;&gt; /etc/ssh/sshd_config
- service ssh restart
- service sshd restart
- sed -i 's/no-pci//' /opt/cisco/vpe/etc/qn.conf
- sed -i 's/1024/1024 decimal-interface-names/g' /opt/cisco/vpe/etc/qn.conf
users:
- default
- gecos: User configured by VIRL Configuration Engine 0.21.4
  lock-passwd: false
  name: cisco
  plain-text-passwd: cisco
  shell: /bin/bash
  ssh-authorized-keys:
  - VIRL-USER-SSH-PUBLIC-KEY
  - VIRL-USER-SSH-PUBLIC-KEY
  sudo: ALL=(ALL) NOPASSWD:ALL
write_files:
- path: /etc/init/ttyS0.conf
  owner: root:root
  content: |
    # ttyS0 - getty
    # This service maintains a getty on ttyS0 from the point the system is
    # started until it is shut down again.
    start on stopped rc or RUNLEVEL=[12345]
    stop on runlevel [!12345]
    respawn
    exec /sbin/getty -L 115200 ttyS0 vt102
  permissions: '0644'
- path: /etc/systemd/system/dhclient@.service
  content: |
    [Unit]
    Description=Run dhclient on %i interface
    After=network.target
    [Service]
    Type=oneshot
    ExecStart=/sbin/dhclient %i -pf /var/run/dhclient.%i.pid -lf /var/lib/dhclient/dhclient.%i.lease
    RemainAfterExit=yes
  owner: root:root
  permissions: '0644'
- path: /usr/local/sbin/cloud-instance-name
  content: |
    #!/usr/bin/python
    import pickle
    print pickle.loads(open('/var/lib/cloud/instance/obj.pkl').read()).metadata['name']
  owner: root:root
  permissions: '0755'
- path: /etc/rc.local&#xD;
  owner: root:root&#xD;
  permissions: '0755'&#xD;
  content: |-&#xD;
    #!/bin/sh&#xD;
    grep -q nfs_server_scratch /var/lib/cloud/instance/user-data.txt || exit 1
    grep -q nfs_server_common /var/lib/cloud/instance/user-data.txt || exit 1
    nfs_server_scratch=$(grep -E '^nfs_server_scratch:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }')
    nfs_server_common=$(grep -E '^nfs_server_common:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }')
    instance_name=$(/usr/local/sbin/cloud-instance-name | cut -f 3 -d '&lt;' | cut -f 1 -d '&gt;')
    echo My instance name is $instance_name

    MAXCOUNT=12
    RETRY=5

    mkdir -p /scratch
    mkdir -p /mnt/common

    echo "Mounting NFS directories"
    count=0
    while [ $count -lt $MAXCOUNT ] &amp;&amp; ! mount -t nfs "${nfs_server_scratch}/${instance_name}" /scratch
    do
      sleep 5
      count=$[$count+1]
    done

    mount -t nfs "${nfs_server_common}" /mnt/common

    mkdir /scratch/$(hostname)

    exit 0&#xD;
</entry>
        </extensions>
        <interface id="0" name="GigabitEthernet0/4/0"/>
        <interface id="1" name="GigabitEthernet0/5/0"/>
    </node>
    <node name="sut2" type="SIMPLE" subtype="vPP" location="748,26" vmImage="server-java-nested">
        <extensions>
            <entry key="config" type="string">#cloud-config
bootcmd:
- ln -s -t /etc/rc.d /etc/rc.local
hostname: sut2
manage_etc_hosts: true
nfs_server_scratch: $$NFS_SERVER_SCRATCH$$
nfs_server_common: $$NFS_SERVER_COMMON$$
runcmd:
- start ttyS0
- systemctl start getty@ttyS0.service
- systemctl start rc-local
- sed -i '/^\s*PasswordAuthentication\s\+no/d' /etc/ssh/sshd_config
- echo "UseDNS no" &gt;&gt; /etc/ssh/sshd_config
- service ssh restart
- service sshd restart
- sed -i 's/no-pci//' /opt/cisco/vpe/etc/qn.conf
- sed -i 's/1024/1024 decimal-interface-names/g' /opt/cisco/vpe/etc/qn.conf
users:
- default
- gecos: User configured by VIRL Configuration Engine 0.21.4
  lock-passwd: false
  name: cisco
  plain-text-passwd: cisco
  shell: /bin/bash
  ssh-authorized-keys:
  - VIRL-USER-SSH-PUBLIC-KEY
  - VIRL-USER-SSH-PUBLIC-KEY
  sudo: ALL=(ALL) NOPASSWD:ALL
write_files:
- path: /etc/init/ttyS0.conf
  owner: root:root
  content: |
    # ttyS0 - getty
    # This service maintains a getty on ttyS0 from the point the system is
    # started until it is shut down again.
    start on stopped rc or RUNLEVEL=[12345]
    stop on runlevel [!12345]
    respawn
    exec /sbin/getty -L 115200 ttyS0 vt102
  permissions: '0644'
- path: /etc/systemd/system/dhclient@.service
  content: |
    [Unit]
    Description=Run dhclient on %i interface
    After=network.target
    [Service]
    Type=oneshot
    ExecStart=/sbin/dhclient %i -pf /var/run/dhclient.%i.pid -lf /var/lib/dhclient/dhclient.%i.lease
    RemainAfterExit=yes
  owner: root:root
  permissions: '0644'
- path: /usr/local/sbin/cloud-instance-name
  content: |
    #!/usr/bin/python
    import pickle
    print pickle.loads(open('/var/lib/cloud/instance/obj.pkl').read()).metadata['name']
  owner: root:root
  permissions: '0755'
- path: /etc/rc.local&#xD;
  owner: root:root&#xD;
  permissions: '0755'&#xD;
  content: |-&#xD;
    #!/bin/sh&#xD;
    grep -q nfs_server_scratch /var/lib/cloud/instance/user-data.txt || exit 1
    grep -q nfs_server_common /var/lib/cloud/instance/user-data.txt || exit 1
    nfs_server_scratch=$(grep -E '^nfs_server_scratch:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }')
    nfs_server_common=$(grep -E '^nfs_server_common:' /var/lib/cloud/instance/user-data.txt | awk '{ print $2 }')
    instance_name=$(/usr/local/sbin/cloud-instance-name | cut -f 3 -d '&lt;' | cut -f 1 -d '&gt;')
    echo My instance name is $instance_name

    MAXCOUNT=12
    RETRY=5

    mkdir -p /scratch
    mkdir -p /mnt/common

    echo "Mounting NFS directories"
    count=0
    while [ $count -lt $MAXCOUNT ] &amp;&amp; ! mount -t nfs "${nfs_server_scratch}/${instance_name}" /scratch
    do
      sleep 5
      count=$[$count+1]
    done

    mount -t nfs "${nfs_server_common}" /mnt/common

    mkdir /scratch/$(hostname)

    exit 0&#xD;
</entry>
        </extensions>
        <interface id="0" name="GigabitEthernet0/4/0"/>
        <interface id="1" name="GigabitEthernet0/5/0"/>
    </node>
    <connection dst="/virl:topology/virl:node[1]/virl:interface[2]" src="/virl:topology/virl:node[3]/virl:interface[1]"/>
    <connection dst="/virl:topology/virl:node[2]/virl:interface[2]" src="/virl:topology/virl:node[1]/virl:interface[1]"/>
    <connection dst="/virl:topology/virl:node[3]/virl:interface[2]" src="/virl:topology/virl:node[2]/virl:interface[1]"/>
</topology>