]> git.proxmox.com Git - ovs.git/blob - tests/interface-reconfigure.at
Fix ovs-dpctl-top by removing 3 wrong hunks in py3-compat.patch.
[ovs.git] / tests / interface-reconfigure.at
1 m4_divert_push([PREPARE_TESTS])
2 [
3 # Creates a directory tree for use with "interface-reconfigure --root-dir".
4 ifr_setup () {
5 for script in \
6 interface-reconfigure \
7 InterfaceReconfigure.py \
8 InterfaceReconfigureBridge.py \
9 InterfaceReconfigureVswitch.py
10 do
11 cp $top_srcdir/xenserver/opt_xensource_libexec_$script $script
12 done
13
14 mkdir -p etc
15 cat > etc/xensource-inventory <<EOF
16 PRODUCT_BRAND='XenServer'
17 PRODUCT_NAME='xenenterprise'
18 PRODUCT_VERSION='5.5.0'
19 BUILD_NUMBER='24648p'
20 KERNEL_VERSION='2.6.18-128.1.6.el5.xs5.5.0.505.1024xen'
21 XEN_VERSION='3.3.1'
22 INSTALLATION_DATE='2010-02-10 16:45:28.748345'
23 PRIMARY_DISK='/dev/disk/by-id/scsi-360022190add7fc001241a14e0ee3e85c'
24 BACKUP_PARTITION='/dev/disk/by-id/scsi-360022190add7fc001241a14e0ee3e85c-part2'
25 INSTALLATION_UUID='852ee692-71b4-439e-abfb-0eba72dc85f0'
26 CONTROL_DOMAIN_UUID='44e6b66e-3074-4a3c-bbcd-756d845a3b56'
27 DEFAULT_SR_PHYSDEVS='/dev/sda3'
28 DOM0_MEM='752'
29 MANAGEMENT_INTERFACE='xenbr2'
30 EOF
31
32 mkdir -p etc/xensource
33 echo vswitch > etc/xensource/network.conf
34
35 for utility in \
36 sbin/ethtool \
37 sbin/ifdown \
38 sbin/ifup \
39 sbin/ip \
40 sbin/update-issue \
41 sbin/vconfig \
42 usr/sbin/brctl
43 do
44 mkdir -p `dirname $utility`
45 cat > $utility <<'EOF'
46 #! /bin/sh
47 echo ${0} ${*} >&2
48 EOF
49 chmod +x $utility
50 done
51
52 mkdir -p usr/bin
53 cat > usr/bin/ovs-vsctl <<'EOF'
54 #! /bin/sh
55 echo ${0} ${*} >&2
56
57 while test ${#} -ge 4; do
58 if test X"${1}" = Xget && \
59 test X"${2}" = Xinterface && \
60 test X"${4}" = Xofport; then
61 if test X"${3}" = Xeth2; then
62 echo 5
63 else
64 echo -1
65 fi
66 fi
67
68 shift
69 done
70 EOF
71 chmod +x usr/bin/ovs-vsctl
72
73 cat > usr/bin/ovs-ofctl <<'EOF'
74 #! /bin/sh
75 echo ${0} ${*} >&2
76
77 # Check that the flow is properly formed.
78 ovs-ofctl parse-flow "${3}" >/dev/null
79 EOF
80 chmod +x usr/bin/ovs-ofctl
81
82 mkdir -p etc/sysconfig/network-scripts
83 configure_netdev () {
84 mkdir -p sys/class/net/${1}
85 echo ${2} > sys/class/net/${1}/address
86 echo ${3} > sys/class/net/${1}/tx_queue_len
87 if test ${1} = eth1; then
88 # No VLAN acceleration.
89 echo 0x829 > sys/class/net/${1}/features
90 else
91 # Supports VLAN acceleration.
92 echo 0x10b89 > sys/class/net/${1}/features
93 fi
94 mkdir sys/class/net/${1}/device
95 ln -s ../../../bus/pci/drivers/e1000 sys/class/net/${1}/device/driver
96
97 : >> etc/sysconfig/network-scripts/ifcfg-${1}
98 }
99
100 configure_netdev lo 00:00:00:00:00:00 0
101 configure_netdev eth0 00:22:19:22:4b:af 1000
102 configure_netdev eth1 00:22:19:22:4b:b1 1000
103 configure_netdev eth2 00:15:17:a0:29:80 1000
104 configure_netdev eth3 00:15:17:a0:29:81 1000
105 configure_netdev eth4 00:1b:21:29:ce:51 1000
106
107 mkdir -p var/xapi
108 cat > var/xapi/network.dbcache <<'EOF'
109 <?xml version="1.0" ?>
110 <xenserver-network-configuration>
111 <pif ref="OpaqueRef:e0955887-571f-17fc-a971-61c1ec7d81b6">
112 <VLAN_slave_of/>
113 <tunnel_access_PIF_of/>
114 <management>
115 False
116 </management>
117 <bond_slave_of>
118 OpaqueRef:86d81bcf-0d25-90b2-cb11-af2007bd586e
119 </bond_slave_of>
120 <uuid>
121 bd62a141-091f-3909-e334-0334f67ff3be
122 </uuid>
123 <IP>
124
125 </IP>
126 <VLAN_master_of>
127 OpaqueRef:NULL
128 </VLAN_master_of>
129 <VLAN>
130 -1
131 </VLAN>
132 <netmask>
133
134 </netmask>
135 <other_config/>
136 <MAC>
137 00:22:19:22:4b:af
138 </MAC>
139 <ip_configuration_mode>
140 None
141 </ip_configuration_mode>
142 <DNS>
143
144 </DNS>
145 <device>
146 eth0
147 </device>
148 <bond_master_of/>
149 <currently_attached>
150 False
151 </currently_attached>
152 <gateway>
153
154 </gateway>
155 <network>
156 OpaqueRef:83e4a934-aeb5-e6f0-a743-d1c7ef7364c5
157 </network>
158 </pif>
159 <pif ref="OpaqueRef:eea8da94-a5e6-18fc-34a7-5e9b5a235806">
160 <VLAN_slave_of/>
161 <tunnel_access_PIF_of/>
162 <management>
163 False
164 </management>
165 <bond_slave_of>
166 OpaqueRef:NULL
167 </bond_slave_of>
168 <uuid>
169 df8d35c2-cc3a-a623-7065-d987a29feb75
170 </uuid>
171 <IP>
172
173 </IP>
174 <VLAN_master_of>
175 OpaqueRef:NULL
176 </VLAN_master_of>
177 <VLAN>
178 -1
179 </VLAN>
180 <netmask>
181
182 </netmask>
183 <other_config/>
184 <MAC>
185 00:1b:21:29:ce:51
186 </MAC>
187 <ip_configuration_mode>
188 None
189 </ip_configuration_mode>
190 <DNS>
191
192 </DNS>
193 <device>
194 eth4
195 </device>
196 <bond_master_of/>
197 <currently_attached>
198 False
199 </currently_attached>
200 <gateway>
201
202 </gateway>
203 <network>
204 OpaqueRef:bf51b4d3-7bdc-ea55-ba21-539b150b0531
205 </network>
206 </pif>
207 <pif ref="OpaqueRef:2956e6c8-487e-981c-85ff-c84796418768">
208 <VLAN_slave_of/>
209 <tunnel_access_PIF_of/>
210 <management>
211 False
212 </management>
213 <bond_slave_of>
214 OpaqueRef:86d81bcf-0d25-90b2-cb11-af2007bd586e
215 </bond_slave_of>
216 <uuid>
217 2f87fc95-5ab4-571a-2487-3f4ac1985663
218 </uuid>
219 <IP>
220
221 </IP>
222 <VLAN_master_of>
223 OpaqueRef:NULL
224 </VLAN_master_of>
225 <VLAN>
226 -1
227 </VLAN>
228 <netmask>
229
230 </netmask>
231 <other_config/>
232 <MAC>
233 00:22:19:22:4b:b1
234 </MAC>
235 <ip_configuration_mode>
236 None
237 </ip_configuration_mode>
238 <DNS>
239
240 </DNS>
241 <device>
242 eth1
243 </device>
244 <bond_master_of/>
245 <currently_attached>
246 False
247 </currently_attached>
248 <gateway>
249
250 </gateway>
251 <network>
252 OpaqueRef:92b41bf6-aa21-45d3-1c86-c87a5fa98f7d
253 </network>
254 </pif>
255 <pif ref="OpaqueRef:d2d1e51e-4da9-3163-8f57-bb683429335e">
256 <VLAN_slave_of/>
257 <tunnel_access_PIF_of/>
258 <management>
259 False
260 </management>
261 <bond_slave_of>
262 OpaqueRef:NULL
263 </bond_slave_of>
264 <uuid>
265 d2dfdab3-daf4-afea-f055-a25a0d24d714
266 </uuid>
267 <IP>
268
269 </IP>
270 <VLAN_master_of>
271 OpaqueRef:4c0eb823-4d96-da1d-e75f-411b85badb0c
272 </VLAN_master_of>
273 <VLAN>
274 4
275 </VLAN>
276 <netmask>
277
278 </netmask>
279 <other_config/>
280 <MAC>
281 fe:ff:ff:ff:ff:ff
282 </MAC>
283 <ip_configuration_mode>
284 None
285 </ip_configuration_mode>
286 <DNS>
287
288 </DNS>
289 <device>
290 bond0
291 </device>
292 <bond_master_of/>
293 <currently_attached>
294 True
295 </currently_attached>
296 <gateway>
297
298 </gateway>
299 <network>
300 OpaqueRef:a63afad0-fb4c-b4a4-3696-cbb3d88afc47
301 </network>
302 </pif>
303 <pif ref="OpaqueRef:2bc0fab5-523a-4125-609d-212391f5f6fc">
304 <VLAN_slave_of>
305 <master>
306 OpaqueRef:e623e1d6-cd02-be8d-820d-49d65c710297
307 </master>
308 </VLAN_slave_of>
309 <tunnel_access_PIF_of/>
310 <management>
311 False
312 </management>
313 <bond_slave_of>
314 OpaqueRef:NULL
315 </bond_slave_of>
316 <uuid>
317 f4ba396e-a993-a592-5fbc-a1d566afb59e
318 </uuid>
319 <IP>
320 10.0.0.188
321 </IP>
322 <VLAN_master_of>
323 OpaqueRef:NULL
324 </VLAN_master_of>
325 <VLAN>
326 -1
327 </VLAN>
328 <netmask>
329 255.0.0.0
330 </netmask>
331 <other_config/>
332 <MAC>
333 00:15:17:a0:29:81
334 </MAC>
335 <ip_configuration_mode>
336 Static
337 </ip_configuration_mode>
338 <DNS>
339
340 </DNS>
341 <device>
342 eth3
343 </device>
344 <bond_master_of/>
345 <currently_attached>
346 True
347 </currently_attached>
348 <gateway>
349
350 </gateway>
351 <network>
352 OpaqueRef:d9189da2-d00b-61ba-8a6d-ac42cc868e32
353 </network>
354 </pif>
355 <pif ref="OpaqueRef:205d1186-2cd1-d5e6-45e4-ea1698ea6e15">
356 <VLAN_slave_of/>
357 <tunnel_access_PIF_of/>
358 <management>
359 True
360 </management>
361 <bond_slave_of>
362 OpaqueRef:NULL
363 </bond_slave_of>
364 <uuid>
365 646ca9a1-36ad-e2f9-3ecc-1e5622c201c2
366 </uuid>
367 <IP>
368 172.18.3.188
369 </IP>
370 <VLAN_master_of>
371 OpaqueRef:NULL
372 </VLAN_master_of>
373 <VLAN>
374 -1
375 </VLAN>
376 <netmask>
377 255.255.0.0
378 </netmask>
379 <other_config/>
380 <MAC>
381 00:15:17:a0:29:80
382 </MAC>
383 <ip_configuration_mode>
384 DHCP
385 </ip_configuration_mode>
386 <DNS>
387
388 </DNS>
389 <device>
390 eth2
391 </device>
392 <bond_master_of/>
393 <currently_attached>
394 True
395 </currently_attached>
396 <gateway>
397
398 </gateway>
399 <network>
400 OpaqueRef:6e7c6e81-6b5e-b91f-e1f9-9e028567bdfe
401 </network>
402 </pif>
403 <pif ref="OpaqueRef:8e3e37e6-ebb9-087e-0201-f6a56bf554c3">
404 <VLAN_slave_of/>
405 <tunnel_access_PIF_of/>
406 <management>
407 False
408 </management>
409 <bond_slave_of>
410 OpaqueRef:NULL
411 </bond_slave_of>
412 <uuid>
413 3941edd2-865b-8dd8-61f0-199f5e1fa652
414 </uuid>
415 <IP>
416
417 </IP>
418 <VLAN_master_of>
419 OpaqueRef:e623e1d6-cd02-be8d-820d-49d65c710297
420 </VLAN_master_of>
421 <VLAN>
422 123
423 </VLAN>
424 <netmask>
425
426 </netmask>
427 <other_config/>
428 <MAC>
429 fe:ff:ff:ff:ff:ff
430 </MAC>
431 <ip_configuration_mode>
432 None
433 </ip_configuration_mode>
434 <DNS>
435
436 </DNS>
437 <device>
438 eth3
439 </device>
440 <bond_master_of/>
441 <currently_attached>
442 True
443 </currently_attached>
444 <gateway>
445
446 </gateway>
447 <network>
448 OpaqueRef:240fb5f8-addc-6ea3-f921-2a42b42acd17
449 </network>
450 </pif>
451 <pif ref="OpaqueRef:69c904bb-8da9-3424-485b-8b47c2d3ef11">
452 <VLAN_slave_of>
453 <master>
454 OpaqueRef:4c0eb823-4d96-da1d-e75f-411b85badb0c
455 </master>
456 </VLAN_slave_of>
457 <tunnel_access_PIF_of/>
458 <management>
459 False
460 </management>
461 <bond_slave_of>
462 OpaqueRef:NULL
463 </bond_slave_of>
464 <uuid>
465 6c0327a9-afa3-fc19-6798-a1bfe20095ed
466 </uuid>
467 <IP>
468
469 </IP>
470 <VLAN_master_of>
471 OpaqueRef:NULL
472 </VLAN_master_of>
473 <VLAN>
474 -1
475 </VLAN>
476 <netmask>
477
478 </netmask>
479 <other_config/>
480 <MAC>
481 00:22:19:22:4b:af
482 </MAC>
483 <ip_configuration_mode>
484 None
485 </ip_configuration_mode>
486 <DNS>
487
488 </DNS>
489 <device>
490 bond0
491 </device>
492 <bond_master_of>
493 <slave>
494 OpaqueRef:86d81bcf-0d25-90b2-cb11-af2007bd586e
495 </slave>
496 </bond_master_of>
497 <currently_attached>
498 True
499 </currently_attached>
500 <gateway>
501
502 </gateway>
503 <network>
504 OpaqueRef:ec1e5037-60ea-97e5-54b8-39bdb43c071a
505 </network>
506 </pif>
507 <bond ref="OpaqueRef:86d81bcf-0d25-90b2-cb11-af2007bd586e">
508 <master>
509 OpaqueRef:69c904bb-8da9-3424-485b-8b47c2d3ef11
510 </master>
511 <uuid>
512 dad825f1-6d81-386e-849c-5589281e53e1
513 </uuid>
514 <slaves>
515 <slave>
516 OpaqueRef:e0955887-571f-17fc-a971-61c1ec7d81b6
517 </slave>
518 <slave>
519 OpaqueRef:2956e6c8-487e-981c-85ff-c84796418768
520 </slave>
521 </slaves>
522 </bond>
523 <vlan ref="OpaqueRef:4c0eb823-4d96-da1d-e75f-411b85badb0c">
524 <tagged_PIF>
525 OpaqueRef:69c904bb-8da9-3424-485b-8b47c2d3ef11
526 </tagged_PIF>
527 <uuid>
528 841814da-d0d2-9da4-0b2e-b6143480bbfb
529 </uuid>
530 <untagged_PIF>
531 OpaqueRef:d2d1e51e-4da9-3163-8f57-bb683429335e
532 </untagged_PIF>
533 </vlan>
534 <vlan ref="OpaqueRef:e623e1d6-cd02-be8d-820d-49d65c710297">
535 <tagged_PIF>
536 OpaqueRef:2bc0fab5-523a-4125-609d-212391f5f6fc
537 </tagged_PIF>
538 <uuid>
539 399279a2-5ccd-5368-9af3-8622a1f1ac82
540 </uuid>
541 <untagged_PIF>
542 OpaqueRef:8e3e37e6-ebb9-087e-0201-f6a56bf554c3
543 </untagged_PIF>
544 </vlan>
545 <network ref="OpaqueRef:a63afad0-fb4c-b4a4-3696-cbb3d88afc47">
546 <PIFs>
547 <PIF>
548 OpaqueRef:d2d1e51e-4da9-3163-8f57-bb683429335e
549 </PIF>
550 </PIFs>
551 <bridge>
552 xapi2
553 </bridge>
554 <other_config/>
555 <uuid>
556 99be2da4-6c33-6f8e-49ea-3bc592fe3c85
557 </uuid>
558 </network>
559 <network ref="OpaqueRef:d9189da2-d00b-61ba-8a6d-ac42cc868e32">
560 <PIFs>
561 <PIF>
562 OpaqueRef:2bc0fab5-523a-4125-609d-212391f5f6fc
563 </PIF>
564 </PIFs>
565 <bridge>
566 xenbr3
567 </bridge>
568 <other_config/>
569 <uuid>
570 2902ae1b-8013-897a-b697-0b200ea3aaa5
571 </uuid>
572 </network>
573 <network ref="OpaqueRef:ec1e5037-60ea-97e5-54b8-39bdb43c071a">
574 <PIFs>
575 <PIF>
576 OpaqueRef:69c904bb-8da9-3424-485b-8b47c2d3ef11
577 </PIF>
578 </PIFs>
579 <bridge>
580 xapi1
581 </bridge>
582 <other_config/>
583 <uuid>
584 45cbbb43-113d-a712-3231-c6463f253cef
585 </uuid>
586 </network>
587 <network ref="OpaqueRef:92b41bf6-aa21-45d3-1c86-c87a5fa98f7d">
588 <PIFs>
589 <PIF>
590 OpaqueRef:2956e6c8-487e-981c-85ff-c84796418768
591 </PIF>
592 </PIFs>
593 <bridge>
594 xenbr1
595 </bridge>
596 <other_config/>
597 <uuid>
598 99f8771a-645a-26a3-e06c-30a401f1d009
599 </uuid>
600 </network>
601 <network ref="OpaqueRef:6e7c6e81-6b5e-b91f-e1f9-9e028567bdfe">
602 <PIFs>
603 <PIF>
604 OpaqueRef:205d1186-2cd1-d5e6-45e4-ea1698ea6e15
605 </PIF>
606 </PIFs>
607 <bridge>
608 xenbr2
609 </bridge>
610 <other_config/>
611 <uuid>
612 d08c8749-0c8f-9e8d-ce25-fd364661ee99
613 </uuid>
614 </network>
615 <network ref="OpaqueRef:83e4a934-aeb5-e6f0-a743-d1c7ef7364c5">
616 <PIFs>
617 <PIF>
618 OpaqueRef:e0955887-571f-17fc-a971-61c1ec7d81b6
619 </PIF>
620 </PIFs>
621 <bridge>
622 xenbr0
623 </bridge>
624 <other_config>
625 <vswitch-disable-in-band>
626 true
627 </vswitch-disable-in-band>
628 </other_config>
629 <uuid>
630 c9eecb03-560d-61de-b6a8-56dfc766f67e
631 </uuid>
632 </network>
633 <network ref="OpaqueRef:bf51b4d3-7bdc-ea55-ba21-539b150b0531">
634 <PIFs>
635 <PIF>
636 OpaqueRef:eea8da94-a5e6-18fc-34a7-5e9b5a235806
637 </PIF>
638 </PIFs>
639 <bridge>
640 xenbr4
641 </bridge>
642 <other_config/>
643 <uuid>
644 d2c14c89-29cc-51d4-7664-633eff02b2ad
645 </uuid>
646 </network>
647 <network ref="OpaqueRef:0b7354a4-8f4b-aa08-2f16-a22c117e4211">
648 <PIFs/>
649 <bridge>
650 xapi0
651 </bridge>
652 <other_config/>
653 <uuid>
654 dc0f0632-c2aa-1b78-2fea-0d3a23c51740
655 </uuid>
656 </network>
657 <network ref="OpaqueRef:240fb5f8-addc-6ea3-f921-2a42b42acd17">
658 <PIFs>
659 <PIF>
660 OpaqueRef:8e3e37e6-ebb9-087e-0201-f6a56bf554c3
661 </PIF>
662 </PIFs>
663 <bridge>
664 xapi3
665 </bridge>
666 <other_config/>
667 <uuid>
668 db7bdc03-074d-42ae-fc73-9b06de1d57f6
669 </uuid>
670 </network>
671 <pool ref="OpaqueRef:a765d06c-fc82-cc67-8f6c-fd8db45f6a84">
672 <other_config>
673 <vswitch-controller-fail-mode>
674 secure
675 </vswitch-controller-fail-mode>
676 </other_config>
677 </pool>
678 </xenserver-network-configuration>
679 EOF
680 }
681
682 ifr_run () {
683 $PYTHON3 ./interface-reconfigure --root-prefix="`pwd`" --no-syslog "$@"
684 }
685
686 ifr_filter () {
687 sed -n -e "s,`pwd`,,g" -e 's/ -- /\
688 /g' -e '/^Running command:/!p' stderr
689 }]
690 m4_divert_pop([PREPARE_TESTS])
691
692 \f
693 AT_BANNER([interface-reconfigure])
694
695 AT_SETUP([non-VLAN, non-bond])
696 AT_KEYWORDS([interface-reconfigure])
697 AT_SKIP_IF([$non_ascii_cwd])
698 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
699 ifr_setup
700
701 AT_CHECK([ifr_run --force xenbr2 up], [0], [], [stderr])
702 AT_CHECK([ifr_filter], [0], [[Force interface xenbr2 up
703 Loading xapi database cache from /var/xapi/network.dbcache
704 Configured for Vswitch datapath
705 action_up: xenbr2
706 Writing network configuration for xenbr2
707 Configuring xenbr2 using DHCP configuration
708 configure_datapath: bridge - xenbr2
709 configure_datapath: physical - ['eth2']
710 configure_datapath: extra ports - []
711 configure_datapath: extra bonds - []
712 /usr/bin/ovs-vsctl -vconsole:off get-fail-mode xenbr2
713 Applying changes to /etc/sysconfig/network-scripts/route-xenbr2 configuration
714 Applying changes to /etc/sysconfig/network configuration
715 Applying changes to /etc/sysconfig/network-scripts/ifcfg-xenbr2 configuration
716 /sbin/ip link set eth2 up mtu 1500
717 /sbin/ethtool -K eth2 gro off lro off
718 /usr/bin/ovs-vsctl --timeout=20
719 --with-iface --if-exists del-port eth2
720 --may-exist add-br xenbr2
721 --may-exist add-port xenbr2 eth2
722 set Bridge xenbr2 other-config:hwaddr="00:15:17:a0:29:80"
723 set Bridge xenbr2 fail_mode=secure
724 remove Bridge xenbr2 other_config disable-in-band
725 br-set-external-id xenbr2 xs-network-uuids d08c8749-0c8f-9e8d-ce25-fd364661ee99
726 /usr/bin/ovs-vsctl -vconsole:off get interface eth2 ofport
727 /usr/bin/ovs-ofctl add-flow xenbr2 idle_timeout=0,priority=0,in_port=5,arp,nw_proto=1,actions=local
728 /usr/bin/ovs-ofctl add-flow xenbr2 idle_timeout=0,priority=0,in_port=local,arp,dl_src=00:15:17:a0:29:80,actions=5
729 /usr/bin/ovs-ofctl add-flow xenbr2 idle_timeout=0,priority=0,in_port=5,dl_dst=00:15:17:a0:29:80,actions=local
730 /usr/bin/ovs-ofctl add-flow xenbr2 idle_timeout=0,priority=0,in_port=local,dl_src=00:15:17:a0:29:80,actions=5
731 /sbin/ifup xenbr2
732 /sbin/update-issue
733 Committing changes to /etc/sysconfig/network-scripts/route-xenbr2 configuration
734 Committing changes to /etc/sysconfig/network configuration
735 Committing changes to /etc/sysconfig/network-scripts/ifcfg-xenbr2 configuration
736 ]])
737
738 AT_CHECK([cat etc/sysconfig/network-scripts/ifcfg-xenbr2], [0],
739 [# DO NOT EDIT: This file (ifcfg-xenbr2) was autogenerated by interface-reconfigure
740 XEMANAGED=yes
741 DEVICE=xenbr2
742 ONBOOT=no
743 NOZEROCONF=yes
744 TYPE=Ethernet
745 BOOTPROTO=dhcp
746 PERSISTENT_DHCLIENT=yes
747 MTU=1500
748 ])
749
750 # Simulate interface-reconfigure creating xenbr2, so that we can tell
751 # interface-reconfigure to take it back down.
752 AT_CHECK([configure_netdev xenbr2 00:15:17:a0:29:80 0])
753
754 AT_CHECK([ifr_run --force xenbr2 down], [0], [], [stderr])
755 AT_CHECK([ifr_filter], [0], [[Force interface xenbr2 down
756 Loading xapi database cache from /var/xapi/network.dbcache
757 Configured for Vswitch datapath
758 action_down: xenbr2
759 /sbin/ifdown xenbr2
760 deconfigure ipdev xenbr2 on xenbr2
761 deconfigure_bridge: bridge - xenbr2
762 action_down: bring down physical devices - ['eth2']
763 /sbin/ip link set eth2 down
764 /usr/bin/ovs-vsctl --timeout=20
765 --with-iface --if-exists del-port xenbr2
766 --if-exists del-br xenbr2
767 ]])
768
769 AT_CLEANUP
770 \f
771 AT_SETUP([VLAN, non-bond])
772 AT_KEYWORDS([interface-reconfigure])
773 AT_SKIP_IF([$non_ascii_cwd])
774 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
775 ifr_setup
776
777 AT_CHECK([ifr_run --force xapi3 up], [0], [], [stderr])
778 AT_CHECK([ifr_filter], [0], [[Force interface xapi3 up
779 Loading xapi database cache from /var/xapi/network.dbcache
780 Configured for Vswitch datapath
781 action_up: xapi3
782 Writing network configuration for xapi3
783 Configuring xapi3 using None configuration
784 configure_datapath: bridge - xenbr3
785 configure_datapath: physical - ['eth3']
786 configure_datapath: extra ports - []
787 configure_datapath: extra bonds - []
788 Applying changes to /etc/sysconfig/network-scripts/route-xapi3 configuration
789 Applying changes to /etc/sysconfig/network-scripts/ifcfg-xapi3 configuration
790 /sbin/ip link set eth3 up mtu 1500
791 /sbin/ethtool -K eth3 gro off lro off
792 /usr/bin/ovs-vsctl --timeout=20
793 --with-iface --if-exists del-port eth3
794 --may-exist add-br xenbr3
795 --may-exist add-port xenbr3 eth3
796 set Bridge xenbr3 other-config:hwaddr="00:15:17:a0:29:81"
797 set Bridge xenbr3 fail_mode=secure
798 remove Bridge xenbr3 other_config disable-in-band
799 br-set-external-id xenbr3 xs-network-uuids 2902ae1b-8013-897a-b697-0b200ea3aaa5;db7bdc03-074d-42ae-fc73-9b06de1d57f6
800 --if-exists del-br xapi3
801 --may-exist add-br xapi3 xenbr3 123
802 br-set-external-id xapi3 xs-network-uuids 2902ae1b-8013-897a-b697-0b200ea3aaa5;db7bdc03-074d-42ae-fc73-9b06de1d57f6
803 set Interface xapi3 MAC="00:15:17:a0:29:81"
804 /sbin/ifup xapi3
805 /sbin/update-issue
806 Committing changes to /etc/sysconfig/network-scripts/route-xapi3 configuration
807 Committing changes to /etc/sysconfig/network-scripts/ifcfg-xapi3 configuration
808 ]])
809
810 AT_CHECK([cat etc/sysconfig/network-scripts/ifcfg-xapi3], [0],
811 [# DO NOT EDIT: This file (ifcfg-xapi3) was autogenerated by interface-reconfigure
812 XEMANAGED=yes
813 DEVICE=xapi3
814 ONBOOT=no
815 NOZEROCONF=yes
816 TYPE=Ethernet
817 BOOTPROTO=none
818 MTU=1500
819 ])
820
821 # Simulate interface-reconfigure creating xapi3, so that we can tell
822 # interface-reconfigure to take it back down.
823 AT_CHECK([configure_netdev xapi3 00:23:20:AC:AF:02 0])
824
825 AT_CHECK([ifr_run --force xapi3 down], [0], [], [stderr])
826 AT_CHECK([ifr_filter], [0], [[Force interface xapi3 down
827 Loading xapi database cache from /var/xapi/network.dbcache
828 Configured for Vswitch datapath
829 action_down: xapi3
830 /sbin/ifdown xapi3
831 deconfigure ipdev xapi3 on xenbr3
832 deconfigure_bridge: bridge - xapi3
833 action_down: no more masters, bring down slave xenbr3
834 deconfigure_bridge: bridge - xenbr3
835 action_down: bring down physical devices - ['eth3']
836 /sbin/ip link set eth3 down
837 /usr/bin/ovs-vsctl --timeout=20
838 --with-iface --if-exists del-port xapi3
839 --if-exists del-br xapi3
840 --if-exists del-br xenbr3
841 ]])
842
843 AT_CLEANUP
844 \f
845 AT_SETUP([Bond, non-VLAN])
846 AT_KEYWORDS([interface-reconfigure])
847 AT_SKIP_IF([$non_ascii_cwd])
848 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
849 ifr_setup
850
851 # Pretend that bond0 exists, even though it would really be created by
852 # a "create-bond" call in an ovs-vsctl invocation within
853 # interface-reconfigure, because otherwise interface-reconfigure will
854 # die with "failed to apply changes: netdev: up: device bond0 does not
855 # exist" after it thinks it created bond0.
856 AT_CHECK([configure_netdev bond0 00:23:20:e6:39:75 0])
857
858 AT_CHECK([ifr_run --force xapi1 up], [0], [], [stderr])
859 AT_CHECK([ifr_filter], [0], [[Force interface xapi1 up
860 Loading xapi database cache from /var/xapi/network.dbcache
861 Configured for Vswitch datapath
862 action_up: xapi1
863 Writing network configuration for xapi1
864 Configuring xapi1 using None configuration
865 configure_datapath: leaving bond bond0 up
866 configure_datapath: leaving bond bond0 up
867 configure_datapath: bridge - xapi1
868 configure_datapath: physical - ['eth0', 'eth1']
869 configure_datapath: extra ports - []
870 configure_datapath: extra bonds - []
871 netdev: down: device xenbr0 does not exist, ignoring
872 netdev: down: device xenbr1 does not exist, ignoring
873 Applying changes to /etc/sysconfig/network-scripts/route-xapi1 configuration
874 Applying changes to /etc/sysconfig/network-scripts/ifcfg-xapi1 configuration
875 /sbin/ip link set eth0 up mtu 1500
876 /sbin/ethtool -K eth0 gro off lro off
877 /sbin/ip link set eth1 up mtu 1500
878 /sbin/ethtool -K eth1 gro off lro off
879 /usr/bin/ovs-vsctl --timeout=20
880 --if-exists del-br xenbr0
881 --if-exists del-br xenbr1
882 --with-iface --if-exists del-port eth0
883 --with-iface --if-exists del-port eth1
884 --may-exist add-br xapi1
885 --with-iface --if-exists del-port bond0
886 --fake-iface add-bond xapi1 bond0 eth0 eth1
887 set Port bond0 MAC="00:22:19:22:4b:af" bond_downdelay=200 other-config:bond-miimon-interval=100 bond_updelay=31000 other-config:bond-detect-mode=carrier lacp=off bond_mode=balance-slb
888 set Bridge xapi1 other-config:hwaddr="00:22:19:22:4b:af"
889 set Bridge xapi1 fail_mode=secure
890 remove Bridge xapi1 other_config disable-in-band
891 br-set-external-id xapi1 xs-network-uuids 45cbbb43-113d-a712-3231-c6463f253cef;99be2da4-6c33-6f8e-49ea-3bc592fe3c85
892 /sbin/ifup xapi1
893 action_up: bring up bond0
894 /sbin/ip link set bond0 up
895 /sbin/update-issue
896 Committing changes to /etc/sysconfig/network-scripts/route-xapi1 configuration
897 Committing changes to /etc/sysconfig/network-scripts/ifcfg-xapi1 configuration
898 ]])
899
900 AT_CHECK([cat etc/sysconfig/network-scripts/ifcfg-xapi1], [0],
901 [# DO NOT EDIT: This file (ifcfg-xapi1) was autogenerated by interface-reconfigure
902 XEMANAGED=yes
903 DEVICE=xapi1
904 ONBOOT=no
905 NOZEROCONF=yes
906 TYPE=Ethernet
907 BOOTPROTO=none
908 MTU=1500
909 ])
910
911 # Simulate interface-reconfigure creating xapi1, so that we can tell
912 # interface-reconfigure to take it back down.
913 AT_CHECK([configure_netdev xapi1 00:22:19:22:4B:AF 0])
914
915 AT_CHECK([ifr_run --force xapi1 down], [0], [], [stderr])
916 AT_CHECK([ifr_filter], [0], [[Force interface xapi1 down
917 Loading xapi database cache from /var/xapi/network.dbcache
918 Configured for Vswitch datapath
919 action_down: xapi1
920 /sbin/ifdown xapi1
921 deconfigure ipdev xapi1 on xapi1
922 deconfigure_bridge: bridge - xapi1
923 action_down: bring down physical devices - ['eth0', 'eth1']
924 /sbin/ip link set eth0 down
925 /sbin/ip link set eth1 down
926 /usr/bin/ovs-vsctl --timeout=20
927 --with-iface --if-exists del-port xapi1
928 --if-exists del-br xapi1
929 ]])
930
931 AT_CLEANUP
932 \f
933 AT_SETUP([VLAN on bond])
934 AT_KEYWORDS([interface-reconfigure])
935 AT_SKIP_IF([$non_ascii_cwd])
936 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
937 ifr_setup
938
939 # Pretend that bond0 exists, even though it would really be created by
940 # a "create-bond" call in an ovs-vsctl invocation within
941 # interface-reconfigure, because otherwise interface-reconfigure will
942 # die with "failed to apply changes: netdev: up: device bond0 does not
943 # exist" after it thinks it created bond0.
944 AT_CHECK([configure_netdev bond0 00:23:20:e6:39:75 0])
945
946 AT_CHECK([ifr_run --force xapi2 up], [0], [], [stderr])
947 AT_CHECK([ifr_filter], [0], [[Force interface xapi2 up
948 Loading xapi database cache from /var/xapi/network.dbcache
949 Configured for Vswitch datapath
950 action_up: xapi2
951 Writing network configuration for xapi2
952 Configuring xapi2 using None configuration
953 configure_datapath: leaving bond bond0 up
954 configure_datapath: leaving bond bond0 up
955 configure_datapath: bridge - xapi1
956 configure_datapath: physical - ['eth0', 'eth1']
957 configure_datapath: extra ports - []
958 configure_datapath: extra bonds - []
959 netdev: down: device xenbr0 does not exist, ignoring
960 netdev: down: device xenbr1 does not exist, ignoring
961 Applying changes to /etc/sysconfig/network-scripts/route-xapi2 configuration
962 Applying changes to /etc/sysconfig/network-scripts/ifcfg-xapi2 configuration
963 /sbin/ip link set eth0 up mtu 1500
964 /sbin/ethtool -K eth0 gro off lro off
965 /sbin/ip link set eth1 up mtu 1500
966 /sbin/ethtool -K eth1 gro off lro off
967 /usr/bin/ovs-vsctl --timeout=20
968 --if-exists del-br xenbr0
969 --if-exists del-br xenbr1
970 --with-iface --if-exists del-port eth0
971 --with-iface --if-exists del-port eth1
972 --may-exist add-br xapi1
973 --with-iface --if-exists del-port bond0
974 --fake-iface add-bond xapi1 bond0 eth0 eth1
975 set Port bond0 MAC="00:22:19:22:4b:af" bond_downdelay=200 other-config:bond-miimon-interval=100 bond_updelay=31000 other-config:bond-detect-mode=carrier lacp=off bond_mode=balance-slb
976 set Bridge xapi1 other-config:hwaddr="00:22:19:22:4b:af"
977 set Bridge xapi1 fail_mode=secure
978 remove Bridge xapi1 other_config disable-in-band
979 br-set-external-id xapi1 xs-network-uuids 45cbbb43-113d-a712-3231-c6463f253cef;99be2da4-6c33-6f8e-49ea-3bc592fe3c85
980 --if-exists del-br xapi2
981 --may-exist add-br xapi2 xapi1 4
982 br-set-external-id xapi2 xs-network-uuids 45cbbb43-113d-a712-3231-c6463f253cef;99be2da4-6c33-6f8e-49ea-3bc592fe3c85
983 set Interface xapi2 MAC="00:22:19:22:4b:af"
984 /sbin/ifup xapi2
985 action_up: bring up bond0
986 /sbin/ip link set bond0 up
987 /sbin/update-issue
988 Committing changes to /etc/sysconfig/network-scripts/route-xapi2 configuration
989 Committing changes to /etc/sysconfig/network-scripts/ifcfg-xapi2 configuration
990 ]])
991
992 AT_CHECK([cat etc/sysconfig/network-scripts/ifcfg-xapi2], [0],
993 [# DO NOT EDIT: This file (ifcfg-xapi2) was autogenerated by interface-reconfigure
994 XEMANAGED=yes
995 DEVICE=xapi2
996 ONBOOT=no
997 NOZEROCONF=yes
998 TYPE=Ethernet
999 BOOTPROTO=none
1000 MTU=1500
1001 ])
1002
1003 # Simulate interface-reconfigure creating xapi2, so that we can tell
1004 # interface-reconfigure to take it back down.
1005 AT_CHECK([configure_netdev xapi2 00:23:20:A4:71:C2 0])
1006
1007 AT_CHECK([ifr_run --force xapi2 down], [0], [], [stderr])
1008 AT_CHECK([ifr_filter], [0], [[Force interface xapi2 down
1009 Loading xapi database cache from /var/xapi/network.dbcache
1010 Configured for Vswitch datapath
1011 action_down: xapi2
1012 /sbin/ifdown xapi2
1013 deconfigure ipdev xapi2 on xapi1
1014 deconfigure_bridge: bridge - xapi2
1015 action_down: no more masters, bring down slave xapi1
1016 deconfigure_bridge: bridge - xapi1
1017 action_down: bring down physical devices - ['eth0', 'eth1']
1018 /sbin/ip link set eth0 down
1019 /sbin/ip link set eth1 down
1020 /usr/bin/ovs-vsctl --timeout=20
1021 --with-iface --if-exists del-port xapi2
1022 --if-exists del-br xapi2
1023 --if-exists del-br xapi1
1024 ]])
1025
1026 AT_CLEANUP
1027
1028 dnl This test configures two tunnels, then deletes the second and re-uses its
1029 dnl name for different types of ports. This was introduced to detect errors
1030 dnl where port configuration persists even when the port is deleted and
1031 dnl readded.
1032 AT_SETUP([Re-create port with different types])
1033 AT_KEYWORDS([interface-reconfigure])
1034 OVS_VSWITCHD_START(
1035 [add-port br0 p0 -- set int p0 type=gre options:remote_ip=127.0.0.1 -- \
1036 add-port br0 p1 -- set int p1 type=dummy -- \
1037 add-port br0 p2 -- set int p2 type=dummy])
1038
1039 AT_CHECK([ovs-vsctl set int p1 type=gre options:remote_ip=127.0.0.1])
1040 AT_CHECK([ovs-vsctl del-port p1])
1041 AT_CHECK([ovs-vsctl add-port br0 p1 -- set int p1 type=dummy])
1042
1043 OVS_APP_EXIT_AND_WAIT([ovs-vswitchd])
1044 OVS_APP_EXIT_AND_WAIT([ovsdb-server])
1045 AT_CLEANUP