private static void PrintPhysicalInterfaces(Session session)
        {
            System.Console.WriteLine("\n*** Physical network interfaces: ***\n");

            foreach (PIF pif in PIF.get_all_records(session).Values)
            {
                // resolve the host reference in the pif
                Host host = Host.get_record(session, pif.host);

                System.Console.WriteLine("Host: {0}", host.name_label);
                System.Console.WriteLine("IP: {0}", pif.IP);
                System.Console.WriteLine("MAC address: {0}", pif.MAC);
                System.Console.WriteLine("-");
            }
        }
Exemple #2
0
        private static void PrintPhysicalNetworkInterfaces(Session session)
        {
            PrintTitle("Physical network interfaces");
            var pifRecords = PIF.get_all_records(session);

            foreach (var pifRec in pifRecords)
            {
                var pif = pifRec.Value;

                Host host = Host.get_record(session, pif.host);
                System.Console.WriteLine("Host: {0}", host.name_label);
                System.Console.WriteLine("IP: {0}", pif.IP);
                System.Console.WriteLine("MAC address: {0}", pif.MAC);
                System.Console.WriteLine();
            }
        }
Exemple #3
0
        private void PrintPhysicalNetworkInterfaces(Session session)
        {
            _logger.Log("Physical network interfaces");
            _logger.WriteHRule();

            var pifRecords = PIF.get_all_records(session);

            foreach (var pifRec in pifRecords)
            {
                var  pif  = pifRec.Value;
                Host host = Host.get_record(session, pif.host);
                _logger.Log("Host: {0}", host.name_label);
                _logger.Log("IP: {0}", pif.IP);
                _logger.Log("MAC address: {0}", pif.MAC);
                _logger.WriteLine();
            }
        }
        private static string PrintPhysicalNetworkInterfaces(Session session)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Physical network interfaces" + newline);
            var pifRecords = PIF.get_all_records(session);

            foreach (var pifRec in pifRecords)
            {
                var pif = pifRec.Value;

                Host host = Host.get_record(session, pif.host);
                sb.Append(String.Format("Host: {0}", host.name_label) + newline);
                sb.Append(String.Format("IP: {0}", pif.IP) + newline);
                sb.Append(String.Format("MAC address: {0}", pif.MAC) + newline);
                sb.Append(newline);
            }

            return(sb.ToString());
        }