4 from opcua
import Server
18 cls.
srv_url =
'opc.tcp://localhost:{0:d}'.format(port_num)
19 cls.srv.set_endpoint(cls.
srv_url)
20 objects = cls.srv.get_objects_node()
21 obj = objects.add_object(4,
"directory")
22 var = obj.add_variable(4,
"variable", 1.999)
23 var2 = obj.add_variable(4,
"variable2", 1.777)
28 s = subprocess.check_output([
"python",
"tools/uals",
"--url", self.
srv_url])
29 self.assertIn(b
"i=85", s)
30 self.assertNotIn(b
"i=89", s)
31 self.assertNotIn(b
"1.999", s)
32 s = subprocess.check_output([
"python",
"tools/uals",
"--url", self.
srv_url,
"-d",
"3"])
33 self.assertIn(b
"1.999", s)
36 s = subprocess.check_output([
"python",
"tools/uaread",
"--url", self.
srv_url,
"--path",
"0:Objects,4:directory,4:variable"])
37 self.assertIn(b
"1.999", s)
40 s = subprocess.check_output([
"python",
"tools/uawrite",
"--url", self.
srv_url,
"--path",
"0:Objects,4:directory,4:variable2",
"1.789"])
41 s = subprocess.check_output([
"python",
"tools/uaread",
"--url", self.
srv_url,
"--path",
"0:Objects,4:directory,4:variable2"])
42 self.assertIn(b
"1.789", s)
43 self.assertNotIn(b
"1.999", s)
46 s = subprocess.check_output([
"python",
"tools/uadiscover",
"--url", self.
srv_url])
47 self.assertIn(b
"opc.tcp://localhost", s)
48 self.assertIn(b
"FreeOpcUa", s)
49 self.assertIn(b
"urn:freeopcua:python:server", s)
def test_uadiscover(self)