[network-key] change name from master to network (#6721)

This commit is contained in:
Jonathan Hui
2021-06-16 23:07:23 -07:00
committed by GitHub
parent b0081172af
commit aaabf25ff2
76 changed files with 556 additions and 550 deletions
+2 -2
View File
@@ -128,7 +128,7 @@ proc switch_node {id} {
proc setup_leader {} {
send "dataset init new\n"
expect_line "Done"
send "dataset masterkey 00112233445566778899aabbccddeeff\n"
send "dataset networkkey 00112233445566778899aabbccddeeff\n"
expect_line "Done"
send "dataset commit active\n"
expect_line "Done"
@@ -195,7 +195,7 @@ proc setup_default_network {} {
expect_line "Done"
send "panid 0xface\n"
expect_line "Done"
send "masterkey 00112233445566778899aabbccddeeff\n"
send "networkkey 00112233445566778899aabbccddeeff\n"
expect_line "Done"
}
+8 -8
View File
@@ -40,7 +40,7 @@ set channel $expect_out(1,string)
expect -re {Channel Mask: 0x[0-9a-f]{8}}
expect -re {Ext PAN ID: [0-9a-f]{16}}
expect -re {Mesh Local Prefix: ([0-9a-f]{1,4}:){3}[0-9a-f]{1,4}::\/64}
expect -re {Master Key: [0-9a-f]{32}}
expect -re {Network Key: [0-9a-f]{32}}
expect -re {Network Name: [^\r\n]+}
expect -re {PAN ID: 0x[0-9a-f]{4}}
expect -re {PSKc: [0-9a-f]{32}}
@@ -77,9 +77,9 @@ expect_line "Done"
send "dataset extpanid\n"
expect "aabbccddeeff0011"
expect_line "Done"
send "dataset masterkey aabbccddeeff00112233445566778899\n"
send "dataset networkkey aabbccddeeff00112233445566778899\n"
expect_line "Done"
send "dataset masterkey\n"
send "dataset networkkey\n"
expect "aabbccddeeff00112233445566778899"
expect_line "Done"
send "dataset meshlocalprefix fdde:4860::\n"
@@ -131,7 +131,7 @@ expect "Channel Mask: 0x03fff800"
expect -re {Delay: \d+}
expect "Ext PAN ID: aabbccddeeff0011"
expect "Mesh Local Prefix: fdde:4860:0:0::/64"
expect "Master Key: aabbccddeeff00112233445566778899"
expect "Network Key: aabbccddeeff00112233445566778899"
expect "Network Name: OT-network"
expect "PAN ID: 0xface"
expect "PSKc: 00112233445566778899aabbccddeeff"
@@ -153,7 +153,7 @@ if {$channel == 11} {
expect "Channel Mask: 0x03fff800"
expect "Ext PAN ID: aabbccddeeff0011"
expect "Mesh Local Prefix: fdde:4860:0:0::/64"
expect "Master Key: aabbccddeeff00112233445566778899"
expect "Network Key: aabbccddeeff00112233445566778899"
expect "Network Name: OT-network"
expect "PAN ID: 0xface"
expect "PSKc: 00112233445566778899aabbccddeeff"
@@ -173,7 +173,7 @@ if {$channel == 11} {
expect "Channel Mask: 0x03fff800"
expect "Ext PAN ID: aabbccddeeff0011"
expect "Mesh Local Prefix: fdde:4860:0:0::/64"
expect "Master Key: aabbccddeeff00112233445566778899"
expect "Network Key: aabbccddeeff00112233445566778899"
expect "Network Name: OT-network"
expect "PAN ID: 0xface"
expect "PSKc: 00112233445566778899aabbccddeeff"
@@ -187,13 +187,13 @@ set addr [get_ipaddr mleid]
switch_node 2
send "dataset mgmtgetcommand active \
activetimestamp pendingtimestamp masterkey networkname extpanid \
activetimestamp pendingtimestamp networkkey networkname extpanid \
localprefix delaytimer panid channel \
-x 000102030405060708090a0b0e0f0c333435 \
address $addr\n"
expect_line "Done"
send "dataset mgmtgetcommand pending \
activetimestamp pendingtimestamp masterkey networkname extpanid \
activetimestamp pendingtimestamp networkkey networkname extpanid \
localprefix delaytimer panid channel \
-x 000102030405060708090a0b0e0f0c333435 \
address $addr\n"
@@ -31,7 +31,7 @@ import unittest
from mesh_cop import TlvType
import thread_cert
from pktverify.consts import MLE_DATA_RESPONSE, MGMT_ACTIVE_SET_URI, MGMT_ACTIVE_GET_URI, LEADER_ALOC, NM_COMMISSIONER_SESSION_ID_TLV, NM_ACTIVE_TIMESTAMP_TLV, NM_SECURITY_POLICY_TLV, NM_NETWORK_MASTER_KEY_TLV, MLE_DISCOVERY_RESPONSE
from pktverify.consts import MLE_DATA_RESPONSE, MGMT_ACTIVE_SET_URI, MGMT_ACTIVE_GET_URI, LEADER_ALOC, NM_COMMISSIONER_SESSION_ID_TLV, NM_ACTIVE_TIMESTAMP_TLV, NM_SECURITY_POLICY_TLV, NM_NETWORK_KEY_TLV, MLE_DISCOVERY_RESPONSE
from pktverify.packet_verifier import PacketVerifier
from pktverify.layer_fields import nullField
from pktverify.bytes import Bytes
@@ -76,7 +76,7 @@ class Cert_5_8_04_SecurityPolicyTLV(thread_cert.TestCase):
'active_dataset': {
'timestamp': 1,
'channel': 19,
'master_key': '00112233445566778899aabbccddeeff',
'network_key': '00112233445566778899aabbccddeeff',
'security_policy': [3600, 'onrcb']
},
'mode': 'rdn',
@@ -86,7 +86,7 @@ class Cert_5_8_04_SecurityPolicyTLV(thread_cert.TestCase):
'active_dataset': {
'timestamp': 1,
'channel': 19,
'master_key': '00112233445566778899aabbccddeeff',
'network_key': '00112233445566778899aabbccddeeff',
'security_policy': [3600, 'onrcb']
},
'mode': 'rdn',
@@ -102,7 +102,7 @@ class Cert_5_8_04_SecurityPolicyTLV(thread_cert.TestCase):
'active_dataset': {
'timestamp': 1,
'channel': 19,
'master_key': '00112233445566778899aabbccddeeff',
'network_key': '00112233445566778899aabbccddeeff',
'security_policy': [3600, 'onrcb']
},
'mode': 'rdn',
@@ -138,8 +138,8 @@ class Cert_5_8_04_SecurityPolicyTLV(thread_cert.TestCase):
self.simulator.go(5)
# Step 7
# Get MasterKey
self.nodes[COMMISSIONER_1].send_mgmt_active_get(leader_rloc, [TlvType.NETWORK_MASTER_KEY])
# Get NetworkKey
self.nodes[COMMISSIONER_1].send_mgmt_active_get(leader_rloc, [TlvType.NETWORK_KEY])
self.simulator.go(5)
# Step 9
@@ -257,18 +257,18 @@ class Cert_5_8_04_SecurityPolicyTLV(thread_cert.TestCase):
# CoAP Request URI
# coap://[<L>]:MM/c/ag
# CoAP Payload
# Network Master Key TLV
# Network Key TLV
pkts.filter_wpan_src64(COMMISSIONER_1).\
filter_ipv6_2dsts(LEADER_RLOC, LEADER_ALOC).\
filter_coap_request(MGMT_ACTIVE_GET_URI).\
filter(lambda p: NM_NETWORK_MASTER_KEY_TLV in p.thread_meshcop.tlv.type).\
filter(lambda p: NM_NETWORK_KEY_TLV in p.thread_meshcop.tlv.type).\
must_next()
# Step 8: Leader MUST send MGMT_ACTIVE_GET.rsp to the Commissioner_1
# CoAP Response Code
# 2.04 Changed
# CoAP Payload
# Network Master Key TLV MUST NOT be included
# Network Key TLV MUST NOT be included
pkts.filter_wpan_src64(LEADER).\
filter_ipv6_dst(COMMISSIONER_1_RLOC).\
filter_coap_ack(MGMT_ACTIVE_GET_URI).\
@@ -64,12 +64,12 @@ class Cert_8_1_01_Commissioning(thread_cert.TestCase):
TOPOLOGY = {
COMMISSIONER: {
'name': 'COMMISSIONER',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
JOINER: {
'name': 'JOINER',
'masterkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'networkkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'mode': 'rdn',
},
}
@@ -88,8 +88,8 @@ class Cert_8_1_01_Commissioning(thread_cert.TestCase):
self.simulator.go(10)
self.simulator.read_cert_messages_in_commissioning_log([COMMISSIONER, JOINER])
self.assertEqual(
self.nodes[JOINER].get_masterkey(),
self.nodes[COMMISSIONER].get_masterkey(),
self.nodes[JOINER].get_networkkey(),
self.nodes[COMMISSIONER].get_networkkey(),
)
joiner_messages = self.simulator.get_messages_sent_by(JOINER)
commissioner_messages = self.simulator.get_messages_sent_by(COMMISSIONER)
@@ -43,12 +43,12 @@ class Cert_8_1_02_Commissioning(thread_cert.TestCase):
TOPOLOGY = {
COMMISSIONER: {
'name': 'COMMISSIONER',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
JOINER: {
'name': 'JOINER',
'masterkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'networkkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'mode': 'rdn',
},
}
@@ -64,11 +64,11 @@ class Cert_8_1_06_Commissioning(thread_cert.TestCase):
TOPOLOGY = {
COMMISSIONER: {
'name': 'COMMISSIONER',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
JOINER: {
'masterkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'networkkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'mode': 'rdn',
},
}
@@ -88,8 +88,8 @@ class Cert_8_1_06_Commissioning(thread_cert.TestCase):
self.simulator.go(10)
self.simulator.read_cert_messages_in_commissioning_log([COMMISSIONER, JOINER])
self.assertEqual(
self.nodes[JOINER].get_masterkey(),
self.nodes[COMMISSIONER].get_masterkey(),
self.nodes[JOINER].get_networkkey(),
self.nodes[COMMISSIONER].get_networkkey(),
)
joiner_messages = self.simulator.get_messages_sent_by(JOINER)
commissioner_messages = self.simulator.get_messages_sent_by(COMMISSIONER)
@@ -44,17 +44,17 @@ class Cert_8_2_01_JoinerRouter(thread_cert.TestCase):
TOPOLOGY = {
COMMISSIONER: {
'name': 'COMMISSIONER',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
JOINER_ROUTER: {
'name': 'JOINER_ROUTER',
'masterkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'networkkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'mode': 'rdn',
},
JOINER: {
'name': 'JOINER',
'masterkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'networkkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'mode': 'rdn',
},
}
@@ -75,8 +75,8 @@ class Cert_8_2_01_JoinerRouter(thread_cert.TestCase):
self.nodes[JOINER_ROUTER].joiner_start('PSKD01')
self.simulator.go(10)
self.assertEqual(
self.nodes[JOINER_ROUTER].get_masterkey(),
self.nodes[COMMISSIONER].get_masterkey(),
self.nodes[JOINER_ROUTER].get_networkkey(),
self.nodes[COMMISSIONER].get_networkkey(),
)
self.nodes[JOINER_ROUTER].thread_start()
@@ -93,8 +93,8 @@ class Cert_8_2_01_JoinerRouter(thread_cert.TestCase):
self.nodes[JOINER].joiner_start('PSKD02')
self.simulator.go(10)
self.assertEqual(
self.nodes[JOINER].get_masterkey(),
self.nodes[COMMISSIONER].get_masterkey(),
self.nodes[JOINER].get_networkkey(),
self.nodes[COMMISSIONER].get_networkkey(),
)
self.nodes[JOINER].thread_start()
@@ -44,17 +44,17 @@ class Cert_8_2_02_JoinerRouter(thread_cert.TestCase):
TOPOLOGY = {
COMMISSIONER: {
'name': 'COMMISSIONER',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
JOINER_ROUTER: {
'name': 'JOINER_ROUTER',
'masterkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'networkkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'mode': 'rdn',
},
JOINER: {
'name': 'JOINER',
'masterkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'networkkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'mode': 'rdn',
},
}
@@ -75,8 +75,8 @@ class Cert_8_2_02_JoinerRouter(thread_cert.TestCase):
self.nodes[JOINER_ROUTER].joiner_start('PSKD01')
self.simulator.go(10)
self.assertEqual(
self.nodes[JOINER_ROUTER].get_masterkey(),
self.nodes[COMMISSIONER].get_masterkey(),
self.nodes[JOINER_ROUTER].get_networkkey(),
self.nodes[COMMISSIONER].get_networkkey(),
)
self.nodes[JOINER_ROUTER].thread_start()
@@ -70,17 +70,17 @@ class Cert_8_2_05_JoinerRouter(thread_cert.TestCase):
TOPOLOGY = {
COMMISSIONER: {
'name': 'COMMISSIONER',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
JOINER_ROUTER: {
'name': 'JOINER_ROUTER',
'masterkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'networkkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'mode': 'rdn',
},
JOINER: {
'name': 'JOINER',
'masterkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'networkkey': 'deadbeefdeadbeefdeadbeefdeadbeef',
'mode': 'rdn',
},
}
@@ -102,8 +102,8 @@ class Cert_8_2_05_JoinerRouter(thread_cert.TestCase):
self.nodes[JOINER_ROUTER].joiner_start(PSKD, URL_1)
self.simulator.go(10)
self.assertEqual(
self.nodes[JOINER_ROUTER].get_masterkey(),
self.nodes[COMMISSIONER].get_masterkey(),
self.nodes[JOINER_ROUTER].get_networkkey(),
self.nodes[COMMISSIONER].get_networkkey(),
)
self.nodes[JOINER_ROUTER].thread_start()
@@ -124,8 +124,8 @@ class Cert_8_2_05_JoinerRouter(thread_cert.TestCase):
commissioner_messages = self.simulator.get_messages_sent_by(COMMISSIONER)
self.assertEqual(
self.nodes[JOINER].get_masterkey(),
self.nodes[COMMISSIONER].get_masterkey(),
self.nodes[JOINER].get_networkkey(),
self.nodes[COMMISSIONER].get_networkkey(),
)
# check commissioner sends JOIN_FIN.rsp with reject
command.check_commissioner_commissioning_messages(commissioner_messages.commissioning_messages,
@@ -65,12 +65,12 @@ class Cert_8_3_01_CommissionerPetition(thread_cert.TestCase):
TOPOLOGY = {
LEADER: {
'name': 'LEADER',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
COMMISSIONER: {
'name': 'COMMISSIONER',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
}
@@ -31,7 +31,7 @@ import unittest
import mesh_cop
import thread_cert
from pktverify.consts import MLE_DATA_RESPONSE, MGMT_ACTIVE_GET_URI, NM_CHANNEL_TLV, NM_COMMISSIONER_ID_TLV, NM_COMMISSIONER_SESSION_ID_TLV, NM_STEERING_DATA_TLV, NM_BORDER_AGENT_LOCATOR_TLV, NM_PAN_ID_TLV, NM_NETWORK_NAME_TLV, NM_NETWORK_MESH_LOCAL_PREFIX_TLV, NM_PSKC_TLV, NM_SCAN_DURATION, NM_ENERGY_LIST_TLV, NM_ACTIVE_TIMESTAMP_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_MASTER_KEY_TLV, NM_SECURITY_POLICY_TLV, LEADER_ALOC
from pktverify.consts import MLE_DATA_RESPONSE, MGMT_ACTIVE_GET_URI, NM_CHANNEL_TLV, NM_COMMISSIONER_ID_TLV, NM_COMMISSIONER_SESSION_ID_TLV, NM_STEERING_DATA_TLV, NM_BORDER_AGENT_LOCATOR_TLV, NM_PAN_ID_TLV, NM_NETWORK_NAME_TLV, NM_NETWORK_MESH_LOCAL_PREFIX_TLV, NM_PSKC_TLV, NM_SCAN_DURATION, NM_ENERGY_LIST_TLV, NM_ACTIVE_TIMESTAMP_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_KEY_TLV, NM_SECURITY_POLICY_TLV, LEADER_ALOC
from pktverify.packet_verifier import PacketVerifier
from pktverify.null_field import nullField
@@ -143,7 +143,7 @@ class Cert_9_2_03_ActiveDatasetGet(thread_cert.TestCase):
# Channel Mask TLV
# Extended PAN ID TLV
# Network Mesh-Local Prefix TLV
# Network Master Key TLV
# Network Key TLV
# Network Name TLV
# PAN ID TLV
# PSKc TLV
@@ -156,7 +156,7 @@ class Cert_9_2_03_ActiveDatasetGet(thread_cert.TestCase):
NM_CHANNEL_MASK_TLV,
NM_EXTENDED_PAN_ID_TLV,
NM_NETWORK_MESH_LOCAL_PREFIX_TLV,
NM_NETWORK_MASTER_KEY_TLV,
NM_NETWORK_KEY_TLV,
NM_NETWORK_NAME_TLV,
NM_PAN_ID_TLV,
NM_PSKC_TLV,
@@ -46,7 +46,7 @@ class Cert_9_2_04_ActiveDataset(thread_cert.TestCase):
'name': 'COMMISSIONER',
'active_dataset': {
'timestamp': 10,
'master_key': '00112233445566778899aabbccddeeff'
'network_key': '00112233445566778899aabbccddeeff'
},
'mode': 'rdn',
'allowlist': [LEADER]
@@ -55,7 +55,7 @@ class Cert_9_2_04_ActiveDataset(thread_cert.TestCase):
'name': 'LEADER',
'active_dataset': {
'timestamp': 10,
'master_key': '00112233445566778899aabbccddeeff'
'network_key': '00112233445566778899aabbccddeeff'
},
'mode': 'rdn',
'allowlist': [COMMISSIONER]
@@ -113,12 +113,12 @@ class Cert_9_2_04_ActiveDataset(thread_cert.TestCase):
self.assertEqual(self.nodes[LEADER].get_network_name(), 'GRL')
# Step 10
# Attempt to set Network Master Key TLV
# Attempt to set Network Key TLV
self.nodes[COMMISSIONER].send_mgmt_active_set(
active_timestamp=104,
channel_mask=0x7fff800,
extended_panid='000db70000000000',
master_key='ffeeddccbbaa99887766554433221100',
network_key='ffeeddccbbaa99887766554433221100',
mesh_local='fd00:0db7::',
network_name='GRL',
)
@@ -131,7 +131,7 @@ class Cert_9_2_04_ActiveDataset(thread_cert.TestCase):
active_timestamp=105,
channel_mask=0x7fff800,
extended_panid='000db70000000000',
master_key='00112233445566778899aabbccddeeff',
network_key='00112233445566778899aabbccddeeff',
mesh_local='fd00:0db7::',
network_name='UL',
panid=0xafce,
@@ -30,7 +30,7 @@
import unittest
import thread_cert
from pktverify.consts import MLE_DATA_RESPONSE, MGMT_ACTIVE_SET_URI, NETWORK_DATA_TLV, SOURCE_ADDRESS_TLV, LEADER_DATA_TLV, ACTIVE_TIMESTAMP_TLV, ACTIVE_OPERATION_DATASET_TLV, NM_CHANNEL_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_MESH_LOCAL_PREFIX_TLV, NM_NETWORK_MASTER_KEY_TLV, NM_NETWORK_NAME_TLV, NM_PAN_ID_TLV, NM_PSKC_TLV, NM_SECURITY_POLICY_TLV
from pktverify.consts import MLE_DATA_RESPONSE, MGMT_ACTIVE_SET_URI, NETWORK_DATA_TLV, SOURCE_ADDRESS_TLV, LEADER_DATA_TLV, ACTIVE_TIMESTAMP_TLV, ACTIVE_OPERATION_DATASET_TLV, NM_CHANNEL_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_MESH_LOCAL_PREFIX_TLV, NM_NETWORK_KEY_TLV, NM_NETWORK_NAME_TLV, NM_PAN_ID_TLV, NM_PSKC_TLV, NM_SECURITY_POLICY_TLV
from pktverify.packet_verifier import PacketVerifier
ROUTER = 1
@@ -60,14 +60,14 @@ class Cert_9_2_05_ActiveDataset(thread_cert.TestCase):
ROUTER: {
'name': 'ROUTER',
'channel': 11,
'master_key': '00112233445566778899aabbccddeeff',
'network_key': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
'allowlist': [LEADER]
},
LEADER: {
'name': 'LEADER',
'channel': 11,
'master_key': '00112233445566778899aabbccddeeff',
'network_key': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
'allowlist': [ROUTER]
},
@@ -96,7 +96,7 @@ class Cert_9_2_05_ActiveDataset(thread_cert.TestCase):
extended_panid='000db80000000001',
mesh_local='fd00:0db8::',
network_name='TEST_1',
master_key='00112233445566778899aabbccddeeff',
network_key='00112233445566778899aabbccddeeff',
panid=0xface,
channel=11,
binary='0410d2aa9cd8dff7919122d77d37ec3c1b5f0c030e10e0',
@@ -113,7 +113,7 @@ class Cert_9_2_05_ActiveDataset(thread_cert.TestCase):
extended_panid='000db80000000002',
mesh_local='fd00:0db8::',
network_name='TEST_2',
master_key='00112233445566778899aabbccddeeff',
network_key='00112233445566778899aabbccddeeff',
panid=0xface,
channel=11,
binary='041017d672be32b0c24a2f8385f2fbaf1d970c030e10f0',
@@ -130,7 +130,7 @@ class Cert_9_2_05_ActiveDataset(thread_cert.TestCase):
extended_panid='000db80000000003',
mesh_local='fd00:0db8::',
network_name='TEST_3',
master_key='00112233445566778899aabbccddeeff',
network_key='00112233445566778899aabbccddeeff',
panid=0xface,
channel=11,
binary='041008f4e9531e8efa8e852d5f4fb951b13e0c030e10f88202aa55',
@@ -146,7 +146,7 @@ class Cert_9_2_05_ActiveDataset(thread_cert.TestCase):
extended_panid='000db80000000003',
mesh_local='fd00:0db8::',
network_name='TEST_3',
master_key='00112233445566778899aabbccddeeff',
network_key='00112233445566778899aabbccddeeff',
panid=0xface,
channel=63,
binary='041008f4e9531e8efa8e852d5f4fb951b13e0c030e10f8',
@@ -215,7 +215,7 @@ class Cert_9_2_05_ActiveDataset(thread_cert.TestCase):
# - Channel Mask TLV [new value set in Step 2]
# - Extended PAN ID TLV [new value set in Step 2]
# - Network Mesh-Local Prefix TLV
# - Network Master Key TLV
# - Network Key TLV
# - Network Name TLV [new value set in Step 2]
# - PAN ID TLV
# - PSKc TLV [new value set in Step 2]
@@ -236,7 +236,7 @@ class Cert_9_2_05_ActiveDataset(thread_cert.TestCase):
NM_CHANNEL_MASK_TLV,
NM_EXTENDED_PAN_ID_TLV,
NM_NETWORK_MESH_LOCAL_PREFIX_TLV,
NM_NETWORK_MASTER_KEY_TLV,
NM_NETWORK_KEY_TLV,
NM_NETWORK_NAME_TLV,
NM_PAN_ID_TLV,
NM_PSKC_TLV,
@@ -308,7 +308,7 @@ class Cert_9_2_05_ActiveDataset(thread_cert.TestCase):
# - Channel Mask TLV [new value set in Step 9]
# - Extended PAN ID TLV [new value set in Step 9]
# - Network Mesh-Local Prefix TLV
# - Network Master Key TLV
# - Network Key TLV
# - Network Name TLV [new value set in Step 9]
# - PAN ID TLV
# - PSKc TLV [new value set in Step 9]
@@ -329,7 +329,7 @@ class Cert_9_2_05_ActiveDataset(thread_cert.TestCase):
NM_CHANNEL_MASK_TLV,
NM_EXTENDED_PAN_ID_TLV,
NM_NETWORK_MESH_LOCAL_PREFIX_TLV,
NM_NETWORK_MASTER_KEY_TLV,
NM_NETWORK_KEY_TLV,
NM_NETWORK_NAME_TLV,
NM_PAN_ID_TLV,
NM_PSKC_TLV,
@@ -33,7 +33,7 @@ import command
import config
import mesh_cop
import thread_cert
from pktverify.consts import MLE_CHILD_ID_RESPONSE, MLE_CHILD_UPDATE_REQUEST, MLE_DATA_RESPONSE, MLE_DATA_REQUEST, MGMT_COMMISSIONER_SET_URI, MGMT_ACTIVE_SET_URI, MGMT_PENDING_SET_URI, TLV_REQUEST_TLV, SOURCE_ADDRESS_TLV, LEADER_DATA_TLV, NETWORK_DATA_TLV, ACTIVE_TIMESTAMP_TLV, PENDING_TIMESTAMP_TLV, ACTIVE_OPERATION_DATASET_TLV, PENDING_OPERATION_DATASET_TLV, NM_COMMISSIONER_SESSION_ID_TLV, NM_BORDER_AGENT_LOCATOR_TLV, NM_ACTIVE_TIMESTAMP_TLV, NM_NETWORK_NAME_TLV, NM_NETWORK_MASTER_KEY_TLV, NM_CHANNEL_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_MESH_LOCAL_PREFIX_TLV, NM_PAN_ID_TLV, NM_PSKC_TLV, NM_SECURITY_POLICY_TLV, NM_DELAY_TIMER_TLV, NM_STEERING_DATA_TLV, NWD_COMMISSIONING_DATA_TLV, LEADER_ALOC
from pktverify.consts import MLE_CHILD_ID_RESPONSE, MLE_CHILD_UPDATE_REQUEST, MLE_DATA_RESPONSE, MLE_DATA_REQUEST, MGMT_COMMISSIONER_SET_URI, MGMT_ACTIVE_SET_URI, MGMT_PENDING_SET_URI, TLV_REQUEST_TLV, SOURCE_ADDRESS_TLV, LEADER_DATA_TLV, NETWORK_DATA_TLV, ACTIVE_TIMESTAMP_TLV, PENDING_TIMESTAMP_TLV, ACTIVE_OPERATION_DATASET_TLV, PENDING_OPERATION_DATASET_TLV, NM_COMMISSIONER_SESSION_ID_TLV, NM_BORDER_AGENT_LOCATOR_TLV, NM_ACTIVE_TIMESTAMP_TLV, NM_NETWORK_NAME_TLV, NM_NETWORK_KEY_TLV, NM_CHANNEL_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_MESH_LOCAL_PREFIX_TLV, NM_PAN_ID_TLV, NM_PSKC_TLV, NM_SECURITY_POLICY_TLV, NM_DELAY_TIMER_TLV, NM_STEERING_DATA_TLV, NWD_COMMISSIONING_DATA_TLV, LEADER_ALOC
from pktverify.packet_verifier import PacketVerifier
from pktverify.layer_fields import nullField
@@ -30,7 +30,7 @@
import unittest
import thread_cert
from pktverify.consts import MLE_CHILD_ID_RESPONSE, MLE_DATA_RESPONSE, MGMT_PENDING_SET_URI, MGMT_ACTIVE_SET_URI, MGMT_DATASET_CHANGED_URI, COAP_CODE_ACK, ACTIVE_OPERATION_DATASET_TLV, ACTIVE_TIMESTAMP_TLV, PENDING_TIMESTAMP_TLV, NM_CHANNEL_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_MASTER_KEY_TLV, NM_NETWORK_MESH_LOCAL_PREFIX_TLV, NM_NETWORK_NAME_TLV, NM_PAN_ID_TLV, NM_PSKC_TLV, NM_SECURITY_POLICY_TLV, SOURCE_ADDRESS_TLV, LEADER_DATA_TLV, ACTIVE_TIMESTAMP_TLV, NETWORK_DATA_TLV, NM_BORDER_AGENT_LOCATOR_TLV, NM_COMMISSIONER_SESSION_ID_TLV, NM_DELAY_TIMER_TLV, PENDING_OPERATION_DATASET_TLV
from pktverify.consts import MLE_CHILD_ID_RESPONSE, MLE_DATA_RESPONSE, MGMT_PENDING_SET_URI, MGMT_ACTIVE_SET_URI, MGMT_DATASET_CHANGED_URI, COAP_CODE_ACK, ACTIVE_OPERATION_DATASET_TLV, ACTIVE_TIMESTAMP_TLV, PENDING_TIMESTAMP_TLV, NM_CHANNEL_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_KEY_TLV, NM_NETWORK_MESH_LOCAL_PREFIX_TLV, NM_NETWORK_NAME_TLV, NM_PAN_ID_TLV, NM_PSKC_TLV, NM_SECURITY_POLICY_TLV, SOURCE_ADDRESS_TLV, LEADER_DATA_TLV, ACTIVE_TIMESTAMP_TLV, NETWORK_DATA_TLV, NM_BORDER_AGENT_LOCATOR_TLV, NM_COMMISSIONER_SESSION_ID_TLV, NM_DELAY_TIMER_TLV, PENDING_OPERATION_DATASET_TLV
from pktverify.packet_verifier import PacketVerifier
PANID_INIT = 0xface
@@ -159,7 +159,7 @@ class Cert_9_2_7_DelayTimer(thread_cert.TestCase):
# Step 4: Leader MUST send a unicast MLE Child ID Response to the Router
_lpkts.filter_wpan_dst64(ROUTER).filter_mle_cmd(MLE_CHILD_ID_RESPONSE).must_next(
).must_verify(lambda p: {ACTIVE_OPERATION_DATASET_TLV, ACTIVE_TIMESTAMP_TLV} < set(p.mle.tlv.type) and {
NM_CHANNEL_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_MASTER_KEY_TLV,
NM_CHANNEL_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_KEY_TLV,
NM_NETWORK_MESH_LOCAL_PREFIX_TLV, NM_NETWORK_NAME_TLV, NM_PAN_ID_TLV, NM_PSKC_TLV, NM_SECURITY_POLICY_TLV
} <= set(p.thread_meshcop.tlv.type) and p.mle.tlv.active_tstamp == LEADER_ACTIVE_TIMESTAMP)
@@ -177,7 +177,7 @@ class Cert_9_2_7_DelayTimer(thread_cert.TestCase):
# Step 10: Leader MUST send a unicast MLE Data Response to the Router
_lpkts.filter_wpan_dst64(ROUTER).filter_mle_cmd(MLE_DATA_RESPONSE).must_next(
).must_verify(lambda p: {ACTIVE_OPERATION_DATASET_TLV, ACTIVE_TIMESTAMP_TLV} < set(p.mle.tlv.type) and {
NM_CHANNEL_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_MASTER_KEY_TLV,
NM_CHANNEL_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_KEY_TLV,
NM_NETWORK_MESH_LOCAL_PREFIX_TLV, NM_NETWORK_NAME_TLV, NM_PAN_ID_TLV, NM_PSKC_TLV, NM_SECURITY_POLICY_TLV
} <= set(p.thread_meshcop.tlv.type) and p.mle.tlv.active_tstamp == ROUTER_ACTIVE_TIMESTAMP)
@@ -31,7 +31,7 @@ import unittest
import config
import thread_cert
from pktverify.consts import MLE_CHILD_ID_REQUEST, MLE_CHILD_ID_RESPONSE, MLE_DATA_RESPONSE, MLE_DATA_REQUEST, MGMT_PENDING_SET_URI, MGMT_ACTIVE_SET_URI, MGMT_DATASET_CHANGED_URI, SOURCE_ADDRESS_TLV, LEADER_DATA_TLV, ACTIVE_OPERATION_DATASET_TLV, ACTIVE_TIMESTAMP_TLV, PENDING_TIMESTAMP_TLV, TLV_REQUEST_TLV, NETWORK_DATA_TLV, NM_BORDER_AGENT_LOCATOR_TLV, NM_COMMISSIONER_SESSION_ID_TLV, NM_DELAY_TIMER_TLV, PENDING_OPERATION_DATASET_TLV, NWD_COMMISSIONING_DATA_TLV, LEADER_ALOC, NM_ACTIVE_TIMESTAMP_TLV, NM_CHANNEL_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_MESH_LOCAL_PREFIX_TLV, NM_NETWORK_MASTER_KEY_TLV, NM_NETWORK_NAME_TLV, NM_PAN_ID_TLV, NM_PSKC_TLV, NM_SECURITY_POLICY_TLV
from pktverify.consts import MLE_CHILD_ID_REQUEST, MLE_CHILD_ID_RESPONSE, MLE_DATA_RESPONSE, MLE_DATA_REQUEST, MGMT_PENDING_SET_URI, MGMT_ACTIVE_SET_URI, MGMT_DATASET_CHANGED_URI, SOURCE_ADDRESS_TLV, LEADER_DATA_TLV, ACTIVE_OPERATION_DATASET_TLV, ACTIVE_TIMESTAMP_TLV, PENDING_TIMESTAMP_TLV, TLV_REQUEST_TLV, NETWORK_DATA_TLV, NM_BORDER_AGENT_LOCATOR_TLV, NM_COMMISSIONER_SESSION_ID_TLV, NM_DELAY_TIMER_TLV, PENDING_OPERATION_DATASET_TLV, NWD_COMMISSIONING_DATA_TLV, LEADER_ALOC, NM_ACTIVE_TIMESTAMP_TLV, NM_CHANNEL_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_MESH_LOCAL_PREFIX_TLV, NM_NETWORK_KEY_TLV, NM_NETWORK_NAME_TLV, NM_PAN_ID_TLV, NM_PSKC_TLV, NM_SECURITY_POLICY_TLV
from pktverify.packet_verifier import PacketVerifier
from pktverify.null_field import nullField
@@ -50,8 +50,8 @@ SED1 = 5
# Test Purpose and Description:
# -----------------------------
# The purpose of this test case is to confirm the DUT correctly applies
# DELAY_TIMER_DEFAULT when the master key is changed.
# The Commissioner first tries to set a master key update to happen too
# DELAY_TIMER_DEFAULT when the network key is changed.
# The Commissioner first tries to set a network key update to happen too
# soon (delay of 60s vs DELAY_TIMER_DEFAULT of 300s); the DUT is expected
# to override the short value and communicate an appropriately longer delay
# to the Router.
@@ -74,7 +74,7 @@ SED1 = 5
# Leader
class Cert_9_2_11_MasterKey(thread_cert.TestCase):
class Cert_9_2_11_NetworkKey(thread_cert.TestCase):
USE_MESSAGE_FACTORY = False
SUPPORT_NCP = False
@@ -85,7 +85,7 @@ class Cert_9_2_11_MasterKey(thread_cert.TestCase):
'timestamp': 10,
'panid': PANID_INIT,
'channel': CHANNEL_INIT,
'master_key': KEY1
'network_key': KEY1
},
'mode': 'rdn',
'allowlist': [LEADER]
@@ -96,7 +96,7 @@ class Cert_9_2_11_MasterKey(thread_cert.TestCase):
'timestamp': 10,
'panid': PANID_INIT,
'channel': CHANNEL_INIT,
'master_key': KEY1
'network_key': KEY1
},
'mode': 'rdn',
'allowlist': [COMMISSIONER, ROUTER1]
@@ -107,7 +107,7 @@ class Cert_9_2_11_MasterKey(thread_cert.TestCase):
'timestamp': 10,
'panid': PANID_INIT,
'channel': CHANNEL_INIT,
'master_key': KEY1
'network_key': KEY1
},
'mode': 'rdn',
'allowlist': [LEADER, ED1, SED1]
@@ -116,7 +116,7 @@ class Cert_9_2_11_MasterKey(thread_cert.TestCase):
'name': 'ED',
'channel': CHANNEL_INIT,
'is_mtd': True,
'masterkey': KEY1,
'networkkey': KEY1,
'mode': 'rn',
'panid': PANID_INIT,
'allowlist': [ROUTER1]
@@ -125,7 +125,7 @@ class Cert_9_2_11_MasterKey(thread_cert.TestCase):
'name': 'SED',
'channel': CHANNEL_INIT,
'is_mtd': True,
'masterkey': KEY1,
'networkkey': KEY1,
'mode': '-',
'panid': PANID_INIT,
'timeout': config.DEFAULT_CHILD_TIMEOUT,
@@ -163,15 +163,15 @@ class Cert_9_2_11_MasterKey(thread_cert.TestCase):
pending_timestamp=10,
active_timestamp=70,
delay_timer=60000,
master_key=KEY2,
network_key=KEY2,
)
self.simulator.go(310)
self.assertEqual(self.nodes[COMMISSIONER].get_masterkey(), KEY2)
self.assertEqual(self.nodes[LEADER].get_masterkey(), KEY2)
self.assertEqual(self.nodes[ROUTER1].get_masterkey(), KEY2)
self.assertEqual(self.nodes[ED1].get_masterkey(), KEY2)
self.assertEqual(self.nodes[SED1].get_masterkey(), KEY2)
self.assertEqual(self.nodes[COMMISSIONER].get_networkkey(), KEY2)
self.assertEqual(self.nodes[LEADER].get_networkkey(), KEY2)
self.assertEqual(self.nodes[ROUTER1].get_networkkey(), KEY2)
self.assertEqual(self.nodes[ED1].get_networkkey(), KEY2)
self.assertEqual(self.nodes[SED1].get_networkkey(), KEY2)
ipaddr = self.nodes[LEADER].get_ip6_address(config.ADDRESS_TYPE.ML_EID)
self.assertTrue(self.nodes[ROUTER1].ping(ipaddr))
@@ -180,15 +180,15 @@ class Cert_9_2_11_MasterKey(thread_cert.TestCase):
pending_timestamp=20,
active_timestamp=30,
delay_timer=500000,
master_key=KEY1,
network_key=KEY1,
)
self.simulator.go(510)
self.assertEqual(self.nodes[COMMISSIONER].get_masterkey(), KEY1)
self.assertEqual(self.nodes[LEADER].get_masterkey(), KEY1)
self.assertEqual(self.nodes[ROUTER1].get_masterkey(), KEY1)
self.assertEqual(self.nodes[ED1].get_masterkey(), KEY1)
self.assertEqual(self.nodes[SED1].get_masterkey(), KEY1)
self.assertEqual(self.nodes[COMMISSIONER].get_networkkey(), KEY1)
self.assertEqual(self.nodes[LEADER].get_networkkey(), KEY1)
self.assertEqual(self.nodes[ROUTER1].get_networkkey(), KEY1)
self.assertEqual(self.nodes[ED1].get_networkkey(), KEY1)
self.assertEqual(self.nodes[SED1].get_networkkey(), KEY1)
ipaddr = self.nodes[LEADER].get_ip6_address(config.ADDRESS_TYPE.ML_EID)
self.assertTrue(self.nodes[ROUTER1].ping(ipaddr))
@@ -264,7 +264,7 @@ class Cert_9_2_11_MasterKey(thread_cert.TestCase):
# - Pending Timestamp TLV
# - Pending Operational Dataset TLV
# - Delay Timer TLV <greater than 200s>
# - Network Master Key TLV: New Master Key
# - Network Key TLV: New Network Key
# - Active Timestamp TLV <70s>
_dr_pkt = pkts.filter_mle_cmd(MLE_DATA_RESPONSE).\
filter_wpan_src64(LEADER).\
@@ -286,7 +286,7 @@ class Cert_9_2_11_MasterKey(thread_cert.TestCase):
).\
must_next()
# Step 8: Verify all devices now use New Master key.
# Step 8: Verify all devices now use New Network key.
# checked in test()
# Step 9: Verify new MAC key is generated and used when sending ICMPv6 Echo Reply
@@ -352,7 +352,7 @@ class Cert_9_2_11_MasterKey(thread_cert.TestCase):
# - Pending Operational Dataset TLV
# - Active Timestamp TLV <30s>
# - Delay Timer TLV <greater than 300s>
# - Network Master Key TLV: New Master Key
# - Network Key TLV: New Network Key
pkts.filter_mle_cmd(MLE_DATA_RESPONSE).\
filter_wpan_src64(LEADER).\
filter_wpan_dst64(ROUTER).\
@@ -375,7 +375,7 @@ class Cert_9_2_11_MasterKey(thread_cert.TestCase):
).\
must_next()
# Step 17: The DUT MUST send an ICMPv6 Echo Reply using the new Master key
# Step 17: The DUT MUST send an ICMPv6 Echo Reply using the new Network key
_pkt = pkts.filter_ping_request().\
filter_wpan_src64(ROUTER).\
filter_ipv6_dst(LEADER_MLEID).\
@@ -31,7 +31,7 @@ import unittest
import config
import thread_cert
from pktverify.consts import MLE_CHILD_ID_RESPONSE, MLE_CHILD_UPDATE_REQUEST, MLE_DATA_RESPONSE, MLE_DATA_REQUEST, MGMT_ACTIVE_SET_URI, MGMT_PENDING_SET_URI, LINK_LOCAL_ALL_NODES_MULTICAST_ADDRESS, TLV_REQUEST_TLV, SOURCE_ADDRESS_TLV, LEADER_DATA_TLV, NETWORK_DATA_TLV, ACTIVE_TIMESTAMP_TLV, PENDING_TIMESTAMP_TLV, PENDING_OPERATION_DATASET_TLV, NM_COMMISSIONER_SESSION_ID_TLV, NM_BORDER_AGENT_LOCATOR_TLV, NM_ACTIVE_TIMESTAMP_TLV, NM_NETWORK_NAME_TLV, NM_NETWORK_MASTER_KEY_TLV, NM_CHANNEL_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_MESH_LOCAL_PREFIX_TLV, NM_PAN_ID_TLV, NM_PSKC_TLV, NM_SECURITY_POLICY_TLV, NM_DELAY_TIMER_TLV
from pktverify.consts import MLE_CHILD_ID_RESPONSE, MLE_CHILD_UPDATE_REQUEST, MLE_DATA_RESPONSE, MLE_DATA_REQUEST, MGMT_ACTIVE_SET_URI, MGMT_PENDING_SET_URI, LINK_LOCAL_ALL_NODES_MULTICAST_ADDRESS, TLV_REQUEST_TLV, SOURCE_ADDRESS_TLV, LEADER_DATA_TLV, NETWORK_DATA_TLV, ACTIVE_TIMESTAMP_TLV, PENDING_TIMESTAMP_TLV, PENDING_OPERATION_DATASET_TLV, NM_COMMISSIONER_SESSION_ID_TLV, NM_BORDER_AGENT_LOCATOR_TLV, NM_ACTIVE_TIMESTAMP_TLV, NM_NETWORK_NAME_TLV, NM_NETWORK_KEY_TLV, NM_CHANNEL_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_MESH_LOCAL_PREFIX_TLV, NM_PAN_ID_TLV, NM_PSKC_TLV, NM_SECURITY_POLICY_TLV, NM_DELAY_TIMER_TLV
from pktverify.packet_verifier import PacketVerifier
from pktverify.addrs import Ipv6Addr
@@ -60,7 +60,7 @@ class Cert_9_2_18_RollBackActiveTimestamp(thread_cert.TestCase):
'timestamp': 1,
'panid': PANID_INIT,
'channel': CHANNEL_INIT,
'master_key': KEY1
'network_key': KEY1
},
'mode': 'rdn',
'allowlist': [LEADER]
@@ -71,7 +71,7 @@ class Cert_9_2_18_RollBackActiveTimestamp(thread_cert.TestCase):
'timestamp': 1,
'panid': PANID_INIT,
'channel': CHANNEL_INIT,
'master_key': KEY1
'network_key': KEY1
},
'mode': 'rdn',
'partition_id': 0xffffffff,
@@ -83,7 +83,7 @@ class Cert_9_2_18_RollBackActiveTimestamp(thread_cert.TestCase):
'timestamp': 1,
'panid': PANID_INIT,
'channel': CHANNEL_INIT,
'master_key': KEY1
'network_key': KEY1
},
'mode': 'rdn',
'allowlist': [LEADER, ED1, SED1]
@@ -92,7 +92,7 @@ class Cert_9_2_18_RollBackActiveTimestamp(thread_cert.TestCase):
'name': 'ED',
'channel': CHANNEL_INIT,
'is_mtd': True,
'masterkey': KEY1,
'networkkey': KEY1,
'mode': 'rn',
'panid': PANID_INIT,
'allowlist': [ROUTER1]
@@ -101,7 +101,7 @@ class Cert_9_2_18_RollBackActiveTimestamp(thread_cert.TestCase):
'name': 'SED',
'channel': CHANNEL_INIT,
'is_mtd': True,
'masterkey': KEY1,
'networkkey': KEY1,
'mode': '-',
'panid': PANID_INIT,
'timeout': config.DEFAULT_CHILD_TIMEOUT,
@@ -148,15 +148,15 @@ class Cert_9_2_18_RollBackActiveTimestamp(thread_cert.TestCase):
active_timestamp=20,
delay_timer=300,
network_name='MyHouse',
master_key=KEY2,
network_key=KEY2,
)
self.simulator.go(310)
self.assertEqual(self.nodes[COMMISSIONER].get_masterkey(), KEY2)
self.assertEqual(self.nodes[LEADER].get_masterkey(), KEY2)
self.assertEqual(self.nodes[ROUTER1].get_masterkey(), KEY2)
self.assertEqual(self.nodes[ED1].get_masterkey(), KEY2)
self.assertEqual(self.nodes[SED1].get_masterkey(), KEY2)
self.assertEqual(self.nodes[COMMISSIONER].get_networkkey(), KEY2)
self.assertEqual(self.nodes[LEADER].get_networkkey(), KEY2)
self.assertEqual(self.nodes[ROUTER1].get_networkkey(), KEY2)
self.assertEqual(self.nodes[ED1].get_networkkey(), KEY2)
self.assertEqual(self.nodes[SED1].get_networkkey(), KEY2)
self.collect_rlocs()
ed_rloc = self.nodes[ED1].get_rloc()
@@ -211,7 +211,7 @@ class Cert_9_2_18_RollBackActiveTimestamp(thread_cert.TestCase):
PENDING_OPERATION_DATASET_TLV
} == set(p.mle.tlv.type) and {
NM_COMMISSIONER_SESSION_ID_TLV, NM_BORDER_AGENT_LOCATOR_TLV, NM_ACTIVE_TIMESTAMP_TLV,
NM_NETWORK_NAME_TLV, NM_NETWORK_MASTER_KEY_TLV
NM_NETWORK_NAME_TLV, NM_NETWORK_KEY_TLV
} <= set(p.thread_meshcop.tlv.type) and p.thread_nwd.tlv.stable == [0])
# Copy a pv.pkts here to filter SED related packets for potential sequence packets disorder
@@ -245,7 +245,7 @@ class Cert_9_2_18_RollBackActiveTimestamp(thread_cert.TestCase):
PENDING_OPERATION_DATASET_TLV
} <= set(p.mle.tlv.type) and {
NM_CHANNEL_TLV, NM_NETWORK_MESH_LOCAL_PREFIX_TLV, NM_PAN_ID_TLV, NM_DELAY_TIMER_TLV,
NM_ACTIVE_TIMESTAMP_TLV, NM_NETWORK_NAME_TLV, NM_NETWORK_MASTER_KEY_TLV
NM_ACTIVE_TIMESTAMP_TLV, NM_NETWORK_NAME_TLV, NM_NETWORK_KEY_TLV
} <= set(p.thread_meshcop.tlv.type) and p.thread_meshcop.tlv.net_name == ["MyHouse"] and p.
thread_meshcop.tlv.master_key == KEY2)
@@ -31,7 +31,7 @@ import unittest
import mesh_cop
import thread_cert
from pktverify.consts import MGMT_PENDING_GET_URI, MGMT_PENDING_SET_URI, NM_CHANNEL_TLV, NM_PAN_ID_TLV, NM_NETWORK_NAME_TLV, NM_NETWORK_MESH_LOCAL_PREFIX_TLV, NM_PSKC_TLV, NM_ACTIVE_TIMESTAMP_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_MASTER_KEY_TLV, NM_SECURITY_POLICY_TLV, NM_PENDING_TIMESTAMP_TLV, NM_DELAY_TIMER_TLV, LEADER_ALOC
from pktverify.consts import MGMT_PENDING_GET_URI, MGMT_PENDING_SET_URI, NM_CHANNEL_TLV, NM_PAN_ID_TLV, NM_NETWORK_NAME_TLV, NM_NETWORK_MESH_LOCAL_PREFIX_TLV, NM_PSKC_TLV, NM_ACTIVE_TIMESTAMP_TLV, NM_CHANNEL_MASK_TLV, NM_EXTENDED_PAN_ID_TLV, NM_NETWORK_KEY_TLV, NM_SECURITY_POLICY_TLV, NM_PENDING_TIMESTAMP_TLV, NM_DELAY_TIMER_TLV, LEADER_ALOC
from pktverify.packet_verifier import PacketVerifier
from pktverify.null_field import nullField
@@ -206,7 +206,7 @@ class Cert_9_2_19_PendingDatasetGet(thread_cert.TestCase):
# Delay Timer TLV
# Extended PAN ID TLV
# Network Mesh-Local Prefix TLV
# Network Master Key TLV
# Network Key TLV
# Network Name TLV
# PAN ID TLV
# Pending Timestamp TLV
@@ -221,7 +221,7 @@ class Cert_9_2_19_PendingDatasetGet(thread_cert.TestCase):
NM_DELAY_TIMER_TLV,
NM_EXTENDED_PAN_ID_TLV,
NM_NETWORK_MESH_LOCAL_PREFIX_TLV,
NM_NETWORK_MASTER_KEY_TLV,
NM_NETWORK_KEY_TLV,
NM_NETWORK_NAME_TLV,
NM_PAN_ID_TLV,
NM_PENDING_TIMESTAMP_TLV,
+2 -2
View File
@@ -121,7 +121,7 @@ EXTRA_DIST = \
Cert_9_2_08_PersistentDatasets.py \
Cert_9_2_09_PendingPartition.py \
Cert_9_2_10_PendingPartition.py \
Cert_9_2_11_MasterKey.py \
Cert_9_2_11_NetworkKey.py \
Cert_9_2_12_Announce.py \
Cert_9_2_13_EnergyScan.py \
Cert_9_2_14_PanIdQuery.py \
@@ -328,7 +328,7 @@ check_SCRIPTS = \
Cert_9_2_08_PersistentDatasets.py \
Cert_9_2_09_PendingPartition.py \
Cert_9_2_10_PendingPartition.py \
Cert_9_2_11_MasterKey.py \
Cert_9_2_11_NetworkKey.py \
Cert_9_2_12_Announce.py \
Cert_9_2_13_EnergyScan.py \
Cert_9_2_14_PanIdQuery.py \
+16 -16
View File
@@ -83,7 +83,7 @@ ONLINK_GUA_PREFIX = '2021::/64'
# Any address starts with 'fd' are considered on-link address.
ONLINK_PREFIX_REGEX_PATTERN = '^fd'
DEFAULT_MASTER_KEY = bytearray([
DEFAULT_NETWORK_KEY = bytearray([
0x00,
0x11,
0x22,
@@ -277,15 +277,15 @@ def create_default_mle_tlvs_factories():
}
def create_default_mle_crypto_engine(master_key):
return net_crypto.CryptoEngine(crypto_material_creator=net_crypto.MleCryptoMaterialCreator(master_key))
def create_default_mle_crypto_engine(network_key):
return net_crypto.CryptoEngine(crypto_material_creator=net_crypto.MleCryptoMaterialCreator(network_key))
def create_default_mle_message_factory(master_key):
def create_default_mle_message_factory(network_key):
return mle.MleMessageFactory(
aux_sec_hdr_factory=net_crypto.AuxiliarySecurityHeaderFactory(),
mle_command_factory=mle.MleCommandFactory(tlvs_factories=create_default_mle_tlvs_factories()),
crypto_engine=create_default_mle_crypto_engine(master_key),
crypto_engine=create_default_mle_crypto_engine(network_key),
)
@@ -333,7 +333,7 @@ def create_default_mesh_cop_tlvs_factories():
mesh_cop.TlvType.EXTENDED_PANID: mesh_cop.ExtendedPanidFactory(),
mesh_cop.TlvType.NETWORK_NAME: mesh_cop.NetworkNameFactory(),
mesh_cop.TlvType.PSKC: mesh_cop.PSKcFactory(),
mesh_cop.TlvType.NETWORK_MASTER_KEY: mesh_cop.NetworkMasterKeyFactory(),
mesh_cop.TlvType.NETWORK_KEY: mesh_cop.NetworkKeyFactory(),
mesh_cop.TlvType.NETWORK_KEY_SEQUENCE_COUNTER: mesh_cop.NetworkKeySequenceCounterFactory(),
mesh_cop.TlvType.NETWORK_MESH_LOCAL_PREFIX: mesh_cop.NetworkMeshLocalPrefixFactory(),
mesh_cop.TlvType.STEERING_DATA: mesh_cop.SteeringDataFactory(),
@@ -437,8 +437,8 @@ def create_default_ipv6_hop_by_hop_options_factory():
return ipv6.HopByHopOptionsFactory(options_factories=create_default_ipv6_hop_by_hop_options_factories())
def create_default_based_on_src_dst_ports_udp_payload_factory(master_key):
mle_message_factory = create_default_mle_message_factory(master_key)
def create_default_based_on_src_dst_ports_udp_payload_factory(network_key):
mle_message_factory = create_default_mle_message_factory(network_key)
coap_message_factory = create_default_coap_message_factory()
dtls_message_factory = create_default_dtls_message_factory()
@@ -465,12 +465,12 @@ def create_default_ipv6_icmp_body_factories():
}
def create_default_ipv6_upper_layer_factories(master_key):
def create_default_ipv6_upper_layer_factories(network_key):
return {
ipv6.IPV6_NEXT_HEADER_UDP:
ipv6.UDPDatagramFactory(
udp_header_factory=ipv6.UDPHeaderFactory(),
udp_payload_factory=create_default_based_on_src_dst_ports_udp_payload_factory(master_key),
udp_payload_factory=create_default_based_on_src_dst_ports_udp_payload_factory(network_key),
),
ipv6.IPV6_NEXT_HEADER_ICMP:
ipv6.ICMPv6Factory(body_factories=create_default_ipv6_icmp_body_factories()),
@@ -491,10 +491,10 @@ def create_default_ipv6_extension_headers_factories():
}
def create_default_ipv6_packet_factory(master_key):
def create_default_ipv6_packet_factory(network_key):
return ipv6.IPv6PacketFactory(
ehf=create_default_ipv6_extension_headers_factories(),
ulpf=create_default_ipv6_upper_layer_factories(master_key),
ulpf=create_default_ipv6_upper_layer_factories(network_key),
)
@@ -514,18 +514,18 @@ def create_default_thread_context_manager():
return context_manager
def create_default_lowpan_parser(context_manager, master_key=DEFAULT_MASTER_KEY):
def create_default_lowpan_parser(context_manager, network_key=DEFAULT_NETWORK_KEY):
return lowpan.LowpanParser(
lowpan_mesh_header_factory=lowpan.LowpanMeshHeaderFactory(),
lowpan_decompressor=create_default_lowpan_decompressor(context_manager),
lowpan_fragements_buffers_manager=lowpan.LowpanFragmentsBuffersManager(),
ipv6_packet_factory=create_default_ipv6_packet_factory(master_key),
ipv6_packet_factory=create_default_ipv6_packet_factory(network_key),
)
def create_default_thread_message_factory(master_key=DEFAULT_MASTER_KEY):
def create_default_thread_message_factory(network_key=DEFAULT_NETWORK_KEY):
context_manager = create_default_thread_context_manager()
lowpan_parser = create_default_lowpan_parser(context_manager, master_key)
lowpan_parser = create_default_lowpan_parser(context_manager, network_key)
return message.MessageFactory(lowpan_parser=lowpan_parser)
+1 -1
View File
@@ -346,7 +346,7 @@ class MacFrame:
else:
message_info.source_mac_address = src_address.mac_address
sec_obj = CryptoEngine(MacCryptoMaterialCreator(config.DEFAULT_MASTER_KEY))
sec_obj = CryptoEngine(MacCryptoMaterialCreator(config.DEFAULT_NETWORK_KEY))
self.payload = MacPayload(bytearray(open_payload) + sec_obj.decrypt(private_payload, mic, message_info))
else:
+4 -4
View File
@@ -44,7 +44,7 @@ class TlvType(IntEnum):
EXTENDED_PANID = 2
NETWORK_NAME = 3
PSKC = 4
NETWORK_MASTER_KEY = 5
NETWORK_KEY = 5
NETWORK_KEY_SEQUENCE_COUNTER = 6
NETWORK_MESH_LOCAL_PREFIX = 7
STEERING_DATA = 8
@@ -213,13 +213,13 @@ class PSKcFactory(object):
raise NotImplementedError("TODO: Not implemented yet")
# NetworkMasterKey TLV (5)
class NetworkMasterKey(object):
# NetworkKey TLV (5)
class NetworkKey(object):
# TODO: Not implemented yet
pass
class NetworkMasterKeyFactory(object):
class NetworkKeyFactory(object):
# TODO: Not implemented yet
def parse(self, data, message_info):
+11 -11
View File
@@ -42,7 +42,7 @@ class CryptoEngine:
def __init__(self, crypto_material_creator):
"""
Args:
master_key (bytearray)
network_key (bytearray)
"""
self._crypto_material_creator = crypto_material_creator
@@ -94,13 +94,13 @@ class CryptoMaterialCreator(object):
_salt = b'Thread'
def __init__(self, master_key):
def __init__(self, network_key):
"""
Args:
master_key (bytearray)
network_key (bytearray)
"""
self.master_key = master_key
self.network_key = network_key
def _generate_keys(self, sequence_counter):
""" Generate MLE and MAC keys.
@@ -114,7 +114,7 @@ class CryptoMaterialCreator(object):
tuple: MLE and MAC as bytes
"""
k = self.master_key
k = self.network_key
s = struct.pack(">L", sequence_counter) + self._salt
d = hmac.new(k, s, digestmod=hashlib.sha256).digest()
@@ -132,13 +132,13 @@ class CryptoMaterialCreator(object):
class MacCryptoMaterialCreator(CryptoMaterialCreator):
def __init__(self, master_key):
def __init__(self, network_key):
"""
Args:
master_key (bytearray)
network_key (bytearray)
"""
super(MacCryptoMaterialCreator, self).__init__(master_key)
super(MacCryptoMaterialCreator, self).__init__(network_key)
def _create_nonce(self, eui64, frame_counter, security_level):
""" Create CCM Nonce required by AES-128 CCM for encryption and decryption.
@@ -196,13 +196,13 @@ class MacCryptoMaterialCreator(CryptoMaterialCreator):
class MleCryptoMaterialCreator(CryptoMaterialCreator):
def __init__(self, master_key):
def __init__(self, network_key):
"""
Args:
master_key (bytearray)
network_key (bytearray)
"""
super(MleCryptoMaterialCreator, self).__init__(master_key)
super(MleCryptoMaterialCreator, self).__init__(network_key)
def _create_nonce(self, source_eui64, frame_counter, security_level):
""" Create CCM Nonce required by AES-128 CCM for encryption and decryption.
+13 -13
View File
@@ -1255,12 +1255,12 @@ class NodeImpl:
self.send_command(cmd)
self._expect_done()
def get_masterkey(self):
self.send_command('masterkey')
def get_networkkey(self):
self.send_command('networkkey')
return self._expect_result('[0-9a-fA-F]{32}')
def set_masterkey(self, masterkey):
cmd = 'masterkey %s' % masterkey
def set_networkkey(self, networkkey):
cmd = 'networkkey %s' % networkkey
self.send_command(cmd)
self._expect_done()
@@ -1816,7 +1816,7 @@ class NodeImpl:
panid=None,
channel=None,
channel_mask=None,
master_key=None,
network_key=None,
security_policy=[],
):
self.send_command('dataset clear')
@@ -1841,8 +1841,8 @@ class NodeImpl:
self.send_command(cmd)
self._expect_done()
if master_key is not None:
cmd = 'dataset masterkey %s' % master_key
if network_key is not None:
cmd = 'dataset networkkey %s' % network_key
self.send_command(cmd)
self._expect_done()
@@ -1929,7 +1929,7 @@ class NodeImpl:
channel_mask=None,
extended_panid=None,
panid=None,
master_key=None,
network_key=None,
mesh_local=None,
network_name=None,
security_policy=None,
@@ -1952,8 +1952,8 @@ class NodeImpl:
if panid is not None:
cmd += 'panid %d ' % panid
if master_key is not None:
cmd += 'masterkey %s ' % master_key
if network_key is not None:
cmd += 'networkkey %s ' % network_key
if mesh_local is not None:
cmd += 'localprefix %s ' % mesh_local
@@ -2008,7 +2008,7 @@ class NodeImpl:
delay_timer=None,
channel=None,
panid=None,
master_key=None,
network_key=None,
mesh_local=None,
network_name=None,
):
@@ -2028,8 +2028,8 @@ class NodeImpl:
if panid is not None:
cmd += 'panid %d ' % panid
if master_key is not None:
cmd += 'masterkey %s ' % master_key
if network_key is not None:
cmd += 'networkkey %s ' % network_key
if mesh_local is not None:
cmd += 'localprefix %s ' % mesh_local
@@ -187,7 +187,7 @@ NM_PAN_ID_TLV = 1
NM_EXTENDED_PAN_ID_TLV = 2
NM_NETWORK_NAME_TLV = 3
NM_PSKC_TLV = 4
NM_NETWORK_MASTER_KEY_TLV = 5
NM_NETWORK_KEY_TLV = 5
NM_NETWORK_KEY_SEQUENCE_COUNTER_TLV = 6
NM_NETWORK_MESH_LOCAL_PREFIX_TLV = 7
NM_STEERING_DATA_TLV = 8
+12 -12
View File
@@ -36,7 +36,7 @@ import ipaddress
import common
import net_crypto
master_key = bytearray(
network_key = bytearray(
[0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff])
@@ -90,7 +90,7 @@ def any_data(length=None):
return bytearray([random.getrandbits(8) for _ in range(length)])
def any_master_key():
def any_network_key():
return bytearray([random.getrandbits(8) for _ in range(16)])
@@ -118,7 +118,7 @@ class TestCryptoEngine(unittest.TestCase):
mic = bytearray([0xe1, 0xb5, 0xa2, 0x53])
net_crypto_engine = net_crypto.CryptoEngine(net_crypto.MleCryptoMaterialCreator(master_key))
net_crypto_engine = net_crypto.CryptoEngine(net_crypto.MleCryptoMaterialCreator(network_key))
# WHEN
mle_msg = net_crypto_engine.decrypt(data, mic, message_info)
@@ -150,7 +150,7 @@ class TestCryptoEngine(unittest.TestCase):
0x0b, 0x08, 0x65, 0x5e, 0x0f, 0x83, 0x40, 0xc7, 0x83, 0x31
])
net_crypto_engine = net_crypto.CryptoEngine(net_crypto.MleCryptoMaterialCreator(master_key))
net_crypto_engine = net_crypto.CryptoEngine(net_crypto.MleCryptoMaterialCreator(network_key))
# WHEN
encrypted_data, mic = net_crypto_engine.encrypt(mle_msg, message_info)
@@ -167,7 +167,7 @@ class TestCryptoEngine(unittest.TestCase):
# GIVEN
data = any_data()
master_key = any_master_key()
network_key = any_network_key()
key_id_mode = 2
security_level = 5
@@ -184,7 +184,7 @@ class TestCryptoEngine(unittest.TestCase):
key_id=any_key_id(key_id_mode))
message_info.aux_sec_hdr_bytes = convert_aux_sec_hdr_to_bytearray(message_info.aux_sec_hdr)
net_crypto_engine = net_crypto.CryptoEngine(net_crypto.MleCryptoMaterialCreator(master_key))
net_crypto_engine = net_crypto.CryptoEngine(net_crypto.MleCryptoMaterialCreator(network_key))
# WHEN
enc_data, mic = net_crypto_engine.encrypt(data, message_info)
@@ -210,7 +210,7 @@ class TestCryptoMaterialCreator(unittest.TestCase):
# GIVEN
sequence_counter = 0
creator = net_crypto.CryptoMaterialCreator(master_key)
creator = net_crypto.CryptoMaterialCreator(network_key)
# WHEN
mle_key, mac_key = creator._generate_keys(sequence_counter)
@@ -233,7 +233,7 @@ class TestCryptoMaterialCreator(unittest.TestCase):
# GIVEN
sequence_counter = 1
creator = net_crypto.CryptoMaterialCreator(master_key)
creator = net_crypto.CryptoMaterialCreator(network_key)
# WHEN
mle_key, mac_key = creator._generate_keys(sequence_counter)
@@ -256,7 +256,7 @@ class TestCryptoMaterialCreator(unittest.TestCase):
# GIVEN
sequence_counter = 2
creator = net_crypto.CryptoMaterialCreator(master_key)
creator = net_crypto.CryptoMaterialCreator(network_key)
# WHEN
mle_key, mac_key = creator._generate_keys(sequence_counter)
@@ -280,7 +280,7 @@ class TestMleCryptoMaterialCreator(unittest.TestCase):
frame_counter = any_frame_counter()
security_level = any_security_level()
creator = net_crypto.MleCryptoMaterialCreator(master_key)
creator = net_crypto.MleCryptoMaterialCreator(network_key)
# WHEN
nonce = creator._create_nonce(source_eui64, frame_counter, security_level)
@@ -303,7 +303,7 @@ class TestMleCryptoMaterialCreator(unittest.TestCase):
destination_address = any_ip_address()
auxiliary_security_header_bytes = convert_aux_sec_hdr_to_bytearray(any_auxiliary_security_header())
creator = net_crypto.MleCryptoMaterialCreator(master_key)
creator = net_crypto.MleCryptoMaterialCreator(network_key)
# WHEN
authenticated_data = creator._create_authenticated_data(source_address, destination_address,
@@ -327,7 +327,7 @@ class TestMleCryptoMaterialCreator(unittest.TestCase):
message_info.aux_sec_hdr = any_auxiliary_security_header()
message_info.aux_sec_hdr_bytes = convert_aux_sec_hdr_to_bytearray(message_info.aux_sec_hdr)
creator = net_crypto.MleCryptoMaterialCreator(master_key)
creator = net_crypto.MleCryptoMaterialCreator(network_key)
# WHEN
key, nonce, auth_data = creator.create_key_and_nonce_and_authenticated_data(message_info)
+2 -2
View File
@@ -1723,7 +1723,7 @@ class TestMleMessageFactory(unittest.TestCase):
0x27, 0xc2, 0x96, 0xf4, 0x9c, 0x65, 0x82, 0x97, 0xcf, 0x97, 0x35, 0x89, 0xc2
])
factory = config.create_default_mle_message_factory(master_key=config.DEFAULT_MASTER_KEY)
factory = config.create_default_mle_message_factory(network_key=config.DEFAULT_NETWORK_KEY)
# WHEN
actual_mle_message = factory.parse(io.BytesIO(data), message_info)
@@ -1773,7 +1773,7 @@ class TestMleMessageFactory(unittest.TestCase):
0x94, 0x01, 0x6d, 0x20, 0xdf, 0x30, 0x82, 0xf8, 0xbb, 0x34, 0x47, 0x42, 0x50, 0xe9, 0x41, 0xa7, 0x33, 0xa5
])
factory = config.create_default_mle_message_factory(master_key=config.DEFAULT_MASTER_KEY)
factory = config.create_default_mle_message_factory(network_key=config.DEFAULT_NETWORK_KEY)
# WHEN
actual_mle_message = factory.parse(io.BytesIO(data), message_info)
@@ -57,17 +57,17 @@ class SrpAutoStartMode(thread_cert.TestCase):
TOPOLOGY = {
CLIENT: {
'name': 'SRP_CLIENT',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
SERVER1: {
'name': 'SRP_SERVER1',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
SERVER2: {
'name': 'SRP_SERVER2',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
}
@@ -58,22 +58,22 @@ class SrpAutoStartMode(thread_cert.TestCase):
TOPOLOGY = {
CLIENT: {
'name': 'SRP_CLIENT',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
SERVER1: {
'name': 'SRP_SERVER1',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rn',
},
SERVER2: {
'name': 'SRP_SERVER2',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rn',
},
SERVER3: {
'name': 'SRP_SERVER3',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rn',
},
}
+2 -2
View File
@@ -57,12 +57,12 @@ class SrpRegisterSingleService(thread_cert.TestCase):
TOPOLOGY = {
SERVER: {
'name': 'SRP_SERVER',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
CLIENT: {
'name': 'SRP_CLIENT',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
}
@@ -56,17 +56,17 @@ class SrpNameConflicts(thread_cert.TestCase):
TOPOLOGY = {
SERVER: {
'name': 'SRP_SERVER',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
CLIENT1: {
'name': 'SRP_CLIENT1',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
CLIENT2: {
'name': 'SRP_CLIENT2',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
}
@@ -55,12 +55,12 @@ class SrpRegisterSingleService(thread_cert.TestCase):
TOPOLOGY = {
SERVER: {
'name': 'SRP_SERVER',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
CLIENT: {
'name': 'SRP_CLIENT',
'masterkey': '00112233445566778899aabbccddeeff',
'networkkey': '00112233445566778899aabbccddeeff',
'mode': 'rdn',
},
}
+6 -6
View File
@@ -168,7 +168,7 @@ class TestCase(NcpSupportMixin, unittest.TestCase):
if node.is_host:
continue
self.nodes[i].set_masterkey(binascii.hexlify(config.DEFAULT_MASTER_KEY).decode())
self.nodes[i].set_networkkey(binascii.hexlify(config.DEFAULT_NETWORK_KEY).decode())
self.nodes[i].set_panid(params['panid'])
self.nodes[i].set_mode(params['mode'])
@@ -176,8 +176,8 @@ class TestCase(NcpSupportMixin, unittest.TestCase):
self.nodes[i].set_preferred_partition_id(params['partition_id'])
if 'channel' in params:
self.nodes[i].set_channel(params['channel'])
if 'masterkey' in params:
self.nodes[i].set_masterkey(params['masterkey'])
if 'networkkey' in params:
self.nodes[i].set_networkkey(params['networkkey'])
if 'network_name' in params:
self.nodes[i].set_network_name(params['network_name'])
@@ -197,13 +197,13 @@ class TestCase(NcpSupportMixin, unittest.TestCase):
self.nodes[i].set_timeout(params['timeout'])
if 'active_dataset' in params:
if 'master_key' not in params['active_dataset']:
params['active_dataset']['master_key'] = binascii.hexlify(config.DEFAULT_MASTER_KEY).decode()
if 'network_key' not in params['active_dataset']:
params['active_dataset']['network_key'] = binascii.hexlify(config.DEFAULT_NETWORK_KEY).decode()
self.nodes[i].set_active_dataset(params['active_dataset']['timestamp'],
panid=params['active_dataset'].get('panid'),
channel=params['active_dataset'].get('channel'),
channel_mask=params['active_dataset'].get('channel_mask'),
master_key=params['active_dataset'].get('master_key'),
network_key=params['active_dataset'].get('network_key'),
security_policy=params['active_dataset'].get('security_policy'))
if 'pending_dataset' in params: