RemoteRF 2.13.1__tar.gz → 2.13.3__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.3}/PKG-INFO +21 -1
- {remoterf-2.13.1 → remoterf-2.13.3}/README.md +20 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/pyproject.toml +1 -1
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/core/app.py +13 -21
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/core/direct_path.py +4 -4
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/core/grpc_acc.py +2 -2
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/core/grpc_client.py +16 -7
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/data/agent_guide.md +2 -1
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/deployment/backend.py +5 -3
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/dynamic_device.py +1 -1
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/ops.py +4 -3
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/remoterf_cli.py +4 -4
- {remoterf-2.13.1 → remoterf-2.13.3/src/remoterf.egg-info}/PKG-INFO +21 -1
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_cli_login_fresh.py +77 -2
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_device_routes.py +22 -11
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_direct_path_global.py +5 -4
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_federated_devices.py +3 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_ops.py +2 -2
- {remoterf-2.13.1 → remoterf-2.13.3}/LICENSE +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/setup.cfg +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/setup.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/_remoterf_alias.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/admin.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/agent_cli.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/agent_docs.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/common/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/common/grpc/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/common/grpc/deployment_capabilities.proto +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/common/grpc/deployment_capabilities_pb2.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/common/grpc/deployment_capabilities_pb2_grpc.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/common/grpc/grpc.proto +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/common/grpc/grpc_pb2.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/common/grpc/grpc_pb2_grpc.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/common/grpc/v2_codec.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/common/tos_notice.txt +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/common/utils/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/common/utils/ansi_codes.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/common/utils/api_token.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/common/utils/banner.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/common/utils/list_string.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/common/utils/process_arg.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/config/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/config/cert_fetcher.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/config/config.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/core/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/core/acc_login.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/core/availability.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/core/banner_note.txt +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/core/dynamic_v2_transport.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/core/messages.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/core/secure_channel.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/core/v2_errors.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/data/mcp_tools.json +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/deployment/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/deployment/direct.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/deployment/homes.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/deployment/http.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/deployment/lanpass.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/deployment/state.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/_virtual.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/adalm_pluto/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/adalm_pluto/adalm_pluto_remote.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/dynamic_v2.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/hackrf/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/hackrf/hackrf_remote.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/rtl_sdr/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/rtl_sdr/rtl_sdr_remote.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/schema_review.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/sim_sdr/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/sim_sdr/sim_sdr_remote.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/support/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/support/ti_mmwave.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/support/uhd.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/support/uhd_dsp.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/support/uhd_v2.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/ti_mmwave/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/ti_mmwave/ti_mmwave_remote.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/usrp/__init__.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/usrp/usrp_remote.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/drivers/usrp/usrp_remote.pyi +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/mcp_server.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf/version.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf.egg-info/SOURCES.txt +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf.egg-info/dependency_links.txt +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf.egg-info/entry_points.txt +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf.egg-info/requires.txt +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf.egg-info/top_level.txt +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/src/remoterf.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_agent_cli.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_agent_docs.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_banner.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_batch.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_bundled_drivers.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_config_address.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_deployment_accounts.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_devices_api.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_direct_path_fixed.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_direct_path_partner.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_direct_path_race.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_direct_path_relay.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_dynamic_device_codegen.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_dynamic_v2.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_fetch_idl_fallback.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_finish_prompt.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_gate_i_direct_path.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_grpc_client_target.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_homes.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_lan_fallback.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_mcp_server.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_messages.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_native_account_credentials.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_native_devices.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_old_import_name.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_partner_dynamic_v2.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_pluto_virtual.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_process_arg.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_relay_paging.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_remote_admin.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_remoterf_cli.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_rx_readahead.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_schema_review.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/tests/test_ti_mmwave.py +0 -0
- {remoterf-2.13.1 → remoterf-2.13.3}/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.3
|
|
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
|
|
@@ -121,6 +121,26 @@ generic native dispatch, but are not release-qualified as exact UHD overload
|
|
|
121
121
|
parity until the server's UHD 4.10 target-introspection and hardware
|
|
122
122
|
differential gates pass.
|
|
123
123
|
|
|
124
|
+
## Wi-Fi
|
|
125
|
+
|
|
126
|
+
USB Wi-Fi clients are generated from the server's `wifi` schema and installed
|
|
127
|
+
under the matching package name:
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
from remoterf.drivers import ensure_driver
|
|
131
|
+
|
|
132
|
+
token = "reservation-token"
|
|
133
|
+
ensure_driver(token=token)
|
|
134
|
+
|
|
135
|
+
from remoterf.drivers.wifi import WifiDongle
|
|
136
|
+
|
|
137
|
+
radio = WifiDongle(token)
|
|
138
|
+
print(radio.scan())
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Existing server inventories that use `device_type: wifi_dongle` are accepted
|
|
142
|
+
as `wifi` during upgrade. New inventory entries should use `device_type: wifi`.
|
|
143
|
+
|
|
124
144
|
## RTL-SDR
|
|
125
145
|
|
|
126
146
|
RTL-SDR clients are generated from the server's `rtl_sdr` schema. The machine
|
|
@@ -94,6 +94,26 @@ generic native dispatch, but are not release-qualified as exact UHD overload
|
|
|
94
94
|
parity until the server's UHD 4.10 target-introspection and hardware
|
|
95
95
|
differential gates pass.
|
|
96
96
|
|
|
97
|
+
## Wi-Fi
|
|
98
|
+
|
|
99
|
+
USB Wi-Fi clients are generated from the server's `wifi` schema and installed
|
|
100
|
+
under the matching package name:
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from remoterf.drivers import ensure_driver
|
|
104
|
+
|
|
105
|
+
token = "reservation-token"
|
|
106
|
+
ensure_driver(token=token)
|
|
107
|
+
|
|
108
|
+
from remoterf.drivers.wifi import WifiDongle
|
|
109
|
+
|
|
110
|
+
radio = WifiDongle(token)
|
|
111
|
+
print(radio.scan())
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Existing server inventories that use `device_type: wifi_dongle` are accepted
|
|
115
|
+
as `wifi` during upgrade. New inventory entries should use `device_type: wifi`.
|
|
116
|
+
|
|
97
117
|
## RTL-SDR
|
|
98
118
|
|
|
99
119
|
RTL-SDR clients are generated from the server's `rtl_sdr` schema. The machine
|
|
@@ -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.3"
|
|
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."""
|
|
@@ -422,15 +422,7 @@ def _account_command(command):
|
|
|
422
422
|
if command in ('forgot-password', 'reset-password'):
|
|
423
423
|
if not account.is_https_home:
|
|
424
424
|
raise AccountBackendError('Contact the local administrator to reset a password')
|
|
425
|
-
|
|
426
|
-
_note("Forgot password", (Sty.BOLD, Sty.BLUE))
|
|
427
|
-
account.backend.forgot(_ask('Email'))
|
|
428
|
-
_note('If eligible, check your email for a password reset token.', Sty.DEFAULT)
|
|
429
|
-
else:
|
|
430
|
-
_panel("Reset password", [("Set a new password with the emailed reset token.", Sty.DEFAULT), (_PASSWORD_HINT, Sty.GRAY)])
|
|
431
|
-
token = _ask('Password reset token', hidden=True)
|
|
432
|
-
account.backend.reset(token, _password_confirmation(enforce_policy=True))
|
|
433
|
-
_note('Password reset. Log in again.', (Sty.BOLD, Sty.GREEN))
|
|
425
|
+
_note('Reset a RemoteRF Global password from your terminal: remoterf --reset-password', Sty.DEFAULT)
|
|
434
426
|
return False
|
|
435
427
|
if command in ('l', 'login'):
|
|
436
428
|
_note(f"Login to {_home_name()}", (Sty.BOLD, Sty.BLUE))
|
|
@@ -454,7 +446,7 @@ def _account_command(command):
|
|
|
454
446
|
_remember_login()
|
|
455
447
|
_sync_labs()
|
|
456
448
|
return ok
|
|
457
|
-
printf('Choose login or register' + ('
|
|
449
|
+
printf('Choose login or register' + (' or verify.' if account.is_https_home else '.'), Sty.WARNING)
|
|
458
450
|
return False
|
|
459
451
|
|
|
460
452
|
|
|
@@ -510,7 +502,8 @@ def welcome(*, show_banner: bool = True, initial=(), route=None):
|
|
|
510
502
|
else:
|
|
511
503
|
prompt = 'Please login or register to continue. (l/r): '
|
|
512
504
|
if account.is_https_home:
|
|
513
|
-
|
|
505
|
+
printf('Forgot your password? Run: remoterf --reset-password', Sty.GRAY)
|
|
506
|
+
prompt = 'Choose register, verify or login: '
|
|
514
507
|
command = session.prompt(stylize(prompt, Sty.DEFAULT)).strip().lower()
|
|
515
508
|
if command in ('exit', 'quit'):
|
|
516
509
|
return False
|
|
@@ -519,7 +512,7 @@ def welcome(*, show_banner: bool = True, initial=(), route=None):
|
|
|
519
512
|
except (AccountBackendError, ValidationError) as exc:
|
|
520
513
|
_error(exc)
|
|
521
514
|
if command in ('l', 'login') and account.is_https_home and getattr(exc, 'code', None) == 'invalid_credentials':
|
|
522
|
-
printf('Forgot your password? Run: remoterf --reset-
|
|
515
|
+
printf('Forgot your password? Run: remoterf --reset-password', Sty.GRAY)
|
|
523
516
|
queue.clear()
|
|
524
517
|
except (KeyboardInterrupt, EOFError):
|
|
525
518
|
return False
|
|
@@ -609,7 +602,6 @@ def commands():
|
|
|
609
602
|
("'logout'", "Log out and forget the stored login"),
|
|
610
603
|
("'status'", "Show connection and device transport status"),
|
|
611
604
|
("'direct on|off'", "Enable or disable direct device transport"),
|
|
612
|
-
*([("'reset-password'", "Set a new password with an emailed token")] if account.is_https_home else []),
|
|
613
605
|
("'exit' or 'quit'", "Exit"),
|
|
614
606
|
]
|
|
615
607
|
width = max(len(name) for name, _ in rows)
|
|
@@ -850,15 +842,15 @@ def _federated_reserve_slot(device_id, chosen_day, chosen_slot, slot_start_str,
|
|
|
850
842
|
return
|
|
851
843
|
when = _format_reservation_range(*chosen_slot)
|
|
852
844
|
install = lambda: account.install_reserved_driver(token, device_id)
|
|
853
|
-
slug = _global_slug(device_id, deployment_name) if token
|
|
845
|
+
slug = _global_slug(device_id, deployment_name) if is_global_token(token) else None
|
|
854
846
|
label = _device_label(device_name, device_handle, slug or deployment_name)
|
|
855
|
-
if not token
|
|
847
|
+
if not is_global_token(token):
|
|
856
848
|
# An older Global: the HOME reference goes where a token goes.
|
|
857
849
|
_panel("Reserved", [(label, (Sty.BOLD, Sty.MAGENTA), f" {when}", Sty.CYAN), (),
|
|
858
850
|
("Token ", Sty.BOLD, token, (Sty.BOLD, Sty.GREEN))])
|
|
859
851
|
_print_usage(install(), token)
|
|
860
852
|
return
|
|
861
|
-
_print_reserved(label, when,
|
|
853
|
+
_print_reserved(label, when, token,
|
|
862
854
|
f"{device_handle}@{slug}" if device_handle and slug else None, "RemoteRF Global", install,
|
|
863
855
|
_UNROUTABLE.format(device_handle, "this deployment's Global name is unknown") if device_handle else _NO_HANDLE)
|
|
864
856
|
|
|
@@ -1740,12 +1732,12 @@ def run(backend=None, *, register=False, enrollment_code=None, server_label=None
|
|
|
1740
1732
|
completer=command_completer,
|
|
1741
1733
|
)
|
|
1742
1734
|
inpu = inpu.strip()
|
|
1743
|
-
if inpu in ('register', 'verify', 'login'
|
|
1735
|
+
if inpu in ('register', 'verify', 'login'):
|
|
1744
1736
|
authenticated = _account_command(inpu)
|
|
1745
1737
|
if inpu == 'login' and authenticated:
|
|
1746
1738
|
session_line()
|
|
1747
|
-
|
|
1748
|
-
|
|
1739
|
+
elif inpu in ('forgot-password', 'reset-password'):
|
|
1740
|
+
_account_command(inpu)
|
|
1749
1741
|
elif inpu == 'refresh':
|
|
1750
1742
|
if not account.is_https_home:
|
|
1751
1743
|
raise AccountBackendError('Local passwords do not use refresh sessions')
|
|
@@ -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:
|
|
@@ -154,7 +154,7 @@ def print_help() -> None:
|
|
|
154
154
|
printf(" remoterf -l | --login [target]", Sty.CYAN, " Login: last used, 'global', a home name, or an account (username@deployment)", Sty.DEFAULT)
|
|
155
155
|
printf(" remoterf -r | --register", Sty.CYAN, " Create a RemoteRF Global account", Sty.DEFAULT)
|
|
156
156
|
printf(" remoterf -r --local-only", Sty.CYAN, " Register at a deployment with an enrollment code", Sty.DEFAULT)
|
|
157
|
-
printf(" remoterf --reset-
|
|
157
|
+
printf(" remoterf --reset-password", Sty.CYAN, " Reset a RemoteRF Global password by email", Sty.DEFAULT)
|
|
158
158
|
printf(" remoterf homes", Sty.CYAN, " List saved deployment homes", Sty.DEFAULT)
|
|
159
159
|
printf(" remoterf --remote-admin [lab]", Sty.CYAN, " Open a lab's remote-admin console (-h for more)", Sty.DEFAULT)
|
|
160
160
|
printf(" remoterf -v | --version", Sty.CYAN, " Print version", Sty.DEFAULT)
|
|
@@ -186,7 +186,7 @@ def print_help() -> None:
|
|
|
186
186
|
print()
|
|
187
187
|
printf("Examples:", (Sty.BOLD, Sty.MAGENTA))
|
|
188
188
|
printf(" remoterf --register --local-only", Sty.GREEN, " then: ucla.global.remoterf.net/QEHN7", Sty.GRAY)
|
|
189
|
-
printf(" remoterf --reset-
|
|
189
|
+
printf(" remoterf --reset-password", Sty.GREEN)
|
|
190
190
|
printf(" remoterf --login ucla", Sty.GREEN)
|
|
191
191
|
printf(" remoterf --login global", Sty.GREEN)
|
|
192
192
|
printf(" remoterf --login jdoe@ucla", Sty.GREEN)
|
|
@@ -593,9 +593,9 @@ def main() -> int:
|
|
|
593
593
|
print("remoterf: --register takes no arguments (or '--local-only')", file=sys.stderr)
|
|
594
594
|
return 2
|
|
595
595
|
|
|
596
|
-
if argv[0]
|
|
596
|
+
if argv[0] == "--reset-password":
|
|
597
597
|
if len(argv) > 1:
|
|
598
|
-
print("remoterf: --reset-
|
|
598
|
+
print("remoterf: --reset-password takes no arguments", file=sys.stderr)
|
|
599
599
|
return 2
|
|
600
600
|
return _reset_password()
|
|
601
601
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: remoterf
|
|
3
|
-
Version: 2.13.
|
|
3
|
+
Version: 2.13.3
|
|
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
|
|
@@ -121,6 +121,26 @@ generic native dispatch, but are not release-qualified as exact UHD overload
|
|
|
121
121
|
parity until the server's UHD 4.10 target-introspection and hardware
|
|
122
122
|
differential gates pass.
|
|
123
123
|
|
|
124
|
+
## Wi-Fi
|
|
125
|
+
|
|
126
|
+
USB Wi-Fi clients are generated from the server's `wifi` schema and installed
|
|
127
|
+
under the matching package name:
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
from remoterf.drivers import ensure_driver
|
|
131
|
+
|
|
132
|
+
token = "reservation-token"
|
|
133
|
+
ensure_driver(token=token)
|
|
134
|
+
|
|
135
|
+
from remoterf.drivers.wifi import WifiDongle
|
|
136
|
+
|
|
137
|
+
radio = WifiDongle(token)
|
|
138
|
+
print(radio.scan())
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Existing server inventories that use `device_type: wifi_dongle` are accepted
|
|
142
|
+
as `wifi` during upgrade. New inventory entries should use `device_type: wifi`.
|
|
143
|
+
|
|
124
144
|
## RTL-SDR
|
|
125
145
|
|
|
126
146
|
RTL-SDR clients are generated from the server's `rtl_sdr` schema. The machine
|
|
@@ -183,15 +183,90 @@ def test_reset_password_uses_the_global_email_code_flow(monkeypatch):
|
|
|
183
183
|
backend.close.assert_called_once_with()
|
|
184
184
|
|
|
185
185
|
|
|
186
|
-
def
|
|
186
|
+
def test_reset_password_dispatches_without_an_existing_login(monkeypatch):
|
|
187
187
|
from remoterf import remoterf_cli
|
|
188
188
|
|
|
189
|
-
monkeypatch.setattr("sys.argv", ["remoterf", "--reset-
|
|
189
|
+
monkeypatch.setattr("sys.argv", ["remoterf", "--reset-password"])
|
|
190
190
|
with mock.patch.object(remoterf_cli, "_reset_password", return_value=0) as reset:
|
|
191
191
|
assert remoterf_cli.main() == 0
|
|
192
192
|
reset.assert_called_once_with()
|
|
193
193
|
|
|
194
194
|
|
|
195
|
+
def test_reset_pass_is_an_unknown_command(monkeypatch, capsys):
|
|
196
|
+
from remoterf import remoterf_cli
|
|
197
|
+
|
|
198
|
+
monkeypatch.setattr("sys.argv", ["remoterf", "--reset-pass"])
|
|
199
|
+
with mock.patch.object(remoterf_cli, "_reset_password", return_value=0) as reset:
|
|
200
|
+
assert remoterf_cli.main() == 2
|
|
201
|
+
assert "unknown command" in capsys.readouterr().err
|
|
202
|
+
reset.assert_not_called()
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def test_reset_password_takes_no_arguments(monkeypatch, capsys):
|
|
206
|
+
from remoterf import remoterf_cli
|
|
207
|
+
|
|
208
|
+
monkeypatch.setattr("sys.argv", ["remoterf", "--reset-password", "x"])
|
|
209
|
+
with mock.patch.object(remoterf_cli, "_reset_password", return_value=0) as reset:
|
|
210
|
+
assert remoterf_cli.main() == 2
|
|
211
|
+
assert "--reset-password takes no arguments" in capsys.readouterr().err
|
|
212
|
+
reset.assert_not_called()
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def test_help_names_only_reset_password(monkeypatch):
|
|
216
|
+
from remoterf import remoterf_cli
|
|
217
|
+
|
|
218
|
+
lines = []
|
|
219
|
+
monkeypatch.setattr(remoterf_cli, "printf", lambda *parts: lines.append("".join(parts[::2])))
|
|
220
|
+
remoterf_cli.print_help()
|
|
221
|
+
out = "\n".join(lines)
|
|
222
|
+
assert "remoterf --reset-password" in out
|
|
223
|
+
assert "--reset-pass " not in out
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def _reset_command_at(https, command):
|
|
227
|
+
from remoterf.core import app
|
|
228
|
+
|
|
229
|
+
backend = mock.Mock(capabilities={"registration_policy": {}})
|
|
230
|
+
account = mock.Mock(is_https_home=https, backend=backend)
|
|
231
|
+
with mock.patch.object(app, "account", account):
|
|
232
|
+
try:
|
|
233
|
+
return app._account_command(command)
|
|
234
|
+
finally:
|
|
235
|
+
backend.forgot.assert_not_called()
|
|
236
|
+
backend.reset.assert_not_called()
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def test_in_app_reset_commands_point_to_the_cli_flag(monkeypatch):
|
|
240
|
+
from remoterf.core import app
|
|
241
|
+
|
|
242
|
+
for command in ("forgot-password", "reset-password"):
|
|
243
|
+
lines = []
|
|
244
|
+
monkeypatch.setattr(app, "printf", lambda *parts: lines.append("".join(parts[::2])))
|
|
245
|
+
assert _reset_command_at(True, command) is False
|
|
246
|
+
assert any("remoterf --reset-password" in line for line in lines)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
def test_in_app_reset_commands_at_a_local_home_name_the_administrator():
|
|
250
|
+
import pytest
|
|
251
|
+
from remoterf.deployment.http import AccountBackendError
|
|
252
|
+
|
|
253
|
+
for command in ("forgot-password", "reset-password"):
|
|
254
|
+
with pytest.raises(AccountBackendError, match="local administrator"):
|
|
255
|
+
_reset_command_at(False, command)
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def test_session_help_has_no_reset_password_row(monkeypatch):
|
|
259
|
+
from remoterf.core import app
|
|
260
|
+
|
|
261
|
+
lines = []
|
|
262
|
+
monkeypatch.setattr(app, "printf", lambda *parts: lines.append("".join(parts[::2])))
|
|
263
|
+
for https in (True, False):
|
|
264
|
+
with mock.patch.object(app, "account", mock.Mock(is_https_home=https, is_admin=False)):
|
|
265
|
+
app.commands()
|
|
266
|
+
assert any("'logout'" in line for line in lines)
|
|
267
|
+
assert not any("reset-password" in line for line in lines)
|
|
268
|
+
|
|
269
|
+
|
|
195
270
|
def _login_at(home, typed, *, https=False, pending=None):
|
|
196
271
|
from remoterf.core import app
|
|
197
272
|
|
|
@@ -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
|
{remoterf-2.13.1 → remoterf-2.13.3}/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
|