Skip to content

Commit

Permalink
Provide a script to bootstrap mm devices
Browse files Browse the repository at this point in the history
  • Loading branch information
kalikiana committed Oct 27, 2022
1 parent 58f720c commit efa361d
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions openqa-prepare-mm-setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
system("zypper in -y os-autoinst-openvswitch");

my $bridge = 1;
my $openvswitch = "/etc/sysconfig/os-autoinst-openvswitch";
open(file, '>', $openvswitch) or die "Failed to open $openvswitch for writing!";
print file, "OS_AUTOINST_USE_BRIDGE=br$bridge";
close(file);

system("ovs-vsctl add-br br$bridge");

my $bridge_file = "/etc/sysconfig/network/ifcfg-br$bridge";
my $ip = "10.0.2.2/15";
my config = """
BOOTPROTO='static'
IPADDR='$ip'
STARTMODE='auto'
ZONE=trusted
OVS_BRIDGE='yes'
PRE_UP_SCRIPT="wicked:gre_tunnel_preup.sh"
""";

for (my $i = 0; $i < 148; $i++) {
$config .= OVS_BRIDGE_PORT_DEVICE_0='tap0';

my $tapconfig = """
BOOTPROTO='none'
IPADDR=''
NETMASK=''
PREFIXLEN=''
STARTMODE='auto'
TUNNEL='tap'
TUNNEL_SET_GROUP='nogroup'
TUNNEL_SET_OWNER='_openqa-worker'
ZONE=trusted
""";

my $tap_file = "/etc/sysconfig/network/ifcfg-tap$i";
open(file, '>', $tap_file) or die "Failed to open $tap_file for writing!";
print file, $tapconfig;
close(file);
}

open(file, '>', $bridge_file) or die "Failed to open $bridge_file for writing!";
print file, $config;
close(file);
print("Config written!");

my $other_ip = "XXX"; # XXX FIX Me, please
my $gre = "/etc/wicked/scripts/gre_tunnel_preup.sh";
open(file, '>', $gre) or die "Failed to open $gre for writing!";
print file, """
#!/bin/sh
action="$$1"
bridge="$$2"
ovs-vsctl set bridge $$bridge stp_enable=true
ovs-vsctl --may-exist add-port $$bridge gre1 -- set interface gre1 type=gre options:remote_ip=$other_ip
""";
close(file);
system("chmod +x $gre");


0 comments on commit efa361d

Please sign in to comment.