def test_write_wrong_type_for_existing(self): """ Objective: Test answer for a command of wrong type to a device that does exist (Actuator 22_20 (Type 45: Single Command) will be tested, but a wrong command type (Double Commands instead of Single Command) is sent to device) """ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(1) s.connect(("127.0.0.1", 2404)) s.send(frames.STARTDT_act.build()) s.recv(6) self.databus.set_value("22_20", 0) # Must be in template # print str(hex(IEC104.addr_in_hex('13_20'))) single_command = ( frames.i_frame() / frames.asdu_head(COT=6) / frames.asdu_infobj_46(IOA=0x141600, DCS=1) ) s.send(single_command.build()) data = s.recv(16) act_conf = ( frames.i_frame(RecvSeq=0x0002) / frames.asdu_head(PN=1, COT=7) / frames.asdu_infobj_46(IOA=0x141600, DCS=1) ) self.assertSequenceEqual(data, act_conf.build())
def test_write_wrong_type_for_existing(self): """ Objective: Test answer for a command of wrong type to a device that does exist (Actuator 22_20 (Type 45: Single Command) will be tested, but a wrong command type (Double Commands instead of Single Command) is sent to device) """ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(1) s.connect(('127.0.0.1', 2404)) s.send(frames.STARTDT_act.build()) s.recv(6) self.databus.set_value('22_20', 0) # Must be in template # print str(hex(IEC104.addr_in_hex('13_20'))) single_command = frames.i_frame() / frames.asdu_head(COT=6) / frames.asdu_infobj_46(IOA=0x141600, DCS=1) s.send(single_command.build()) data = s.recv(16) act_conf = frames.i_frame(RecvSeq=0x0002) / frames.asdu_head(PN=1, COT=7) / frames.asdu_infobj_46(IOA=0x141600, DCS=1) self.assertSequenceEqual(data, act_conf.build())