Changes between Initial Version and Version 1 of Internal/OpenFlow/OrbitSwitches/scripts


Ignore:
Timestamp:
May 24, 2012, 3:12:07 PM (12 years ago)
Author:
akoshibe
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Internal/OpenFlow/OrbitSwitches/scripts

    v1 v1  
     1= Miscellaneous scripts. =
     2Here you can find various hacky scripts made for various purposes, that may or may not be useful.
     3
     4=== gridmap ===
     5A collection of functions that can be clobbered together into a mapping script. For example:
     6{{{
     7    require "gridmap.rb"
     8
     9    puts "enter node ID as \"x1,y1; x2,y2;...\"\n"
     10    puts "enter \"quit\" to exit\n"
     11
     12    g = Grid.new
     13    nodes = nil
     14
     15    while
     16        nodes = gets.chomp.split(';')
     17        break if nodes.first == "quit"
     18        nodes.each do |el|
     19            r,c = *(el.split(','))
     20            p g.switch_of(r.to_i,c.to_i)
     21        end
     22    end
     23}}}
     24Returns a [switch, switchport] mapping for a node [x,y], or list of nodes x1,y1;x2,y2...:
     25{{{
     26# ruby sample.rb
     27enter node ID as "x1,y1; x2,y2;..."
     28enter "quit" to exit
     291,1
     30[253, 32]
     311,2
     32[8, 39]
     3320,20;19,19
     34[1, 2]
     35[1, 44]
     36quit
     37}}}
     38This functions assume underlying wires are there correctly, so it is not 100% accurate.