RemoteRF 2.13.13__tar.gz → 2.13.15__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {remoterf-2.13.13/src/remoterf.egg-info → remoterf-2.13.15}/PKG-INFO +1 -1
- {remoterf-2.13.13 → remoterf-2.13.15}/pyproject.toml +1 -1
- remoterf-2.13.15/src/remoterf/integrations.py +190 -0
- {remoterf-2.13.13 → remoterf-2.13.15/src/remoterf.egg-info}/PKG-INFO +1 -1
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf.egg-info/SOURCES.txt +2 -0
- remoterf-2.13.15/tests/test_integrations_helper.py +179 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/LICENSE +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/README.md +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/setup.cfg +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/setup.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/_remoterf_alias.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/admin.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/agent_cli.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/agent_docs.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/api.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/grpc/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/grpc/deployment_capabilities.proto +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/grpc/deployment_capabilities_pb2.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/grpc/deployment_capabilities_pb2_grpc.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/grpc/grpc.proto +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/grpc/grpc_pb2.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/grpc/grpc_pb2_grpc.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/grpc/v2_codec.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/tos_notice.txt +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/utils/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/utils/ansi_codes.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/utils/api_token.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/utils/banner.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/utils/list_string.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/utils/process_arg.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/config/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/config/cert_fetcher.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/config/config.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/core/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/core/acc_login.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/core/app.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/core/availability.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/core/banner_note.txt +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/core/direct_path.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/core/dynamic_v2_transport.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/core/grpc_acc.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/core/grpc_client.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/core/messages.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/core/secure_channel.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/core/v2_errors.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/data/agent_guide.md +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/data/mcp_tools.json +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/deployment/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/deployment/backend.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/deployment/direct.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/deployment/homes.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/deployment/http.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/deployment/lanpass.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/deployment/state.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/_virtual.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/adalm_pluto/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/adalm_pluto/adalm_pluto_remote.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/adalm_pluto_mimo/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/adalm_pluto_mimo/adalm_pluto_mimo_remote.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/bluetooth/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/bluetooth/bluetooth_remote.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/dynamic_device.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/dynamic_v2.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/gps/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/gps/gps_remote.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/hackrf/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/hackrf/hackrf_remote.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/krakensdr/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/krakensdr/krakensdr_remote.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/rfbeam_kmd7/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/rfbeam_kmd7/rfbeam_kmd7_remote.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/rtl_sdr/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/rtl_sdr/rtl_sdr_remote.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/rtlsdr/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/schema_review.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/sim_sdr/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/sim_sdr/sim_sdr_remote.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/support/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/support/krakensdr.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/support/rfbeam_kmd7.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/support/ti_mmwave.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/support/uhd.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/support/uhd_dsp.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/support/uhd_v2.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/support/wifi.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/ti_awr6843/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/ti_awr6843/ti_awr6843_remote.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/ti_mmwave/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/ti_mmwave/ti_mmwave_remote.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/usrp/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/usrp/usrp_remote.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/usrp/usrp_remote.pyi +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/wifi/__init__.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/wifi/wifi_remote.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/mcp_server.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/ops.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/remoterf_cli.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/version.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf.egg-info/dependency_links.txt +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf.egg-info/entry_points.txt +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf.egg-info/requires.txt +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf.egg-info/top_level.txt +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_agent_cli.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_agent_docs.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_api.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_banner.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_batch.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_bundled_drivers.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_ca_pin.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_cli_login_fresh.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_config_address.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_deployment_accounts.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_device_routes.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_devices_api.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_direct_path_fixed.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_direct_path_global.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_direct_path_partner.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_direct_path_race.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_direct_path_relay.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_dynamic_device_codegen.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_dynamic_v2.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_federated_devices.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_fetch_idl_fallback.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_finish_prompt.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_gate_i_direct_path.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_grpc_client_target.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_homes.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_integration_schema.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_lan_fallback.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_mcp_server.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_messages.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_native_account_credentials.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_native_devices.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_native_drivers.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_old_import_name.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_ops.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_partner_dynamic_v2.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_pluto_virtual.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_process_arg.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_relay_paging.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_remote_admin.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_remoterf_cli.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_restart_ride_through.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_rx_readahead.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_schema_review.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_ti_mmwave.py +0 -0
- {remoterf-2.13.13 → remoterf-2.13.15}/tests/test_upgrade_rescue.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: remoterf
|
|
3
|
-
Version: 2.13.
|
|
3
|
+
Version: 2.13.15
|
|
4
4
|
Summary: A python API to remotely access signal centric hardware. Client-side only! Courtesy of Wireless Lab @ UCLA & Prof. Ian Roberts.
|
|
5
5
|
Author-email: Ethan Ge <84103791+ethange1@users.noreply.github.com>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "remoterf"
|
|
7
|
-
version = "2.13.
|
|
7
|
+
version = "2.13.15"
|
|
8
8
|
description = "A python API to remotely access signal centric hardware. Client-side only! Courtesy of Wireless Lab @ UCLA & Prof. Ian Roberts."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "GPL-3.0-or-later"
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"""Convenience wrapper for application integrations on an owning USRP root.
|
|
2
|
+
|
|
3
|
+
Wraps an existing ``MultiUSRP`` (never a token) and its seven
|
|
4
|
+
``integration_*`` methods::
|
|
5
|
+
|
|
6
|
+
with OaiGnb(radio) as gnb: # starts, waits for RUNNING, stops on exit
|
|
7
|
+
print(gnb.health())
|
|
8
|
+
|
|
9
|
+
Before ``start`` set configuration as attributes (``app.band = 41``). Declared
|
|
10
|
+
actions are methods (``app.capture(n=4096)``). Every start/call request key is
|
|
11
|
+
generated once and reused when the RPC is retried after a lost reply.
|
|
12
|
+
"""
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import base64
|
|
16
|
+
import json
|
|
17
|
+
import time
|
|
18
|
+
import uuid
|
|
19
|
+
|
|
20
|
+
import numpy as np
|
|
21
|
+
|
|
22
|
+
# Must not exceed remoterf_device_core.integrations.artifacts.MAX_FETCH_BYTES.
|
|
23
|
+
MAX_FETCH_BYTES = 384 * 1024
|
|
24
|
+
POLL_S = 0.2
|
|
25
|
+
# Longer than the server's largest per-integration action timeout (600 s).
|
|
26
|
+
CALL_WAIT_S = 660.0
|
|
27
|
+
_DONE = {"SUCCEEDED", "ERROR", "CANCELLED"}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class IntegrationError(RuntimeError):
|
|
31
|
+
def __init__(self, code, message=None):
|
|
32
|
+
super().__init__(f"{code}: {message}" if message else code)
|
|
33
|
+
self.code = code
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class App:
|
|
37
|
+
def __init__(self, radio, integration_id, profile, **config):
|
|
38
|
+
self.__dict__.update(_radio=radio, _id=integration_id, _profile=profile,
|
|
39
|
+
_config=dict(config), _start=None, _op=None, _actions=None)
|
|
40
|
+
|
|
41
|
+
def __setattr__(self, name, value):
|
|
42
|
+
if name.startswith("_") or hasattr(type(self), name):
|
|
43
|
+
raise AttributeError(f"{name} is reserved; pass it to the constructor instead")
|
|
44
|
+
if self._start is not None:
|
|
45
|
+
raise AttributeError("configuration is fixed once start was requested")
|
|
46
|
+
self._config[name] = value
|
|
47
|
+
|
|
48
|
+
def __getattr__(self, name):
|
|
49
|
+
if name.startswith("_"):
|
|
50
|
+
raise AttributeError(name)
|
|
51
|
+
if name in self._config:
|
|
52
|
+
return self._config[name]
|
|
53
|
+
if name in self.actions:
|
|
54
|
+
return lambda **params: self.call(name, **params)
|
|
55
|
+
raise AttributeError(name)
|
|
56
|
+
|
|
57
|
+
@property
|
|
58
|
+
def actions(self):
|
|
59
|
+
if self._actions is None:
|
|
60
|
+
described = self._rpc("integration_describe", {"integration_id": self._id})
|
|
61
|
+
self.__dict__["_actions"] = tuple(described["integration"]["actions"])
|
|
62
|
+
return self._actions
|
|
63
|
+
|
|
64
|
+
@property
|
|
65
|
+
def operation_id(self):
|
|
66
|
+
return self._op
|
|
67
|
+
|
|
68
|
+
def _rpc(self, method, request):
|
|
69
|
+
"""A server refusal carries details.integration_code; raise it as IntegrationError."""
|
|
70
|
+
try:
|
|
71
|
+
return getattr(self._radio, method)(request)
|
|
72
|
+
except Exception as exc:
|
|
73
|
+
details = getattr(exc, "details", None)
|
|
74
|
+
code = details.get("integration_code") if isinstance(details, dict) else None
|
|
75
|
+
if code:
|
|
76
|
+
raise IntegrationError(code, str(exc)) from exc
|
|
77
|
+
raise
|
|
78
|
+
|
|
79
|
+
def _send(self, method, request):
|
|
80
|
+
# Same request (and key) on retry: the server attaches to the recorded outcome.
|
|
81
|
+
# Only transport failures are retried; a refusal would just be refused again.
|
|
82
|
+
try:
|
|
83
|
+
return self._rpc(method, request)
|
|
84
|
+
except IntegrationError:
|
|
85
|
+
raise
|
|
86
|
+
except Exception:
|
|
87
|
+
return self._rpc(method, request)
|
|
88
|
+
|
|
89
|
+
def _poll(self, request, done, timeout_s):
|
|
90
|
+
deadline = time.monotonic() + timeout_s
|
|
91
|
+
while True:
|
|
92
|
+
snapshot = self._rpc("integration_status", request)
|
|
93
|
+
if done(snapshot):
|
|
94
|
+
return snapshot
|
|
95
|
+
if time.monotonic() >= deadline:
|
|
96
|
+
raise TimeoutError(f"integration did not finish within {timeout_s} s")
|
|
97
|
+
time.sleep(POLL_S)
|
|
98
|
+
|
|
99
|
+
def start(self, timeout_s=120.0, wait=True):
|
|
100
|
+
if self._start is None:
|
|
101
|
+
generation = self._rpc("integration_list", {})["generation"]
|
|
102
|
+
self.__dict__["_start"] = {"integration_id": self._id, "profile": self._profile,
|
|
103
|
+
"configuration": dict(self._config),
|
|
104
|
+
"request_key": uuid.uuid4().hex, "generation": generation}
|
|
105
|
+
snapshot = self._send("integration_start", self._start)
|
|
106
|
+
self.__dict__["_op"] = snapshot["operation_id"]
|
|
107
|
+
if not wait:
|
|
108
|
+
return snapshot
|
|
109
|
+
snapshot = self._poll({"operation_id": self._op},
|
|
110
|
+
lambda s: s["state"] != "STARTING", timeout_s)
|
|
111
|
+
if snapshot["state"] != "RUNNING":
|
|
112
|
+
raise IntegrationError(snapshot.get("error") or snapshot["state"])
|
|
113
|
+
return snapshot
|
|
114
|
+
|
|
115
|
+
def status(self):
|
|
116
|
+
return self._rpc("integration_status", {"operation_id": self._require()})
|
|
117
|
+
|
|
118
|
+
def _require(self):
|
|
119
|
+
if self._op is None:
|
|
120
|
+
raise IntegrationError("not_started")
|
|
121
|
+
return self._op
|
|
122
|
+
|
|
123
|
+
def call(self, action, /, **params):
|
|
124
|
+
operation_id = self._require()
|
|
125
|
+
request = {"operation_id": operation_id, "action": action,
|
|
126
|
+
"parameters": params, "request_key": uuid.uuid4().hex}
|
|
127
|
+
snapshot = self._send("integration_call", request)
|
|
128
|
+
snapshot = self._poll({"operation_id": operation_id, "action_id": snapshot["action_id"]},
|
|
129
|
+
lambda s: s["state"] in _DONE, CALL_WAIT_S)
|
|
130
|
+
if snapshot["state"] != "SUCCEEDED":
|
|
131
|
+
raise IntegrationError(snapshot.get("error") or snapshot["state"])
|
|
132
|
+
return self._decode(snapshot["result"])
|
|
133
|
+
|
|
134
|
+
def _decode(self, result):
|
|
135
|
+
"""An "artifact" entry is fetched and decoded in place; alone, it is returned directly."""
|
|
136
|
+
artifact = result.get("artifact") if isinstance(result, dict) else None
|
|
137
|
+
if not isinstance(artifact, dict) or "name" not in artifact:
|
|
138
|
+
return result
|
|
139
|
+
data = self.fetch(artifact["name"])
|
|
140
|
+
if "dtype" in artifact:
|
|
141
|
+
value = np.frombuffer(data, dtype=artifact["dtype"]).reshape(artifact["shape"])
|
|
142
|
+
elif artifact.get("format") == "json":
|
|
143
|
+
value = json.loads(data)
|
|
144
|
+
elif artifact.get("format") in {"bytes", "pcap"}:
|
|
145
|
+
value = data
|
|
146
|
+
else:
|
|
147
|
+
return result
|
|
148
|
+
return value if len(result) == 1 else {**result, "artifact": value}
|
|
149
|
+
|
|
150
|
+
def fetch(self, name):
|
|
151
|
+
operation_id, data = self._require(), bytearray()
|
|
152
|
+
while True:
|
|
153
|
+
chunk = self._rpc("integration_fetch", {"operation_id": operation_id, "artifact": name,
|
|
154
|
+
"offset": len(data), "limit": MAX_FETCH_BYTES})
|
|
155
|
+
raw = base64.b64decode(chunk["data"])
|
|
156
|
+
data += raw
|
|
157
|
+
if chunk["eof"]:
|
|
158
|
+
return bytes(data)
|
|
159
|
+
if not raw:
|
|
160
|
+
raise IntegrationError("fetch_stalled")
|
|
161
|
+
|
|
162
|
+
def stop(self, timeout_s=120.0):
|
|
163
|
+
if self._op is None:
|
|
164
|
+
return None
|
|
165
|
+
self._rpc("integration_stop", {"operation_id": self._op})
|
|
166
|
+
return self._poll({"operation_id": self._op}, lambda s: s["released"], timeout_s)
|
|
167
|
+
|
|
168
|
+
def __enter__(self):
|
|
169
|
+
if self._op is None:
|
|
170
|
+
self.start()
|
|
171
|
+
return self
|
|
172
|
+
|
|
173
|
+
def __exit__(self, *exc):
|
|
174
|
+
self.stop()
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class OaiGnb(App):
|
|
178
|
+
def __init__(self, radio, **config):
|
|
179
|
+
super().__init__(radio, "org.remoterf.oai", "gnb", **config)
|
|
180
|
+
|
|
181
|
+
start_cell = App.start
|
|
182
|
+
stop_cell = App.stop
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
class OaiUe(App):
|
|
186
|
+
def __init__(self, radio, **config):
|
|
187
|
+
super().__init__(radio, "org.remoterf.oai", "ue", **config)
|
|
188
|
+
|
|
189
|
+
attach = App.start
|
|
190
|
+
detach = App.stop
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: remoterf
|
|
3
|
-
Version: 2.13.
|
|
3
|
+
Version: 2.13.15
|
|
4
4
|
Summary: A python API to remotely access signal centric hardware. Client-side only! Courtesy of Wireless Lab @ UCLA & Prof. Ian Roberts.
|
|
5
5
|
Author-email: Ethan Ge <84103791+ethange1@users.noreply.github.com>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -9,6 +9,7 @@ src/remoterf/admin.py
|
|
|
9
9
|
src/remoterf/agent_cli.py
|
|
10
10
|
src/remoterf/agent_docs.py
|
|
11
11
|
src/remoterf/api.py
|
|
12
|
+
src/remoterf/integrations.py
|
|
12
13
|
src/remoterf/mcp_server.py
|
|
13
14
|
src/remoterf/ops.py
|
|
14
15
|
src/remoterf/remoterf_cli.py
|
|
@@ -126,6 +127,7 @@ tests/test_gate_i_direct_path.py
|
|
|
126
127
|
tests/test_grpc_client_target.py
|
|
127
128
|
tests/test_homes.py
|
|
128
129
|
tests/test_integration_schema.py
|
|
130
|
+
tests/test_integrations_helper.py
|
|
129
131
|
tests/test_lan_fallback.py
|
|
130
132
|
tests/test_mcp_server.py
|
|
131
133
|
tests/test_messages.py
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import base64
|
|
2
|
+
import json
|
|
3
|
+
|
|
4
|
+
import numpy as np
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from remoterf import integrations
|
|
8
|
+
from remoterf.integrations import App, IntegrationError, OaiGnb, OaiUe
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class FakeRadio:
|
|
12
|
+
"""In-memory integration_* dict API; no network."""
|
|
13
|
+
|
|
14
|
+
def __init__(self, actions=("health", "capture", "dump", "load_l1_plugin"), fail_once=()):
|
|
15
|
+
self.actions = list(actions)
|
|
16
|
+
self.fail_once = set(fail_once)
|
|
17
|
+
self.requests = []
|
|
18
|
+
self.starts = {}
|
|
19
|
+
self.calls = {}
|
|
20
|
+
self.artifacts = {}
|
|
21
|
+
self.start_state = "RUNNING"
|
|
22
|
+
self.released = False
|
|
23
|
+
|
|
24
|
+
def _record(self, method, request):
|
|
25
|
+
self.requests.append((method, request))
|
|
26
|
+
if method in self.fail_once:
|
|
27
|
+
self.fail_once.discard(method)
|
|
28
|
+
raise ConnectionError("lost reply")
|
|
29
|
+
|
|
30
|
+
def integration_list(self, request):
|
|
31
|
+
self._record("integration_list", request)
|
|
32
|
+
return {"generation": 3, "integrations": []}
|
|
33
|
+
|
|
34
|
+
def integration_describe(self, request):
|
|
35
|
+
self._record("integration_describe", request)
|
|
36
|
+
return {"integration": {"id": request["integration_id"], "actions": self.actions}}
|
|
37
|
+
|
|
38
|
+
def integration_start(self, request):
|
|
39
|
+
self._record("integration_start", request)
|
|
40
|
+
op = self.starts.setdefault(request["request_key"], f"op-{len(self.starts)}")
|
|
41
|
+
return {"operation_id": op, "state": "STARTING"}
|
|
42
|
+
|
|
43
|
+
def integration_status(self, request):
|
|
44
|
+
self._record("integration_status", request)
|
|
45
|
+
if "action_id" in request:
|
|
46
|
+
action, params = self.calls[request["action_id"]]
|
|
47
|
+
if action == "fail":
|
|
48
|
+
return {"state": "ERROR", "error": "action_failed", "result": {}}
|
|
49
|
+
return {"state": "SUCCEEDED", "error": None, "result": self.result(action, params)}
|
|
50
|
+
return {"operation_id": request["operation_id"], "state": self.start_state,
|
|
51
|
+
"error": "process_exited" if self.start_state == "ERROR" else None,
|
|
52
|
+
"released": self.released}
|
|
53
|
+
|
|
54
|
+
def result(self, action, params):
|
|
55
|
+
if action == "capture":
|
|
56
|
+
self.artifacts["iq.bin"] = np.arange(params["n"], dtype=np.complex64).tobytes()
|
|
57
|
+
return {"artifact": {"name": "iq.bin", "dtype": "complex64", "shape": [params["n"]]}}
|
|
58
|
+
if action == "dump":
|
|
59
|
+
self.artifacts["x.json"] = json.dumps({"ok": 1}).encode()
|
|
60
|
+
return {"returncode": 0, "artifact": {"name": "x.json", "format": "json"}}
|
|
61
|
+
return {"action": action, "params": params}
|
|
62
|
+
|
|
63
|
+
def integration_call(self, request):
|
|
64
|
+
self._record("integration_call", request)
|
|
65
|
+
action_id = f"a-{request['request_key']}"
|
|
66
|
+
self.calls[action_id] = (request["action"], request["parameters"])
|
|
67
|
+
return {"action_id": action_id, "state": "QUEUED"}
|
|
68
|
+
|
|
69
|
+
def integration_fetch(self, request):
|
|
70
|
+
self._record("integration_fetch", request)
|
|
71
|
+
data = self.artifacts[request["artifact"]]
|
|
72
|
+
chunk = data[request["offset"]:request["offset"] + min(request["limit"], 1000)]
|
|
73
|
+
return {"data": base64.b64encode(chunk).decode(),
|
|
74
|
+
"eof": request["offset"] + len(chunk) >= len(data)}
|
|
75
|
+
|
|
76
|
+
def integration_stop(self, request):
|
|
77
|
+
self._record("integration_stop", request)
|
|
78
|
+
self.released = True
|
|
79
|
+
return {"operation_id": request["operation_id"], "state": "STOPPING"}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@pytest.fixture(autouse=True)
|
|
83
|
+
def fast_poll(monkeypatch):
|
|
84
|
+
monkeypatch.setattr(integrations, "POLL_S", 0)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def test_lifecycle_config_actions_and_artifacts():
|
|
88
|
+
radio = FakeRadio()
|
|
89
|
+
app = App(radio, "org.example.app", "receive", rate=1)
|
|
90
|
+
app.band = 41
|
|
91
|
+
assert app.band == 41
|
|
92
|
+
with pytest.raises(AttributeError):
|
|
93
|
+
app.status = 1
|
|
94
|
+
|
|
95
|
+
with app:
|
|
96
|
+
start = next(r for m, r in radio.requests if m == "integration_start")
|
|
97
|
+
assert start["configuration"] == {"rate": 1, "band": 41} and start["generation"] == 3
|
|
98
|
+
with pytest.raises(AttributeError):
|
|
99
|
+
app.band = 7
|
|
100
|
+
assert app.health(x=1) == {"action": "health", "params": {"x": 1}}
|
|
101
|
+
iq = app.capture(n=600)
|
|
102
|
+
assert iq.dtype == np.complex64 and np.array_equal(iq, np.arange(600, dtype=np.complex64))
|
|
103
|
+
assert app.dump() == {"returncode": 0, "artifact": {"ok": 1}}
|
|
104
|
+
with pytest.raises(AttributeError):
|
|
105
|
+
app.not_declared
|
|
106
|
+
with pytest.raises(IntegrationError, match="action_failed"):
|
|
107
|
+
app.call("fail")
|
|
108
|
+
assert radio.released
|
|
109
|
+
assert all(r["limit"] == integrations.MAX_FETCH_BYTES
|
|
110
|
+
for m, r in radio.requests if m == "integration_fetch")
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def test_request_keys_reused_on_retry():
|
|
114
|
+
radio = FakeRadio(fail_once={"integration_start", "integration_call"})
|
|
115
|
+
app = App(radio, "org.example.app", "receive")
|
|
116
|
+
app.start()
|
|
117
|
+
app.call("health")
|
|
118
|
+
for method in ("integration_start", "integration_call"):
|
|
119
|
+
keys = [r["request_key"] for m, r in radio.requests if m == method]
|
|
120
|
+
assert len(keys) == 2 and keys[0] == keys[1]
|
|
121
|
+
assert len(radio.starts) == 1
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def test_start_failure_raises_error_code():
|
|
125
|
+
radio = FakeRadio()
|
|
126
|
+
radio.start_state = "ERROR"
|
|
127
|
+
with pytest.raises(IntegrationError) as err:
|
|
128
|
+
App(radio, "org.example.app", "receive").start()
|
|
129
|
+
assert err.value.code == "process_exited"
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def test_oai_subclasses_and_aliases():
|
|
133
|
+
radio = FakeRadio()
|
|
134
|
+
gnb = OaiGnb(radio)
|
|
135
|
+
gnb.start_cell()
|
|
136
|
+
assert radio.requests[-2][1]["profile"] == "gnb"
|
|
137
|
+
assert gnb.load_l1_plugin(stage="pre_fft", c_code="int x;")["params"]["stage"] == "pre_fft"
|
|
138
|
+
gnb.stop_cell()
|
|
139
|
+
ue = OaiUe(FakeRadio())
|
|
140
|
+
ue.attach(wait=False)
|
|
141
|
+
assert ue._start["integration_id"] == "org.remoterf.oai" and ue._start["profile"] == "ue"
|
|
142
|
+
ue.detach()
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
class Refused(Exception):
|
|
146
|
+
"""Shape of RemoteRFProtocolError for a server-side integration refusal."""
|
|
147
|
+
|
|
148
|
+
def __init__(self, code):
|
|
149
|
+
super().__init__("application integrations are disabled")
|
|
150
|
+
self.details = {"integration_code": code}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def test_server_refusal_becomes_integration_error_without_retry():
|
|
154
|
+
radio = FakeRadio()
|
|
155
|
+
|
|
156
|
+
def refuse(request):
|
|
157
|
+
radio._record("integration_start", request)
|
|
158
|
+
raise Refused("integration_disabled")
|
|
159
|
+
|
|
160
|
+
radio.integration_start = refuse
|
|
161
|
+
with pytest.raises(IntegrationError) as caught:
|
|
162
|
+
OaiGnb(radio).start_cell(timeout_s=1)
|
|
163
|
+
assert caught.value.code == "integration_disabled"
|
|
164
|
+
assert "application integrations are disabled" in str(caught.value)
|
|
165
|
+
assert [m for m, _ in radio.requests].count("integration_start") == 1
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def test_refusal_on_status_poll_is_mapped_too():
|
|
169
|
+
radio = FakeRadio()
|
|
170
|
+
app = App(radio, "org.example.fake", "test")
|
|
171
|
+
app.start(timeout_s=1)
|
|
172
|
+
|
|
173
|
+
def refuse(request):
|
|
174
|
+
raise Refused("unknown_operation")
|
|
175
|
+
|
|
176
|
+
radio.integration_status = refuse
|
|
177
|
+
with pytest.raises(IntegrationError) as caught:
|
|
178
|
+
app.status()
|
|
179
|
+
assert caught.value.code == "unknown_operation"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/grpc/deployment_capabilities.proto
RENAMED
|
File without changes
|
{remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/grpc/deployment_capabilities_pb2.py
RENAMED
|
File without changes
|
{remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/common/grpc/deployment_capabilities_pb2_grpc.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/adalm_pluto/adalm_pluto_remote.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{remoterf-2.13.13 → remoterf-2.13.15}/src/remoterf/drivers/rfbeam_kmd7/rfbeam_kmd7_remote.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|