RemoteRF 2.13.1__tar.gz → 2.13.2__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.1/src/remoterf.egg-info → remoterf-2.13.2}/PKG-INFO +1 -1
- {remoterf-2.13.1 → remoterf-2.13.2}/pyproject.toml +1 -1
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/core/app.py +5 -5
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/core/direct_path.py +4 -4
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/core/grpc_acc.py +2 -2
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/core/grpc_client.py +16 -7
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/data/agent_guide.md +2 -1
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/deployment/backend.py +5 -3
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/dynamic_device.py +1 -1
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/ops.py +4 -3
- {remoterf-2.13.1 → remoterf-2.13.2/src/remoterf.egg-info}/PKG-INFO +1 -1
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_device_routes.py +22 -11
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_direct_path_global.py +5 -4
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_federated_devices.py +3 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_ops.py +2 -2
- {remoterf-2.13.1 → remoterf-2.13.2}/LICENSE +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/README.md +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/setup.cfg +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/setup.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/_remoterf_alias.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/admin.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/agent_cli.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/agent_docs.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/common/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/common/grpc/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/common/grpc/deployment_capabilities.proto +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/common/grpc/deployment_capabilities_pb2.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/common/grpc/deployment_capabilities_pb2_grpc.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/common/grpc/grpc.proto +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/common/grpc/grpc_pb2.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/common/grpc/grpc_pb2_grpc.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/common/grpc/v2_codec.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/common/tos_notice.txt +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/common/utils/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/common/utils/ansi_codes.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/common/utils/api_token.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/common/utils/banner.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/common/utils/list_string.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/common/utils/process_arg.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/config/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/config/cert_fetcher.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/config/config.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/core/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/core/acc_login.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/core/availability.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/core/banner_note.txt +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/core/dynamic_v2_transport.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/core/messages.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/core/secure_channel.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/core/v2_errors.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/data/mcp_tools.json +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/deployment/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/deployment/direct.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/deployment/homes.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/deployment/http.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/deployment/lanpass.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/deployment/state.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/_virtual.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/adalm_pluto/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/adalm_pluto/adalm_pluto_remote.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/dynamic_v2.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/hackrf/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/hackrf/hackrf_remote.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/rtl_sdr/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/rtl_sdr/rtl_sdr_remote.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/schema_review.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/sim_sdr/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/sim_sdr/sim_sdr_remote.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/support/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/support/ti_mmwave.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/support/uhd.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/support/uhd_dsp.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/support/uhd_v2.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/ti_mmwave/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/ti_mmwave/ti_mmwave_remote.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/usrp/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/usrp/usrp_remote.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/drivers/usrp/usrp_remote.pyi +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/mcp_server.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/remoterf_cli.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf/version.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf.egg-info/SOURCES.txt +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf.egg-info/dependency_links.txt +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf.egg-info/entry_points.txt +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf.egg-info/requires.txt +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf.egg-info/top_level.txt +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/src/remoterf.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_agent_cli.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_agent_docs.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_banner.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_batch.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_bundled_drivers.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_cli_login_fresh.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_config_address.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_deployment_accounts.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_devices_api.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_direct_path_fixed.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_direct_path_partner.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_direct_path_race.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_direct_path_relay.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_dynamic_device_codegen.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_dynamic_v2.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_fetch_idl_fallback.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_finish_prompt.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_gate_i_direct_path.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_grpc_client_target.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_homes.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_lan_fallback.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_mcp_server.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_messages.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_native_account_credentials.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_native_devices.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_old_import_name.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_partner_dynamic_v2.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_pluto_virtual.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_process_arg.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_relay_paging.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_remote_admin.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_remoterf_cli.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_rx_readahead.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_schema_review.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/tests/test_ti_mmwave.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.2}/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.2
|
|
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.2"
|
|
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"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# You should have received a copy of the GNU General Public License
|
|
14
14
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
15
15
|
|
|
16
|
-
from remoterf.core.grpc_client import addr as server_addr, handle_admin_command, _key
|
|
16
|
+
from remoterf.core.grpc_client import addr as server_addr, handle_admin_command, _key, is_global_token
|
|
17
17
|
from . import *
|
|
18
18
|
from ..common.utils import *
|
|
19
19
|
|
|
@@ -154,7 +154,7 @@ def _native_label(label):
|
|
|
154
154
|
|
|
155
155
|
|
|
156
156
|
def _print_reserved(where, when, token, handle, logged_in_to, install, no_handle=_NO_HANDLE):
|
|
157
|
-
"""The token and, when the device has one, its handle (
|
|
157
|
+
"""The token and, when the device has one, its handle (Name@<deployment>).
|
|
158
158
|
Boxed before the driver install, which can fail or stall; the usage box
|
|
159
159
|
follows it, once the device type is known. `no_handle`: why no handle is
|
|
160
160
|
shown."""
|
|
@@ -850,15 +850,15 @@ def _federated_reserve_slot(device_id, chosen_day, chosen_slot, slot_start_str,
|
|
|
850
850
|
return
|
|
851
851
|
when = _format_reservation_range(*chosen_slot)
|
|
852
852
|
install = lambda: account.install_reserved_driver(token, device_id)
|
|
853
|
-
slug = _global_slug(device_id, deployment_name) if token
|
|
853
|
+
slug = _global_slug(device_id, deployment_name) if is_global_token(token) else None
|
|
854
854
|
label = _device_label(device_name, device_handle, slug or deployment_name)
|
|
855
|
-
if not token
|
|
855
|
+
if not is_global_token(token):
|
|
856
856
|
# An older Global: the HOME reference goes where a token goes.
|
|
857
857
|
_panel("Reserved", [(label, (Sty.BOLD, Sty.MAGENTA), f" {when}", Sty.CYAN), (),
|
|
858
858
|
("Token ", Sty.BOLD, token, (Sty.BOLD, Sty.GREEN))])
|
|
859
859
|
_print_usage(install(), token)
|
|
860
860
|
return
|
|
861
|
-
_print_reserved(label, when,
|
|
861
|
+
_print_reserved(label, when, token,
|
|
862
862
|
f"{device_handle}@{slug}" if device_handle and slug else None, "RemoteRF Global", install,
|
|
863
863
|
_UNROUTABLE.format(device_handle, "this deployment's Global name is unknown") if device_handle else _NO_HANDLE)
|
|
864
864
|
|
|
@@ -23,7 +23,7 @@ punch fails or the path dies, calls fall back to gRPC; a Global host relay is
|
|
|
23
23
|
tried first after both QUIC paths fail. A path that died is retried after 30 s,
|
|
24
24
|
a failed attempt only once a device call wants it.
|
|
25
25
|
Signaling is ACC:direct_offer over the channel the client already has. See
|
|
26
|
-
RemoteRF-Server docs/gate-i-direct-path.md. A Global device ref or
|
|
26
|
+
RemoteRF-Server docs/gate-i-direct-path.md. A Global device ref or Global
|
|
27
27
|
token signals through Global instead (global_path).
|
|
28
28
|
|
|
29
29
|
A partner lab's device (one the home lists on a federation agreement) gets a
|
|
@@ -896,12 +896,12 @@ def _partner(token: str) -> Optional[DirectPath]:
|
|
|
896
896
|
|
|
897
897
|
|
|
898
898
|
def _global_offer(ref: str, deployment_id: Optional[str]) -> Callable[[dict], dict]:
|
|
899
|
-
"""The offer through Global:
|
|
899
|
+
"""The offer through Global: a Global token is its own credential, a ref takes the login."""
|
|
900
900
|
def send(offer: dict) -> dict:
|
|
901
901
|
from ..deployment.http import AccountBackendError
|
|
902
902
|
from . import grpc_client
|
|
903
903
|
|
|
904
|
-
backend = grpc_client._token_backend() if
|
|
904
|
+
backend = grpc_client._token_backend() if grpc_client.is_global_token(ref) else grpc_client.federated_backend()
|
|
905
905
|
try:
|
|
906
906
|
answer = json.loads(backend.device_direct(ref, deployment_id, json.dumps(offer)))
|
|
907
907
|
except AccountBackendError as exc:
|
|
@@ -917,7 +917,7 @@ def _global_offer(ref: str, deployment_id: Optional[str]) -> Callable[[dict], di
|
|
|
917
917
|
|
|
918
918
|
|
|
919
919
|
def global_path(ref: str, deployment_id: Optional[str] = None) -> Optional[DirectPath]:
|
|
920
|
-
"""The path to the lab behind a Global device ref or
|
|
920
|
+
"""The path to the lab behind a Global device ref or Global token,
|
|
921
921
|
signaled through Global, when it is ready for this call."""
|
|
922
922
|
if not enabled():
|
|
923
923
|
return None
|
|
@@ -129,7 +129,7 @@ class RemoteRFAccount:
|
|
|
129
129
|
if self.is_https_home:
|
|
130
130
|
with self._busy("Reserving…"):
|
|
131
131
|
reservation = self.backend.reserve(device_id, int(start_time.timestamp()), int(end_time.timestamp()))
|
|
132
|
-
# Global's device API token
|
|
132
|
+
# Global's device API token, else (an older Global) the
|
|
133
133
|
# HOME reference, which also drives: adi.Pluto("<deployment>:<id>")
|
|
134
134
|
return reservation.get('token') or reservation['device_id']
|
|
135
135
|
username, credential_secret = self._rpc_credentials()
|
|
@@ -148,7 +148,7 @@ class RemoteRFAccount:
|
|
|
148
148
|
try:
|
|
149
149
|
from ..drivers.dynamic_device import install_driver
|
|
150
150
|
if self.is_https_home:
|
|
151
|
-
# By the ref, which needs no live slot (
|
|
151
|
+
# By the ref, which needs no live slot (a Global token does).
|
|
152
152
|
return install_driver(device_id=device_id).name
|
|
153
153
|
return install_driver(token=handle, device_id=device_id).name
|
|
154
154
|
except Exception as e:
|
|
@@ -189,6 +189,15 @@ def get_tcp_calls():
|
|
|
189
189
|
# relayed through the HOME; the response is the destination's ordinary
|
|
190
190
|
# GenericRPCResponse, so generated drivers do not know the difference.
|
|
191
191
|
|
|
192
|
+
_GLOBAL_TOKEN = re.compile(r"[a-z0-9]{12}")
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def is_global_token(s) -> bool:
|
|
196
|
+
"""A Global device token: 12 lowercase letters and digits, or a legacy
|
|
197
|
+
``rfg_`` one. A lab token is 11 characters, so it never matches."""
|
|
198
|
+
return isinstance(s, str) and (s.startswith("rfg_") or _GLOBAL_TOKEN.fullmatch(s) is not None)
|
|
199
|
+
|
|
200
|
+
|
|
192
201
|
_federated_backend = None
|
|
193
202
|
# A direct-path thread may ask at the same moment: two backends would each
|
|
194
203
|
# refresh the stored session, and Global revokes a replayed refresh token.
|
|
@@ -227,7 +236,7 @@ def _federated_ref(function_name, args):
|
|
|
227
236
|
|
|
228
237
|
|
|
229
238
|
def _federated_call(route, function_name, args):
|
|
230
|
-
"""Relay through Global:
|
|
239
|
+
"""Relay through Global: a Global token needs no login, a ref the bearer."""
|
|
231
240
|
from ..deployment.http import AccountBackendError
|
|
232
241
|
ref = getattr(route, "wire", route)
|
|
233
242
|
# A driver schema always takes the relay, in one piece: Global screens each one it carries.
|
|
@@ -246,7 +255,7 @@ def _federated_call(route, function_name, args):
|
|
|
246
255
|
if not refused:
|
|
247
256
|
return response
|
|
248
257
|
def send(request):
|
|
249
|
-
if ref
|
|
258
|
+
if is_global_token(ref):
|
|
250
259
|
return _token_backend().device_token_rpc(
|
|
251
260
|
ref, getattr(route, "deployment_id", None), request.SerializeToString()
|
|
252
261
|
)
|
|
@@ -274,7 +283,7 @@ def _federated_call(route, function_name, args):
|
|
|
274
283
|
"768 KiB limit for one call and this deployment does not page it; read fewer "
|
|
275
284
|
"samples per call (about 98k complex64) or use a direct path"
|
|
276
285
|
) from None
|
|
277
|
-
if ref
|
|
286
|
+
if is_global_token(ref) and str(exc) == "not_found":
|
|
278
287
|
raise RuntimeError(
|
|
279
288
|
"this RemoteRF Global does not accept device tokens yet; use the device reference"
|
|
280
289
|
) from None
|
|
@@ -298,7 +307,7 @@ _token_backend_cache = None
|
|
|
298
307
|
|
|
299
308
|
|
|
300
309
|
def _token_backend():
|
|
301
|
-
"""Global, unauthenticated:
|
|
310
|
+
"""Global, unauthenticated: a Global token is its own credential."""
|
|
302
311
|
global _token_backend_cache
|
|
303
312
|
if _token_backend_cache is None:
|
|
304
313
|
from ..deployment import homes
|
|
@@ -388,7 +397,7 @@ def _resolve(t):
|
|
|
388
397
|
from remoterf_federation_core import is_global_ref
|
|
389
398
|
|
|
390
399
|
if "@" not in t:
|
|
391
|
-
return DeviceRoute(t, "global" if t
|
|
400
|
+
return DeviceRoute(t, "global" if is_global_token(t) or is_global_ref(t) else "active")
|
|
392
401
|
x, _, dep = t.rpartition("@")
|
|
393
402
|
dep = dep.strip().lower()
|
|
394
403
|
if not x or not dep:
|
|
@@ -848,8 +857,8 @@ def _dispatch(function_name, args, connection):
|
|
|
848
857
|
|
|
849
858
|
def _route_call(route, function_name, args):
|
|
850
859
|
key = "token" if function_name == "IDL:get_drivers" else "a"
|
|
851
|
-
if route.
|
|
852
|
-
# The
|
|
860
|
+
if route.kind == "global" and is_global_token(route.wire):
|
|
861
|
+
# The Global token is Global's credential and goes only in the request body;
|
|
853
862
|
# the frame is relayed to the lab, which pins the device itself.
|
|
854
863
|
args = {**args, key: map_arg("")}
|
|
855
864
|
elif unmap_arg(args[key]) != route.wire:
|
|
@@ -48,7 +48,8 @@ Close the device in `finally`. `adi.Pluto(virtual=True)` simulates a Pluto offli
|
|
|
48
48
|
As a token it works for the logged-in account that holds the reservation, on a machine with that saved login.
|
|
49
49
|
With no live reservation of that account on the device, the client reserves the current slot if it is free
|
|
50
50
|
(`REMOTERF_AUTO_RESERVE=0` turns this off).
|
|
51
|
-
- A Global token `
|
|
51
|
+
- A Global token is a bare 12-character code (for example `k3v9qlw2mxb7`); it works from any machine, with no login.
|
|
52
|
+
Handles are always `Name@deployment`.
|
|
52
53
|
- A deployment's own token (11 characters) works on a machine whose client is set up for that deployment.
|
|
53
54
|
- Every token works only inside its reservation window, from start to end.
|
|
54
55
|
- Drivers take `token=`, and fall back to the `REMOTERF_TOKEN` environment variable. Generated scripts use
|
|
@@ -402,7 +402,7 @@ class HttpsJsonAccountBackend(DeploymentAccountBackend):
|
|
|
402
402
|
)
|
|
403
403
|
|
|
404
404
|
def device_token_rpc(self, token, deployment_id, request_bytes):
|
|
405
|
-
"""Relay one frame on a Global device API token
|
|
405
|
+
"""Relay one frame on a Global device API token: the token
|
|
406
406
|
is the credential, so there is no login and no bearer."""
|
|
407
407
|
|
|
408
408
|
data = {"token": token}
|
|
@@ -433,10 +433,12 @@ class HttpsJsonAccountBackend(DeploymentAccountBackend):
|
|
|
433
433
|
|
|
434
434
|
def device_direct(self, ref, deployment_id, ice):
|
|
435
435
|
"""Signal a direct path to the lab behind ``ref`` (a device ref under
|
|
436
|
-
this login, or
|
|
436
|
+
this login, or a Global token with no login): the ICE offer goes in,
|
|
437
437
|
the lab's signed answer comes back as Global relayed it."""
|
|
438
438
|
|
|
439
|
-
|
|
439
|
+
from ..core.grpc_client import is_global_token
|
|
440
|
+
|
|
441
|
+
if is_global_token(ref):
|
|
440
442
|
data, auth = {"token": ref, "ice": ice}, {}
|
|
441
443
|
if deployment_id is not None:
|
|
442
444
|
data["deployment_id"] = deployment_id
|
|
@@ -95,7 +95,7 @@ def fetch_idl(
|
|
|
95
95
|
from remoterf_federation_core import is_global_ref
|
|
96
96
|
|
|
97
97
|
# A bare HOME-minted device reference is fetched through the same relayed
|
|
98
|
-
# IDL RPC every driver uses;
|
|
98
|
+
# IDL RPC every driver uses; a Global token tries v2 over the relayed device
|
|
99
99
|
# plane first.
|
|
100
100
|
federated = is_global_ref(token) or is_global_ref(device_id)
|
|
101
101
|
if token is not None and device_id is None and prefer_v2 and not federated:
|
|
@@ -27,7 +27,7 @@ from datetime import date, datetime, time, timedelta, timezone
|
|
|
27
27
|
import grpc
|
|
28
28
|
|
|
29
29
|
from .common.utils import map_arg, str_to_list, unmap_arg
|
|
30
|
-
from .core.grpc_client import _key
|
|
30
|
+
from .core.grpc_client import _key, is_global_token
|
|
31
31
|
from .core.messages import explain
|
|
32
32
|
from .deployment.http import AccountBackendError
|
|
33
33
|
|
|
@@ -750,8 +750,9 @@ def reserve(s, handle, start, end, *, reveal_token=False) -> dict:
|
|
|
750
750
|
minutes=int(row.get("max_reservation_time_sec") or 0) // 60 or None,
|
|
751
751
|
days=_days(row.get("max_horizon_sec"))) from exc
|
|
752
752
|
rid, token = reservation["reservation_id"], reservation.get("token")
|
|
753
|
-
#
|
|
754
|
-
|
|
753
|
+
# Global's token is bare and works as is; an older Global issues none,
|
|
754
|
+
# and the handle still works.
|
|
755
|
+
token = token if is_global_token(token) else None
|
|
755
756
|
else:
|
|
756
757
|
before = _native_reservations(s)
|
|
757
758
|
try:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: remoterf
|
|
3
|
-
Version: 2.13.
|
|
3
|
+
Version: 2.13.2
|
|
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
|
|
@@ -24,7 +24,8 @@ from remoterf.deployment.http import JsonTransport
|
|
|
24
24
|
GLOBAL = "550e8400-e29b-41d4-a716-446655440000"
|
|
25
25
|
DEST = "11111111-1111-4111-8111-111111111111"
|
|
26
26
|
REF = f"{DEST}:12"
|
|
27
|
-
RFG = "rfg_" + "A" * 43
|
|
27
|
+
RFG = "rfg_" + "A" * 43 # the legacy shape
|
|
28
|
+
TOKEN = "k3v9qlw2mxb7" # Global's bare 12-character token
|
|
28
29
|
SLOT = (datetime.datetime(2026, 1, 1, 10), datetime.datetime(2026, 1, 1, 11))
|
|
29
30
|
WHEN = ("2026-01-01", "from", "10:00", "AM", "to", "11:00", "AM")
|
|
30
31
|
GET = "pluto:tx_lo:GET"
|
|
@@ -107,6 +108,10 @@ def test_bare_strings_route_as_before(routes):
|
|
|
107
108
|
assert grpc_client.device_route("Zm9vYmFy") == grpc_client.DeviceRoute("Zm9vYmFy", "active")
|
|
108
109
|
assert grpc_client.device_route(REF).kind == "global"
|
|
109
110
|
assert grpc_client.device_route(RFG) == grpc_client.DeviceRoute(RFG, "global")
|
|
111
|
+
assert grpc_client.device_route(TOKEN) == grpc_client.DeviceRoute(TOKEN, "global")
|
|
112
|
+
# A lab token is 11 characters; 12 that are not all lowercase or digits are no Global token.
|
|
113
|
+
for lab in ("Zm9vYmFyAbc", "k3v9qlw2mxb", "K3v9qlw2mxb7", "k3v9qlw2mx-7", "k3v9qlw2mxb7x"):
|
|
114
|
+
assert grpc_client.device_route(lab) == grpc_client.DeviceRoute(lab, "active")
|
|
110
115
|
grpc_client.rpc_client(function_name=GET, args={"a": map_arg("Zm9vYmFy")})
|
|
111
116
|
assert routes.calls == [(GET, {"a": "Zm9vYmFy"})]
|
|
112
117
|
|
|
@@ -118,15 +123,16 @@ def test_raw_tokens_never_auto_reserve(monkeypatch, routes):
|
|
|
118
123
|
assert grpc_client.device_route(RFG).wire == RFG
|
|
119
124
|
|
|
120
125
|
|
|
121
|
-
|
|
126
|
+
@pytest.mark.parametrize("token", [RFG, TOKEN])
|
|
127
|
+
def test_a_bare_global_token_needs_no_login(monkeypatch, routes, token):
|
|
122
128
|
transport = _token_backend(monkeypatch)
|
|
123
|
-
response = grpc_client.rpc_client(function_name=GET, args={"a": map_arg(
|
|
129
|
+
response = grpc_client.rpc_client(function_name=GET, args={"a": map_arg(token)})
|
|
124
130
|
assert unmap_arg(response.results["tx_lo"]) == 7
|
|
125
131
|
method, path = transport.request.call_args.args
|
|
126
132
|
kwargs = transport.request.call_args.kwargs
|
|
127
133
|
assert (method, path) == ("POST", "/v2/deployment/devices/token-rpc")
|
|
128
134
|
assert "access" not in kwargs and set(kwargs["data"]) == {"token", "request_b64"}
|
|
129
|
-
assert kwargs["data"]["token"] ==
|
|
135
|
+
assert kwargs["data"]["token"] == token
|
|
130
136
|
assert routes.calls == []
|
|
131
137
|
|
|
132
138
|
|
|
@@ -150,13 +156,15 @@ def test_rfg_at_deployment_is_bound_to_that_deployment(monkeypatch, routes):
|
|
|
150
156
|
assert routes.calls == []
|
|
151
157
|
|
|
152
158
|
|
|
159
|
+
@pytest.mark.parametrize("token", [RFG, TOKEN])
|
|
153
160
|
@pytest.mark.parametrize("fn, key", [(GET, "a"), ("IDL:get_drivers", "token")])
|
|
154
|
-
def
|
|
161
|
+
def test_the_global_token_never_leaves_global(monkeypatch, routes, fn, key, token):
|
|
155
162
|
transport = _token_backend(monkeypatch)
|
|
156
|
-
grpc_client.rpc_client(function_name=fn, args={key: map_arg(
|
|
163
|
+
grpc_client.rpc_client(function_name=fn, args={key: map_arg(token)})
|
|
157
164
|
data = transport.request.call_args.kwargs["data"]
|
|
158
165
|
sent = grpc_pb2.GenericRPCRequest.FromString(base64.b64decode(data["request_b64"]))
|
|
159
|
-
assert data["token"] ==
|
|
166
|
+
assert data["token"] == token and unmap_arg(sent.args[key]) == ""
|
|
167
|
+
assert routes.calls == []
|
|
160
168
|
|
|
161
169
|
|
|
162
170
|
def test_an_old_global_says_it_takes_no_device_tokens(monkeypatch, routes):
|
|
@@ -175,6 +183,9 @@ def test_a_handle_without_a_saved_login_is_a_plain_token(monkeypatch, routes):
|
|
|
175
183
|
_login(monkeypatch, None)
|
|
176
184
|
grpc_client.rpc_client(function_name=GET, args={"a": map_arg("PlutoA@ucla")})
|
|
177
185
|
assert routes.calls == [(GET, {"a": "PlutoA"})]
|
|
186
|
+
# With an @ it is a handle, even when the name has a Global token's shape.
|
|
187
|
+
grpc_client.rpc_client(function_name=GET, args={"a": map_arg(f"{TOKEN}@ucla")})
|
|
188
|
+
assert routes.calls[-1] == (GET, {"a": TOKEN})
|
|
178
189
|
|
|
179
190
|
|
|
180
191
|
def test_a_handle_is_exchanged_once_at_the_active_lab(monkeypatch, routes):
|
|
@@ -668,7 +679,7 @@ def test_a_global_reservation_shows_the_token_and_the_handle(monkeypatch):
|
|
|
668
679
|
|
|
669
680
|
lines = _shown(monkeypatch, client_app)
|
|
670
681
|
account = Mock()
|
|
671
|
-
account.reserve_device.return_value =
|
|
682
|
+
account.reserve_device.return_value = TOKEN
|
|
672
683
|
account.install_reserved_driver.return_value = "pluto"
|
|
673
684
|
monkeypatch.setattr(client_app, "account", account)
|
|
674
685
|
monkeypatch.setattr(homes, "discover", lambda host: {"deployment_id": DEST})
|
|
@@ -676,8 +687,8 @@ def test_a_global_reservation_shows_the_token_and_the_handle(monkeypatch):
|
|
|
676
687
|
client_app._federated_reserve_slot(REF, day, SLOT, "10:00", "11:00", deployment_name="UCLA",
|
|
677
688
|
device_name="Pluto SDR", device_handle="PlutoA")
|
|
678
689
|
assert _row(lines, "PlutoA@ucla", *WHEN)
|
|
679
|
-
assert _row(lines, "Token",
|
|
680
|
-
assert any(line.startswith("│ Token
|
|
690
|
+
assert _row(lines, "Token", TOKEN) and _row(lines, "Handle", "PlutoA@ucla") # bare, no @ucla
|
|
691
|
+
assert any(line.startswith(f"│ Token {TOKEN}") for line in lines) # lines up with "Handle "
|
|
681
692
|
assert any("logged in to RemoteRF Global" in line for line in lines)
|
|
682
693
|
# A display name that is not the lab's slug: the bare token, which works
|
|
683
694
|
# as is, and no handle (it needs @<slug> to route).
|
|
@@ -685,7 +696,7 @@ def test_a_global_reservation_shows_the_token_and_the_handle(monkeypatch):
|
|
|
685
696
|
client_app._federated_reserve_slot(REF, day, SLOT, "10:00", "11:00", deployment_name="UCLA Lab",
|
|
686
697
|
device_name="Pluto SDR", device_handle="PlutoA")
|
|
687
698
|
assert _row(lines, "PlutoA@UCLA", "Lab", *WHEN)
|
|
688
|
-
assert _row(lines, "Token",
|
|
699
|
+
assert _row(lines, "Token", TOKEN) and not any("Handle" in line for line in lines)
|
|
689
700
|
assert not any("has no handle" in line for line in lines)
|
|
690
701
|
assert "Its handle PlutoA can't be used from here: this deployment's Global name is unknown" in _text(lines)
|
|
691
702
|
|
|
@@ -88,14 +88,15 @@ def test_non_device_calls_and_REMOTERF_DIRECT_0_stay_on_the_relay(fresh, monkeyp
|
|
|
88
88
|
assert FakePath.instances == [] and fresh.device_rpc.call_count == 2
|
|
89
89
|
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
@pytest.mark.parametrize("token, dep", [(RFG, DEST), ("k3v9qlw2mxb7", None)])
|
|
92
|
+
def test_a_global_token_signals_with_the_token_and_no_bearer(fresh, monkeypatch, token, dep):
|
|
92
93
|
monkeypatch.setattr(grpc_client, "federated_backend", Mock(side_effect=AssertionError("no login")))
|
|
93
|
-
route = grpc_client.DeviceRoute(
|
|
94
|
+
route = grpc_client.DeviceRoute(token, "global", deployment_id=dep)
|
|
94
95
|
grpc_client._federated_call(route, "pluto:rx_lo:GET", {"a": map_arg("")})
|
|
95
96
|
path = FakePath.instances[0]
|
|
96
|
-
assert path.memo ==
|
|
97
|
+
assert path.memo == (dep or token)
|
|
97
98
|
assert path.offer({"id": "x"}) == PIN
|
|
98
|
-
fresh.device_direct.assert_called_once_with(
|
|
99
|
+
fresh.device_direct.assert_called_once_with(token, dep, json.dumps({"id": "x"}))
|
|
99
100
|
|
|
100
101
|
|
|
101
102
|
@pytest.mark.parametrize("code, unavailable", [
|
|
@@ -133,6 +133,9 @@ def test_device_direct_posts_bearer_or_token_body():
|
|
|
133
133
|
assert kwargs["data"] == {"token": rfg, "deployment_id": DEST, "ice": "OFFER"} and "access" not in kwargs
|
|
134
134
|
backend.device_direct(rfg, None, "OFFER")
|
|
135
135
|
assert transport.request.call_args.kwargs["data"] == {"token": rfg, "ice": "OFFER"}
|
|
136
|
+
backend.device_direct("k3v9qlw2mxb7", None, "OFFER") # Global's bare token
|
|
137
|
+
kwargs = transport.request.call_args.kwargs
|
|
138
|
+
assert kwargs["data"] == {"token": "k3v9qlw2mxb7", "ice": "OFFER"} and "access" not in kwargs
|
|
136
139
|
|
|
137
140
|
for bad in ({"provenance": "home", "ice": "x"}, {"provenance": "destination"}, {"provenance": "destination", "ice": 1}):
|
|
138
141
|
transport.request.return_value = bad
|
|
@@ -85,7 +85,7 @@ class Home:
|
|
|
85
85
|
"destinations": [{"deployment_id": DEP, "display_name": "ucla", "status": "ok"}]}
|
|
86
86
|
|
|
87
87
|
def reserve(self, device_id, start, end):
|
|
88
|
-
return {"reservation_id": f"{DEP}:10", "device_id": device_id, "token": "
|
|
88
|
+
return {"reservation_id": f"{DEP}:10", "device_id": device_id, "token": "k3v9qlw2mxb7"}
|
|
89
89
|
|
|
90
90
|
def cancel(self, rid):
|
|
91
91
|
return True
|
|
@@ -233,7 +233,7 @@ def test_lab_reserve_finds_its_id_when_the_lab_is_in_another_zone(lab, monkeypat
|
|
|
233
233
|
|
|
234
234
|
def test_global_reserve_and_reservations(home):
|
|
235
235
|
out = ops.reserve(home, "Pluto_01@ucla", "2026-03-02T15:00:00Z", "2026-03-02T15:30:00Z", reveal_token=True)
|
|
236
|
-
assert (out["reservation_id"], out["token"], out["use_as_token"]) == (f"{DEP}:10", "
|
|
236
|
+
assert (out["reservation_id"], out["token"], out["use_as_token"]) == (f"{DEP}:10", "k3v9qlw2mxb7", "Pluto_01@ucla") # bare, no @ucla
|
|
237
237
|
assert out["start"] == "2026-03-02T15:00:00Z"
|
|
238
238
|
rows = ops.list_reservations(home)["reservations"]
|
|
239
239
|
assert [(r["handle"], r["device"], r["deployment"], r["start"], r["mine"]) for r in rows] == [
|
|
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.1 → remoterf-2.13.2}/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
|
|
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
|