Signed-off-by: Isaku Yamahata <[email protected]>
---
bin/ryu-client | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/bin/ryu-client b/bin/ryu-client
index 9d5c7e4..f8c0b03 100755
--- a/bin/ryu-client
+++ b/bin/ryu-client
@@ -19,6 +19,7 @@
import sys
from optparse import OptionParser
+from ryu.app.client import DiscoveryClient
from ryu.app.client import OFPClient
@@ -33,16 +34,24 @@ def client_test():
parser.print_help()
sys.exit(1)
- client = OFPClient(options.host + ':' + str(options.port))
+ address = options.host + ':' + str(options.port)
+ ofp_client = OFPClient(address)
+ discovery_client = DiscoveryClient(address)
+
commands = {
- 'list_nets': lambda a: sys.stdout.write(client.get_networks()),
- 'create_net': lambda a: client.create_network(a[1]),
- 'update_net': lambda a: client.update_network(a[1]),
- 'delete_net': lambda a: client.delete_network(a[1]),
- 'list_ports': lambda a: sys.stdout.write(client.get_ports(a[1])),
- 'create_port': lambda a: client.create_port(a[1], a[2], a[3]),
- 'update_port': lambda a: client.update_port(a[1], a[2], a[3]),
- 'delete_port': lambda a: client.delete_port(a[1], a[2], a[3])
+ 'list_nets': lambda a: sys.stdout.write(ofp_client.get_networks()),
+ 'create_net': lambda a: ofp_client.create_network(a[1]),
+ 'update_net': lambda a: ofp_client.update_network(a[1]),
+ 'delete_net': lambda a: ofp_client.delete_network(a[1]),
+ 'list_ports': lambda a: sys.stdout.write(ofp_client.get_ports(a[1])),
+ 'create_port': lambda a: ofp_client.create_port(a[1], a[2], a[3]),
+ 'update_port': lambda a: ofp_client.update_port(a[1], a[2], a[3]),
+ 'delete_port': lambda a: ofp_client.delete_port(a[1], a[2], a[3]),
+
+ 'list_links': lambda a: sys.stdout.write(
+ discovery_client.list_links()),
+ 'list_switch_links': lambda a: sys.stdout.write(
+ discovery_client.list_switch_links(a[1])),
}
# allow '-', instead of '_'
--
1.7.1.1
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel