Signed-off-by: YAMADA Hideki <[email protected]>
---
bin/ryu-client | 5 +++++
ryu/app/client.py | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/bin/ryu-client b/bin/ryu-client
index 292ee26..ea3a3ea 100755
--- a/bin/ryu-client
+++ b/bin/ryu-client
@@ -23,6 +23,7 @@ from ryu.app.client import OFPClient
from ryu.app.client import QuantumIfaceClient
from ryu.app.client import SwitchConfClient
from ryu.app.client import TunnelClient
+from ryu.app.client import TopologyClient
def client_test():
@@ -41,6 +42,7 @@ def client_test():
tun_client = TunnelClient(address)
sc_client = SwitchConfClient(address)
qi_client = QuantumIfaceClient(address)
+ topo_client = TopologyClient(address)
commands = {
'list_nets': lambda a: sys.stdout.write(ofp_client.get_networks()),
@@ -87,6 +89,9 @@ def client_test():
qi_client.get_network_id(a[1])),
'qi_create_net_id': lambda a: qi_client.create_network_id(a[1], a[2]),
'qi_update_net_id': lambda a: qi_client.update_network_id(a[1], a[2]),
+
+ 'topo_list_switches': lambda a: topo_client.list_switches(),
+ 'topo_list_links': lambda a: topo_client.list_links(),
}
# allow '-', instead of '_'
diff --git a/ryu/app/client.py b/ryu/app/client.py
index 32b645e..52dae7c 100644
--- a/ryu/app/client.py
+++ b/ryu/app/client.py
@@ -245,3 +245,37 @@ class QuantumIfaceClientV1_0(RyuClientBase):
QuantumIfaceClient = QuantumIfaceClientV1_0
+
+
+class TopologyClientV1_0(RyuClientBase):
+ version = 'v1.0'
+
+ # /topology/switches
+ # /topology/switches/{dpid}
+ # /topology/links
+ # /topology/links/{dpid}
+ _path_switches = 'topology/switches'
+ _path_links = 'topology/links'
+
+ def __init__(self, address):
+ super(TopologyClientV1_0, self).__init__(self.version, address)
+
+ # dpid: string representation (see ryu.lib.dpid)
+ # if None, get all
+ def list_switches(self, dpid=None):
+ uri = self._path_switches
+ if dpid:
+ uri += '/%s' % (dpid)
+
+ return self._do_request('GET', uri)
+
+ # dpid: string representation (see ryu.lib.dpid)
+ # if None, get all
+ def list_links(self, dpid=None):
+ uri = self._path_links
+ if dpid:
+ uri += '/%s' % (dpid)
+ return self._do_request('GET', uri)
+
+
+TopologyClient = TopologyClientV1_0
--
1.7.1
------------------------------------------------------------------------------
Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game
on Steam. $5K grand prize plus 10 genre and skill prizes.
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel