Example #1
0
 def destroy_port(self, uuid):
     session = get_session()
     with session.begin():
         query = model_query(models.Port, session=session)
         query = add_identity_filter(query, uuid)
         count = query.delete()
         if count == 0:
             raise exception.PortNotFound(uuid=uuid)
Example #2
0
 def get_port_by_name(self, port_name):
     query = model_query(models.Port).filter_by(name=port_name)
     try:
         return query.one()
     except NoResultFound:
         raise exception.PortNotFound(name=port_name)
Example #3
0
 def get_port_by_uuid(self, port_uuid):
     query = model_query(models.Port).filter_by(uuid=port_uuid)
     try:
         return query.one()
     except NoResultFound:
         raise exception.PortNotFound(uuid=port_uuid)