Beispiel #1
0
 def lsn_port_get_by_mac(self, context, network_id, mac, raise_on_err=True):
     """Retrieve LSN and LSN port given network and mac address."""
     lsn_id = self.lsn_get(context, network_id, raise_on_err=raise_on_err)
     if lsn_id:
         try:
             lsn_port_id = lsn_api.lsn_port_by_mac_get(
                 self.cluster, lsn_id, mac)
         except (n_exc.NotFound, api_exc.NsxApiException):
             if raise_on_err:
                 LOG.error(_LE('Unable to find Logical Service Node Port '
                               'for LSN %(lsn_id)s and mac address '
                               '%(mac)s'),
                           {'lsn_id': lsn_id, 'mac': mac})
                 raise p_exc.LsnPortNotFound(lsn_id=lsn_id,
                                             entity='MAC',
                                             entity_id=mac)
             else:
                 LOG.warn(_LW('Unable to find Logical Service Node '
                              'Port for LSN %(lsn_id)s and mac address '
                              '%(mac)s'),
                          {'lsn_id': lsn_id, 'mac': mac})
             return (lsn_id, None)
         else:
             return (lsn_id, lsn_port_id)
     else:
         return (None, None)
 def lsn_port_get_by_mac(self, context, network_id, mac, raise_on_err=True):
     """Retrieve LSN and LSN port given network and mac address."""
     lsn_id = self.lsn_get(context, network_id, raise_on_err=raise_on_err)
     if lsn_id:
         try:
             lsn_port_id = lsn_api.lsn_port_by_mac_get(
                 self.cluster, lsn_id, mac)
         except (n_exc.NotFound, api_exc.NsxApiException):
             if raise_on_err:
                 LOG.error(_LE('Unable to find Logical Service Node Port '
                               'for LSN %(lsn_id)s and mac address '
                               '%(mac)s'),
                           {'lsn_id': lsn_id, 'mac': mac})
                 raise p_exc.LsnPortNotFound(lsn_id=lsn_id,
                                             entity='MAC',
                                             entity_id=mac)
             else:
                 LOG.warn(_LW('Unable to find Logical Service Node '
                              'Port for LSN %(lsn_id)s and mac address '
                              '%(mac)s'),
                          {'lsn_id': lsn_id, 'mac': mac})
             return (lsn_id, None)
         else:
             return (lsn_id, lsn_port_id)
     else:
         return (None, None)
Beispiel #3
0
 def lsn_port_get_by_mac(self, context, network_id, mac, raise_on_err=True):
     """Retrieve LSN and LSN port given network and mac address."""
     lsn_id = self.lsn_get(context, network_id, raise_on_err=raise_on_err)
     if lsn_id:
         try:
             lsn_port_id = lsn_api.lsn_port_by_mac_get(self.cluster, lsn_id, mac)
         except (n_exc.NotFound, api_exc.NsxApiException):
             logger = raise_on_err and LOG.error or LOG.warn
             logger(
                 _("Unable to find Logical Service Node Port for " "LSN %(lsn_id)s and mac address %(mac)s")
                 % {"lsn_id": lsn_id, "mac": mac}
             )
             if raise_on_err:
                 raise p_exc.LsnPortNotFound(lsn_id=lsn_id, entity="MAC", entity_id=mac)
             return (lsn_id, None)
         else:
             return (lsn_id, lsn_port_id)
     else:
         return (None, None)