switch['username'],
switch['password'],
vlan_id)
- except Exception as e:
+ except Exception:
# Proper formatting
- LOG.warning(_("Brocade NOS driver:"))
- LOG.warning(_("%s"), e)
+ LOG.exception(_("Brocade NOS driver error"))
LOG.debug(_("Returning the allocated vlan (%d) to the pool"),
vlan_id)
self._vlan_bitmap.release_vlan(int(vlan_id))
self._driver.delete_network(switch['address'],
switch['username'],
switch['password'],
- net_id)
- except Exception as e:
+ vlan_id)
+ except Exception:
# Proper formatting
- LOG.warning(_("Brocade NOS driver:"))
- LOG.warning(_("%s"), e)
+ LOG.exception(_("Brocade NOS driver error"))
raise Exception(_("Brocade plugin raised exception, "
"check logs"))
switch['password'],
vlan_id,
mac)
- except Exception as e:
+ except Exception:
# Proper formatting
- LOG.warning(_("Brocade NOS driver:"))
- LOG.warning(_("%s"), e)
+ LOG.exception(_("Brocade NOS driver error"))
raise Exception(_("Brocade plugin raised exception, "
"check logs"))
def delete_port(self, context, port_id):
with context.session.begin(subtransactions=True):
+ neutron_port = self.get_port(context, port_id)
+ interface_mac = neutron_port['mac_address']
+ # convert mac format: xx:xx:xx:xx:xx:xx -> xxxx.xxxx.xxxx
+ mac = self.mac_reformat_62to34(interface_mac)
+
+ brocade_port = brocade_db.get_port(context, port_id)
+ vlan_id = brocade_port['vlan_id']
+
+ switch = self._switch
+ try:
+ self._driver.dissociate_mac_from_network(switch['address'],
+ switch['username'],
+ switch['password'],
+ vlan_id,
+ mac)
+ except Exception:
+ LOG.exception(_("Brocade NOS driver error"))
+ raise Exception(
+ _("Brocade plugin raised exception, check logs"))
+
super(BrocadePluginV2, self).delete_port(context, port_id)
brocade_db.delete_port(context, port_id)
# Delete the network
brocade_db.delete_network(self.context, net['id'])
+ self.assertFalse(brocade_db.get_networks(self.context))
def test_create_port(self):
"""Test brocade specific port db."""
# Delete Port
brocade_db.delete_port(self.context, port_id)
+ self.assertFalse(brocade_db.get_ports(self.context))