Skip to content

Commit

Permalink
zephyr: mesh: Added Brige Configutation client/server
Browse files Browse the repository at this point in the history
Added Bridge Configuration Client and Server support
and added the support to the zephyr-master workspace file.

Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
  • Loading branch information
Balaklaka authored and sjanc committed Sep 4, 2024
1 parent dace327 commit 7a24ff0
Show file tree
Hide file tree
Showing 6 changed files with 382 additions and 2 deletions.
6 changes: 6 additions & 0 deletions autopts/ptsprojects/zephyr/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,12 @@ def test_cases(ptses):
[TestFunc(time.sleep, 10, post_wid=500),
TestFunc(btp.mesh_proxy_solicit, post_wid=500)],
generic_wid_hdl=mesh_wid_hdl),
ZTestCase("MESH", "MESH/CL/BCM/SBS/BV-01-C", cmds=pre_conditions_prov,
generic_wid_hdl=mesh_wid_hdl),
ZTestCase("MESH", "MESH/CL/BCM/BDS/BV-01-C", cmds=pre_conditions_prov,
generic_wid_hdl=mesh_wid_hdl),
ZTestCase("MESH", "MESH/CL/BCM/BTS/BV-01-C", cmds=pre_conditions_prov,
generic_wid_hdl=mesh_wid_hdl),
]

test_cases_lt2 = [
Expand Down
98 changes: 98 additions & 0 deletions autopts/pybtp/btp/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,27 @@
"proxy_private_identity": (defs.BTP_SERVICE_ID_MESH,
defs.MESH_PROXY_PRIVATE_IDENTITY,
CONTROLLER_INDEX, ""),
"subnet_bridge_get": (defs.BTP_SERVICE_ID_MESH,
defs.MESH_SUBNET_BRIDGE_GET,
CONTROLLER_INDEX),
"subnet_bridge_set": (defs.BTP_SERVICE_ID_MESH,
defs.MESH_SUBNET_BRIDGE_SET,
CONTROLLER_INDEX),
"bridging_table_add": (defs.BTP_SERVICE_ID_MESH,
defs.MESH_BRIDGING_TABLE_ADD,
CONTROLLER_INDEX),
"bridging_table_remove": (defs.BTP_SERVICE_ID_MESH,
defs.MESH_BRIDGING_TABLE_REMOVE,
CONTROLLER_INDEX),
"bridged_subnets_get": (defs.BTP_SERVICE_ID_MESH,
defs.MESH_BRIDGED_SUBNETS_GET,
CONTROLLER_INDEX),
"bridging_table_get": (defs.BTP_SERVICE_ID_MESH,
defs.MESH_BRIDGING_TABLE_GET,
CONTROLLER_INDEX),
"bridge_capability_get": (defs.BTP_SERVICE_ID_MESH,
defs.MESH_BRIDGE_CAPABILITY_GET,
CONTROLLER_INDEX),
"od_priv_proxy_get": (defs.BTP_SERVICE_ID_MESH,
defs.MESH_OD_PRIV_PROXY_GET,
CONTROLLER_INDEX),
Expand Down Expand Up @@ -1956,6 +1977,83 @@ def mesh_rpr_reprov_remote(dst, addr, comp_change):
iutctl.btp_socket.send_wait_rsp(*MESH['rpr_reprov_remote'], data)


def mesh_subnet_bridge_get(dst):
logging.debug("%s", mesh_subnet_bridge_get.__name__)

stack = get_stack()
iutctl = get_iut()

data = bytearray(struct.pack("<H", dst))

iutctl.btp_socket.send_wait_rsp(*MESH['subnet_bridge_get'], data)


def mesh_subnet_bridge_set(dst, val):
logging.debug("%s", mesh_subnet_bridge_set.__name__)

stack = get_stack()
iutctl = get_iut()

data = bytearray(struct.pack("<HB", dst, val))

iutctl.btp_socket.send_wait_rsp(*MESH['subnet_bridge_set'], data)


def mesh_bridging_table_add(dst, dir, net_idx1, net_idx2, addr1, addr2):
logging.debug("%s", mesh_bridging_table_add.__name__)

stack = get_stack()
iutctl = get_iut()

data = bytearray(struct.pack("<HBHHHH", dst, dir, net_idx1, net_idx2, addr1, addr2))

iutctl.btp_socket.send_wait_rsp(*MESH['bridging_table_add'], data)


def mesh_bridging_table_remove(dst, net_idx1, net_idx2, addr1, addr2):
logging.debug("%s", mesh_bridging_table_remove.__name__)

stack = get_stack()
iutctl = get_iut()

data = bytearray(struct.pack("<HHHHH", dst, net_idx1, net_idx2, addr1, addr2))

iutctl.btp_socket.send_wait_rsp(*MESH['bridging_table_remove'], data)


def mesh_bridged_subnets_get(dst, filter, net_idx, start_idx):
logging.debug("%s", mesh_bridged_subnets_get.__name__)

stack = get_stack()
iutctl = get_iut()

data = bytearray(struct.pack("<HBHB", dst, filter, net_idx, start_idx))

iutctl.btp_socket.send_wait_rsp(*MESH['bridged_subnets_get'], data)


def mesh_bridging_table_get(dst, net_idx1, net_idx2, start_idx):
logging.debug("%s", mesh_bridging_table_get.__name__)

stack = get_stack()
iutctl = get_iut()

data = bytearray(struct.pack("<HHHH", dst, net_idx1, net_idx2, start_idx))

iutctl.btp_socket.send_wait_rsp(*MESH['bridging_table_get'], data)


def mesh_bridge_capability_get(dst):
logging.debug("%s", mesh_bridge_capability_get.__name__)

stack = get_stack()
iutctl = get_iut()

data = bytearray(struct.pack("<H", dst))

iutctl.btp_socket.send_wait_rsp(*MESH['bridge_capability_get'], data)


def mesh_od_priv_proxy_get(dst):
logging.debug("%s", mesh_od_priv_proxy_get.__name__)

Expand Down
7 changes: 7 additions & 0 deletions autopts/pybtp/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,13 @@ def BIT(bit):
MESH_RPR_LINK_CLOSE = 0x5f
MESH_RPR_PROV_REMOTE = 0x60
MESH_RPR_REPROV_REMOTE = 0x61
MESH_SUBNET_BRIDGE_GET=0x62
MESH_SUBNET_BRIDGE_SET=0x63
MESH_BRIDGING_TABLE_ADD=0x64
MESH_BRIDGING_TABLE_REMOVE=0x65
MESH_BRIDGED_SUBNETS_GET=0x66
MESH_BRIDGING_TABLE_GET=0x67
MESH_BRIDGE_CAPABILITY_GET=0x68

MESH_PRIV_BEACON_GET = 0x6c
MESH_PRIV_BEACON_SET = 0x6d
Expand Down
204 changes: 204 additions & 0 deletions autopts/wid/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -3685,6 +3685,210 @@ def hdl_wid_891(params: WIDParams):
return True


def hdl_wid_920(params: WIDParams):
"""
Implements:
description: Please send SUBNET_BRIDGE_GET:
MeshApplicationData::Network Header
Network Header:
NID: <WildCard: Exists>
IVI: <WildCard: Exists>
TTL: <WildCard: Exists>
CTL: <WildCard: Exists>
SEQ: <WildCard: Exists>
SRC: [0x0002]
DST: [0x0001]
TransportPDU: <WildCard: Exists>
MeshApplicationData::Application Data
Subnet Bridge Server:
Op Code: [0x80B1] SUBNET_BRIDGE_GET
style: MMI_Style_Ok_Cancel2 0x11141
"""
_, dst = find_src_dst(params.description)

btp.mesh_subnet_bridge_get(dst)
return True


def hdl_wid_921(params: WIDParams):
"""
Implements:
description: Please send SUBNET_BRIDGE_SET:
MeshApplicationData::Network Header
Network Header:
NID: <WildCard: Exists>
IVI: <WildCard: Exists>
TTL: <WildCard: Exists>
CTL: <WildCard: Exists>
SEQ: <WildCard: Exists>
SRC: [0x0003]
DST: [0x0001]
TransportPDU: <WildCard: Exists>
MeshApplicationData::Application Data
Subnet Bridge Server:
Op Code: [0x80B2] SUBNET_BRIDGE_SET
Subnet_Bridge: [1 (0x01)] Enable
style: MMI_Style_Ok_Cancel2 0x11141
"""
_, dst = find_src_dst(params.description)

pattern = re.compile(r"\((0x[0-9a-fA-F]+)\)")
vals = pattern.findall(params.description)

enable = int(vals[0], 16)

btp.mesh_subnet_bridge_set(dst, enable)
return True


def hdl_wid_922(params: WIDParams):
"""
Implements:
description: Please send BRIDGING_TABLE_GET:
MeshApplicationData::Network Header
Network Header:
NID: <WildCard: Exists>
IVI: <WildCard: Exists>
TTL: <WildCard: Exists>
CTL: <WildCard: Exists>
SEQ: <WildCard: Exists>
SRC: [0x0003]
DST: [0x0001]
TransportPDU: <WildCard: Exists>
MeshApplicationData::Application Data
Subnet Bridge Server:
Op Code: [0x80B9] BRIDGING_TABLE_GET
NetKeyIndex1: <WildCard: Exists>
NetKeyIndex2: <WildCard: Exists>
Start_Index_Bridging_Table: <WildCard: Exists>
style: MMI_Style_Ok_Cancel2 0x11141
"""
_, dst = find_src_dst(params.description)

btp.mesh_bridging_table_get(dst, 1, 0, 0)
return True


def hdl_wid_923(params: WIDParams):
"""
Implements:
description: Please send BRIDGING_TABLE_ADD:
MeshApplicationData::Network Header
Network Header:
NID: <WildCard: Exists>
IVI: <WildCard: Exists>
TTL: <WildCard: Exists>
CTL: <WildCard: Exists>
SEQ: <WildCard: Exists>
SRC: [0x0003]
DST: [0x0001]
TransportPDU: <WildCard: Exists>
MeshApplicationData::Application Data
Subnet Bridge Server:
Op Code: [0x80B4] BRIDGING_TABLE_ADD
Directions: <WildCard: Exists>
NetKeyIndex1: <WildCard: Exists>
NetKeyIndex2: <WildCard: Exists>
Address1: <WildCard: Exists>
Address2: <WildCard: Exists>
style: MMI_Style_Ok_Cancel2 0x11141
"""
_, dst = find_src_dst(params.description)

btp.mesh_bridging_table_add(dst, 2, 1, 2, 1, 2)
return True


def hdl_wid_924(params: WIDParams):
"""
Implements:
description: Please send BRIDGING_TABLE_REMOVE:
MeshApplicationData::Network Header
Network Header:
NID: <WildCard: Exists>
IVI: <WildCard: Exists>
TTL: <WildCard: Exists>
CTL: <WildCard: Exists>
SEQ: <WildCard: Exists>
SRC: [0x0003]
DST: [0x0001]
TransportPDU: <WildCard: Exists>
MeshApplicationData::Application Data
Subnet Bridge Server:
Op Code: [0x80B5] BRIDGING_TABLE_REMOVE
NetKeyIndex1: <WildCard: Exists>
NetKeyIndex2: <WildCard: Exists>
Address1: <WildCard: Exists>
Address2: <WildCard: Exists>
style: MMI_Style_Ok_Cancel2 0x11141
"""
_, dst = find_src_dst(params.description)

btp.mesh_bridging_table_remove(dst, 1, 2, 1, 2)
return True


def hdl_wid_925(params: WIDParams):
"""
Implements:
description: Please send BRIDGED_SUBNETS_GET:
MeshApplicationData::Network Header
Network Header:
NID: <WildCard: Exists>
IVI: <WildCard: Exists>
TTL: <WildCard: Exists>
CTL: <WildCard: Exists>
SEQ: <WildCard: Exists>
SRC: [0x0003]
DST: [0x0001]
TransportPDU: <WildCard: Exists>
MeshApplicationData::Application Data
Subnet Bridge Server:
Op Code: [0x80B7] BRIDGED_SUBNETS_GET
Filter: <WildCard: Exists>
Prohibited: <WildCard: Exists>
NetKeyIndex: <WildCard: Exists>
Start_Index_Bridged_Subnets: <WildCard: Exists>
style: MMI_Style_Ok_Cancel2 0x11141
"""
_, dst = find_src_dst(params.description)

btp.mesh_bridged_subnets_get(dst, 1, 1, 0)
return True


def hdl_wid_926(params: WIDParams):
"""
Implements:
description: Please send BRIDGE_CAPABILITY_GET:
MeshApplicationData::Network Header
Network Header:
NID: <WildCard: Exists>
IVI: <WildCard: Exists>
TTL: <WildCard: Exists>
CTL: <WildCard: Exists>
SEQ: <WildCard: Exists>
SRC: [0x0002]
DST: [0x0001]
TransportPDU: <WildCard: Exists>
MeshApplicationData::Application Data
Subnet Bridge Server:
Op Code: [0x80BB] BRIDGING_TABLE_SIZE_GET
style: MMI_Style_Ok_Cancel2 0x11141
"""
_, dst = find_src_dst(params.description)

btp.mesh_bridge_capability_get(dst)
return True


def hdl_wid_940(_: WIDParams):
"""
Implements:
Expand Down
4 changes: 2 additions & 2 deletions autopts/workspaces/zephyr/zephyr-master/zephyr-master.pqw6
Original file line number Diff line number Diff line change
Expand Up @@ -20995,13 +20995,13 @@
<Row>
<Name>TSPC_MESH_11_7</Name>
<Description>Bridge Configuration Server Model (C.3)</Description>
<Value>FALSE</Value>
<Value>TRUE</Value>
<Mandatory>FALSE</Mandatory>
</Row>
<Row>
<Name>TSPC_MESH_11_8</Name>
<Description>Bridge Configuration Client Model (C.2)</Description>
<Value>FALSE</Value>
<Value>TRUE</Value>
<Mandatory>FALSE</Mandatory>
</Row>
<Row>
Expand Down
Loading

0 comments on commit 7a24ff0

Please sign in to comment.