Пример #1
0
    def test_TD_COAP_LINK_10(self):
        """
        :Identifier: TD_COAP_LINK_10
        :Objective: Handle an alternate link
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Core Link Format
            - Server supports Core Link Format
            - Server offers resources /test and /alternate (see Note)
            - Resource /alternate is anchored at /test (i.e. anchor=”/test”)
                with rel=”alternate”

        - Step 1 (stimulus) Client is requested to retrieve the resource /test
            using the alternate /alternate

        - Step 2 (check) Client sends a GET request to Server for /alternate

        - Step 3 (check) Server sends response containing the resource /test

        - Step 4 (verify) Client displays the response

        Note: /test and /alternate refer to a real resource and its alternate
            available on Server and shall be extracted from Server’s
            /.well-known/core resource
        """
        r1 = request.get(self.server.url + "/alternate")
        r2 = request.get(self.server.url + "/test")
        self.assertEqual(r1.payload, r2.payload)
Пример #2
0
    def test_TD_COAP_OBS_02(self):
        """
        :Identifier: TD_COAP_OBS_02
        :Objective: Stop resource observation
        :Configuration: CoAP_CFG_01

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

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

        - Step 2 (check (CON))
            Client sends GET request not containing Observe option

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

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

        - Step 5 (check (CON)) Server does not send further response

        - Step 6 (verify (IOP)) Client does not display updated information
        """
        r = coap.get(self.server.url + "/obs", observable=True)
        r = coap.get(self.server.url + "/obs")
        self.assertNotIn(options.observe, r.options)
        logging.info(r)
Пример #3
0
    def test_TD_COAP_LINK_10(self):
        """
        :Identifier: TD_COAP_LINK_10
        :Objective: Handle an alternate link
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Core Link Format
            - Server supports Core Link Format
            - Server offers resources /test and /alternate (see Note)
            - Resource /alternate is anchored at /test (i.e. anchor=”/test”)
                with rel=”alternate”

        - Step 1 (stimulus) Client is requested to retrieve the resource /test
            using the alternate /alternate

        - Step 2 (check) Client sends a GET request to Server for /alternate

        - Step 3 (check) Server sends response containing the resource /test

        - Step 4 (verify) Client displays the response

        Note: /test and /alternate refer to a real resource and its alternate
            available on Server and shall be extracted from Server’s
            /.well-known/core resource
        """
        r1 = request.get(self.server.url + "/alternate")
        r2 = request.get(self.server.url + "/test")
        self.assertEqual(r1.payload, r2.payload)
Пример #4
0
    def test_TD_COAP_LINK_07(self):
        """
        :Identifier: TD_COAP_LINK_07
        :Objective: Filter discovery results using href attribute and
            complete value strings
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Core Link Format
            - Server supports Core Link Format
            - Server offers resources /link1 /link2 and /link3

        - Step 1 (stimulus) Client is requested to retrieve the link-value
            anchored at /link1

        - Step 2 (check) Client sends a GET request to Server for
            /.well-known/core resource containing URI-Query indicating
            href=“/link1”

        - Step 3 (check) Server sends response containing:
            Content-format option indicating 40 (application/link-format)
            Payload indicating only the link for /link1

        - Step 4 (verify) Client displays the retrieved list of resources
        """
        r1 = request.get(self.server.url + "/.well-known/core",
            query={"href": "/link1"})
        self.assertEqual(r1.contentType, mediaCodes.link)
        r2 = request.get(self.server.url + "/link1")
        self.assertIn(r1.payload, r2.payload)
        logging.info(r1.payload)
Пример #5
0
    def test_TD_COAP_LINK_07(self):
        """
        :Identifier: TD_COAP_LINK_07
        :Objective: Filter discovery results using href attribute and
            complete value strings
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Core Link Format
            - Server supports Core Link Format
            - Server offers resources /link1 /link2 and /link3

        - Step 1 (stimulus) Client is requested to retrieve the link-value
            anchored at /link1

        - Step 2 (check) Client sends a GET request to Server for
            /.well-known/core resource containing URI-Query indicating
            href=“/link1”

        - Step 3 (check) Server sends response containing:
            Content-format option indicating 40 (application/link-format)
            Payload indicating only the link for /link1

        - Step 4 (verify) Client displays the retrieved list of resources
        """
        r1 = request.get(self.server.url + "/.well-known/core",
                         query={"href": "/link1"})
        self.assertEqual(r1.contentType, mediaCodes.link)
        r2 = request.get(self.server.url + "/link1")
        self.assertIn(r1.payload, r2.payload)
        logging.info(r1.payload)
Пример #6
0
    def test_TD_COAP_LINK_09(self):
        """
        :Identifier: TD_COAP_LINK_09
        :Objective: Arrange link descriptions hierarchically
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Core Link Format
            - Server supports Core Link Format
            - Server offers an entry located at /path with ct=40
            - Server offers sub-resources /path/sub1, /path/sub2, ... (see
                Note)

        - Step 1 (stimulus) Client is requested to retrieve one of the
            sub-resources

        - Step 2 (check) Client sends a GET request to Server for
            /.well-known/core resource

        - Step 3 (check) Server sends response containing:
            - Content-format option indicating 40 (application/link-format)
            - Payload indicating the link description for /path

        - Step 4 (check) Client sends a GET request for /path to Server

        - Step 5 (check) Server sends response containing:
            - Content-format option indicating 40 (application/link-format)
            - Payload indicating the link description for /path/sub1,
                /path/sub2, ...

        - Step 6 (check) Client sends a GET request for /path/sub1

        - Step 7 (check) Server sends 2.05 (Content) response. Payload contains
            /path/sub1

        - Step 8 (verify) Client displays the retrieved sub-resource.

        Note: /path/sub1, /path/sub2, ... refer to real resources available on
            Server and shall be extracted from Server’s /.well-known/core
            resource
        """
        r = request.get(self.server.url + "/.well-known/core")
        self.assertEqual(r.contentType, mediaCodes.link)
        r = request.get(self.server.url + r.payload)
        self.assertEqual(r.contentType, mediaCodes.link)
        self.assertIn(["/path/sub1", "/path/sub2"], r.payload)
        for sub_resource in r.payload:
            sub = request.get(self.server.url + sub_resource)
            logging.info(sub.payload)
Пример #7
0
    def test_TD_COAP_LINK_09(self):
        """
        :Identifier: TD_COAP_LINK_09
        :Objective: Arrange link descriptions hierarchically
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Core Link Format
            - Server supports Core Link Format
            - Server offers an entry located at /path with ct=40
            - Server offers sub-resources /path/sub1, /path/sub2, ... (see
                Note)

        - Step 1 (stimulus) Client is requested to retrieve one of the
            sub-resources

        - Step 2 (check) Client sends a GET request to Server for
            /.well-known/core resource

        - Step 3 (check) Server sends response containing:
            - Content-format option indicating 40 (application/link-format)
            - Payload indicating the link description for /path

        - Step 4 (check) Client sends a GET request for /path to Server

        - Step 5 (check) Server sends response containing:
            - Content-format option indicating 40 (application/link-format)
            - Payload indicating the link description for /path/sub1,
                /path/sub2, ...

        - Step 6 (check) Client sends a GET request for /path/sub1

        - Step 7 (check) Server sends 2.05 (Content) response. Payload contains
            /path/sub1

        - Step 8 (verify) Client displays the retrieved sub-resource.

        Note: /path/sub1, /path/sub2, ... refer to real resources available on
            Server and shall be extracted from Server’s /.well-known/core
            resource
        """
        r = request.get(self.server.url + "/.well-known/core")
        self.assertEqual(r.contentType, mediaCodes.link)
        r = request.get(self.server.url + r.payload)
        self.assertEqual(r.contentType, mediaCodes.link)
        self.assertIn(["/path/sub1", "/path/sub2"], r.payload)
        for sub_resource in r.payload:
            sub = request.get(self.server.url + sub_resource)
            logging.info(sub.payload)
Пример #8
0
    def test_TD_COAP_LINK_06(self):
        """
        :Identifier: TD_COAP_LINK_06
        :Objective: Filter discovery results using sz attribute and prefix
            value strings
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Core Link Format
            - Server supports Core Link Format
            - Server offers resource with sz attribute
            - Server offers resources with no sz attribute

        - Step 1 (stimulus) Client is requested to retrieve Server’s list of
            resources having a sz attribute

        - Step 2 (check) Client sends a GET request to Server for
            /.well-known/core resource containing URI-Query indicating sz=“*”

        - Step 3 (check) Server sends response containing:
            - Content-format option indicating 40 (application/link-format)
            - Payload indicating only the links having a sz attribute

        - Step 4 (verify) Client displays the retrieved list of resources
        """
        r = request.get(self.server.url + "/.well-known/core",
                        query={"sz": "*"})
        self.assertEqual(r.contentType, mediaCodes.link)
        for i in r.payload:
            self.assertIn("sz", i)
        logging.info(r.payload)
Пример #9
0
    def test_TD_COAP_LINK_05(self):
        """
        :Identifier: TD_COAP_LINK_05
        :Objectives: Filter discovery results using if attribute and prefix
            value strings
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Core Link Format
            - Server supports Core Link Format
            - Server offers 4 groups of resources:
                1. Resources with if=“If1”
                2. Resources with if=“If2”
                3. Resources with if=“foo”
                4. Resources with no if attribute

        - Step 1 (stimulus) Client is requested to retrieve Server’s list of
            resources matching the interface description pattern “If*”

        - Step 2 (check) Client sends a GET request to Server for
            /.well-known/core resources containing URI-Query indicating
            if=“If*”

        - Step 3 (check) Server sends response containing:
            - Content-format option indicating 40 (application/link-format)
            - Payload indicating only the links of groups 1 and 2

        - Step 4 (verify) Client displays the retrieved list of resources
        """
        r = request.get(self.server.url + "/.well-known/core",
                        query={"if": "If*"})
        self.assertEqual(r.contentType, mediaCodes.link)
        for i in r.payload:
            self.assertTrue(i["if"].startwith("If"))
        logging.info(r.payload)
Пример #10
0
    def test_TD_COAP_LINK_04(self):
        """
        :Identifier: TD_COAP_LINK_04
        :Objective: Filter discovery results in presence of multiple rt
            attributes
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Core Link Format
            - Server supports Core Link Format
            - Server offers 4 groups of resources:
                1. Resources with rt=“Type1 Type2”
                2. Resources with rt=“Type2 Type3”
                3. Resources with rt=“Type1 Type3”
                4. Resources with rt=“”

        - Step 1 (stimulus) Client is requested to retrieve Server’s list of
            resources of a specific type Type2

        - Step 2 (check) Client sends a GET request to Server for
            /.well-known/core resource containing URI-Query indicating
            rt=“Type2”

        - Step 3 (check) Server sends response containing:
            - Content-format option indicating 40 (application/link-format)
            - Payload indicating only the links of groups 1 and 2
        """
        r = request.get(self.server.url + "/.well-known/core",
            query={"rt": "Type2"})
        self.assertEqual(r.contentType, mediaCodes.link)
        for i in r.payload:
            self.assertIn("Type2", i["rt"])
Пример #11
0
    def test_TD_COAP_LINK_03(self):
        """
        :Identifier: TD_COAP_LINK_03
        :Objective: Handle empty prefix value strings
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Core Link Format
            - Server supports Core Link Format
            - Server offers different types of resources (Type1, Type2, ...;
                see Note)
            - Server offers resources with no type (i.e. no rt attribute)

        - Step 1 (stimulus) Client is requested to retrieve Server’s list of
            resources matching an rt empty value

        - Step 2 (check) Client sends a GET request to Server for
            /.well-known/core resource containing URI-Query indicating rt=“”

        - Step 3 (check) Server sends response containing:
            - Content-format option indicating 40 (application/link-format)
            - Payload indicating only the links having an rt attribute

        - Step 4 (verify) Client displays the list of resources with rt
            attribute available on Server

        Note: Type1, Type2, ... refer to real resource types available on
            Server and shall be extracted from Server’s /.well-known/core
            resource
        """
        r = request.get(self.server.url + "/.well-known/core",
                        query={"rt": ""})
        self.assertEqual(r.contentType, mediaCodes.link)
        for i in r.payload:
            self.assertIn(i, "rt")
Пример #12
0
    def test_TD_COAP_LINK_08(self):
        """
        :Identifier: TD_COAP_LINK_08
        :Objective: Filter discovery results using href attribute and prefix
            value strings
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Core Link Format
            - Server supports Core Link Format
            - Server offers resources /link1 /link2 and /link3
            - Server offers resource /test

        - Step 1 (stimulus) Client is requested to retrieve the link-value
            anchored at /link*

        - Step 2 (check) Client sends a GET request to Server for
            /.well-known/core resource containing URI-Query indicating
            href=“/link*”

        - Step 3 (check) Server sends response containing:
            - Content-format option indicating 40 (application/link-format)
            - Payload indicating only the link matching /link*

        - Step 4 (verify) Client displays the retrieved list of resources
        """
        r = request.get(self.server.url + "/.well-known/core",
            query={"href": "/link*"})
        self.assertEqual(r.contentType, mediaCodes.link)
        for i in r.payload:
            self.assertTrue(i.startwith("/link"))
        logging.info(r.payload)
Пример #13
0
    def test_TD_COAP_LINK_06(self):
        """
        :Identifier: TD_COAP_LINK_06
        :Objective: Filter discovery results using sz attribute and prefix
            value strings
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Core Link Format
            - Server supports Core Link Format
            - Server offers resource with sz attribute
            - Server offers resources with no sz attribute

        - Step 1 (stimulus) Client is requested to retrieve Server’s list of
            resources having a sz attribute

        - Step 2 (check) Client sends a GET request to Server for
            /.well-known/core resource containing URI-Query indicating sz=“*”

        - Step 3 (check) Server sends response containing:
            - Content-format option indicating 40 (application/link-format)
            - Payload indicating only the links having a sz attribute

        - Step 4 (verify) Client displays the retrieved list of resources
        """
        r = request.get(self.server.url + "/.well-known/core",
            query={"sz": "*"})
        self.assertEqual(r.contentType, mediaCodes.link)
        for i in r.payload:
            self.assertIn("sz", i)
        logging.info(r.payload)
Пример #14
0
    def test_TD_COAP_LINK_05(self):
        """
        :Identifier: TD_COAP_LINK_05
        :Objectives: Filter discovery results using if attribute and prefix
            value strings
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Core Link Format
            - Server supports Core Link Format
            - Server offers 4 groups of resources:
                1. Resources with if=“If1”
                2. Resources with if=“If2”
                3. Resources with if=“foo”
                4. Resources with no if attribute

        - Step 1 (stimulus) Client is requested to retrieve Server’s list of
            resources matching the interface description pattern “If*”

        - Step 2 (check) Client sends a GET request to Server for
            /.well-known/core resources containing URI-Query indicating
            if=“If*”

        - Step 3 (check) Server sends response containing:
            - Content-format option indicating 40 (application/link-format)
            - Payload indicating only the links of groups 1 and 2

        - Step 4 (verify) Client displays the retrieved list of resources
        """
        r = request.get(self.server.url + "/.well-known/core",
            query={"if": "If*"})
        self.assertEqual(r.contentType, mediaCodes.link)
        for i in r.payload:
            self.assertTrue(i["if"].startwith("If"))
        logging.info(r.payload)
Пример #15
0
    def test_TD_COAP_LINK_01(self):
        """
        :Identifier: TD_COAP_LINK_01
        :Objective: Access to well-known interface for resource discovery
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports CoRE Link Format
            - Server supports /.well-known/core resource and the CoRE Link
                Format

        - Step 1 (stimulus) Client is requested retrieve Server’s list of
            resource

        - Step 2 (check (CON)) Client sends a GET request to Server for
            /.well-known/core resource

        - Step 3 (check (CON)) Server sends response containing:
           - Content-Type option indicating 40 (application/link-format)
            payload indicating all the links available on Server

        - Step 4 (verify (IOP)) Client displays the list of resources available
            on Server
        """

        r = request.get(self.server.url + "/.well-known/core",
            confirmable=True)
        self.assertEqual(r.contentType, mediaCodes.link)
        self.assertEqual(r.code, codes.content)
        logging.info(r.payload)
Пример #16
0
    def test_TD_COAP_LINK_08(self):
        """
        :Identifier: TD_COAP_LINK_08
        :Objective: Filter discovery results using href attribute and prefix
            value strings
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Core Link Format
            - Server supports Core Link Format
            - Server offers resources /link1 /link2 and /link3
            - Server offers resource /test

        - Step 1 (stimulus) Client is requested to retrieve the link-value
            anchored at /link*

        - Step 2 (check) Client sends a GET request to Server for
            /.well-known/core resource containing URI-Query indicating
            href=“/link*”

        - Step 3 (check) Server sends response containing:
            - Content-format option indicating 40 (application/link-format)
            - Payload indicating only the link matching /link*

        - Step 4 (verify) Client displays the retrieved list of resources
        """
        r = request.get(self.server.url + "/.well-known/core",
                        query={"href": "/link*"})
        self.assertEqual(r.contentType, mediaCodes.link)
        for i in r.payload:
            self.assertTrue(i.startwith("/link"))
        logging.info(r.payload)
Пример #17
0
    def test_TD_COAP_LINK_04(self):
        """
        :Identifier: TD_COAP_LINK_04
        :Objective: Filter discovery results in presence of multiple rt
            attributes
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Core Link Format
            - Server supports Core Link Format
            - Server offers 4 groups of resources:
                1. Resources with rt=“Type1 Type2”
                2. Resources with rt=“Type2 Type3”
                3. Resources with rt=“Type1 Type3”
                4. Resources with rt=“”

        - Step 1 (stimulus) Client is requested to retrieve Server’s list of
            resources of a specific type Type2

        - Step 2 (check) Client sends a GET request to Server for
            /.well-known/core resource containing URI-Query indicating
            rt=“Type2”

        - Step 3 (check) Server sends response containing:
            - Content-format option indicating 40 (application/link-format)
            - Payload indicating only the links of groups 1 and 2
        """
        r = request.get(self.server.url + "/.well-known/core",
                        query={"rt": "Type2"})
        self.assertEqual(r.contentType, mediaCodes.link)
        for i in r.payload:
            self.assertIn("Type2", i["rt"])
Пример #18
0
    def test_TD_COAP_LINK_03(self):
        """
        :Identifier: TD_COAP_LINK_03
        :Objective: Handle empty prefix value strings
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Core Link Format
            - Server supports Core Link Format
            - Server offers different types of resources (Type1, Type2, ...;
                see Note)
            - Server offers resources with no type (i.e. no rt attribute)

        - Step 1 (stimulus) Client is requested to retrieve Server’s list of
            resources matching an rt empty value

        - Step 2 (check) Client sends a GET request to Server for
            /.well-known/core resource containing URI-Query indicating rt=“”

        - Step 3 (check) Server sends response containing:
            - Content-format option indicating 40 (application/link-format)
            - Payload indicating only the links having an rt attribute

        - Step 4 (verify) Client displays the list of resources with rt
            attribute available on Server

        Note: Type1, Type2, ... refer to real resource types available on
            Server and shall be extracted from Server’s /.well-known/core
            resource
        """
        r = request.get(self.server.url + "/.well-known/core",
            query={"rt": ""})
        self.assertEqual(r.contentType, mediaCodes.link)
        for i in r.payload:
            self.assertIn(i, "rt")
Пример #19
0
    def test_TD_COAP_LINK_01(self):
        """
        :Identifier: TD_COAP_LINK_01
        :Objective: Access to well-known interface for resource discovery
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports CoRE Link Format
            - Server supports /.well-known/core resource and the CoRE Link
                Format

        - Step 1 (stimulus) Client is requested retrieve Server’s list of
            resource

        - Step 2 (check (CON)) Client sends a GET request to Server for
            /.well-known/core resource

        - Step 3 (check (CON)) Server sends response containing:
           - Content-Type option indicating 40 (application/link-format)
            payload indicating all the links available on Server

        - Step 4 (verify (IOP)) Client displays the list of resources available
            on Server
        """

        r = request.get(self.server.url + "/.well-known/core",
                        confirmable=True)
        self.assertEqual(r.contentType, mediaCodes.link)
        self.assertEqual(r.code, codes.content)
        logging.info(r.payload)
Пример #20
0
 def matchTest(self):
     """
     TODO
     """
     link1 = "</myUri/something>;ct=42;if=\"/someRef/path\";obs;rt=\"MyName\";sz=10"
     link2 = "</myUri>;ct=50;rt=\"MyName\""
     link3 = "</a>;sz=10;rt=\"MyNope\""
     raw_links = "%s,%s,%s" % (link1, link2, link3)
     res = Resource(link_format=raw_links)
     query = {"rt": "MyName"}
     res = request.get("/myUri/something", param=query)
     self.assertEquals(link2 + "," + link1, res.payload)
Пример #21
0
    def test_TD_COAP_BLOCK_01(self):
        """
        :Identifier: TD_COAP_BLOCK_01
        :Objective: Handle GET blockwise transfer for large resource
            (early negotiation)
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Block transfers
            - Server supports Block transfers
            - Server offers a large resource /large
            - Client knows /large requires block transfer

        - Step 1 stimulus Client is requested to retrieve resource /large

        - Step 2 (check (CON)) Client sends a GET request containing Block2
            option indicating block number 0 and desired block size

        - Step 3 (check (CON)) Server sends response containing
            Block2 option indicating block number and size

        - Step 4 (check (CON)) Client send GET requests for further blocks

        - Step 5 (check (CON)) Each request contains Block2 option indicating
            block number of the next block and size of the last received block

        - Step 6 (check (CON)) Server sends further responses containing
            Block2 option indicating block number and size

        - Step 7 (verify (IOP)) Client displays the received information
        """
        r = coap.get(self.server.url + "/large",
            confirmable=True,
            options={options.block2: (0, PLUGTEST_BLOCK_SIZE)})
        self.assertEqual(r.options[options.block2])
        self.assertEqual(r.code, codes.content)
        self.assertEqual(r.msgType, msgType.ack)
        logging.info(r)
Пример #22
0
    def test_TD_COAP_LINK_02(self):
        """
        :Identifier: TD_COAP_LINK_02
        :Objective: Use filtered requests for limiting discovery results
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports CoRE Link Format
            - Server supports CoRE Link Format
            - Server offers different types of resources (Type1, Type2, ...;
                see Note)

        - Step 1 (stimulus) Client is requested retrieve Server’s list of
            resource of a specific type Type1

        - Step 2 (check (CON)) Client sends a GET request to Server for
            /.well-known/core resource containing URI-Query indicating
            “rt=Type1”

        - Step 3 (check (CON)) Server sends response containing: Content-Type
            option indicating 40 (application/link-format) payload indicating
            only the links of type Type1 available on Server

        - Step 4 (verify (IOP)) Client displays the list of resources of type
            Type1 available on Server

        - Note: Type1, Type2, ... refer to real resource types available on
            Server and shall be extracted from Server’s /.well-known/core
            resource
        """
        r = request.get(self.server.url + "/.well-known/core",
                        confirmable=True,
                        query={"rt": "Type1"})
        self.assertEqual(r.contentType, mediaCodes.link)
        self.assertEqual(r.msgType, msgType.ack)
        self.assertEqual(r.code, codes.content)
        for i in r.payload:
            self.assertEqual(i["type"], "Type1")
Пример #23
0
    def test_TD_COAP_BLOCK_02(self):
        """
        :Identifier: TD_COAP_BLOCK_02
        :Objective: Handle GET block wise transfer for large resource (late negotiation)
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports Block transfers
            - Server supports Block transfers
            - Server offers a large resource /large
            - Client does not know /large requires block transfer

        - Step 1 stimulus Client is requested to retrieve resource /large

        - Step 2 (check (CON)) Client sends a GET request not containing Block2 option

        - Step 3 (check (CON)) Server sends response containing Block2 option indicating block number and size

        - Step 4 (check (CON)) Client send GET requests for further blocks

        - Step 5 (check (CON)) Each request contains Block2 option indicating block number
            of the next block and size of the last received block or the
            desired size of next block

        - Step 6 (check (CON)) Server sends further responses containing
            Block2 option indicating block number and size

        - Step 7 (verify (IOP)) Client displays the received information
        """
        r = coap.get(self.server.url + "/large", confirmable=True)
        self.assertEqual(r.code, codes.content)
        self.assertEqual(r.msgType, msgType.ack)
        self.assertin(r.options, options.block2)
        # get actual number of blocks for check
        maxNUM = r.options[options.block2]
        self.assertEqual(r.options[options.block2],
            options.BLOCK2, maxNUM, message.encodeSZX(PLUGTEST_BLOCK_SIZE))
Пример #24
0
    def test_TD_COAP_LINK_02(self):
        """
        :Identifier: TD_COAP_LINK_02
        :Objective: Use filtered requests for limiting discovery results
        :Configuration: CoAP_CFG_01

        :Pre-test conditions:
            - Client supports CoRE Link Format
            - Server supports CoRE Link Format
            - Server offers different types of resources (Type1, Type2, ...;
                see Note)

        - Step 1 (stimulus) Client is requested retrieve Server’s list of
            resource of a specific type Type1

        - Step 2 (check (CON)) Client sends a GET request to Server for
            /.well-known/core resource containing URI-Query indicating
            “rt=Type1”

        - Step 3 (check (CON)) Server sends response containing: Content-Type
            option indicating 40 (application/link-format) payload indicating
            only the links of type Type1 available on Server

        - Step 4 (verify (IOP)) Client displays the list of resources of type
            Type1 available on Server

        - Note: Type1, Type2, ... refer to real resource types available on
            Server and shall be extracted from Server’s /.well-known/core
            resource
        """
        r = request.get(self.server.url + "/.well-known/core",
            confirmable=True, query={"rt": "Type1"})
        self.assertEqual(r.contentType, mediaCodes.link)
        self.assertEqual(r.msgType, msgType.ack)
        self.assertEqual(r.code, codes.content)
        for i in r.payload:
            self.assertEqual(i["type"], "Type1")