def test_receive_multikey(self): enip = EnipProtocol( protocol=CLIENT_PROTOCOL) TAGS = (('SENSOR1', 1, 'INT'), ('ACTUATOR1', 'INT')) cmd = EnipProtocol._start_server_cmd(tags=TAGS) try: server = subprocess.Popen(cmd, shell=False) # read a multikey what = ('SENSOR1', 1) address = 'localhost:44818' enip._receive(what, address) # read a single key what = ('ACTUATOR1',) address = 'localhost:44818' enip._receive(what, address) EnipProtocol._stop_server(server) except Exception as error: EnipProtocol._stop_server(server) print 'ERROR test_client: ', error
def test_send_multikey(self): enip = EnipProtocol(protocol=CLIENT_PROTOCOL) TAGS = (('SENSOR1', 1, 'INT'), ('ACTUATOR1', 'INT')) cmd = EnipProtocol._start_server_cmd(tags=TAGS) try: server = subprocess.Popen(cmd, shell=False) # write a multikey what = ('SENSOR1', 1) address = 'localhost:44818' for value in range(5): enip._send(what, value, address) # write a single key what = ('ACTUATOR1', ) address = 'localhost:44818' for value in range(5): enip._send(what, value, address) EnipProtocol._stop_server(server) except Exception as error: EnipProtocol._stop_server(server) print 'ERROR test_client: ', error
def test_server_stop(self): cmd = EnipProtocol._start_server_cmd() try: server = subprocess.Popen(cmd, shell=False) EnipProtocol._stop_server(server) except Exception as error: print 'ERROR test_server_stop: ', error
def test_server_multikey(self): TAGS = (('SENSOR1', 1, 'INT'), ('ACTUATOR1', 'INT')) cmd = EnipProtocol._start_server_cmd(tags=TAGS) try: server = subprocess.Popen(cmd, shell=False) EnipProtocol._stop_server(server) except Exception as error: print 'ERROR test_server_multikey: ', error
def test_server_stop(self): cmd = EnipProtocol._start_server_cmd() try: server = subprocess.Popen(cmd, shell=False) EnipProtocol._stop_server(server) except Exception as error: print 'ERROR test_server_stop: ', error
def test_server_multikey(self): TAGS = (('SENSOR1', 1, 'INT'), ('ACTUATOR1', 'INT')) cmd = EnipProtocol._start_server_cmd(tags=TAGS) try: server = subprocess.Popen(cmd, shell=False) EnipProtocol._stop_server(server) except Exception as error: print 'ERROR test_server_multikey: ', error