Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 56d6bd49 authored by Gaetan SIMO's avatar Gaetan SIMO
Browse files

[Rakefile] Adding cacti-play + weathermap gems and they corresponding rake task

parent 0ffdfa5a
No related branches found
No related tags found
No related merge requests found
source :rubygems source :rubygems
gem 'json_pure', '~> 1.5' gem 'json_pure', '~> 1.5'
gem 'net-ssh'
gem 'restfully','1.0.5' gem 'restfully','1.0.5'
gem "net-admin-common",
:git => "ssh://g5kadmin@git.grid5000.fr/srv/git/repos/net-admin-common",
:tag => "2.2"
gem "cacti-play",
:git => "ssh://g5kadmin@git.grid5000.fr/srv/git/repos/cacti-play",
:tag => "2.4"
gem "weathermap",
:git => "ssh://g5kadmin@git.grid5000.fr/srv/git/repos/weathermap",
:tag => "5.5"
GIT
remote: ssh://g5kadmin@git.grid5000.fr/srv/git/repos/cacti-play
revision: 1912fcc73ba790370b62d8b9792a35485bb498f6
tag: 2.4
specs:
cacti-play (2.4)
net-admin-common (>= 2.2)
GIT
remote: ssh://g5kadmin@git.grid5000.fr/srv/git/repos/net-admin-common
revision: a0335cc1d5cb7fcd79b6fc3fb11d5f0bc34bd596
tag: 2.2
specs:
net-admin-common (2.2)
net-ssh (>= 2.3.0)
net-ssh-multi (>= 1.1)
rest-client (>= 1.6.7)
GIT
remote: ssh://g5kadmin@git.grid5000.fr/srv/git/repos/weathermap
revision: 288a5dd149ba01de7a70207ecc992a0a3ae43ca3
tag: 5.5
specs:
weathermap (5.5)
cacti-play (>= 2.3)
interpolator (>= 0.15)
ipaddress (>= 0.8.0)
json (>= 1.7.0)
net-admin-common (>= 2.0)
GEM GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
specs: specs:
addressable (2.2.8) addressable (2.2.8)
backports (2.5.1) backports (2.5.1)
bond (0.4.2) bond (0.4.2)
interpolator (0.15)
ipaddress (0.8.0)
json (1.7.0) json (1.7.0)
json_pure (1.5.1) json_pure (1.5.1)
mime-types (1.18) mime-types (1.18)
net-ssh (2.1.0) net-ssh (2.5.2)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
net-ssh-multi (1.1)
net-ssh (>= 2.1.4)
net-ssh-gateway (>= 0.99.0)
rack (1.4.1) rack (1.4.1)
rack-cache (1.2) rack-cache (1.2)
rack (>= 0.4) rack (>= 0.4)
...@@ -45,6 +82,8 @@ PLATFORMS ...@@ -45,6 +82,8 @@ PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
cacti-play!
json_pure (~> 1.5) json_pure (~> 1.5)
net-ssh net-admin-common!
restfully (= 1.0.5) restfully (= 1.0.5)
weathermap!
...@@ -8,18 +8,6 @@ ROOT_DIR = File.expand_path File.dirname(__FILE__) ...@@ -8,18 +8,6 @@ ROOT_DIR = File.expand_path File.dirname(__FILE__)
LIB_DIR = File.join(ROOT_DIR, "generators", "lib") LIB_DIR = File.join(ROOT_DIR, "generators", "lib")
$LOAD_PATH.unshift(LIB_DIR) unless $LOAD_PATH.include?(LIB_DIR) $LOAD_PATH.unshift(LIB_DIR) unless $LOAD_PATH.include?(LIB_DIR)
REFERENCE_REPOSITORY_DIR = File.expand_path(File.dirname(__FILE__))
# Import dependency rake file
IMPORTED_RAKEFILES = Array.new
IMPORTED_RAKEFILES.push File.expand_path(__FILE__)
%w(weathermap).each do |dependency|
Dir.glob(File.expand_path(File.join(REFERENCE_REPOSITORY_DIR,"..",dependency,"Rakefile"))).each do |rakefile|
import rakefile unless IMPORTED_RAKEFILES.include? rakefile
end
end
require 'grid5000' require 'grid5000'
task :environment do task :environment do
...@@ -230,15 +218,6 @@ namespace :netlinks do ...@@ -230,15 +218,6 @@ namespace :netlinks do
# puts command # puts command
sh command sh command
end end
desc "Display network links description amongst network equipments."
task :display do
host=ENV["HOST"]
abort "You must provide the HOST=" if host.nil?
cmd = File.join(WEATHERMAP_DIR,"bin","weathermap-app.rb")
cmd += " --host '#{host}' --action display"
sh cmd
end
end end
namespace :env do namespace :env do
desc "Generates environment JSON files .\nUse DRY=yes to simulate the execution. " desc "Generates environment JSON files .\nUse DRY=yes to simulate the execution. "
...@@ -253,27 +232,33 @@ namespace :env do ...@@ -253,27 +232,33 @@ namespace :env do
sh command sh command
end end
end end
namespace :weathermap do
=begin @weathermap_options = ""
task :mm => [:environment,:hosts] do task :hosts do
host,site = @host.scan(/(\S+)\.(\S+)/).flatten @weathermap_site = ENV['SITE']
root_dir_input = "#{ROOT_DIR}/generators/input" @weathermap_host = ENV['HOST']
Dir.glob("#{root_dir_input}/#{site}*").each do |file| abort "You must provide the SITE= " if @weathermap_site.nil?
filename = File.basename(file) abort "You must provide the HOST= name (uid) in its site " if @weathermap_host.nil? or @weathermap_host.match(/\.grid5000\.fr/) != nil
if ((scan = filename.scan(/(\S+)-(\S+)\.(rb|yaml)/)).size > 0) end
site,cluster = scan.flatten task :execute => ["weathermap:hosts"] do
cmd = "mkdir -p #{root_dir_input}/#{site}/clusters" cmd = "bundle exec weathermap"
cmd += " && mv #{file} #{root_dir_input}/#{site}/clusters/#{cluster}#{File.extname(filename)}" cmd += " --site '#{@weathermap_site}' --host '#{@weathermap_host}' --api-path #{ROOT_DIR} #{@weathermap_options}"
sh cmd sh cmd
# puts cmd end
elsif ((scan = filename.scan(/(\S+)\.rb/)).size > 0) desc "Create weathermaps for host HOST without data."
site = scan.first.first task :testing => ["weathermap:hosts"] do
cmd = "mkdir -p #{root_dir_input}/#{site}/clusters" @weathermap_options.replace("--action write --use-cacti no")
cmd += " && mv #{file} #{root_dir_input}/#{site}/#{site}.rb" Rake::Task['weathermap:execute'].invoke
sh cmd end
end desc "Create weathermaps for host HOST with RRD from cacti."
task :production => ["weathermap:hosts"] do
@weathermap_options.replace("--action write --use-cacti yes")
Rake::Task['weathermap:execute'].invoke
end
desc "Display network links description amongst network equipments."
task :display do
@weathermap_options.replace("--action display")
Rake::Task['weathermap:execute'].invoke
end end
end end
=end
...@@ -15,7 +15,7 @@ aspen: ...@@ -15,7 +15,7 @@ aspen:
linecards: linecards:
2: 2:
naming_pattern: "%LINECARD%:%PORT%" naming_pattern: "%LINECARD%:%PORT%"
kind: node kind: switch
rate: 1000000000 rate: 1000000000
ports: ports:
1: 1:
...@@ -56,33 +56,37 @@ aspen: ...@@ -56,33 +56,37 @@ aspen:
port: 0/3 port: 0/3
23: 23:
uid: voltaire-1 uid: voltaire-1
kind: switch
24: 24:
uid: voltaire-2 uid: voltaire-2
kind: switch
32: 32:
uid: grimage-9 uid: grimage-9
port: bmc port: bmc
kind: node
33: 33:
uid: grimage-10 uid: grimage-10
port: bmc port: bmc
kind: node
3: 3:
naming_pattern: "%LINECARD%:%PORT%" naming_pattern: "%LINECARD%:%PORT%"
kind: other kind: node
rate: 1000000000 rate: 1000000000
ports: ports:
1: 1:
uid: digmgt uid: digmgt
port: eth0 port: eth0
kin: other
2: 2:
uid: digmgt uid: digmgt
port: eth1 port: eth1
kin: other
3: 3:
uid: digmgt uid: digmgt
port: eth2 port: eth2
kin: other
4: 4:
uid: digmgt uid: digmgt
port: eth3 port: eth3
kin: other
5: 5:
uid: grimage-9 uid: grimage-9
port: eth0 port: eth0
...@@ -181,7 +185,7 @@ aspen: ...@@ -181,7 +185,7 @@ aspen:
port: eth1 port: eth1
4: 4:
naming_pattern: "%LINECARD%:%PORT%" naming_pattern: "%LINECARD%:%PORT%"
kind: other kind: node
rate: 1000000000 rate: 1000000000
ports: ports:
1: 1:
...@@ -244,9 +248,11 @@ aspen: ...@@ -244,9 +248,11 @@ aspen:
23: 23:
uid: digmgt uid: digmgt
port: eth4 port: eth4
kin: other
24: 24:
uid: alpes uid: alpes
port: eth0 port: eth0
kin: other
25: 25:
uid: grimage-1 uid: grimage-1
port: eth0 port: eth0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment