def get_networkinfo(ns):
    tf = TableFormatter(stdout, 0, True, {0: FIRST_COLUMN_MIN_SIZE})

    result = [('', ''), ('Networking:', '')]
    try:
        lan_endpoints = get_all_instances(ns, 'LMI_LANEndpoint')
    except Exception:
        result += [(get_colored_string('error:', RED_COLOR),
                    'Missing class LMI_LANEndpoint. Is openlmi-networking package installed on the server?')]
        tf.produce_output(result)
        return []

    nic = 1
    for lan_endpoint in lan_endpoints:
        if lan_endpoint.Name == 'lo':
            continue
        result += [
            ('  NIC %d' % nic, ''),
            ('    Name:', lan_endpoint.Name)]
        try:
            ip_net_con = lan_endpoint.associators(
                AssocClass='LMI_EndpointForIPNetworkConnection',
                ResultClass='LMI_IPNetworkConnection')[0]
            result += [('    Status:',
                ns.LMI_IPNetworkConnection.OperatingStatusValues.value_name(
                ip_net_con.OperatingStatus))]
        except Exception:
            pass
        try:
            for ip_protocol_endpoint in lan_endpoint.associators(
                    AssocClass='LMI_BindsToLANEndpoint',
                    ResultClass='LMI_IPProtocolEndpoint'):
                if ip_protocol_endpoint.ProtocolIFType == \
                        ns.LMI_IPProtocolEndpoint.ProtocolIFTypeValues.IPv4:
                    result += [('    IPv4 Address:',
                        ip_protocol_endpoint.IPv4Address)]
                elif ip_protocol_endpoint.ProtocolIFType == \
                        ns.LMI_IPProtocolEndpoint.ProtocolIFTypeValues.IPv6:
                    result += [('    IPv6 Address:',
                        ip_protocol_endpoint.IPv6Address)]
        except Exception:
            pass
        result += [
            ('    MAC Address:', lan_endpoint.MACAddress)]
        tf.produce_output(result)
        result = []
        nic += 1

    return []
Prints tabular data of networking status.
dataset/ETHPy150Open openlmi/openlmi-scripts/commands/system/lmi/scripts/system/__init__.py/get_networkinfo