Skip to content

Commit e8ada99

Browse files
authored
Merge pull request #134 from riley206-pnnl/develop
Added network discovery, and small fixes to reflect changes to the bacnet proxy.
2 parents 03ecb8c + cd96500 commit e8ada99

7 files changed

Lines changed: 619 additions & 77 deletions

File tree

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ pydantic
44
pydantic-settings
55
loguru
66
aiofiles
7-
-e git+https://github.com/riley206-pnnl/bacnet-scan-tool.git@feature/bacnet-tests#egg=bacnet_scan_tool
7+
-e git+https://github.com/riley206-pnnl/bacnet-scan-tool.git@feature/bacnet-tests#egg=bacnet_scan_tool

volttron_installer/backend/endpoints.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,23 @@ async def bacnet_scan_get_host_ip() -> dict:
573573
return data
574574
except ApiError as e:
575575
raise HTTPException(status_code=e.status_code, detail=e.detail)
576+
577+
@bacnet_scan_tool_router.get("/discover_networks", response_model=dict)
578+
async def bacnet_discover_networks(verbose: bool = False) -> dict:
579+
"""Discover available networks for BACnet scanning using comprehensive network analysis."""
580+
from .tool_proxy_factory import ApiError
581+
582+
url = get_api_url.get_api_url("/api/tool_proxy/bacnet_scan_tool/discover_networks")
583+
try:
584+
response = await ToolProxyFactory.request(
585+
url,
586+
"GET",
587+
params={"verbose": verbose}
588+
)
589+
data = response.json()
590+
return data
591+
except ApiError as e:
592+
raise HTTPException(status_code=e.status_code, detail=e.detail)
576593

577594
@bacnet_scan_tool_router.post("/bacnet/scan_subnet", response_model=ScanResponse)
578595
async def bacnet_scan_subnet(network_str: str | None = None) -> dict[str, str]:

volttron_installer/backend/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,3 +823,4 @@ class BACnetReadObjectListRequest(BaseModel):
823823
device_object_identifier: str
824824
page: int | None = None
825825
page_size: int | None = None
826+
force_fresh_read: bool = True

volttron_installer/models.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ class LocalIPModel(rx.Base):
9696
subnet_mask: str = ""
9797
cidr: str = ""
9898

99+
class NetworkDiscoveryModel(rx.Base):
100+
status: str = ""
101+
networks: list[str] = []
102+
summary: dict = {}
103+
message: str = ""
104+
error: str | None = None
105+
99106
class BACnetPointTableFilter(rx.Base):
100107
volttron_point_name: str = ""
101108
units: str = ""

volttron_installer/pages/bacnet_scan.py

Lines changed: 416 additions & 37 deletions
Large diffs are not rendered by default.

volttron_installer/state.py

Lines changed: 170 additions & 38 deletions
Large diffs are not rendered by default.

volttron_installer/thin_endpoint_wrappers/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
PlatformDeploymentStatus, CreateAgentRequest, ToolRequest, ToolStatusResponse, \
77
BACnetReadDeviceAllRequest, BACnetDevice, BACnetReadPropertyRequest, BACnetScanResults, \
88
BACnetWritePropertyRequest, BACnetReadObjectListRequest
9-
from ..models import WindowsHostIPModel, LocalIPModel
9+
from ..models import WindowsHostIPModel, LocalIPModel, NetworkDiscoveryModel
1010
from rxconfig import config
1111

1212
from bacnet_scan_tool.models import ScanResponse, ObjectListNamesResponse
@@ -216,6 +216,12 @@ async def get_bacnet_host_ip() -> WindowsHostIPModel:
216216
"""Get Windows host IP address for WSL2 users."""
217217
return await proxy_request(f"{API_BASE_URL}{BACNET_SCAN_TOOL_PREFIX}/get_host_ip", "GET")
218218

219+
@with_model(NetworkDiscoveryModel)
220+
async def discover_networks(verbose: bool = False) -> NetworkDiscoveryModel:
221+
"""Discover available networks for BACnet scanning using comprehensive network analysis."""
222+
params = {"verbose": verbose}
223+
return await proxy_request(f"{API_BASE_URL}{BACNET_SCAN_TOOL_PREFIX}/discover_networks", "GET", params=params)
224+
219225
async def get_tool_proxy(tool_name: str, path: str, **kwargs) -> httpx.Response:
220226
return await proxy_request(f"{API_BASE_URL}{TOOL_PROXY_PREFIX}/{tool_name}/{path}", "GET", **kwargs)
221227

0 commit comments

Comments
 (0)