mirror of
https://github.com/espressif/openthread.git
synced 2026-08-13 14:17:47 +00:00
[meshcop] support Thread 1.2 Security Policy flags (#6320)
This commit is contained in:
@@ -137,7 +137,7 @@ class Cert_5_8_04_SecurityPolicyTLV(thread_cert.TestCase):
|
||||
# Disabling O-Bit security_policy = [3600, 0b01111000]
|
||||
self.nodes[COMMISSIONER_1].send_mgmt_active_set(
|
||||
active_timestamp=15,
|
||||
binary='0c030e1078',
|
||||
security_policy=[3600, 'nrcb'],
|
||||
)
|
||||
self.simulator.go(5)
|
||||
|
||||
@@ -148,10 +148,9 @@ class Cert_5_8_04_SecurityPolicyTLV(thread_cert.TestCase):
|
||||
|
||||
# Step 9
|
||||
# Disabling N-Bit security_policy = [3600, 0b10111000]
|
||||
|
||||
self.nodes[COMMISSIONER_1].send_mgmt_active_set(
|
||||
active_timestamp=20,
|
||||
binary='0c030e10b8',
|
||||
security_policy=[3600, 'orcb'],
|
||||
)
|
||||
self.simulator.go(5)
|
||||
|
||||
@@ -166,7 +165,7 @@ class Cert_5_8_04_SecurityPolicyTLV(thread_cert.TestCase):
|
||||
# Disabling B-Bit security_policy = [3600, 0b11110000]
|
||||
self.nodes[COMMISSIONER_1].send_mgmt_active_set(
|
||||
active_timestamp=25,
|
||||
binary='0c030e10f0',
|
||||
security_policy=[3600, 'onrc'],
|
||||
)
|
||||
self.simulator.go(5)
|
||||
|
||||
@@ -181,7 +180,7 @@ class Cert_5_8_04_SecurityPolicyTLV(thread_cert.TestCase):
|
||||
# Disabling R-Bit security_policy = [3600, 0b11011000]
|
||||
self.nodes[COMMISSIONER_1].send_mgmt_active_set(
|
||||
active_timestamp=30,
|
||||
binary='0c030e10d8',
|
||||
security_policy=[3600, 'oncb'],
|
||||
)
|
||||
self.simulator.go(5)
|
||||
|
||||
@@ -218,7 +217,13 @@ class Cert_5_8_04_SecurityPolicyTLV(thread_cert.TestCase):
|
||||
pkts.filter_wpan_src64(LEADER).\
|
||||
filter_ipv6_dst(COMMISSIONER_1_RLOC).\
|
||||
filter_coap_ack(MGMT_ACTIVE_GET_URI).\
|
||||
filter(lambda p: p.thread_meshcop.tlv.unknown == '0e10f8').\
|
||||
filter(lambda p: (p.thread_meshcop.tlv.sec_policy_rot == 3600 and
|
||||
p.thread_meshcop.tlv.sec_policy_o == 1 and
|
||||
p.thread_meshcop.tlv.sec_policy_n == 1 and
|
||||
p.thread_meshcop.tlv.sec_policy_r == 1 and
|
||||
p.thread_meshcop.tlv.sec_policy_c == 1 and
|
||||
p.thread_meshcop.tlv.sec_policy_b == 1) or
|
||||
(p.thread_meshcop.tlv.unknown == '0e10ff')).\
|
||||
must_next()
|
||||
|
||||
# Step 5: Commissioner_1 sends MGMT_ACTIVE_SET.req to Leader
|
||||
@@ -237,7 +242,8 @@ class Cert_5_8_04_SecurityPolicyTLV(thread_cert.TestCase):
|
||||
NM_SECURITY_POLICY_TLV
|
||||
} == set(p.thread_meshcop.tlv.type) and\
|
||||
p.thread_meshcop.tlv.active_tstamp == 15 and\
|
||||
p.thread_meshcop.tlv.unknown == '0e1078').\
|
||||
(p.thread_meshcop.tlv.sec_policy_o == 0 or
|
||||
p.thread_meshcop.tlv.unknown == '0e107f')).\
|
||||
must_next()
|
||||
|
||||
# Step 6: Leader MUST send MGMT_ACTIVE_SET.rsp to the Commissioner_1
|
||||
@@ -289,7 +295,8 @@ class Cert_5_8_04_SecurityPolicyTLV(thread_cert.TestCase):
|
||||
NM_SECURITY_POLICY_TLV
|
||||
} == set(p.thread_meshcop.tlv.type) and\
|
||||
p.thread_meshcop.tlv.active_tstamp == 20 and\
|
||||
p.thread_meshcop.tlv.unknown == '0e10b8').\
|
||||
(p.thread_meshcop.tlv.sec_policy_n == 0 or
|
||||
p.thread_meshcop.tlv.unknown == '0e10bf')).\
|
||||
must_next()
|
||||
|
||||
# Step 10: Leader MUST send MGMT_ACTIVE_SET.rsp to the Commissioner_1
|
||||
@@ -326,7 +333,8 @@ class Cert_5_8_04_SecurityPolicyTLV(thread_cert.TestCase):
|
||||
NM_SECURITY_POLICY_TLV
|
||||
} == set(p.thread_meshcop.tlv.type) and\
|
||||
p.thread_meshcop.tlv.active_tstamp == 25 and\
|
||||
p.thread_meshcop.tlv.unknown == '0e10f0').\
|
||||
(p.thread_meshcop.tlv.sec_policy_b == 0 or
|
||||
p.thread_meshcop.tlv.unknown == '0e10f7')).\
|
||||
must_next()
|
||||
|
||||
# Step 14: Leader MUST send MGMT_ACTIVE_SET.rsp to the Commissioner_1
|
||||
@@ -371,7 +379,8 @@ class Cert_5_8_04_SecurityPolicyTLV(thread_cert.TestCase):
|
||||
NM_SECURITY_POLICY_TLV
|
||||
} == set(p.thread_meshcop.tlv.type) and\
|
||||
p.thread_meshcop.tlv.active_tstamp == 30 and\
|
||||
p.thread_meshcop.tlv.unknown == '0e10d8').\
|
||||
(p.thread_meshcop.tlv.sec_policy_r == 0 or
|
||||
p.thread_meshcop.tlv.unknown == '0e10df')).\
|
||||
must_next()
|
||||
|
||||
# Step 18: Leader MUST send MGMT_ACTIVE_SET.rsp to the Commissioner_1
|
||||
@@ -401,7 +410,8 @@ class Cert_5_8_04_SecurityPolicyTLV(thread_cert.TestCase):
|
||||
filter_mle_cmd(MLE_DATA_RESPONSE).\
|
||||
filter(lambda p:
|
||||
p.mle.tlv.active_tstamp == 30 and\
|
||||
p.thread_meshcop.tlv.unknown == '0e10d8').\
|
||||
(p.thread_meshcop.tlv.sec_policy_r == 0 or
|
||||
p.thread_meshcop.tlv.unknown == '0e10df')).\
|
||||
must_next()
|
||||
|
||||
|
||||
|
||||
@@ -1927,6 +1927,7 @@ class NodeImpl:
|
||||
master_key=None,
|
||||
mesh_local=None,
|
||||
network_name=None,
|
||||
security_policy=None,
|
||||
binary=None,
|
||||
):
|
||||
cmd = 'dataset mgmtsetcommand active '
|
||||
@@ -1955,6 +1956,10 @@ class NodeImpl:
|
||||
if network_name is not None:
|
||||
cmd += 'networkname %s ' % self._escape_escapable(network_name)
|
||||
|
||||
if security_policy is not None:
|
||||
rotation, flags = security_policy
|
||||
cmd += 'securitypolicy %d %s ' % (rotation, flags)
|
||||
|
||||
if binary is not None:
|
||||
cmd += '-x %s ' % binary
|
||||
|
||||
|
||||
Reference in New Issue
Block a user