This will be used by tunnel app.
Signed-off-by: Isaku Yamahata <[email protected]>
---
ryu/controller/network.py | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/ryu/controller/network.py b/ryu/controller/network.py
index abfd12c..08dcdbf 100644
--- a/ryu/controller/network.py
+++ b/ryu/controller/network.py
@@ -184,8 +184,11 @@ class DPIDs(dict):
except KeyError:
raise PortNotFound(dpid=dpid, port=port_no, network_id=None)
- def get_ports(self, dpid):
- return self.get(dpid, {}).values()
+ def get_ports(self, dpid, network_id=None):
+ if network_id is None:
+ return self.get(dpid, {}).values()
+ return [p for p in self.get(dpid, {}).values()
+ if p.network_id == network_id]
def get_port(self, dpid, port_no):
try:
@@ -199,6 +202,9 @@ class DPIDs(dict):
except KeyError:
raise PortUnknown(dpid=dpid, port=port_no)
+ def get_networks(self, dpid):
+ return set(self[dpid].values())
+
def get_network_safe(self, dpid, port_no):
port = self.get(dpid, {}).get(port_no)
if port is None:
@@ -317,6 +323,9 @@ class Network(object):
def has_network(self, network_id):
return self.networks.has_network(network_id)
+ def get_networks(self, dpid):
+ return self.dpids.get_networks(dpid)
+
def create_mac(self, network_id, dpid, port_no, mac_address):
self.dpids.set_mac(network_id, dpid, port_no, mac_address)
@@ -332,8 +341,8 @@ class Network(object):
return []
return [mac_address]
- def get_ports(self, dpid):
- return self.dpids.get_ports(dpid)
+ def get_ports(self, dpid, network_id=None):
+ return self.dpids.get_ports(dpid, network_id)
def get_port(self, dpid, port_no):
return self.dpids.get_port(dpid, port_no)
--
1.7.10.4
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel