예제 #1
0
        wdm_next_args['total_server_count'] = 0
        wdm_next_args['final_server_status'] = 4
        wdm_next_args['timer_server_period'] = 0
        wdm_next_args['enable_server_flip'] = 0

        wdm_next_args['client_event_generator'] = 'Security'

        wdm_next_args['client_inter_event_period'] = 2000

        wdm_next_args['client_log_check'] = [('Handler\[0\] \[(ALIVE|CONFM)\] bound mutual subscription is going away', wdm_next_args['test_client_iterations']),
                                             ('Client->kEvent_OnNotificationProcessed', 1),
                                             ('Client\[0\] moving to \[ FREE\] Ref\(0\)', wdm_next_args['test_client_iterations']),
                                             ('Handler\[0\] Moving to \[ FREE\] Ref\(0\)', wdm_next_args['test_client_iterations'])]
        wdm_next_args['server_log_check'] = [('TimerEventHandler Ref\(\d+\) Timeout', wdm_next_args['test_client_iterations']),
                                             ('bound mutual subscription is going away', wdm_next_args['test_client_iterations']),
                                             ('Client\[0\] \[(ALIVE|CONFM)\] HandleSubscriptionTerminated', wdm_next_args['test_client_iterations']),
                                             ('Client\[0\] moving to \[ FREE\] Ref\(0\)', wdm_next_args['test_client_iterations']),
                                             ('Handler\[0\] Moving to \[ FREE\] Ref\(0\)', wdm_next_args['test_client_iterations'])]

        wdm_next_args['test_tag'] = self.__class__.__name__[19:].upper()
        wdm_next_args['test_case_name'] = ['I11: Mutual Subscribe: Initiator Continuous Events. Client in initiator aborts',
                                           'M35: Stress Mutual Subscribe: Initiator Continuous Events. Client in initiator aborts']
        print 'test file: ' + self.__class__.__name__
        print "weave-wdm-next test I11 and M35"
        super(test_weave_wdm_next_mutual_subscribe_54, self).weave_wdm_next_test_base(wdm_next_args)


if __name__ == "__main__":
    WeaveUtilities.run_unittest()

import itertools
import os
import getopt
import sys
import unittest
import set_test_path

from happy.Utils import *
import happy.HappyNodeList
import WeaveStateLoad
import WeaveStateUnload
import WeaveTime
import WeaveUtilities
import plugins.plaid.Plaid as Plaid

gFaultOpts = WeaveUtilities.FaultInjectionOptions()
gOptions = {'enableFaults': False, 'mode': "local"}


class test_weave_time_01(unittest.TestCase):
    def setUp(self):
        self.tap = None

        if "WEAVE_SYSTEM_CONFIG_USE_LWIP" in list(os.environ.keys(
        )) and os.environ["WEAVE_SYSTEM_CONFIG_USE_LWIP"] == "1":
            self.topology_file = os.path.dirname(os.path.realpath(__file__)) + \
                "/../../../topologies/standalone/three_nodes_on_tap_thread_weave.json"
            self.tap = "wpan0"
        else:
            self.topology_file = os.path.dirname(os.path.realpath(__file__)) + \
                "/../../../topologies/standalone/three_nodes_on_thread_weave.json"
예제 #3
0
    def __process_results(self, client_output, server_output, client_info):
        kevents = re.findall(r"WEAVE:.+kEvent_\w+", client_output)
        smoke_check = False
        client_parser_error = None
        client_leak_detected = None
        server_parser_error = None
        server_leak_detected = None
        result = {}
        client_parser_error, client_leak_detected = WeaveUtilities.scan_for_leaks_and_parser_errors(
            client_output)
        result["no_client_parser_error"] = not client_parser_error
        result["no_client_leak_detected"] = not client_leak_detected
        if server_output is not "":
            server_parser_error, server_leak_detected = WeaveUtilities.scan_for_leaks_and_parser_errors(
                server_output)
            result["no_server_parser_error"] = not client_parser_error
            result["no_server_leak_detected"] = not server_leak_detected
        if self.wdm_option == "view":
            if any("kEvent_ViewResponseReceived" in s for s in kevents) and \
                            kevents[-1] == "kEvent_ViewResponseConsumed":
                smoke_check = True
            else:
                smoke_check = False
        elif self.wdm_option == "one_way_subscribe":
            if any("Client->kEvent_OnSubscriptionEstablished" in s for s in kevents) \
                    and "Closing endpoints" in client_output:
                smoke_check = True
            else:
                smoke_check = False
        elif self.wdm_option == "mutual_subscribe":
            if any("Publisher->kEvent_OnSubscriptionEstablished" in s for s in kevents) \
                    and "Closing endpoints" in client_output:
                smoke_check = True
            else:
                smoke_check = False
        elif self.wdm_option == "subless_notify":
            if any("kEvent_SubscriptionlessNotificationProcessingComplete" in s
                   for s in kevents):
                smoke_check = True
            else:
                smoke_check = False

        result["smoke_check"] = smoke_check

        if self.quiet is False:
            print "weave-wdm-next %s from node %s (%s) to node %s (%s) : "\
                  % (self.wdm_option, client_info["client_node_id"], client_info["client_ip"], self.server_node_id, self.server_ip)
            if smoke_check is True:
                for kevent in kevents:
                    print hgreen(kevent)
                print hgreen("weave-wdm-next %s success" % self.wdm_option)
            else:
                for kevent in kevents:
                    print hred(kevent)
                print hred("weave-wdm-next %s failure" % self.wdm_option)

            if client_parser_error is True:
                print hred("client parser error")
            if client_leak_detected is True:
                print hred("client_resource leak detected")
            if server_parser_error is True:
                print hred("server parser error")
            if server_leak_detected is True:
                print hred("server resource leak detected")

        return result
import json
import getopt
import sys

from happy.Utils import *
import happy.HappyNodeList
import WeaveStateLoad
import WeaveStateUnload
import WeavePing
import WeaveTunnelStart
import WeaveTunnelStop
import WeaveUtilities
from WeaveTest import WeaveTest
import plugins.plaid.Plaid as Plaid

gFaultopts = WeaveUtilities.FaultInjectionOptions(nodes=["gateway", "service"])
gOptions = {'case': True, "num_pings": "3", "restart": True}


class test_weave_tunnel_faults(unittest.TestCase):
    def setUp(self):
        self.tap = None

        if "WEAVE_SYSTEM_CONFIG_USE_LWIP" in os.environ.keys(
        ) and os.environ["WEAVE_SYSTEM_CONFIG_USE_LWIP"] == "1":
            self.topology_file = os.path.dirname(os.path.realpath(__file__)) + \
                "/../../../topologies/standalone/thread_wifi_on_tap_ap_service.json"
            self.tap = "wpan0"
        else:
            self.topology_file = os.path.dirname(os.path.realpath(__file__)) + \
                "/../../../topologies/standalone/thread_wifi_ap_service.json"