Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface Management #70

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RFnexus
Copy link
Contributor

@RFnexus RFnexus commented Mar 9, 2025

This PR adds comprehensive interface management to NomadNet. It allows the user to create, edit, disable / enable, and monitor interfaces in realtime under the [ Interfaces ] tab. Currently it's submitted as a draft for review and feedback.

Screenshot from 2025-03-09 15-30-43

Adding interfaces

Ctrl + A lets the user add a new interface. The user selects in a dialog the interface type, then proceeds to the AddInterfaceView. The INTERFACE_FIELDS dict defines the behavior for how input is validated and transformed based interface on type. Common interface fields are defined in COMMON_INTERFACE_OPTIONS which display under "Show more options" in the add dialog.

A set of Urwid form widget classes has been added in FormWidgets.py for this purpose. This can also be extended to allow the user to edit the NomadNet, LXMF, or RNS config interactively from the application itself.

image

image

Certain interface types will have custom options inside of the Add and Edit views. For example, interfaces with a port field have an interactive port picker with the option to refresh ports and when pyserial is available. The RNodeInterface has a built in on-air parameter calculator that updates as the fields are changed, showing bitrate and link budget calculations.
image

Each interface type in INTERFACE_FIELDS can have additional_options which are shown undre "Show more options".

All fields are validated based on an array of set rules, for example ['required', 'float']. Any validation errors will be shown to the user. The behavior of the values from each FormWidget input is described in the transform key. For example, on the RNodeInterface frequency is entered in MHz as opposed to Hz for ease of use. The transform key is: "transform": lambda x: int(float(x.strip()) * 1000000)

Viewing interfaces

Pressing "Enter" on the selected interface will bring you to the ShowInterface view. This view contains the Interface information and interactive charts that display the RX and TX traffic over a set history length.
image

From here the interface can be enabled / disabled, and edited. The shortcuts are displayed below in the shortcut bar.

The chart system is derived from pyasciichart and supports both unicode and plain characters. It is also supported on lower-width terminals. Pressing v will toggle a vertical view, while pressing h will toggle a horizontal view. This may be expanded in the future to contain more interactive charts, such as noise floor and channel capacity for RNodes.

image

Editing interfaces

Editing interfaces is identical to adding interfaces, except the fields are automatically populated. EditInterfaceView is a child of AddInterfaceView

image

Interfaces can also be edited and removed directly from the list using keyboard shortcuts when they are selected.
image

Remaining Tasks:

  • RNodeMultiInterface
  • CustomInterface
  • Open config in text editor option
  • Automatically determine history length for charts based on terminal columns
  • Cleanup and testing
  • Add guide entry under "Interfaces" section
  • Export / import (? - would require some type of clipboard control, which Python does not have natively)
  • More validation rules - byte_size, i2p_address (?)
  • support AutoInterface sub peer stats for RNS 0.9.3 (future)

If there are any features you want added or changed, let me know. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant