Commit 29deef1c authored by Elodie Bertoncello's avatar Elodie Bertoncello
parents efd9984c 645ea1b6

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
......@@ -2,3 +2,4 @@ source :rubygems
gem 'json_pure', '~> 1.5'
gem 'net-ssh'
gem 'restfully','1.0.5'
GEM
remote: http://rubygems.org/
specs:
addressable (2.2.8)
backports (2.5.1)
bond (0.4.2)
json (1.7.0)
json_pure (1.5.1)
mime-types (1.18)
net-ssh (2.1.0)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rb-readline (0.4.2)
rest-client (1.6.7)
mime-types (>= 1.16)
rest-client-components (1.2.0)
rack (>= 1.0.1)
rest-client (>= 1.6.0, < 1.7.0)
restfully (1.0.5)
addressable
backports
json (~> 1.5)
rack-cache
rb-readline
rest-client (~> 1.6)
rest-client-components
ripl (= 0.6.1)
ripl-color_streams
ripl-multi_line
ripl-play (~> 0.2.1)
ripl-short_errors
ripl (0.6.1)
bond (~> 0.4.0)
ripl-color_streams (0.1.2)
ripl (>= 0.2.8)
ripl-multi_line (0.3.0)
ripl (>= 0.3.6)
ripl-play (0.2.1)
ripl (>= 0.3.0)
ripl-short_errors (0.1.0)
ripl (>= 0.2.8)
PLATFORMS
ruby
......@@ -10,3 +47,4 @@ PLATFORMS
DEPENDENCIES
json_pure (~> 1.5)
net-ssh
restfully (= 1.0.5)
......@@ -26,18 +26,38 @@ task :api_sites do
end
end
task :hosts do
# HOSTS=gw.lille
# HOSTS=*.lille
# SITES=lille => HOSTS=*.lille
# SITES=* => HOSTS=*.*
site = ENV['SITE']
host = ENV['HOST']
if site != nil
host = "*.#{site}"
elsif host != nil
abort "HOST must be on the form <hostname>.<site>. You provided '#{host}'." if host.scan(/^(\S+)\.(\S+)$/).empty?
else
abort "You must provide SITE= , (SITE=lille, or SITE=*), or a HOST, (HOST=gw.lille, or HOST=*.lille, or HOST=sw-*.lille)"
end
abort "You must provide HOST= , (HOST=gw.lille, or HOST=*.lille, or HOST=sw-*.lille)" if host.nil?
@host = host
end
namespace :g5k do
desc "Generates the JSON files based on the generators, for all sites.\nUse SITE=<SITE-NAME> if you wish to restrict the generation to a specific site.\nUse DRY=1 to simulate the execution."
task :generate => :environment do
site = if ENV['SITE']
ENV['SITE']
else
"*"
end
command = "#{File.join(ROOT_DIR, "generators", "grid5000")} #{File.join(ROOT_DIR, "generators", "input", "#{site}.rb")} #{File.join(ROOT_DIR, "generators", "input", "#{site}.yaml")}"
command << " -s" if ENV['DRY'] && ENV['DRY'] != "0"
@logger.info "Executing #{command.inspect}..."
system command
task :generate => [:environment,:hosts] do
host,site = @host.scan(/(\S+)\.(\S+)/).flatten
root_dir_input = "#{ROOT_DIR}/generators/input/sites"
command = File.join(ROOT_DIR, "generators", "grid5000")
command += " " + File.join(root_dir_input, site,"#{site}.rb")
command += " " + File.join(root_dir_input, site,"clusters","#{host}.rb")
command += " " + File.join(root_dir_input, site,"clusters","#{host}.yaml")
command << " -s" if ENV['DRY'] == "yes"
# puts command
sh command
end
end
......@@ -175,3 +195,56 @@ namespace :oar do
end
end
end
namespace :netlinks do
desc "Generates network API JSON files based on net-links yaml files.\nUse DRY=yes to simulate the execution. "
task :generate => [:environment,:hosts] do
host,site = @host.scan(/(\S+)\.(\S+)/).flatten
root_dir_input = File.join(ROOT_DIR, "generators","input")
command = File.join(ROOT_DIR, "generators", "grid5000")
command += " " + File.join(root_dir_input, "net-links.rb")
command += " " + File.join(root_dir_input,"sites", site,"#{site}.rb")
command += " " + File.join(root_dir_input,"sites", site,"net-links","#{host}.yaml")
command << " -s" if ENV['DRY'] == "yes"
# puts command
sh command
end
end
namespace :env do
desc "Generates environment JSON files .\nUse DRY=yes to simulate the execution. "
task :generate => [:environment] do
env_name = ENV["ENV_NAME"]
abort "You must provide ENV_NAME=" if env_name.nil?
root_dir_input = "#{ROOT_DIR}/generators/input"
command = File.join(ROOT_DIR, "generators", "grid5000")
command += " " + File.join(root_dir_input, "environments","#{env_name}")
command << " -s" if ENV['DRY'] == "yes"
sh command
end
end
=begin
task :mm => [:environment,:hosts] do
host,site = @host.scan(/(\S+)\.(\S+)/).flatten
root_dir_input = "#{ROOT_DIR}/generators/input"
Dir.glob("#{root_dir_input}/#{site}*").each do |file|
filename = File.basename(file)
if ((scan = filename.scan(/(\S+)-(\S+)\.(rb|yaml)/)).size > 0)
site,cluster = scan.flatten
cmd = "mkdir -p #{root_dir_input}/#{site}/clusters"
cmd += " && mv #{file} #{root_dir_input}/#{site}/clusters/#{cluster}#{File.extname(filename)}"
sh cmd
# puts cmd
elsif ((scan = filename.scan(/(\S+)\.rb/)).size > 0)
site = scan.first.first
cmd = "mkdir -p #{root_dir_input}/#{site}/clusters"
cmd += " && mv #{file} #{root_dir_input}/#{site}/#{site}.rb"
sh cmd
end
end
end
=end
{
"kind": "virtual",
"linecards": [
{
"ports": [
{
"kind": "virtual",
"linecard": 0,
"port": 0,
"rate": 10000000000,
"uid": "renater5-paris"
},
{
"kind": "router",
"site_uid": "lille",
"uid": "gw"
}
]
}
],
"type": "network_equipment",
"uid": "renater5-lille"
}
\ No newline at end of file
{
"kind": "virtual",
"linecards": [
{
"ports": [
{
"kind": "virtual",
"linecard": 0,
"port": 1,
"rate": 10000000000,
"uid": "renater5-paris"
},
{
"kind": "router",
"site_uid": "lyon",
"uid": "gw"
}
]
}
],
"type": "network_equipment",
"uid": "renater5-lyon"
}
\ No newline at end of file
{
"kind": "virtual",
"linecards": [
{
"ports": [
{
"kind": "virtual",
"linecard": 0,
"port": 2,
"rate": 10000000000,
"uid": "renater5-paris"
},
{
"kind": "router",
"site_uid": "nancy",
"uid": "gw"
}
]
}
],
"type": "network_equipment",
"uid": "renater5-nancy"
}
\ No newline at end of file
{
"kind": "virtual",
"linecards": [
{
"ports": [
{
"kind": "virtual",
"linecard": 0,
"port": 0,
"rate": 10000000000,
"uid": "renater5-lille"
},
{
"kind": "virtual",
"linecard": 0,
"port": 0,
"rate": 10000000000,
"uid": "renater5-lyon"
},
{
"kind": "virtual",
"linecard": 0,
"port": 0,
"rate": 10000000000,
"uid": "renater5-nancy"
}
]
}
],
"type": "network_equipment",
"uid": "renater5-paris"
}
\ No newline at end of file
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2K4G7",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2K4G7",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2FTKM",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2HKM6",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2JD77",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2HSD8",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2A96S",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2HS2A",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2K4E4",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT22VDZ",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2HBCP",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2K2PG",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2N397",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2JNMQ",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2JKP2",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2K4K3",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2K3TT",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2JKTM",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2JP96",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2H3BS",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2K428",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2JMGF",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2JR3S",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2JQL0",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": null,
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT1XVC4",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2HG5S",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2182C",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",
"rev": "D7013KT2JBZM",
"size": 65192580223.0835
"size": 65192580223.083496
}
],
"supported_job_types": {
......
......@@ -111,7 +111,7 @@
"interface": "SCSI",
"model": "ST373207LC",