-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide a script to bootstrap mm devices
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
|
||
|