コード例 #1
0
    def report(self):
        """Print system and ROS network information."""
        # check ifcfg import for windows and osx users
        ifcfg_ifaces = ifcfg.interfaces()

        network_report = Report('NETWORK CONFIGURATION')
        for iface in ifcfg_ifaces.values():
            for k, v in iface.items():
                if v:
                    network_report.add_to_report(k, v)
        return network_report
コード例 #2
0
 def report(self):
     ros_report = Report('ROS 2 INFORMATION')
     distros = _check_platform_helper()
     if not distros:
         return ros_report
     distro_name, distro_info, distro_data = distros
     ros_report.add_to_report('distribution name', distro_name)
     ros_report.add_to_report('distribution type',
                              distro_info.get('distribution_type'))
     ros_report.add_to_report('distribution status',
                              distro_info.get('distribution_status'))
     ros_report.add_to_report('release platforms',
                              distro_data.get('release_platforms'))
     return ros_report
コード例 #3
0
 def report(self):
     """Report packages within the directory where command is called."""
     report = Report('PACKAGE VERSIONS')
     local_package_vers = get_local_package_versions()
     distro_package_vers = get_distro_package_versions()
     if not local_package_vers or not distro_package_vers:
         return report
     for name, local_ver_str in local_package_vers.items():
         required_ver_str = distro_package_vers.get(name, '')
         local_ver = version.parse(local_ver_str).base_version
         required_ver = version.parse(required_ver_str).base_version
         report.add_to_report(
             name, f'required={required_ver}, local={local_ver}')
     return report
コード例 #4
0
ファイル: network.py プロジェクト: laoshaw/ros2cli
    def report(self):
        """Print system and ROS network information."""
        # check ifcfg import for windows and osx users
        try:
            ifcfg_ifaces = ifcfg.interfaces()
        except NameError:
            doctor_warn('ifcfg is not imported. Unable to generate network report.')
            return Report('')

        network_report = Report('NETWORK CONFIGURATION')
        for iface in ifcfg_ifaces.values():
            for k, v in iface.items():
                if v:
                    network_report.add_to_report(k, v)
        return network_report
コード例 #5
0
ファイル: network.py プロジェクト: seanyen/ros2cli
    def report(self):
        """Print system and ROS network information."""
        if_stats = psutil.net_if_stats()

        network_report = Report('NETWORK CONFIGURATION')

        for interface, addrs in psutil.net_if_addrs().items():
            if_info = {
                'inet': None,
                'inet4': [],
                'ether': None,
                'inet6': [],
                'netmask': None,
                'device': interface,
                'flags': None,
                'mtu': None,
                'broadcast': None,
            }
            for addr in addrs:
                if addr.family == socket.AddressFamily.AF_INET:
                    if_info['inet'] = addr.address
                    if_info['inet4'].append(addr.address)
                    if_info['netmask'] = addr.netmask
                    if_info['broadcast'] = addr.broadcast
                elif addr.family == socket.AddressFamily.AF_INET6:
                    if_info['inet6'].append(addr.address)
                elif 'AF_PACKET' in socket.AddressFamily.__members__:
                    if addr.family == socket.AddressFamily.AF_PACKET:
                        # Loopback reports an all-zero MAC address, which is
                        # bogus and should not be reported
                        if addr.address != '00:00:00:00:00:00':
                            if_info['ether'] = addr.address

            if interface in if_stats:
                if_info['mtu'] = if_stats[interface].mtu

            flags = InterfaceFlags(interface)
            if_info['flags'] = str(flags)

            for k, v in if_info.items():
                if v:
                    network_report.add_to_report(k, v)
        return network_report
コード例 #6
0
ファイル: test_topic.py プロジェクト: wayneparrott/ros2cli
def _generate_expected_report(topic, pub_count, sub_count):
    expected_report = Report('TOPIC LIST')
    expected_report.add_to_report('topic', topic)
    expected_report.add_to_report('publisher count', pub_count)
    expected_report.add_to_report('subscriber count', sub_count)
    return expected_report
コード例 #7
0
    def report(self):
        platform_name = platform.system()

        # platform info
        platform_report = Report('PLATFORM INFORMATION')
        platform_report.add_to_report('system', platform_name)
        platform_report.add_to_report('platform info', platform.platform())
        if platform_name == 'Darwin':
            platform_report.add_to_report('mac OS version', platform.mac_ver())
        platform_report.add_to_report('release', platform.release())
        platform_report.add_to_report('processor', platform.processor())
        return platform_report
コード例 #8
0
 def report(self):
     rmw_report = Report('RMW MIDDLEWARE')
     rmw_report.add_to_report('middleware name',
                              get_rmw_implementation_identifier())
     return rmw_report
コード例 #9
0
 def report(self):
     report = Report('TOPIC LIST')
     to_be_reported = _get_topic_names()
     if not to_be_reported:
         report.add_to_report('topic', 'none')
         report.add_to_report('publisher count', 0)
         report.add_to_report('subscriber count', 0)
     with DirectNode(None) as node:
         for topic in to_be_reported:
             report.add_to_report('topic', topic)
             report.add_to_report('publisher count',
                                  node.count_publishers(topic))
             report.add_to_report('subscriber count',
                                  node.count_subscribers(topic))
     return report
コード例 #10
0
ファイル: qos_compatibility.py プロジェクト: seanyen/ros2cli
 def report(self):
     report = Report('QOS COMPATIBILITY LIST')
     to_be_reported = get_topic_names()
     with NodeStrategy(None) as node:
         for topic in to_be_reported:
             for pub in node.get_publishers_info_by_topic(topic):
                 for sub in node.get_subscriptions_info_by_topic(topic):
                     compatibility, reason = qos_check_compatible(
                         pub.qos_profile, sub.qos_profile)
                     report.add_to_report('topic [type]',
                                          f'{topic} [{pub.topic_type}]')
                     report.add_to_report('publisher node', pub.node_name)
                     report.add_to_report('subscriber node', sub.node_name)
                     if compatibility == QoSCompatibility.OK:
                         compatibility_msg = 'OK'
                     else:
                         compatibility_msg = reason
                     report.add_to_report('compatibility status',
                                          compatibility_msg)
     if self._is_report_empty(report):
         report.add_to_report('compatibility status',
                              'No publisher/subscriber pairs found')
     return report