network: add a helper function to list ports that doesn't raise

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Isaku Yamahata 2013-07-10 18:35:08 +09:00 committed by FUJITA Tomonori
parent 3ac48b77e1
commit a86e9b7ab4

View File

@ -321,6 +321,12 @@ class Network(app_manager.RyuApp):
def list_ports(self, network_id):
return self.networks.list_ports(network_id)
def list_ports_noraise(self, network_id):
try:
return self.list_ports(network_id)
except NetworkNotFound:
return []
def _update_port(self, network_id, dpid, port, port_may_exist):
def _known_nw_id(nw_id):
return nw_id is not None and nw_id != self.nw_id_unknown