def test_subscribe_to_execute_with_payload(self):
        port = self.config.clientIpcPort
        subscribeProcess = tools_common.run_non_blocking(tools_common.CLIENT_SUBSCRIBE, 
                                                    "--verbose --ipcPort %i --waitCount 1 --waitTime 5 /3/0/4" % (port,))
        
        # wait for subscribe process to start up
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session IPC configured for UDP: address 127.0.0.1, port %d" % (port,))
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session connected")
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Subscribe /3/0/4 Execute\n")
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Waiting for 1 notifications over 5 seconds:\n")
        
        # do execute command
        expectedStdout = "Target /3/0/4 executed successfully\n"
        expectedStderr = ""
        expectedCode = 0
        
        inputText = "QmFzZTY0IGlzIGEgZ2VuZXJpYyB0ZXJtIGZvciB"
        result = server_execute_stdin(self.config, inputText, "/3/0/4")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # read subscribe output
        expectedStdout = "Execute 1:\nDATA: length 39, payload: [51 6d 46 7a 5a 54 59 30 49 47 6c 7a 49 47 45 67 5a 32 56 75 5a 58 4a 70 59 79 42 30 5a 58 4a 74 49 47 5a 76 63 69 42 ]\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0
        
        result = tools_common.non_blocking_get_run_result(subscribeProcess)
        
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
    def subscribe_resource(self, path, value, expectedResponse):
        resourcePath = "/".join(path.split("/")[0:4])
        # test that we can subscribe to a single change of value on a specified resource
        # open client subscribe subprocess. Only wait for a single change to the resource
        port = self.config.clientIpcPort
        subscribeProcess = tools_common.run_non_blocking(tools_common.CLIENT_SUBSCRIBE, 
                                                    "--verbose --ipcPort %i --waitCount 1 --waitTime 5 %s" % (port, resourcePath,))
        
        # wait for subscribe process to start up
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session IPC configured for UDP: address 127.0.0.1, port %d" % (port,))
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session connected")
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Subscribe %s Change\n" % (resourcePath, ))
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Waiting for 1 notifications over 5 seconds:\n")
        
        # do set command
        expectedStdout = ""
        expectedStderr = ""
        expectedCode = 0
        
        result = client_set(self.config, "%s=%s" % (path, value))
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        #Notify 1:\n    Manufacturer[3/0/0]: abc\nUnsubscribe /3/0/0\n
        # read subscribe output
        expectedStdout = expectedResponse
        expectedStderr = ""
        expectedCode = 0
        
        result = tools_common.non_blocking_get_run_result(subscribeProcess)
        
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
    def test_subscribe_to_execute(self):
        port = self.config.clientIpcPort
        subscribeProcess = tools_common.run_non_blocking(tools_common.CLIENT_SUBSCRIBE, 
                                                    "--verbose --ipcPort %i --waitCount 1 --waitTime 5 /3/0/4" % (port,))
        
        # wait for subscribe process to start up
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session IPC configured for UDP: address 127.0.0.1, port %d" % (port,))
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session connected")
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Subscribe /3/0/4 Execute\n")
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Waiting for 1 notifications over 5 seconds:\n")
        
        # do execute command
        expectedStdout = "Target /3/0/4 executed successfully\n"
        expectedStderr = ""
        expectedCode = 0
        
        result = server_execute(self.config, "/3/0/4")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # read subscribe output
        expectedStdout = "Execute 1:\nNO DATA\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0
        
        result = tools_common.non_blocking_get_run_result(subscribeProcess)
        
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
    def test_client_subscribe_resource_server_execute(self):
        # test that the client can subscribe to an executable resource and receive a notification
        # when that resource is executed by the server

        # open client subscribe subprocess. Only wait for a single execute of the resource
        port = self.config.clientIpcPort
        subscribeProcess = tools_common.run_non_blocking(tools_common.CLIENT_SUBSCRIBE,
                                                    "--verbose --ipcPort %i --waitCount 1 /3/0/4" % (port,))

        # wait for subscribe process to start up
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session IPC configured for UDP: address 127.0.0.1, port %d" % (port,))
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session connected")
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Subscribe /3/0/4 Execute\n")
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Waiting for 1 notifications:\n")

        # test we can execute a resource, specifying no payload
        expectedStdout = "Target /3/0/4 executed successfully\n"
        expectedStderr = ""
        expectedCode = 0
        result = server_execute(self.config, "/3/0/4")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode,   result.code)

        # read subscribe output
        expectedStdout = "Execute 1:\nNO DATA\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(subscribeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode,   result.code)
    def test_client_subscribe_resource_server_write(self):
        # test that the client can subscribe to a resource and receive a notification
        # when that resource is changed by the server through the write function

        # open client subscribe subprocess. Only wait for a single execute of the resource
        port = self.config.clientIpcPort
        subscribeProcess = tools_common.run_non_blocking(tools_common.CLIENT_SUBSCRIBE,
                                                    "--verbose --ipcPort %i --waitCount 1 /3/0/15" % (port,))

        # wait for subscribe process to start up
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session IPC configured for UDP: address 127.0.0.1, port %d" % (port,))
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session connected")
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Subscribe /3/0/15 Change\n")
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Waiting for 1 notifications:\n")
        
        # do write command
        expectedStdout = ""
        expectedStderr = ""
        expectedCode = 0

        result = server_write(self.config, "/3/0/15=abc")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode,   result.code)

        # read subscribe output
        expectedStdout = "Notify 1:\nChanged: /3/0/15 Resource Modified:\nDevice[/3/0]:\n    Timezone[/3/0/15]: abc\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(subscribeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode,   result.code)
    def observe_resource(self, path, currentValuesOutput, value,
                         expectedResponse):
        # test that we can observe to a single change of value on a specified resource
        # open client observe subprocess. Only wait for a single change to the resource
        resourcePath = "/".join(path.split("/")[0:4])

        port = self.config.serverIpcPort
        observeProcess = tools_common.run_non_blocking(
            SERVER_OBSERVE,
            "--verbose --ipcPort %i --waitCount 1 --waitTime 555 %s --clientID %s"
            % (port, resourcePath, self.config.clientEndpointName))

        # wait for observe process to start up
        self.assertEqual(
            tools_common.strip_prefix(observeProcess.stdout.readline()),
            "Session IPC configured for UDP: address 127.0.0.1, port %d" %
            (port, ))
        self.assertEqual(
            tools_common.strip_prefix(observeProcess.stdout.readline()),
            "Session connected")
        self.assertEqual(
            tools_common.strip_prefix(observeProcess.stdout.readline()),
            "Observe %s\n" % (resourcePath, ))
        self.assertEqual(
            tools_common.strip_prefix(observeProcess.stdout.readline()),
            "Waiting for 1 notifications over 555 seconds:\n")
        self.assertEqual(
            tools_common.strip_prefix(observeProcess.stdout.readline()),
            "Notify 0 from clientID TestClient:\n")
        self.assertEqual(
            tools_common.strip_prefix(observeProcess.stdout.readline()),
            "Changed: %s Resource Modified:\n" % (resourcePath, ))

        for line in currentValuesOutput:
            self.assertEqual(
                tools_common.strip_prefix(observeProcess.stdout.readline()),
                line)

        # do write command
        expectedStdout = ""
        expectedStderr = ""
        expectedCode = 0

        result = server_write(self.config, "%s=%s" % (path, value))
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        #Notify 1:\n    Manufacturer[3/0/0]: abc\nUnobserve /3/0/0\n
        # read observe output
        expectedStdout = expectedResponse
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(observeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
    def test_subscribe_single_resource_multiple_changes(self):
        # test that we can subscribe to multiple changes of value on a specified resource
        num_changes = 2
        # open client subscribe subprocess. Wait for multiple changes to the resource
        port = self.config.clientIpcPort
        subscribeProcess = tools_common.run_non_blocking(
            tools_common.CLIENT_SUBSCRIBE,
            "--verbose --ipcPort %i --waitCount %d --waitTime 5 /3/0/0" %
            (port, num_changes))

        time.sleep(0.25)
        # wait for subscribe process to start up
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session IPC configured for UDP: address 127.0.0.1, port %d" %
            (port, ))
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session connected")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Subscribe /3/0/0 Change\n")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Waiting for %d notifications over 5 seconds:\n" % (num_changes, ))

        # send the first set command
        expectedStdout = ""
        expectedStderr = ""
        expectedCode = 0

        result = client_set(self.config, "/3/0/0=1")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # wait until we have received a notify before sending the second change
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Notify 1:\n")
        result = client_set(self.config, "/3/0/0=2")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # read subscribe output
        expectedStdout = "Changed: /3/0/0 Resource Modified:\nDevice[/3/0]:\n    Manufacturer[/3/0/0]: 1\nNotify 2:\nChanged: /3/0/0 Resource Modified:\nDevice[/3/0]:\n    Manufacturer[/3/0/0]: 2\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(subscribeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
    def observe_resource(self, path, currentValuesOutput, value, expectedResponse):
        # test that we can observe to a single change of value on a specified resource
        # open client observe subprocess. Only wait for a single change to the resource
        resourcePath = "/".join(path.split("/")[0:4])

        port = self.config.serverIpcPort
        observeProcess = tools_common.run_non_blocking(
            SERVER_OBSERVE,
            "--verbose --ipcPort %i --waitCount 1 --waitTime 555 %s --clientID %s"
            % (port, resourcePath, self.config.clientEndpointName),
        )

        # wait for observe process to start up
        self.assertEqual(
            tools_common.strip_prefix(observeProcess.stdout.readline()),
            "Session IPC configured for UDP: address 127.0.0.1, port %d" % (port,),
        )
        self.assertEqual(tools_common.strip_prefix(observeProcess.stdout.readline()), "Session connected")
        self.assertEqual(tools_common.strip_prefix(observeProcess.stdout.readline()), "Observe %s\n" % (resourcePath,))
        self.assertEqual(
            tools_common.strip_prefix(observeProcess.stdout.readline()),
            "Waiting for 1 notifications over 555 seconds:\n",
        )
        self.assertEqual(
            tools_common.strip_prefix(observeProcess.stdout.readline()), "Notify 0 from clientID TestClient:\n"
        )
        self.assertEqual(
            tools_common.strip_prefix(observeProcess.stdout.readline()),
            "Changed: %s Resource Modified:\n" % (resourcePath,),
        )

        for line in currentValuesOutput:
            self.assertEqual(tools_common.strip_prefix(observeProcess.stdout.readline()), line)

        # do write command
        expectedStdout = ""
        expectedStderr = ""
        expectedCode = 0

        result = server_write(self.config, "%s=%s" % (path, value))
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # Notify 1:\n    Manufacturer[3/0/0]: abc\nUnobserve /3/0/0\n
        # read observe output
        expectedStdout = expectedResponse
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(observeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
Beispiel #9
0
    def test_server_observe_resource_client_set(self):
        # test that the server can observe changes to a resource and receive a notification
        # when that resource is changed by the client through the set function

        # open client subscribe subprocess. Only wait for a single execute of the resource
        port = self.config.serverIpcPort
        clientEndpointName = self.config.clientEndpointName
        observeProcess = tools_common.run_non_blocking(
            tools_common.SERVER_OBSERVE,
            "--verbose --ipcPort %i --clientID %s --waitCount 1 /3/0/1" %
            (port, clientEndpointName))

        # wait for observe process to start up
        self.assertEqual(
            tools_common.strip_prefix(observeProcess.stdout.readline()),
            "Session IPC configured for UDP: address 127.0.0.1, port %d" %
            (port, ))
        self.assertEqual(
            tools_common.strip_prefix(observeProcess.stdout.readline()),
            "Session connected")
        self.assertEqual(
            tools_common.strip_prefix(observeProcess.stdout.readline()),
            "Observe /3/0/1\n")
        self.assertEqual(
            tools_common.strip_prefix(observeProcess.stdout.readline()),
            "Waiting for 1 notifications:\n")
        self.assertEqual(
            tools_common.strip_prefix(observeProcess.stdout.readline()),
            "Notify 0 from clientID TestClient:\n")
        self.assertEqual(
            tools_common.strip_prefix(observeProcess.stdout.readline()),
            "Changed: /3/0/1 Resource Modified:\n")

        # do set command
        expectedStdout = ""
        expectedStderr = ""
        expectedCode = 0

        result = client_set(self.config, "/3/0/1=abc")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # read subscribe output
        expectedStdout = "Device[/3/0]:\n    ModelNumber[/3/0/1]: Awa Client\nNotify 1 from clientID TestClient:\nChanged: /3/0/1 Resource Modified:\nDevice[/3/0]:\n    ModelNumber[/3/0/1]: abc\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(observeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
    def test_subscribe_multiple_resources_multiple_changes(self):
        # test that we can subscribe to a single change of value on
        # one of the multiple resources specified

        # open client subscribe subprocess. Only wait for a single change to one of the resources
        port = self.config.clientIpcPort
        subscribeProcess = tools_common.run_non_blocking(
            tools_common.CLIENT_SUBSCRIBE,
            "--verbose --ipcPort %i --waitCount 1 --waitTime 5 /3/0/0 /3/0/1" %
            (port, ))
        # wait for subscribe process to start up

        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session IPC configured for UDP: address 127.0.0.1, port %d" %
            (port, ))
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session connected")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Subscribe /3/0/0 Change\n")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Subscribe /3/0/1 Change\n")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Waiting for 1 notifications over 5 seconds:\n")

        # do set command and expect notifications from the subscribe subprocess
        expectedStdout = ""
        expectedStderr = ""
        expectedCode = 0

        # set the first resource
        result = client_set(self.config, "/3/0/0=abc /3/0/1=def")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        expectedStdout = "Notify 1:\nChanged: /3/0/0 Resource Modified:\nDevice[/3/0]:\n    Manufacturer[/3/0/0]: abc\nNotify 2:\nChanged: /3/0/1 Resource Modified:\nDevice[/3/0]:\n    ModelNumber[/3/0/1]: def\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(subscribeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
Beispiel #11
0
    def test_client_subscribe_resource_server_execute_with_payload(self):
        # test that the client can subscribe to an executable resource and receive a notification
        # when that resource is executed by the server. Payload should be printed on the client

        # open client subscribe subprocess. Only wait for a single execute of the resource
        port = self.config.clientIpcPort
        subscribeProcess = tools_common.run_non_blocking(
            tools_common.CLIENT_SUBSCRIBE,
            "--verbose --ipcPort %i --waitCount 1 /3/0/4" % (port, ))

        # wait for subscribe process to start up
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session IPC configured for UDP: address 127.0.0.1, port %d" %
            (port, ))
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session connected")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Subscribe /3/0/4 Execute\n")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Waiting for 1 notifications:\n")

        # test we can execute a resource, specifying a payload of data
        expectedStdout = "Target /3/0/4 executed successfully\n"
        expectedStderr = ""
        expectedCode = 0
        inputText = "QmFzZTY0IGlzIGEgZ2VuZXJpYyB0ZXJtIGZvciB"
        result = server_execute_stdin(self.config, inputText, "/3/0/4")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        hexBytes = ""
        for c in inputText:
            hexBytes += c.encode("hex") + " "

        # read subscribe output
        expectedStdout = "Execute 1:\nDATA: length 39, payload: [" + hexBytes + "]\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(subscribeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
    def test_subscribe_resource_single_change(self):
        # test that we can subscribe to a single change of value on a specified resource

        # open client subscribe subprocess. Only wait for a single change to the resource

        #import pdb; pdb.set_trace()

        port = self.config.clientIpcPort
        subscribeProcess = tools_common.run_non_blocking(
            tools_common.CLIENT_SUBSCRIBE,
            "--verbose --ipcPort %i --waitCount 1 --waitTime 5 /3/0/0" %
            (port, ))

        # wait for subscribe process to start up
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session IPC configured for UDP: address 127.0.0.1, port %d" %
            (port, ))
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session connected")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Subscribe /3/0/0 Change\n")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Waiting for 1 notifications over 5 seconds:\n")

        # do set command
        expectedStdout = ""
        expectedStderr = ""
        expectedCode = 0

        result = client_set(self.config, "/3/0/0=abc")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # read subscribe output
        expectedStdout = "Notify 1:\nChanged: /3/0/0 Resource Modified:\nDevice[/3/0]:\n    Manufacturer[/3/0/0]: abc\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(subscribeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
    def subscribe_resource(self, path, value, expectedResponse):
        resourcePath = "/".join(path.split("/")[0:4])
        # test that we can subscribe to a single change of value on a specified resource
        # open client subscribe subprocess. Only wait for a single change to the resource
        port = self.config.clientIpcPort
        subscribeProcess = tools_common.run_non_blocking(
            tools_common.CLIENT_SUBSCRIBE,
            "--verbose --ipcPort %i --waitCount 1 --waitTime 5 %s" % (
                port,
                resourcePath,
            ))

        # wait for subscribe process to start up
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session IPC configured for UDP: address 127.0.0.1, port %d" %
            (port, ))
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session connected")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Subscribe %s Change\n" % (resourcePath, ))
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Waiting for 1 notifications over 5 seconds:\n")

        # do set command
        expectedStdout = ""
        expectedStderr = ""
        expectedCode = 0

        result = client_set(self.config, "%s=%s" % (path, value))
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        #Notify 1:\n    Manufacturer[3/0/0]: abc\nUnsubscribe /3/0/0\n
        # read subscribe output
        expectedStdout = expectedResponse
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(subscribeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
Beispiel #14
0
    def test_client_subscribe_resource_server_write(self):
        # test that the client can subscribe to a resource and receive a notification
        # when that resource is changed by the server through the write function

        # open client subscribe subprocess. Only wait for a single execute of the resource
        port = self.config.clientIpcPort
        subscribeProcess = tools_common.run_non_blocking(
            tools_common.CLIENT_SUBSCRIBE,
            "--verbose --ipcPort %i --waitCount 1 /3/0/15" % (port, ))

        # wait for subscribe process to start up
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session IPC configured for UDP: address 127.0.0.1, port %d" %
            (port, ))
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session connected")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Subscribe /3/0/15 Change\n")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Waiting for 1 notifications:\n")

        # do write command
        expectedStdout = ""
        expectedStderr = ""
        expectedCode = 0

        result = server_write(self.config, "/3/0/15=abc")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # read subscribe output
        expectedStdout = "Notify 1:\nChanged: /3/0/15 Resource Modified:\nDevice[/3/0]:\n    Timezone[/3/0/15]: abc\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(subscribeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
Beispiel #15
0
    def test_client_subscribe_resource_server_execute(self):
        # test that the client can subscribe to an executable resource and receive a notification
        # when that resource is executed by the server

        # open client subscribe subprocess. Only wait for a single execute of the resource
        port = self.config.clientIpcPort
        subscribeProcess = tools_common.run_non_blocking(
            tools_common.CLIENT_SUBSCRIBE,
            "--verbose --ipcPort %i --waitCount 1 /3/0/4" % (port, ))

        # wait for subscribe process to start up
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session IPC configured for UDP: address 127.0.0.1, port %d" %
            (port, ))
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session connected")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Subscribe /3/0/4 Execute\n")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Waiting for 1 notifications:\n")

        # test we can execute a resource, specifying no payload
        expectedStdout = "Target /3/0/4 executed successfully\n"
        expectedStderr = ""
        expectedCode = 0
        result = server_execute(self.config, "/3/0/4")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # read subscribe output
        expectedStdout = "Execute 1:\nNO DATA\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(subscribeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
    def test_subscribe_to_execute_with_payload(self):
        port = self.config.clientIpcPort
        subscribeProcess = tools_common.run_non_blocking(
            tools_common.CLIENT_SUBSCRIBE,
            "--verbose --ipcPort %i --waitCount 1 --waitTime 5 /3/0/4" %
            (port, ))

        # wait for subscribe process to start up
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session IPC configured for UDP: address 127.0.0.1, port %d" %
            (port, ))
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session connected")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Subscribe /3/0/4 Execute\n")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Waiting for 1 notifications over 5 seconds:\n")

        # do execute command
        expectedStdout = "Target /3/0/4 executed successfully\n"
        expectedStderr = ""
        expectedCode = 0

        inputText = "QmFzZTY0IGlzIGEgZ2VuZXJpYyB0ZXJtIGZvciB"
        result = server_execute_stdin(self.config, inputText, "/3/0/4")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # read subscribe output
        expectedStdout = "Execute 1:\nDATA: length 39, payload: [51 6d 46 7a 5a 54 59 30 49 47 6c 7a 49 47 45 67 5a 32 56 75 5a 58 4a 70 59 79 42 30 5a 58 4a 74 49 47 5a 76 63 69 42 ]\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(subscribeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
 def test_subscribe_single_resource_multiple_changes(self):
     # test that we can subscribe to multiple changes of value on a specified resource
     num_changes = 2;
     # open client subscribe subprocess. Wait for multiple changes to the resource
     port = self.config.clientIpcPort
     subscribeProcess = tools_common.run_non_blocking(tools_common.CLIENT_SUBSCRIBE, 
                                                 "--verbose --ipcPort %i --waitCount %d --waitTime 5 /3/0/0" % (port, num_changes))
     
     time.sleep(0.25)
     # wait for subscribe process to start up
     self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session IPC configured for UDP: address 127.0.0.1, port %d" % (port,))
     self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session connected")
     self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Subscribe /3/0/0 Change\n")
     self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Waiting for %d notifications over 5 seconds:\n" % (num_changes,))
     
     # send the first set command
     expectedStdout = ""
     expectedStderr = ""
     expectedCode = 0
     
     result = client_set(self.config, "/3/0/0=1")
     self.assertEqual(expectedStdout, result.stdout)
     self.assertEqual(expectedStderr, result.stderr)
     self.assertEqual(expectedCode, result.code)
     
     # wait until we have received a notify before sending the second change
     self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Notify 1:\n")
     result = client_set(self.config, "/3/0/0=2")
     self.assertEqual(expectedStdout, result.stdout)
     self.assertEqual(expectedStderr, result.stderr)
     self.assertEqual(expectedCode, result.code)
     
     # read subscribe output
     expectedStdout = "Changed: /3/0/0 Resource Modified:\nDevice[/3/0]:\n    Manufacturer[/3/0/0]: 1\nNotify 2:\nChanged: /3/0/0 Resource Modified:\nDevice[/3/0]:\n    Manufacturer[/3/0/0]: 2\nSession disconnected\n"
     expectedStderr = ""
     expectedCode = 0
     
     result = tools_common.non_blocking_get_run_result(subscribeProcess)
     
     self.assertEqual(expectedStdout, result.stdout)
     self.assertEqual(expectedStderr, result.stderr)
     self.assertEqual(expectedCode, result.code)
    def test_subscribe_to_execute(self):
        port = self.config.clientIpcPort
        subscribeProcess = tools_common.run_non_blocking(
            tools_common.CLIENT_SUBSCRIBE,
            "--verbose --ipcPort %i --waitCount 1 --waitTime 5 /3/0/4" %
            (port, ))

        # wait for subscribe process to start up
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session IPC configured for UDP: address 127.0.0.1, port %d" %
            (port, ))
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session connected")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Subscribe /3/0/4 Execute\n")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Waiting for 1 notifications over 5 seconds:\n")

        # do execute command
        expectedStdout = "Target /3/0/4 executed successfully\n"
        expectedStderr = ""
        expectedCode = 0

        result = server_execute(self.config, "/3/0/4")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # read subscribe output
        expectedStdout = "Execute 1:\nNO DATA\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(subscribeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
    def test_client_subscribe_resource_server_execute_with_payload(self):
        # test that the client can subscribe to an executable resource and receive a notification
        # when that resource is executed by the server. Payload should be printed on the client

        # open client subscribe subprocess. Only wait for a single execute of the resource
        port = self.config.clientIpcPort
        subscribeProcess = tools_common.run_non_blocking(tools_common.CLIENT_SUBSCRIBE,
                                                    "--verbose --ipcPort %i --waitCount 1 /3/0/4" % (port,))

        # wait for subscribe process to start up
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session IPC configured for UDP: address 127.0.0.1, port %d" % (port,))
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session connected")
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Subscribe /3/0/4 Execute\n")
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Waiting for 1 notifications:\n")

        # test we can execute a resource, specifying a payload of data
        expectedStdout = "Target /3/0/4 executed successfully\n"
        expectedStderr = ""
        expectedCode = 0
        inputText = "QmFzZTY0IGlzIGEgZ2VuZXJpYyB0ZXJtIGZvciB"
        result = server_execute_stdin(self.config, inputText, "/3/0/4")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode,   result.code)

        hexBytes = ""
        for c in inputText:
            hexBytes += c.encode("hex") + " "

        # read subscribe output
        expectedStdout = "Execute 1:\nDATA: length 39, payload: [" + hexBytes +"]\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(subscribeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode,   result.code)
    def test_server_observe_resource_client_set(self):
        # test that the server can observe changes to a resource and receive a notification
        # when that resource is changed by the client through the set function

        # open client subscribe subprocess. Only wait for a single execute of the resource
        port = self.config.serverIpcPort
        clientEndpointName = self.config.clientEndpointName
        observeProcess = tools_common.run_non_blocking(tools_common.SERVER_OBSERVE,
                                                    "--verbose --ipcPort %i --clientID %s --waitCount 1 /3/0/1" % (port, clientEndpointName))

        # wait for observe process to start up
        self.assertEqual(tools_common.strip_prefix(observeProcess.stdout.readline()), "Session IPC configured for UDP: address 127.0.0.1, port %d" % (port,))
        self.assertEqual(tools_common.strip_prefix(observeProcess.stdout.readline()), "Session connected")
        self.assertEqual(tools_common.strip_prefix(observeProcess.stdout.readline()), "Observe /3/0/1\n")
        self.assertEqual(tools_common.strip_prefix(observeProcess.stdout.readline()), "Waiting for 1 notifications:\n")
        self.assertEqual(tools_common.strip_prefix(observeProcess.stdout.readline()), "Notify 0 from clientID TestClient:\n")
        self.assertEqual(tools_common.strip_prefix(observeProcess.stdout.readline()), "Changed: /3/0/1 Resource Modified:\n")

        # do set command
        expectedStdout = ""
        expectedStderr = ""
        expectedCode = 0

        result = client_set(self.config, "/3/0/1=abc")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode,   result.code)

        # read subscribe output
        expectedStdout = "Device[/3/0]:\n    ModelNumber[/3/0/1]: Awa Client\nNotify 1 from clientID TestClient:\nChanged: /3/0/1 Resource Modified:\nDevice[/3/0]:\n    ModelNumber[/3/0/1]: abc\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(observeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode,   result.code)
    def test_subscribe_resource_single_change(self):
        # test that we can subscribe to a single change of value on a specified resource
        
        # open client subscribe subprocess. Only wait for a single change to the resource
        
        #import pdb; pdb.set_trace()
        
        port = self.config.clientIpcPort
        subscribeProcess = tools_common.run_non_blocking(tools_common.CLIENT_SUBSCRIBE, 
                                                    "--verbose --ipcPort %i --waitCount 1 --waitTime 5 /3/0/0" % (port,))
        
        # wait for subscribe process to start up
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session IPC configured for UDP: address 127.0.0.1, port %d" % (port,))
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session connected")
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Subscribe /3/0/0 Change\n")
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Waiting for 1 notifications over 5 seconds:\n")
        
        # do set command
        expectedStdout = ""
        expectedStderr = ""
        expectedCode = 0
        
        result = client_set(self.config, "/3/0/0=abc")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # read subscribe output
        expectedStdout = "Notify 1:\nChanged: /3/0/0 Resource Modified:\nDevice[/3/0]:\n    Manufacturer[/3/0/0]: abc\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0
        
        result = tools_common.non_blocking_get_run_result(subscribeProcess)
        
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
 def test_subscribe_multiple_resources_multiple_changes(self):
     # test that we can subscribe to a single change of value on 
     # one of the multiple resources specified
     
     # open client subscribe subprocess. Only wait for a single change to one of the resources
     port = self.config.clientIpcPort
     subscribeProcess = tools_common.run_non_blocking(tools_common.CLIENT_SUBSCRIBE, 
                                                 "--verbose --ipcPort %i --waitCount 1 --waitTime 5 /3/0/0 /3/0/1" % (port,))
     # wait for subscribe process to start up
     
     self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session IPC configured for UDP: address 127.0.0.1, port %d" % (port,))
     self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session connected")
     self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Subscribe /3/0/0 Change\n")
     self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Subscribe /3/0/1 Change\n")
     self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Waiting for 1 notifications over 5 seconds:\n")
     
     # do set command and expect notifications from the subscribe subprocess
     expectedStdout = ""
     expectedStderr = ""
     expectedCode = 0
     
     # set the first resource
     result = client_set(self.config, "/3/0/0=abc /3/0/1=def")
     self.assertEqual(expectedStdout, result.stdout)
     self.assertEqual(expectedStderr, result.stderr)
     self.assertEqual(expectedCode, result.code)
     
     expectedStdout = "Notify 1:\nChanged: /3/0/0 Resource Modified:\nDevice[/3/0]:\n    Manufacturer[/3/0/0]: abc\nNotify 2:\nChanged: /3/0/1 Resource Modified:\nDevice[/3/0]:\n    ModelNumber[/3/0/1]: def\nSession disconnected\n"
     expectedStderr = ""
     expectedCode = 0
     
     result = tools_common.non_blocking_get_run_result(subscribeProcess)
     
     self.assertEqual(expectedStdout, result.stdout)
     self.assertEqual(expectedStderr, result.stderr)
     self.assertEqual(expectedCode, result.code)
    def test_subscribe_single_resource_multiple_changes_skip_same_value(self):
        # test that we don't get a notify if we set a value to resource that already has that value
        port = self.config.clientIpcPort
        
        # open client subscribe subprocess. Wait for a change to the resource
        subscribeProcess = tools_common.run_non_blocking(tools_common.CLIENT_SUBSCRIBE, 
                                                    "--verbose --ipcPort %i --waitCount 1 --waitTime 5 /3/0/0" % (port,))
        time.sleep(0.25)
        # wait for subscribe process to start up
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session IPC configured for UDP: address 127.0.0.1, port %d" % (port,))
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session connected")
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Subscribe /3/0/0 Change\n")
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Waiting for 1 notifications over 5 seconds:\n")
        
        # do set command
        expectedStdout = ""
        expectedStderr = ""
        expectedCode = 0
        
        result = client_set(self.config, "/3/0/0=abc")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # read subscribe output
        expectedStdout = "Notify 1:\nChanged: /3/0/0 Resource Modified:\nDevice[/3/0]:\n    Manufacturer[/3/0/0]: abc\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0
        
        result = tools_common.non_blocking_get_run_result(subscribeProcess)
        
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
        
        # open a new client subscribe subprocess. Wait for a change to the resource
        subscribeProcess = tools_common.run_non_blocking(tools_common.CLIENT_SUBSCRIBE, 
                                                    "--verbose --ipcPort %i --waitCount 1 --waitTime 5 /3/0/0" % (port,))
        
        # wait for subscribe process to start up
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session IPC configured for UDP: address 127.0.0.1, port %d" % (port,))
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Session connected")
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Subscribe /3/0/0 Change\n")
        self.assertEqual(tools_common.strip_prefix(subscribeProcess.stdout.readline()), "Waiting for 1 notifications over 5 seconds:\n")
        
        expectedStdout = ""
        expectedStderr = ""
        expectedCode = 0
        
        # do set command. This one should NOT cause a notify.
        result = client_set(self.config, "/3/0/0=abc")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
        
        # do another set command. This one should cause a notify.
        result = client_set(self.config, "/3/0/0=def")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # read subscribe output
        expectedStdout = "Notify 1:\nChanged: /3/0/0 Resource Modified:\nDevice[/3/0]:\n    Manufacturer[/3/0/0]: def\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0
        
        result = tools_common.non_blocking_get_run_result(subscribeProcess)
        
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)
    def test_subscribe_single_resource_multiple_changes_skip_same_value(self):
        # test that we don't get a notify if we set a value to resource that already has that value
        port = self.config.clientIpcPort

        # open client subscribe subprocess. Wait for a change to the resource
        subscribeProcess = tools_common.run_non_blocking(
            tools_common.CLIENT_SUBSCRIBE,
            "--verbose --ipcPort %i --waitCount 1 --waitTime 5 /3/0/0" %
            (port, ))
        time.sleep(0.25)
        # wait for subscribe process to start up
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session IPC configured for UDP: address 127.0.0.1, port %d" %
            (port, ))
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session connected")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Subscribe /3/0/0 Change\n")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Waiting for 1 notifications over 5 seconds:\n")

        # do set command
        expectedStdout = ""
        expectedStderr = ""
        expectedCode = 0

        result = client_set(self.config, "/3/0/0=abc")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # read subscribe output
        expectedStdout = "Notify 1:\nChanged: /3/0/0 Resource Modified:\nDevice[/3/0]:\n    Manufacturer[/3/0/0]: abc\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(subscribeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # open a new client subscribe subprocess. Wait for a change to the resource
        subscribeProcess = tools_common.run_non_blocking(
            tools_common.CLIENT_SUBSCRIBE,
            "--verbose --ipcPort %i --waitCount 1 --waitTime 5 /3/0/0" %
            (port, ))

        # wait for subscribe process to start up
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session IPC configured for UDP: address 127.0.0.1, port %d" %
            (port, ))
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Session connected")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Subscribe /3/0/0 Change\n")
        self.assertEqual(
            tools_common.strip_prefix(subscribeProcess.stdout.readline()),
            "Waiting for 1 notifications over 5 seconds:\n")

        expectedStdout = ""
        expectedStderr = ""
        expectedCode = 0

        # do set command. This one should NOT cause a notify.
        result = client_set(self.config, "/3/0/0=abc")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # do another set command. This one should cause a notify.
        result = client_set(self.config, "/3/0/0=def")
        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)

        # read subscribe output
        expectedStdout = "Notify 1:\nChanged: /3/0/0 Resource Modified:\nDevice[/3/0]:\n    Manufacturer[/3/0/0]: def\nSession disconnected\n"
        expectedStderr = ""
        expectedCode = 0

        result = tools_common.non_blocking_get_run_result(subscribeProcess)

        self.assertEqual(expectedStdout, result.stdout)
        self.assertEqual(expectedStderr, result.stderr)
        self.assertEqual(expectedCode, result.code)