[tests] enhance Cert_5_1_06_RemoveRouterId (#3379)

This commit is contained in:
wgtdkp
2018-12-25 07:08:47 +08:00
committed by Jonathan Hui
parent 3108b6a615
commit 35eaaab653
2 changed files with 36 additions and 20 deletions
+19 -2
View File
@@ -96,6 +96,15 @@ def check_address_error_notification(command_msg, source_node, destination_addre
+ str(ipv6.ip_address(destination_address)) + ", but the destination_address in command msg is: " \
+ str(command_msg.ipv6_packet.ipv6_header.destination_address)
def check_address_solicit(command_msg, was_router):
command_msg.assertCoapMessageRequestUriPath('/a/as')
command_msg.assertCoapMessageContainsTlv(network_layer.MacExtendedAddress)
command_msg.assertCoapMessageContainsTlv(network_layer.Status)
if was_router:
command_msg.assertCoapMessageContainsTlv(network_layer.Rloc16)
else:
command_msg.assertMleMessageDoesNotContainTlv(network_layer.Rloc16)
def check_address_release(command_msg, destination_node):
"""Verify the message is a properly formatted address release destined to the given node.
"""
@@ -234,14 +243,22 @@ def check_mle_advertisement(command_msg):
command_msg.assertMleMessageContainsTlv(mle.LeaderData)
command_msg.assertMleMessageContainsTlv(mle.Route64)
def check_parent_request(command_msg):
def check_parent_request(command_msg, is_first_request):
"""Verify a properly formatted Parent Request command message.
"""
command_msg.assertSentWithHopLimit(255)
command_msg.assertSentToDestinationAddress(config.LINK_LOCAL_ALL_ROUTERS_ADDRESS)
command_msg.assertMleMessageContainsTlv(mle.Mode)
command_msg.assertMleMessageContainsTlv(mle.Challenge)
command_msg.assertMleMessageContainsTlv(mle.ScanMask)
scan_mask = command_msg.assertMleMessageContainsTlv(mle.ScanMask)
if not scan_mask.router:
raise ValueError("Parent request without R bit set")
if is_first_request:
if scan_mask.end_device:
raise ValueError("First parent request with E bit set")
elif not scan_mask.end_device:
raise ValueError("Second parent request without E bit set")
command_msg.assertMleMessageContainsTlv(mle.Version)
def check_parent_response(command_msg, mle_frame_counter = CheckType.OPTIONAL):