Exemple #1
0
 def lsn_port_create(self, context, lsn_id, subnet_info):
     """Create and return LSN port for associated subnet."""
     try:
         return lsn_api.lsn_port_create(self.cluster, lsn_id, subnet_info)
     except n_exc.NotFound:
         raise p_exc.LsnNotFound(entity='', entity_id=lsn_id)
     except api_exc.NsxApiException:
         err_msg = _('Unable to create port for LSN  %s') % lsn_id
         raise p_exc.NsxPluginException(err_msg=err_msg)
Exemple #2
0
 def lsn_get(self, context, network_id, raise_on_err=True):
     """Retrieve the LSN id associated to the network."""
     try:
         return lsn_api.lsn_for_network_get(self.cluster, network_id)
     except (n_exc.NotFound, api_exc.NsxApiException):
         logger = raise_on_err and LOG.error or LOG.warn
         logger(_('Unable to find Logical Service Node for '
                  'network %s'), network_id)
         if raise_on_err:
             raise p_exc.LsnNotFound(entity='network', entity_id=network_id)
Exemple #3
0
def lsn_get_for_network(context, network_id, raise_on_err=True):
    """Retrieve LSN information given its network id."""
    query = context.session.query(Lsn)
    try:
        return query.filter_by(net_id=network_id).one()
    except (orm.exc.NoResultFound, d_exc.DBError):
        logger = raise_on_err and LOG.error or LOG.warn
        logger(_('Unable to find Logical Service Node for '
                 'network %s'), network_id)
        if raise_on_err:
            raise p_exc.LsnNotFound(entity='network', entity_id=network_id)
Exemple #4
0
 def lsn_get(self, context, network_id, raise_on_err=True):
     """Retrieve the LSN id associated to the network."""
     try:
         return lsn_api.lsn_for_network_get(self.cluster, network_id)
     except (n_exc.NotFound, api_exc.NsxApiException):
         if raise_on_err:
             LOG.error(
                 _LE('Unable to find Logical Service Node for '
                     'network %s.'), network_id)
             raise p_exc.LsnNotFound(entity='network', entity_id=network_id)
         else:
             LOG.warn(
                 _LW('Unable to find Logical Service Node for '
                     'the requested network %s.'), network_id)