Skip to content

Commit efa361d

Browse files
committed
Provide a script to bootstrap mm devices
See: https://progress.opensuse.org/issues/115418
1 parent 58f720c commit efa361d

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

openqa-prepare-mm-setup

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
system("zypper in -y os-autoinst-openvswitch");
2+
3+
my $bridge = 1;
4+
my $openvswitch = "/etc/sysconfig/os-autoinst-openvswitch";
5+
open(file, '>', $openvswitch) or die "Failed to open $openvswitch for writing!";
6+
print file, "OS_AUTOINST_USE_BRIDGE=br$bridge";
7+
close(file);
8+
9+
system("ovs-vsctl add-br br$bridge");
10+
11+
my $bridge_file = "/etc/sysconfig/network/ifcfg-br$bridge";
12+
my $ip = "10.0.2.2/15";
13+
my config = """
14+
BOOTPROTO='static'
15+
IPADDR='$ip'
16+
STARTMODE='auto'
17+
ZONE=trusted
18+
OVS_BRIDGE='yes'
19+
PRE_UP_SCRIPT="wicked:gre_tunnel_preup.sh"
20+
""";
21+
22+
for (my $i = 0; $i < 148; $i++) {
23+
$config .= OVS_BRIDGE_PORT_DEVICE_0='tap0';
24+
25+
my $tapconfig = """
26+
BOOTPROTO='none'
27+
IPADDR=''
28+
NETMASK=''
29+
PREFIXLEN=''
30+
STARTMODE='auto'
31+
TUNNEL='tap'
32+
TUNNEL_SET_GROUP='nogroup'
33+
TUNNEL_SET_OWNER='_openqa-worker'
34+
ZONE=trusted
35+
""";
36+
37+
my $tap_file = "/etc/sysconfig/network/ifcfg-tap$i";
38+
open(file, '>', $tap_file) or die "Failed to open $tap_file for writing!";
39+
print file, $tapconfig;
40+
close(file);
41+
}
42+
43+
open(file, '>', $bridge_file) or die "Failed to open $bridge_file for writing!";
44+
print file, $config;
45+
close(file);
46+
print("Config written!");
47+
48+
my $other_ip = "XXX"; # XXX FIX Me, please
49+
my $gre = "/etc/wicked/scripts/gre_tunnel_preup.sh";
50+
open(file, '>', $gre) or die "Failed to open $gre for writing!";
51+
print file, """
52+
#!/bin/sh
53+
action="$$1"
54+
bridge="$$2"
55+
ovs-vsctl set bridge $$bridge stp_enable=true
56+
ovs-vsctl --may-exist add-port $$bridge gre1 -- set interface gre1 type=gre options:remote_ip=$other_ip
57+
""";
58+
close(file);
59+
system("chmod +x $gre");
60+
61+

0 commit comments

Comments
 (0)