Exemple #1
0
    def test_TD_COAP_OBS_01(self):
        """
        :Identifier: TD_COAP_OBS_01
        :Objective: Handle resource observation
        :Configuration: CoAP_CFG_01

        - Pre-test conditions:
            - Client supports Observe option
            - Server supports Observe option
            - Server offers an observable resource /obs which changes
                periodically (e.g. every 5s)  which produces confirmable
                notifications

        - Step 1 stimulus Client is requested to observe resource /obs on
            Server

        - Step 2 (check (CON)) Client sends a GET request containing Observe
            option indicating 0

        - Step 3 (check (CON)) Server sends response containing Observe option

        - Step 4 (verify (IOP)) Client displays the received information

        - Step 5 (check (CON)) Server sends response containing Observe option
            indicating increasing values, as resource changes

        - Step 6 (verify (IOP)) Client displays the updated information
        """
        r = coap.observe(self.server.url + "/obs",
            callback=self.callback_TD_COAP_OBS_01)
        self.assertin(r.options, options.observe)
Exemple #2
0
    def test_TD_COAP_OBS_09(self):
        """
        :Identifier: TD_COAP_OBS_09
        :Objective: Update of the observed resource
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Observe option
            - Server supports Observe option
            - Server offers an observable resource /obs which changes
                periodically (e.g. every 5s) which produces confirmable
                notifications

        - Step 1 (stimulus) Client is requested to send to the server a
            confirmable GET request with observe option for resource /obs

        - Step 2 (check) The request sent by clients contains:
            - Type = 0 (CON)
            - Code = 1 (GET)
            - Token value = a value generated by the client
            - Observe option = empty

        - Step 3 (check) Server sends the response containing:
            - Type = 2 (ACK)
            - Content-format of the resource /obs
            - Token value = same as one found in the step 2
            - Observe option with a sequence number
        """
        r = coap.observe(self.server.url + "/obs",
            callback=self.callback_TD_COAP_OBS_09,
            confirmable=True)
        self.assertEqual(r.sent.msgType, msgType.con)
        self.assertEqual(r.sent.code, codes.GET)
        self.assertEqual(r.sent.options)
Exemple #3
0
    def test_TD_COAP_OBS_07(self):
        """
        :Identifier: TD_COAP_OBS_07
        :Objective: Server cleans the observers list on DELETE
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Observe option
            - Server supports Observe option
            - Server offers an observable resource /obs which changes
                periodically (e.g. every 5s) which produces confirmable
                notifications

        - Step 1 (stimulus): Client is requested to send to the server a GET
            request with observe option for resource /obs

        - Step 2 (check): The request sent by client contains:
            - Type = 1 (CON)
            - Code = 1 (GET)
            - Token value = a value generated by the client
            - Observe option = empty

        - Step 3 (check): Server sends a notification containing:
            - Type = 1 (CON)
            - Content-format = the same for all notifications
            - Token value = same as one found in the step 2
            - Observe option indicating increasing values

        - Step 4 (check): Client displays the received information

        - Step 5 (check): Client sends an ACK

        - Step 6 (stimulus): Client is requested to send to the server a
            DELETE request with observe option for resource /obs

        - Step 7 (check): The request sent by client contains:
            - Type = 1(NON)
            - Code = 4(DELETE)

        - Step 8 (check): Server sends response containing:
            - Type = 1(CON)
            - Code = 66(2.02 Deleted)

        - Step 9 (check): Server sends 4.04 (Not Found) response to the
            observer registered for /obs

        - Step 10 (verify): Server does not send further responses

        Notes:
            (1) Steps 3-5 are in a loop.
            (2) Step 6-10 are asynchronous to the loop.
            (3) Steps 8 and 9 may occur out-of-order
        """
        r = coap.observe(self.server.url + "/obs")
        self.assertEqual(r.msgType, msgType.con)
        self.assertEqual(r.code, codes.GET)
Exemple #4
0
    def test_TD_COAP_OBS_04(self):
        """
        :Identifier: TD_COAP_OBS_04
        :Objective: Server detection of deregistration (client OFF)
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Observe option
            - Server supports Observe option
            - Server offers an observable resource /obs which changes
                periodically (e.g. every 5s) which produces confirmable
                notifications
            - Client is observing /obs on Server

        - Step 1 stimulus Client is switched off

        - Step 2 (check (CON)) Server’s confirmable responses are not
            acknowledged

        - Step 3 (verify (IOP)) After some delay, Server does not send further
            responses
        """
        r = coap.observe(self.server.url + "/obs")