def get_port_status(cluster, lswitch_id, port_id):
 try:
  r = do_single_request(HTTP_GET, ('/ws.v1/lswitch/%s/lport/%s/status' % (lswitch_id, port_id)), cluster=cluster)
  r = json.loads(r)
 except NvpApiClient.ResourceNotFound as e:
  LOG.error(_('Port not found, Error: %s'), str(e))
  raise exception.PortNotFound(port_id=port_id, net_id=lswitch_id)
 except NvpApiClient.NvpApiException as e:
  raise exception.QuantumException()
 if (r['link_status_up'] is True):
  return constants.PORT_STATUS_ACTIVE
 else:
  return constants.PORT_STATUS_DOWN

def get_port_status ( cluster , lswitch_id , port_id ) : try : r = do_single_request ( HTTP_GET , ( '/ws.v1/lswitch/%s/lport/%s/status' % ( lswitch_id , port_id ) ) , cluster = cluster ) r = json . loads ( r ) except NvpApiClient . ResourceNotFound as e : LOG . error ( _ ( 'Port not found, Error: %s' ) , str ( e ) ) raise exception . PortNotFound ( port_id = port_id , net_id = lswitch_id ) except NvpApiClient . NvpApiException as e : raise exception . QuantumException ( ) if ( r [ 'link_status_up' ] is True ) : return constants . PORT_STATUS_ACTIVE else : return constants . PORT_STATUS_DOWN
retrieve the operational status of the port .