mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-08 22:06:10 +02:00
rest_qos: Avoid None when deleting OVSDB addr
Currently, rest_qos.py will raise AttributeError when deleting OVSDB server address because rest_qos.py will try to split the given address string but the address is None when deleting. This patch checks if the given address is None or not before the string manipulation and fixes this problem. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
253ce73b7f
commit
98d97b992e
@ -425,7 +425,8 @@ class QoSController(ControllerBase):
|
||||
@staticmethod
|
||||
def delete_ovsdb_addr(dpid):
|
||||
ofs = QoSController._OFS_LIST.get(dpid, None)
|
||||
ofs.set_ovsdb_addr(dpid, None)
|
||||
if ofs is not None:
|
||||
ofs.set_ovsdb_addr(dpid, None)
|
||||
|
||||
@route('qos_switch', BASE_URL + '/queue/{switchid}',
|
||||
methods=['GET'], requirements=REQUIREMENTS)
|
||||
@ -600,25 +601,22 @@ class QoS(object):
|
||||
self.ofctl.mod_flow_entry(self.dp, flow, cmd)
|
||||
|
||||
def set_ovsdb_addr(self, dpid, ovsdb_addr):
|
||||
# easy check if the address format valid
|
||||
_proto, _host, _port = ovsdb_addr.split(':')
|
||||
|
||||
old_address = self.ovsdb_addr
|
||||
if old_address == ovsdb_addr:
|
||||
return
|
||||
if ovsdb_addr is None:
|
||||
elif ovsdb_addr is None:
|
||||
# Determine deleting OVSDB address was requested.
|
||||
if self.ovs_bridge:
|
||||
self.ovs_bridge.del_controller()
|
||||
self.ovs_bridge = None
|
||||
return
|
||||
|
||||
ovs_bridge = bridge.OVSBridge(self.CONF, dpid, ovsdb_addr)
|
||||
try:
|
||||
ovs_bridge.init()
|
||||
except:
|
||||
raise ValueError('ovsdb addr is not available.')
|
||||
self.ovsdb_addr = ovsdb_addr
|
||||
if self.ovs_bridge is None:
|
||||
ovs_bridge = bridge.OVSBridge(self.CONF, dpid, ovsdb_addr)
|
||||
self.ovs_bridge = ovs_bridge
|
||||
try:
|
||||
ovs_bridge.init()
|
||||
except:
|
||||
raise ValueError('ovsdb addr is not available.')
|
||||
self.ovs_bridge = ovs_bridge
|
||||
|
||||
def _update_vlan_list(self, vlan_list):
|
||||
for vlan_id in self.vlan_list.keys():
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user