Permalink
Browse files

Modify routing_switch configurations to current-directory independent.

  • Loading branch information...
1 parent e3c0682 commit 773e8178bee4769378cb8be6ee8d7722ce772965 kazuya committed Jan 29, 2013
View
@@ -26,15 +26,9 @@ How to build
Get Trema and Apps
- $ git clone git://github.com/trema/trema.git trema
+ $ sudo gem install trema
$ git clone git://github.com/trema/apps.git apps
- Build Trema first
-
- $ cd trema
- $ ./build.rb
- $ cd ..
-
Build topology
$ cd apps/topology
@@ -50,8 +44,7 @@ How to build
How to run
----------
- $ cd trema
- $ sudo ./trema run -c ../apps/routing_switch/routing_switch.conf
+ $ sudo trema run -c ./apps/routing_switch/routing_switch.conf
License & Terms
---------------
@@ -17,17 +17,18 @@ vhost ("host2") {
link "0xe0", "host1"
link "0xe0", "host2"
+$apps_dir = File.join( File.dirname( __FILE__ ), ".." )
run {
- path "../apps/topology/topology"
+ path File.join( $apps_dir, "./topology/topology" )
}
run {
- path "../apps/topology/topology_discovery"
+ path File.join( $apps_dir, "./topology/topology_discovery" )
}
run {
- path "../apps/routing_switch/routing_switch"
+ path File.join( $apps_dir, "./routing_switch/routing_switch" )
}
event :port_status => "topology", :packet_in => "filter", :state_notify => "topology"
@@ -1,15 +1,17 @@
+$apps_dir = File.join( File.dirname( __FILE__ ), ".." )
+
run {
- path "../apps/topology/topology"
+ path File.join( $apps_dir, "./topology/topology" )
options "--lldp_over_ip", "--lldp_ip_src=10.42.122.202", "--lldp_ip_dst=10.42.122.212"
}
run {
- path "../apps/topology/topology_discovery"
+ path File.join( $apps_dir, "./topology/topology_discovery" )
options "--lldp_over_ip", "--lldp_ip_src=10.42.122.202", "--lldp_ip_dst=10.42.122.212"
}
run {
- path "../apps/routing_switch/routing_switch"
+ path File.join( $apps_dir, "./routing_switch/routing_switch" )
}
event :port_status => "topology", :packet_in => "filter", :state_notify => "topology"
@@ -49,18 +49,20 @@ link "0xe1", "0xe2"
link "0xe1", "0xe3"
link "0xe2", "0xe3"
+$apps_dir = File.join( File.dirname( __FILE__ ), ".." )
+
run {
- path "../apps/topology/topology"
+ path File.join( $apps_dir, "./topology/topology" )
options "--lldp_over_ip", "--lldp_ip_src=10.42.122.202", "--lldp_ip_dst=10.42.122.212"
}
run {
- path "../apps/topology/topology_discovery"
+ path File.join( $apps_dir, "./topology/topology_discovery" )
options "--lldp_over_ip", "--lldp_ip_src=10.42.122.202", "--lldp_ip_dst=10.42.122.212"
}
run {
- path "../apps/routing_switch/routing_switch"
+ path File.join( $apps_dir, "./routing_switch/routing_switch" )
}
event :port_status => "topology", :packet_in => "filter", :state_notify => "topology"
@@ -1,13 +1,13 @@
run {
- path "../apps/topology/topology"
+ path File.join( $apps_dir, "./topology/topology" )
}
run {
- path "../apps/topology/topology_discovery"
+ path File.join( $apps_dir, "./topology/topology_discovery" )
}
run {
- path "../apps/routing_switch/routing_switch"
+ path File.join( $apps_dir, "./routing_switch/routing_switch" )
}
event :port_status => "topology", :packet_in => "filter", :state_notify => "topology"
@@ -46,6 +46,26 @@ def state_description
end
end
end
+
+
+ class DescStatsReply
+ def to_a
+ "Manufacturer description: #{ mfr_desc }\n" +
+ "Hardware description: #{ hw_desc }\n" +
+ "Software description: #{ sw_desc }\n" +
+ "Serial number: #{ serial_num }\n" +
+ "Human readable description of datapath: #{ dp_desc }"
+ end
+ end
+
+
+ class TableStatsReply
+ def to_a
+ "Table no: #{ table_id } (#{ name })\n" +
+ " Max flows: #{ max_entries }\n" +
+ " Wildcards: #{ wildcards.to_hex }"
+ end
+ end
end
@@ -58,23 +78,10 @@ def switch_ready datapath_id
def stats_reply datapath_id, message
- case message.type
- when StatsReply::OFPST_DESC
- message.stats.each do | each |
- next unless each.is_a?( DescStatsReply )
- info "Manufacturer description: #{ each.mfr_desc }"
- info "Hardware description: #{ each.hw_desc }"
- info "Software description: #{ each.sw_desc }"
- info "Serial number: #{ each.serial_num }"
- info "Human readable description of datapath: #{ each.dp_desc }"
- end
- when StatsReply::OFPST_TABLE
- message.stats.each do | each |
- next unless each.is_a?( TableStatsReply )
- info "Table no: #{each.table_id} (#{each.name})"
- info " Max flows: #{each.max_entries}"
- info " Wildcards: #{each.wildcards.to_hex}"
- end
+ message.stats.each do | each |
+ if each.is_a?( DescStatsReply ) or each.is_a?( TableStatsReply )
+ info each.to_a
+ end
end
end

0 comments on commit 773e817

Please sign in to comment.