Version 2 (modified by 13 years ago) ( diff ) | ,
---|
Miscellaneous scripts.
Here you can find various hacky scripts made for various purposes, that may or may not be useful.
gridmap
A collection of Ruby functions that can be clobbered together into a mapping script. For example:
require "gridmap.rb" puts "enter node ID as \"x1,y1; x2,y2;...\"\n" puts "enter \"quit\" to exit\n" g = Grid.new nodes = nil while nodes = gets.chomp.split(';') break if nodes.first == "quit" nodes.each do |el| r,c = *(el.split(',')) p g.switch_of(r.to_i,c.to_i) end end
Returns a [switch, switchport] mapping for a node [x,y], or list of nodes x1,y1;x2,y2…:
# ruby sample.rb enter node ID as "x1,y1; x2,y2;..." enter "quit" to exit 1,1 [253, 32] 1,2 [8, 39] 20,20;19,19 [1, 2] [1, 44] quit
The functions assume underlying wires are there correctly, so it is not 100% accurate.
Attachments (2)
- gridmap.rb (3.0 KB ) - added by 13 years ago.
-
pingmapper.rb
(1.7 KB
) - added by 12 years ago.
script that returns a list of [node:MAC] pairs and populates switch MAC tables for a sandbox.
Download all attachments as: .zip
Note:
See TracWiki
for help on using the wiki.