Commit 12a7310b authored by John Hackett's avatar John Hackett

Adding misc scripts

parent 58b60f35
......@@ -3,4 +3,5 @@ source "https://rubygems.org"
# gem "rails"
gem "sinatra"
gem "opennebula"
\ No newline at end of file
gem "opennebula"
gem "ipaddress"
\ No newline at end of file
......@@ -2,6 +2,7 @@ GEM
remote: https://rubygems.org/
specs:
builder (3.2.3)
ipaddress (0.8.3)
json (2.1.0)
mini_portile2 (2.3.0)
mustermann (1.0.1)
......@@ -31,6 +32,7 @@ PLATFORMS
ruby
DEPENDENCIES
ipaddress
opennebula
sinatra
......
# This script is to be invoked as part of `make image`
# It's purpose is to be called from virt-builder, so we
# don't have to install packages every time we run a
# build with terraform
install python
install gnupg
install openssh-server
install avahi-daemon
#!/usr/bin/env python3
import ipaddress
prefix = ipaddress.ip_address('2001:8b0:baa7::1')
print(prefix)
#!/usr/bin/env ruby
require 'ipaddress'
hello = IPAddress "2001:8b0:baa7::1/48"
puts hello
......@@ -48,24 +48,18 @@ end
# glory to ipam
ipv6 = "2001:08b0:baa7:#{group.id.to_s}::/64"
private_network = %{
ipv6_network = %{
#Configuration attributes (dummy driver)
NAME = "rfc1918-ovs #{USERNAME}"
DESCRIPTION = "An OVS public network for IP addresses"
NAME = "IPV6 #{USERNAME}"
DESCRIPTION = "IPv6 range #{ipv6}"
VN_MAD = "ovswitch"
BRIDGE = "onebr0"
VN_MAD = "fw"
BRIDGE = "br0"
CLUSTERS = [
ID = 0
]
VLAN_IDS = [
START = "10",
RESERVED = "0, 1, 4095"
]
PERMISSIONS = [
OWNER_U = "1",
OWNER_M = "1",
......@@ -85,13 +79,13 @@ private_network = %{
GATEWAY = "10.0.24.1"
#Address Ranges, only these addresses will be assigned to the VMs
AR=[TYPE = "IP4", IP = "172.16.0.5", SIZE = "150"]
AR=[TYPE = "IP6", IP = "2001:08b0:baa7:#{group.id.to_s}::10", SIZE = "100000"]
}
network_xml = VirtualNetwork.build_xml
network = VirtualNetwork.new(network_xml, client)
err = network.allocate(private_network, -1)
err = network.allocate(ipv6_network, -1)
if OpenNebula.is_error?(err)
STDERR.puts "network allocate fail: #{err.message}"
else
......@@ -114,6 +108,71 @@ else
puts "chmod successful: #{network.id.to_s}"
end
#private_network = %{
#Configuration attributes (dummy driver)
# NAME = "rfc1918-ovs #{USERNAME}"
# DESCRIPTION = "An OVS public network for IP addresses"
#
# VN_MAD = "ovswitch"
# BRIDGE = "onebr0"
#
# CLUSTERS = [
# ID = 0
# ]
#
# VLAN_IDS = [
# START = "10",
# RESERVED = "0, 1, 4095"
# ]
#
# PERMISSIONS = [
# OWNER_U = "1",
# OWNER_M = "1",
# OWNER_A = "0",
# GROUP_U = "1",
# GROUP_M = "1",
# GROUP_A = "0",
# OTHER_U = "0",
# OTHER_M = "0",
# OTHER_A = "0"
# ]
#
# # Context attributes
# NETWORK_ADDRESS = "172.16.0.0"
# NETWORK_MASK = "255.240.0.0"
# DNS = "192.168.0.1"
# GATEWAY = "10.0.24.1"
#
# #Address Ranges, only these addresses will be assigned to the VMs
# AR=[TYPE = "IP4", IP = "172.16.0.5", SIZE = "150"]
#}
#
#network_xml = VirtualNetwork.build_xml
#network = VirtualNetwork.new(network_xml, client)
#
#err = network.allocate(private_network, -1)
#if OpenNebula.is_error?(err)
# STDERR.puts "network allocate fail: #{err.message}"
#else
# puts "network allocated: #{network.id.to_s}"
#end
#
#puts "#{group.admin_ids}"
#
#err = network.chown(group.admin_ids.first, group.id)
#if OpenNebula.is_error?(err)
# STDERR.puts "chown fail: #{err.message}"
#else
# puts "chown successful: #{network.id.to_s}"
#end
#
#err = network.chmod_octet("600")
#if OpenNebula.is_error?(err)
# STDERR.puts "chmod fail: #{err.message}"
#else
# puts "chmod successful: #{network.id.to_s}"
#end
#
acl = "@#{group.id} NET/##{network.id} USE"
default_acl_xml = Acl.build_xml()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment