예제 #1
0
def _get_queryset_only_nat(port):
    """
  Give a nicer though less accurate name to the function as we're using it a
  lot here in the tests.
  """
    return maindb._get_queryset_of_all_available_vessels_for_a_port_only_nat_nodes(
        port)
예제 #2
0
def get_available_vessel_counts_by_port():

  # Set the log level high enough so that we don't produce a bunch of logging
  # output due to the logging decorators.
  initial_log_level = log.loglevel
  log.set_log_level(log.LOG_LEVEL_INFO)

  available_vessels_dict = {}
  
  for port in maindb.ALLOWED_USER_PORTS:
    available_vessels_dict[port] = {}
    available_vessels_dict[port]["all"] = maindb._get_queryset_of_all_available_vessels_for_a_port_include_nat_nodes(port).count()
    available_vessels_dict[port]["no_nat"] = maindb._get_queryset_of_all_available_vessels_for_a_port_exclude_nat_nodes(port).count()
    available_vessels_dict[port]["only_nat"] = maindb._get_queryset_of_all_available_vessels_for_a_port_only_nat_nodes(port).count()
  
  # Restore the original log level.
  log.set_log_level(initial_log_level)
  
  return available_vessels_dict
def _get_queryset_only_nat(port):
    """
  Give a nicer though less accurate name to the function as we're using it a
  lot here in the tests.
  """
    return maindb._get_queryset_of_all_available_vessels_for_a_port_only_nat_nodes(port)