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 911b1fe..c428221 100644
--- a/ryu/controller/network.py
+++ b/ryu/controller/network.py
@@ -180,8 +180,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:
@@ -195,6 +198,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:
@@ -313,6 +319,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)
@@ -328,8 +337,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
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel