def check_app_log_files(self):
     '''Check app log files for necessary messages'''
     BaseTestScenario.check_app_log_files(self)
     active_lang = self.scenarious[self.name]
     silence_langs = self.scenarious.values()
     silence_langs.remove(active_lang)
     for host in  self.host_app_logs.keys():
         if self.get_role_by_host(host) == active_lang:
             search_strings = ["got message from " + lang for lang in silence_langs]
         else:
             search_strings = ["got message from " + active_lang]
         file_name = self.host_app_logs[host]
         app_log_file = os.path.join(self.log_root, host.get_hostname(), self.host_app_logs[host])
         f = open(app_log_file, 'r')
         file_lines = f.readlines()
         try:
             for string in search_strings: # all must be find
                 for x in file_lines: # xotya bi v odnoi
                     print x
                     if x.lower().find(string) != -1:
                         break
                 else:
                     self.errors.append("Application log file %s for the host [%s] did not recieve necessary messages"%\
                                     (file_name, host.get_hostname()))
                     break
         finally:
             f.close()
Beispiel #2
0
 def check_app_log_files(self):
     '''Check app log files for necessary messages'''
     BaseTestScenario.check_app_log_files(self)
     active_lang = self.scenarious[self.name]
     silence_langs = self.scenarious.values()
     silence_langs.remove(active_lang)
     for host in self.host_app_logs.keys():
         if self.get_role_by_host(host) == active_lang:
             search_strings = [
                 "got message from " + lang for lang in silence_langs
             ]
         else:
             search_strings = ["got message from " + active_lang]
         file_name = self.host_app_logs[host]
         app_log_file = os.path.join(self.log_root, host.get_hostname(),
                                     self.host_app_logs[host])
         f = open(app_log_file, 'r')
         file_lines = f.readlines()
         try:
             for string in search_strings:  # all must be find
                 for x in file_lines:  # xotya bi v odnoi
                     print x
                     if x.lower().find(string) != -1:
                         break
                 else:
                     self.errors.append("Application log file %s for the host [%s] did not recieve necessary messages"%\
                                     (file_name, host.get_hostname()))
                     break
         finally:
             f.close()
    def __init__(self):
        """Constructs the object"""

        # Call base init with the predifined params:
        BaseTestScenario.__init__(self, "dds2466",
                                  "CoFlight requirements eFDPfi_MW_DDS_15")

        self.parser = DDS2466Parser()
    def __init__(self, type):
        """Constructs the object"""

        # Call base init with the predifined params:
        BaseTestScenario.__init__(
            self, "dds2734_" + DDS2734TransLocTestScenario.TEST_TYPES[type], "The transient local test"
        )

        self.type = type
        self.parser = DDS2734TransLocParser()
    def __init__(self):
        """Constructs the object"""

        # Call base init with the predifined params:
        BaseTestScenario.__init__(
            self,
            "dds2466",
            "CoFlight requirements eFDPfi_MW_DDS_15")

        self.parser = DDS2466Parser()
Beispiel #6
0
 def __init__(self, name="", description="", log_root=".", result_file=""):
     # Call base init with the predifined params:
     BaseTestScenario.__init__(self, name, description, log_root,
                               result_file)
     self.scenarious = {
         'c_as_active': 'c',
         'cpp_as_active': 'cpp',
         'cs_as_active': 'cs',
         'java_as_active': 'java'
     }
    def __init__(self, type):
        """Constructs the object"""

        # Call base init with the predifined params:
        BaseTestScenario.__init__(
            self, "dds2734_" + DDS2734TransLocTestScenario.TEST_TYPES[type],
            "The transient local test")

        self.type = type
        self.parser = DDS2734TransLocParser()
    def __init__(self, type):
        """Constructs the object"""

        # Call base init with the predifined params:
        BaseTestScenario.__init__(
            self,
            "dds2734_" + DDS2734TestScenario.TEST_TYPES[type],
            "The test case tests the discovery process of the configured networking service")

        self.type   = type
        self.parser = DDS2734Parser()
Beispiel #9
0
    def __init__(self, type):
        """Constructs the object"""

        # Call base init with the predifined params:
        BaseTestScenario.__init__(
            self, "dds2734_" + DDS2734TestScenario.TEST_TYPES[type],
            "The test case tests the discovery process of the configured networking service"
        )

        self.type = type
        self.parser = DDS2734Parser()
    def analyze(self):
        """Analize the test scenario results"""
        if not self.is_failed():
            try:
                # Check for the OSPL error log file:
                self.check_for_ospl_error_log()

                # Get test hosts:
                hosts = {}
                hosts["Pub"] = self.get_host_by_role("Pub")[0]
                hosts["Sub"] = self.get_host_by_role("Sub")[0]

                # Read node mopnitor logs:
                app_log_contents = {}
                app_log_contents["Pub"] = self.parser.get_process_log_content(
                    self.log_root, hosts["Pub"], "dds2734_publisher"
                )
                app_log_contents["Sub"] = self.parser.get_process_log_content(
                    self.log_root, hosts["Sub"], "dds2734_subscriber"
                )

                for index in app_log_contents.keys():
                    if len(app_log_contents[index]) == 0:
                        raise TestError(
                            "DDS2734TestScenario::analyze - empty application log for node [%s]"
                            % hosts[index].get_host_name()
                        )

                # Check test case expected result:
                if self.type == DDS2734TransLocTestScenario.TRANSLOC_NORMAL:
                    self.check_transloc_normal(app_log_contents)
                elif self.type == DDS2734TransLocTestScenario.TRANSLOC_LATE_READER:
                    self.check_transloc_late_reader(app_log_contents)
                elif self.type == DDS2734TransLocTestScenario.TRANSLOC_LATE_NODE:
                    self.check_transloc_late_node(app_log_contents)
                elif self.type == DDS2734TransLocTestScenario.TRANSLOC_TOO_LATE_READER:
                    self.check_transloc_too_late_reader(app_log_contents)
                elif self.type == DDS2734TransLocTestScenario.TRANSLOC_TOO_LATE_NODE:
                    self.check_transloc_too_late_node(app_log_contents)

            except:
                self.fail()
                self.errors.append("Cannot analyze results: %s %s" % (sys.exc_info()[0], sys.exc_info()[1]))

        # Call parent analyze to create log file:
        BaseTestScenario.analyze(self)
    def analyze(self):
        """Analize the test scenario results"""
        if not self.is_failed():
            try:
                # Check for the OSPL error log file:
                self.check_for_ospl_error_log()

                # Get test hosts:
                hosts = {}
                hosts["Pub"] = self.get_host_by_role("Pub")[0]
                hosts["Sub"] = self.get_host_by_role("Sub")[0]

                # Read node mopnitor logs:
                app_log_contents = {}
                app_log_contents["Pub"] = self.parser.get_process_log_content(
                    self.log_root, hosts["Pub"], "dds2734_publisher")
                app_log_contents["Sub"] = self.parser.get_process_log_content(
                    self.log_root, hosts["Sub"], "dds2734_subscriber")

                for index in app_log_contents.keys():
                    if len(app_log_contents[index]) == 0:
                        raise TestError(
                            "DDS2734TestScenario::analyze - empty application log for node [%s]"
                            % hosts[index].get_host_name())

                # Check test case expected result:
                if self.type == DDS2734TransLocTestScenario.TRANSLOC_NORMAL:
                    self.check_transloc_normal(app_log_contents)
                elif self.type == DDS2734TransLocTestScenario.TRANSLOC_LATE_READER:
                    self.check_transloc_late_reader(app_log_contents)
                elif self.type == DDS2734TransLocTestScenario.TRANSLOC_LATE_NODE:
                    self.check_transloc_late_node(app_log_contents)
                elif self.type == DDS2734TransLocTestScenario.TRANSLOC_TOO_LATE_READER:
                    self.check_transloc_too_late_reader(app_log_contents)
                elif self.type == DDS2734TransLocTestScenario.TRANSLOC_TOO_LATE_NODE:
                    self.check_transloc_too_late_node(app_log_contents)

            except:
                self.fail()
                self.errors.append("Cannot analyze results: %s %s" %
                                   (sys.exc_info()[0], sys.exc_info()[1]))

        # Call parent analyze to create log file:
        BaseTestScenario.analyze(self)
Beispiel #12
0
    def analyze(self):
        """Analize the test scenario results"""
        if not self.is_failed():
            try:
                # Check for the OSPL error log file:
                self.check_for_ospl_error_log()

                # Get test hosts:
                hosts = {}
                hosts["A"] = self.get_host_by_role("A")[0]
                hosts["B"] = self.get_host_by_role("B")[0]
                hosts["C"] = self.get_host_by_role("C")[0]

                # Read node mopnitor logs:
                monitor_contents = {}
                monitor_contents["A"] = self.parser.get_process_log_content(
                    self.log_root, hosts["A"], "NodeMonitor")
                monitor_contents["B"] = self.parser.get_process_log_content(
                    self.log_root, hosts["B"], "NodeMonitor")
                monitor_contents["C"] = self.parser.get_process_log_content(
                    self.log_root, hosts["C"], "NodeMonitor")

                for index in monitor_contents.keys():
                    if len(monitor_contents[index]) == 0:
                        raise TestError(
                            "DDS2734TestScenario::analyze - empty node monitor log for node [%s]"
                            % hosts[index].get_host_name())

                # Check test case expected result:
                if self.type == DDS2734TestScenario.MULTI_FULL:
                    self.check_multi_full_case(hosts, monitor_contents)

                if self.type == DDS2734TestScenario.MULTI_PART:
                    self.check_multi_part_case(hosts, monitor_contents)

                if self.type == DDS2734TestScenario.MULTI_NONE:
                    self.check_multi_none_case(hosts, monitor_contents)

                if self.type == DDS2734TestScenario.UNI_FULL:
                    self.check_uni_full_case(hosts, monitor_contents)

                if self.type == DDS2734TestScenario.UNI_SINGLE:
                    self.check_uni_single_case(hosts, monitor_contents)

                if self.type == DDS2734TestScenario.MIXED_FULL:
                    self.check_mixed_full_case(hosts, monitor_contents)

                if self.type == DDS2734TestScenario.MIXED_SINGLE:
                    self.check_mixed_single_case(hosts, monitor_contents)

                if self.type == DDS2734TestScenario.MIXED_EMPTY:
                    self.check_mixed_empty_case(hosts, monitor_contents)

                if self.type == DDS2734TestScenario.MIXED_EMPTY2:
                    self.check_mixed_empty2_case(hosts, monitor_contents)
            except:
                self.fail()
                self.errors.append("Cannot analyze results: %s %s" %
                                   (sys.exc_info()[0], sys.exc_info()[1]))

        # Call parent analyze to create log file:
        BaseTestScenario.analyze(self)
 def __init__(self, name = "", description = "", log_root = ".", q_steps = 0):
     """Constructs a test scenario."""
     BaseTestScenario.__init__(self, name, description, log_root)
     # Quantity of test scenario steps 
     self.q_steps = q_steps
    def analyze(self):
        """Analize the test scenario results"""
        if not self.is_failed():
            try:
                # Check for the OSPL error log file:
                self.check_for_ospl_error_log()

                # Get test hosts:
                hosts = {}
                hosts["A"] = self.get_host_by_role("A")[0]
                hosts["B"] = self.get_host_by_role("B")[0]
                hosts["C"] = self.get_host_by_role("C")[0]

                # Read node mopnitor logs:
                monitor_contents = {}
                monitor_contents["A"] = self.parser.get_process_log_content(
                    self.log_root,
                    hosts["A"],
                    "NodeMonitor")
                monitor_contents["B"] = self.parser.get_process_log_content(
                    self.log_root,
                    hosts["B"],
                    "NodeMonitor")
                monitor_contents["C"] = self.parser.get_process_log_content(
                    self.log_root,
                    hosts["C"],
                    "NodeMonitor")

                for index in monitor_contents.keys():
                    if len(monitor_contents[index]) == 0:
                        raise TestError("DDS2734TestScenario::analyze - empty node monitor log for node [%s]"% hosts[index].get_host_name())

                # Check test case expected result:
                if self.type == DDS2734TestScenario.MULTI_FULL:
                    self.check_multi_full_case(hosts, monitor_contents)
                
                if self.type == DDS2734TestScenario.MULTI_PART:
                    self.check_multi_part_case(hosts, monitor_contents)
                
                if self.type == DDS2734TestScenario.MULTI_NONE:
                    self.check_multi_none_case(hosts, monitor_contents)

                if self.type == DDS2734TestScenario.UNI_FULL:
                    self.check_uni_full_case(hosts, monitor_contents)

                if self.type == DDS2734TestScenario.UNI_SINGLE:
                    self.check_uni_single_case(hosts, monitor_contents)

                if self.type == DDS2734TestScenario.MIXED_FULL:
                    self.check_mixed_full_case(hosts, monitor_contents)

                if self.type == DDS2734TestScenario.MIXED_SINGLE:
                    self.check_mixed_single_case(hosts, monitor_contents)

                if self.type == DDS2734TestScenario.MIXED_EMPTY:
                    self.check_mixed_empty_case(hosts, monitor_contents)

                if self.type == DDS2734TestScenario.MIXED_EMPTY2:
                    self.check_mixed_empty2_case(hosts, monitor_contents)
            except:
                self.fail()
                self.errors.append("Cannot analyze results: %s %s"% (sys.exc_info()[0], sys.exc_info()[1]))

        # Call parent analyze to create log file:
        BaseTestScenario.analyze(self)
 def __init__(self, name = "", description = "", log_root = ".", result_file = ""):
     # Call base init with the predifined params:
     BaseTestScenario.__init__(self, name, description, log_root, result_file)
     self.scenarious = {'c_as_active': 'c', 'cpp_as_active': 'cpp', 'cs_as_active': 'cs', 'java_as_active': 'java'} 
 def __init__(self, name="", description="", log_root="."):
     """Constructs a test scenario."""
     BaseTestScenario.__init__(self, name, description, log_root)
 def __init__(self, name="", description="", log_root="."):
     """Constructs a test scenario."""
     BaseTestScenario.__init__(self, name, description, log_root)
                        self.check_for_timestamps(pub_data1, sub_data1)
                        # pub2->sub1:
                        self.check_for_timestamps(pub_data2, sub_data1)
                        # pub1->sub2:
                        self.check_for_timestamps(pub_data1, sub_data2)
                        # pub2->sub2:
                        self.check_for_timestamps(pub_data2, sub_data2)

                        # Check for the same publisher:
                        self.check_for_publishers(sub_data1)
                        self.check_for_publishers(sub_data2)

                        # Check that subscriber have the same results:
                        self.check_for_subscribers(sub_data1, sub_data2)
                    except TestError, msg:
                        self.fail()
                        self.errors.append(msg)

                # Check for the OSPL error log file:
                self.check_for_ospl_error_log()
            except:
                self.fail()
                self.errors.append("Cannot analyze results: %s" %
                                   sys.exc_info()[0])

        # Call parent analyze to create log file:
        BaseTestScenario.analyze(self)


#===============================================================================
                    try:
                        # Check for right timestamps:
                        # pub1->sub1:
                        self.check_for_timestamps(pub_data1, sub_data1)
                        # pub2->sub1:
                        self.check_for_timestamps(pub_data2, sub_data1)
                        # pub1->sub2:
                        self.check_for_timestamps(pub_data1, sub_data2)
                        # pub2->sub2:
                        self.check_for_timestamps(pub_data2, sub_data2)

                        # Check for the same publisher:
                        self.check_for_publishers(sub_data1)
                        self.check_for_publishers(sub_data2)

                        # Check that subscriber have the same results:
                        self.check_for_subscribers(sub_data1, sub_data2)
                    except TestError, msg:
                        self.fail()
                        self.errors.append(msg)

                # Check for the OSPL error log file:
                self.check_for_ospl_error_log()
            except:
                self.fail()
                self.errors.append("Cannot analyze results: %s"% sys.exc_info()[0])

        # Call parent analyze to create log file:
        BaseTestScenario.analyze(self)
#===============================================================================
 def __init__(self, name="", description="", log_root=".", q_steps=0):
     """Constructs a test scenario."""
     BaseTestScenario.__init__(self, name, description, log_root)
     # Quantity of test scenario steps
     self.q_steps = q_steps