Signed-off-by: Isaku Yamahata <[email protected]>
---
Changes v2 -> v3:
- de-GRE
---
 ryu/app/client.py |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/ryu/app/client.py b/ryu/app/client.py
index b8e5096..de74357 100644
--- a/ryu/app/client.py
+++ b/ryu/app/client.py
@@ -111,3 +111,49 @@ class OFPClientV1_0(RyuClientBase):
 
 
 OFPClient = OFPClientV1_0
+
+
+class TunnelClientV1_0(RyuClientBase):
+    version = 'v1.0'
+
+    # /tunnels/networks/{network-id}/key/{tunnel_key}
+    # /tunnels/switches/{dpid}/ports/{port-id}/{remote_dpip}
+    path_tunnels = 'tunnels'
+    path_key = path_tunnels + '/networks/%(network_id)s/key'
+    path_tunnel_key = path_key + '/%(tunnel_key)s'
+    path_ports = path_tunnels + '/switches/%(dpid)s/ports'
+    path_port = path_ports + '/%(port_no)s'
+    path_remote_dpid = path_port + '/%(remote_dpid)s'
+
+    def __init__(self, address):
+        super(TunnelClientV1_0, self).__init__(self.version, address)
+
+    def get_tunnel_key(self, network_id):
+        return self._do_request_read('GET', self.path_key % locals())
+
+    def delete_tunnel_key(self, network_id):
+        return self._do_request_read('DELETE', self.path_key % locals())
+
+    def create_tunnel_key(self, network_id, tunnel_key):
+        self._do_request('POST', self.path_tunnel_key % locals())
+
+    def update_tunnel_key(self, network_id, tunnel_key):
+        self._do_request('PUT', self.path_tunnel_key % locals())
+
+    def list_ports(self, dpid):
+        return self._do_request_read('GET', self.path_ports % locals())
+
+    def delete_port(self, dpid, port_no):
+        return self._do_request_read('DELETE', self.path_port % locals())
+
+    def get_remote_dpid(self, dpid, port_no):
+        return self._do_request_read('GET', self.path_port % locals())
+
+    def create_remote_dpid(self, dpid, port_no, remote_dpid):
+        self._do_request('POST', self.path_remote_dpid % locals())
+
+    def update_remote_dpid(self, dpid, port_no, remote_dpid):
+        self._do_request('PUT', self.path_remote_dpid % locals())
+
+
+TunnelClient = TunnelClientV1_0
-- 
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

Reply via email to