def test_update_nexusport_binding_no_result_found_handling(self): with mock.patch('sqlalchemy.orm.Query.one') as mock_one: mock_one.side_effect = sqlalchemy.orm.exc.NoResultFound with self.assertRaises(c_exc.NexusPortBindingNotFound): nexus_db.update_nexusport_binding(port_id=10, vlan_id=20, switch_ip='10.0.0.1', instance_id=1)
def update_nexusport_binding(self, port_id, new_vlan_id): """update nexus port binding.""" try: res = nexus_db.update_nexusport_binding(port_id, new_vlan_id) LOG.debug("Updating nexus port binding : %s" % res.port_id) bind_dict = {} bind_dict["port-id"] = str(res.port_id) bind_dict["vlan-id"] = str(res.vlan_id) return bind_dict except Exception, exc: raise Exception("Failed to update nexus port binding vnic: %s" % str(exc))
def update_nexusport_binding(self, port_id, new_vlan_id): """Update nexus port binding.""" try: res = nexus_db.update_nexusport_binding(port_id, new_vlan_id) LOG.debug("Updating nexus port binding : %s" % res.port_id) bind_dict = {} bind_dict["port-id"] = str(res.port_id) bind_dict["vlan-id"] = str(res.vlan_id) return bind_dict except Exception as exc: raise Exception("Failed to update nexus port binding vnic: %s" % str(exc))