mirror of
https://github.com/JoelBender/bacpypes
synced 2025-09-28 22:15:23 +08:00
more tests
This commit is contained in:
parent
0683bd1ecf
commit
a84973df5e
|
@ -229,9 +229,9 @@ class TestDeviceCommunicationControl(unittest.TestCase):
|
||||||
# run the group
|
# run the group
|
||||||
anet.run()
|
anet.run()
|
||||||
|
|
||||||
def test_turn_off_comm(self):
|
def test_disable(self):
|
||||||
"""Test."""
|
"""Test."""
|
||||||
if _debug: TestDeviceCommunicationControl._debug("test_turn_off_comm")
|
if _debug: TestDeviceCommunicationControl._debug("test_disable")
|
||||||
|
|
||||||
# create a network
|
# create a network
|
||||||
anet = ApplicationNetwork()
|
anet = ApplicationNetwork()
|
||||||
|
@ -250,7 +250,6 @@ class TestDeviceCommunicationControl(unittest.TestCase):
|
||||||
.send(WhoIsRequest(destination=anet.vlan.broadcast_address)).doc("7-2-3") \
|
.send(WhoIsRequest(destination=anet.vlan.broadcast_address)).doc("7-2-3") \
|
||||||
.timeout(10).doc("7-2-4") \
|
.timeout(10).doc("7-2-4") \
|
||||||
.success()
|
.success()
|
||||||
# .receive(IAmRequest, pduSource=anet.iut.address).doc("7-2-4") \
|
|
||||||
|
|
||||||
# no IUT application layer matching
|
# no IUT application layer matching
|
||||||
anet.iut.start_state.success()
|
anet.iut.start_state.success()
|
||||||
|
@ -258,3 +257,72 @@ class TestDeviceCommunicationControl(unittest.TestCase):
|
||||||
# run the group
|
# run the group
|
||||||
anet.run()
|
anet.run()
|
||||||
|
|
||||||
|
def test_disable_initiation(self):
|
||||||
|
"""Test disabling initiation. After the DCC request send the IUT
|
||||||
|
a WhoIsRequest and verify that the IAmRequest makes it back.
|
||||||
|
"""
|
||||||
|
if _debug: TestDeviceCommunicationControl._debug("test_disable")
|
||||||
|
|
||||||
|
# create a network
|
||||||
|
anet = ApplicationNetwork()
|
||||||
|
|
||||||
|
# add the service capability to the IUT
|
||||||
|
anet.iut.add_capability(WhoIsIAmServices)
|
||||||
|
anet.iut.add_capability(DeviceCommunicationControlServices)
|
||||||
|
|
||||||
|
# test sequence
|
||||||
|
anet.td.start_state.doc("7-3-0") \
|
||||||
|
.send(DeviceCommunicationControlRequest(
|
||||||
|
destination=anet.iut.address,
|
||||||
|
enableDisable='disableInitiation',
|
||||||
|
)).doc("7-3-1") \
|
||||||
|
.receive(SimpleAckPDU).doc("7-3-2") \
|
||||||
|
.send(WhoIsRequest(destination=anet.vlan.broadcast_address)).doc("7-3-3") \
|
||||||
|
.receive(IAmRequest, pduSource=anet.iut.address).doc("7-3-4") \
|
||||||
|
.success()
|
||||||
|
|
||||||
|
# no IUT application layer matching
|
||||||
|
anet.iut.start_state.success()
|
||||||
|
|
||||||
|
# run the group
|
||||||
|
anet.run()
|
||||||
|
|
||||||
|
def test_disable_time_duration(self):
|
||||||
|
"""Test disabling communication for a specific amount of time in
|
||||||
|
minutes. After turning off communications, wait for 30 seconds and
|
||||||
|
send a request and nothing should come back. Wait an additional 30
|
||||||
|
seconds and try again, this tim receiving the response."""
|
||||||
|
if _debug: TestDeviceCommunicationControl._debug("test_disable_time_duration")
|
||||||
|
|
||||||
|
# create a network
|
||||||
|
anet = ApplicationNetwork()
|
||||||
|
|
||||||
|
# add the service capability to the IUT
|
||||||
|
anet.iut.add_capability(WhoIsIAmServices)
|
||||||
|
anet.iut.add_capability(DeviceCommunicationControlServices)
|
||||||
|
|
||||||
|
# test sequence
|
||||||
|
anet.td.start_state.doc("7-4-0") \
|
||||||
|
.send(DeviceCommunicationControlRequest(
|
||||||
|
destination=anet.iut.address,
|
||||||
|
enableDisable='disable',
|
||||||
|
timeDuration=1,
|
||||||
|
)).doc("7-4-1") \
|
||||||
|
.receive(SimpleAckPDU).doc("7-4-2") \
|
||||||
|
.timeout(30).doc("7-4-3") \
|
||||||
|
.send(WhoIsRequest(
|
||||||
|
destination=anet.vlan.broadcast_address,
|
||||||
|
)).doc("7-4-4") \
|
||||||
|
.timeout(30).doc("7-4-5") \
|
||||||
|
.send(WhoIsRequest(
|
||||||
|
destination=anet.vlan.broadcast_address,
|
||||||
|
)).doc("7-4-6") \
|
||||||
|
.receive(IAmRequest, pduSource=anet.iut.address).doc("7-4-7") \
|
||||||
|
.success()
|
||||||
|
|
||||||
|
# no IUT application layer matching
|
||||||
|
anet.iut.start_state.success()
|
||||||
|
|
||||||
|
# run the group a little longer than a minute
|
||||||
|
anet.run(65)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user