Module: WIKI_Old
- Defined in:
- generators/gen_wiki_old.rb
Overview
Deprecated, old confluence wiki table output from IBLinkinfo.
Class Method Summary (collapse)
-
+ (Object) gen(ib, file = 'iblinkinfo_wiki_old.txt')
Generate an old | separated format confluence wiki table.
Class Method Details
+ (Object) gen(ib, file = 'iblinkinfo_wiki_old.txt')
Generate an old | separated format confluence wiki table.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'generators/gen_wiki_old.rb', line 6 def self.gen(ib, file='iblinkinfo_wiki_old.txt') #Output Wiki | separated fields for current switch port to rack mappings #@switches.each do |k,v| File.open(file, "w") do |fd| ib.switch_location.each do |k,loc| if loc[1] == :leaf || loc[1] == :ex_spine fd.puts "h3. #{k}" v = ib.switches[k] if v != nil (1..loc[4]).step(2) do |i| fd.print " | " if i == 19 fd.print "| " if i == 1 fd.print " | #{i}" end fd.print " |\n" (1..loc[4]).step(2) do |i| l = ib.location[v[i][9]] fd.print " | " if i == 19 fd.print "| " if i == 1 if(l != nil && @switches[v[i][9]] != nil) fd.print " | #{l[0]}/P#{"%02d"%v[i][7]}" else fd.print " | #{l == nil ? v[i][9] : "#{l[2]}/P#{"%02d"%v[i][7]}"}" end end fd.print " |\n" (2..loc[4]).step(2) do |i| fd.print " | " if i == 20 fd.print "| " if i == 2 fd.print " | #{i}" end fd.print " |\n" (2..loc[4]).step(2) do |i| l = ib.location[v[i][9]] fd.print " | " if i == 20 fd.print "| " if i == 2 if(l != nil && @switches[v[i][9]] != nil) fd.print " | #{l[0]}/P#{"%02d"%v[i][7]}" else fd.print " | #{l == nil ? v[i][9] : "#{l[2]}/P#{"%02d"%v[i][7]}"}" end end fd.print " |\n" end end end end end |