Пример #1
0
    def setUp(self):
        self.topology = TopologyManager.fromConfigFile(
            "constrained-device-without-gateway-client-uat-hobbyist")

        #constrained-device-without-gateway-client-uat-hobbyist
        def delTopology():
            del self.topology

        self.addCleanup(delTopology)

        #print("Defining test objects")
        #self.topology.constrainedClients[0].DefineTestObjects()
        #print("Creating instances of test objects")
        #self.topology.constrainedClients[0].CreateInstancesOfTestObjects()

        print("Starting constrained client")
        self.topology.constrainedClients[0].start()

        print("Waiting for client to bootstrap")
        self.topology.constrainedClients[0].WaitForResources([
            "/0/0/0",
            "/0/1/0",
            "/0/2/0",
        ])

        print("Waiting for client to connect to gateway")
        self.topology.gatewayServers[0].WaitForClient(
            self.topology.constrainedClients[0].getClientID())
Пример #2
0
    def test_ServerCanAccessConstrainedClient(self):
        self.topology = TopologyManager.fromConfigFile(
            "constrained-device-without-gateway-client-uat-hobbyist")

        def delTopology():
            del self.topology

        self.addCleanup(delTopology)

        self.topology.constrainedClients[0].start()

        self.assertEqual(
            "0", self.topology.constrainedClients[0].createResource(3, 0, 0))
        self.assertEqual(
            "0", self.topology.constrainedClients[0].setResourceValue(
                "/3/0/0", "hello"))
        self.assertEqual(
            "hello",
            self.topology.constrainedClients[0].getResourceValue("/3/0/0"))

        self.topology.constrainedClients[0].WaitForResources([
            "/0/0/0",
            "/0/1/0",
            "/0/2/0",
        ])  # wait for bootstrapping to complete
        self.topology.gatewayServers[0].WaitForClient(
            self.topology.constrainedClients[0].getClientID())
        self.assertEqual(
            "hello", self.topology.gatewayServers[0].ReadSingleResource(
                self.topology.constrainedClients[0].getClientID(), "/3/0/0",
                AwaResourceType.String))
Пример #3
0
    def setUp(self):
        self.topology = TopologyManager.fromConfigFile("cloud-client-we-nuc-1")

        def delTopology():
            del self.topology

        self.addCleanup(delTopology)
    def test_TaygaInterface(self):
        self.topology = TopologyManager.fromConfigFile("constrained-device-only")
        def delTopology(): del self.topology
        self.addCleanup(delTopology)

        output = self.topology.constrainedClients[0].executeScript(["hardware/check-tayga", ])
        self.assertEqual("success", output.strip())
    def setUp(self):
        self.topology = TopologyManager.fromConfigFile("local-gateways")

        def delTopology():
            del self.topology

        self.addCleanup(delTopology)
        self.client_id = self.topology.gatewayClients[0]._clientConfig["client-id"]
Пример #6
0
    def setUp(self):
        self.topology = TopologyManager.fromConfigFile(
            "constrained-device-only")

        def delTopology():
            del self.topology

        self.addCleanup(delTopology)
    def test_CanRegisterWithGatewayServer(self):
        self.topology = TopologyManager.fromConfigFile("constrained-device-without-gateway-client-uat-hobbyist")
        def delTopology(): del self.topology
        self.addCleanup(delTopology)

        self.topology.constrainedClients[0].start()

        self.topology.constrainedClients[0].WaitForResources(["/0/0/0","/0/1/0", "/0/2/0", ])  # wait for bootstrapping to complete
        self.topology.gatewayServers[0].WaitForClient(self.topology.constrainedClients[0].getClientID())
    def test_CanBootstrap(self):
        # instances should be added to constrained device's server object to be considered "bootstrapped"
        # /0/0: Bootstrap server (Will already exist because the client needs to know where to connect)
        # /0/1: Cloud server
        # /0/2: Gateway server
        self.topology = TopologyManager.fromConfigFile("constrained-device-without-gateway-client-uat-hobbyist")
        def delTopology(): del self.topology
        self.addCleanup(delTopology)

        self.topology.constrainedClients[0].start()
        self.topology.constrainedClients[0].WaitForResources(["/0/0/0","/0/1/0", "/0/2/0", ])
Пример #9
0
    def test_TaygaInterface(self):
        self.topology = TopologyManager.fromConfigFile(
            "constrained-device-only")

        def delTopology():
            del self.topology

        self.addCleanup(delTopology)

        output = self.topology.constrainedClients[0].executeScript([
            "hardware/check-tayga",
        ])
        self.assertEqual("success", output.strip())
    def test_ServerCanAccessConstrainedClient(self):
        self.topology = TopologyManager.fromConfigFile("constrained-device-without-gateway-client-uat-hobbyist")
        def delTopology(): del self.topology
        self.addCleanup(delTopology)

        self.topology.constrainedClients[0].start()

        self.assertEqual("0", self.topology.constrainedClients[0].createResource(3, 0, 0))
        self.assertEqual("0", self.topology.constrainedClients[0].setResourceValue("/3/0/0", "hello"))
        self.assertEqual("hello", self.topology.constrainedClients[0].getResourceValue("/3/0/0"))

        self.topology.constrainedClients[0].WaitForResources(["/0/0/0","/0/1/0", "/0/2/0", ])  # wait for bootstrapping to complete
        self.topology.gatewayServers[0].WaitForClient(self.topology.constrainedClients[0].getClientID())
        self.assertEqual("hello", self.topology.gatewayServers[0].ReadSingleResource(self.topology.constrainedClients[0].getClientID(), "/3/0/0", AwaResourceType.String))
Пример #11
0
    def test_CanRegisterWithGatewayServer(self):
        self.topology = TopologyManager.fromConfigFile(
            "constrained-device-without-gateway-client-uat-hobbyist")

        def delTopology():
            del self.topology

        self.addCleanup(delTopology)

        self.topology.constrainedClients[0].start()

        self.topology.constrainedClients[0].WaitForResources([
            "/0/0/0",
            "/0/1/0",
            "/0/2/0",
        ])  # wait for bootstrapping to complete
        self.topology.gatewayServers[0].WaitForClient(
            self.topology.constrainedClients[0].getClientID())
    def setUp(self):
        self.topology = TopologyManager.fromConfigFile("constrained-device-without-gateway-client-uat-hobbyist")
        #constrained-device-without-gateway-client-uat-hobbyist
        def delTopology(): del self.topology
        self.addCleanup(delTopology)

        #print("Defining test objects")
        #self.topology.constrainedClients[0].DefineTestObjects()
        #print("Creating instances of test objects")
        #self.topology.constrainedClients[0].CreateInstancesOfTestObjects()

        print("Starting constrained client")
        self.topology.constrainedClients[0].start()

        print("Waiting for client to bootstrap")
        self.topology.constrainedClients[0].WaitForResources(["/0/0/0","/0/1/0", "/0/2/0", ])

        print("Waiting for client to connect to gateway")
        self.topology.gatewayServers[0].WaitForClient(self.topology.constrainedClients[0].getClientID())
Пример #13
0
    def test_CanBootstrap(self):
        # instances should be added to constrained device's server object to be considered "bootstrapped"
        # /0/0: Bootstrap server (Will already exist because the client needs to know where to connect)
        # /0/1: Cloud server
        # /0/2: Gateway server
        self.topology = TopologyManager.fromConfigFile(
            "constrained-device-without-gateway-client-uat-hobbyist")

        def delTopology():
            del self.topology

        self.addCleanup(delTopology)

        self.topology.constrainedClients[0].start()
        self.topology.constrainedClients[0].WaitForResources([
            "/0/0/0",
            "/0/1/0",
            "/0/2/0",
        ])
    def setUp(self):
        self.topology = TopologyManager.fromConfigFile("constrained-device-only")

        def delTopology(): del self.topology
        self.addCleanup(delTopology)
 def setUp(self):
     self.topology = TopologyManager.fromConfigFile("cloud-client-we-nuc-1")
     def delTopology(): del self.topology
     self.addCleanup(delTopology)
Пример #16
0
 def setUp(self):
     self.topology = TopologyManager.fromConfigFile("local-gateways")
     def delTopology(): del self.topology
     self.addCleanup(delTopology)
     self.client_id = self.topology.gatewayClients[0]._clientConfig["client-id"]