def ShowNetworkConfig(_, args):
  """Show network information.

  @type args: list
  @param args: should either be an empty list, in which case
      we show information about all nodes, or should contain
      a list of networks (names or UUIDs) to be queried for information
  @rtype: int
  @return: the desired exit code

  """
  cl = GetClient()
  result = cl.QueryNetworks(fields=["name", "network", "gateway",
                                    "network6", "gateway6",
                                    "mac_prefix",
                                    "free_count", "reserved_count",
                                    "map", "group_list", "inst_list",
                                    "external_reservations",
                                    "serial_no", "uuid"],
                            names=args, use_locking=False)

  for (name, network, gateway, network6, gateway6,
       mac_prefix, free_count, reserved_count,
       mapping, group_list, instances, ext_res, serial, uuid) in result:
    size = free_count + reserved_count
    ToStdout("Network name: %s", name)
    ToStdout("UUID: %s", uuid)
    ToStdout("Serial number: %d", serial)
    ToStdout("  Subnet: %s", network)
    ToStdout("  Gateway: %s", gateway)
    ToStdout("  IPv6 Subnet: %s", network6)
    ToStdout("  IPv6 Gateway: %s", gateway6)
    ToStdout("  Mac Prefix: %s", mac_prefix)
    ToStdout("  Size: %d", size)
    ToStdout("  Free: %d (%.2f%%)", free_count,
             100 * float(free_count) / float(size))
    ToStdout("  Usage map:")
    lenmapping = len(mapping)
    idx = 0
    while idx < lenmapping:
      line = mapping[idx: idx + 64]
      ToStdout("     %s %s %d", str(idx).rjust(4), line.ljust(64), idx + 63)
      idx += 64
    ToStdout("         (X) used    (.) free")

    if ext_res:
      ToStdout("  externally reserved IPs:")
      for line in textwrap.wrap(ext_res, width=64):
        ToStdout(line % "    %s")

    if group_list:
      ToStdout("  connected to node groups:")
      for group, nic_mode, nic_link, nic_vlan in group_list:
        ToStdout("    %s (mode:%s link:%s vlan:%s)",
                 group, nic_mode, nic_link, nic_vlan)
    else:
      ToStdout("  not connected to any node group")

    if instances:
      ToStdout("  used by %d instances:", len(instances))
      for name in instances:
        ((ips, networks), ) = cl.QueryInstances([name],
                                                ["nic.ips", "nic.networks"],
                                                use_locking=False)

        l = lambda value: ", ".join(str(idx) + ":" + str(ip)
                                    for idx, (ip, net) in enumerate(value)
                                      if net == uuid)

        ToStdout("    %s: %s", name, l(zip(ips, networks)))
    else:
      ToStdout("  not used by any instances")
dataset/ETHPy150Open ganeti/ganeti/lib/client/gnt_network.py/ShowNetworkConfig/swapped operands of `%`