Esempio n. 1
0
    def test_compatible(self):
        qos = QoSProfile(
            depth=1,
            reliability=QoSReliabilityPolicy.RELIABLE,
            durability=QoSDurabilityPolicy.VOLATILE,
            lifespan=Duration(seconds=1),
            deadline=Duration(seconds=1),
            liveliness=QoSLivelinessPolicy.AUTOMATIC,
            liveliness_lease_duration=Duration(seconds=1),
        )
        compatibility, reason = qos_check_compatible(
            qos, qos
        )

        assert compatibility == QoSCompatibility.OK
        assert reason == ''
Esempio n. 2
0
    def test_warn_of_possible_incompatibility(self):
        """
        This test is assuming a DDS implementation.

        It's possible that a "best effort" publisher and "reliable"
        subscription is a valid match in a non-DDS implementation.
        """
        pub_qos = QoSPresetProfiles.SYSTEM_DEFAULT.value
        sub_qos = QoSProfile(
            depth=1,
            reliability=QoSReliabilityPolicy.RELIABLE,
        )
        compatibility, reason = qos_check_compatible(
            pub_qos, sub_qos
        )

        assert compatibility == QoSCompatibility.WARNING
        assert reason != ''
Esempio n. 3
0
    def test_incompatible(self):
        """
        This test is assuming a DDS implementation.

        It's possible that a "best effort" publisher and "reliable"
        subscription is a valid match in a non-DDS implementation.
        """
        pub_qos = QoSProfile(
            depth=1,
            reliability=QoSReliabilityPolicy.BEST_EFFORT,
        )
        sub_qos = QoSProfile(
            depth=1,
            reliability=QoSReliabilityPolicy.RELIABLE,
        )

        compatibility, reason = qos_check_compatible(
            pub_qos, sub_qos
        )

        assert compatibility == QoSCompatibility.ERROR
        assert reason != ''
Esempio n. 4
0
 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
Esempio n. 5
0
 def check(self):
     """Check publisher and subscriber counts."""
     result = Result()
     to_be_checked = get_topic_names()
     with NodeStrategy(None) as node:
         for topic in to_be_checked:
             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)
                     reason_message = self._strip_leading_warning_or_error_from_string(
                         reason)
                     if compatibility == QoSCompatibility.WARNING:
                         doctor_warn(
                             f"QoS compatibility warning found on topic '{topic}': "
                             f'{reason_message}')
                         result.add_warning()
                     elif compatibility == QoSCompatibility.ERROR:
                         doctor_error(
                             f"QoS compatibility error found on topic '{topic}': "
                             f'{reason_message}')
                         result.add_error()
     return result