Skip to content

Commit 6c35920

Browse files
milan-zededaeriknordmark
authored andcommitted
Adjust LPS network endpoint payload definitions
- Moved `PortConfigSource` into `evecommon/netcmn.proto` so it can be used by both `info/info.proto` and `profile/network.proto`. - Replaced the unnecessary `NetworkConfig` wrapper in `profile/network.proto` with a direct `repeated NetworkPortConfig` field. - Removed/renamed all references to "local config *change*" -- instead, the local configuration was defined to be fully declarative in nature - Introduced `LocalNetworkConfigInfo` to report the state of the local config, including any errors: * global `error_message` indicates problems with the config as a whole, such as invalid token, malformed payloads or missing logical labels. * Per-port errors are still reported via `NetworkPortConfig.error_message`. - Extended `NetworkConfigTestingStatus` with: * `testing_in_progress` boolean to indicate if controller connectivity testing is still ongoing. * `testing_phase` string providing optional context about why testing is in progress (e.g., waiting for interface, DHCP IP, or DNS). - Renamed `logical_name` to `logical_label` in `profile/network.proto` for consistency with naming used in other proto files. - Renamed `NetworkPortAddresses.usb_adapter` to `NetworkPortAddresses.usb_address` (the previous field name was a mistake) - Added missing probing configuration into CellularConfig (in `profile/network.proto`) - Updated documentation and comments in `profile/network.proto` for clarity. Signed-off-by: Milan Lenco <[email protected]>
1 parent 39169fa commit 6c35920

File tree

4 files changed

+214
-181
lines changed

4 files changed

+214
-181
lines changed

PROFILE.md

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -278,31 +278,31 @@ the `404` code.
278278

279279
Publishes the current IP configuration of all network adapters (excluding those
280280
directly assigned to applications).
281-
The response may optionally include updated configuration for one or more
282-
adapters, which EVE will validate and apply if permitted.
281+
The response may optionally include a locally-declared desired configuration
282+
for one or more adapters, which EVE will validate and apply if permitted.
283283

284284
```http
285285
POST /api/v1/network
286286
```
287287

288288
Return codes:
289289

290-
* Success, with modified network configuration included in the response
290+
* Success, with locally-declared network configuration included in the response
291291
for EVE to apply: `200`
292-
* Success, no configuration changes requested; any existing local modifications
293-
remain in effect: `204`
292+
* Success, no local network configuration updates requested; any existing
293+
local configuration remains in effect: `204`
294294
* Not implemented, or intentionally used by the local server to throttle
295295
the periodic network information updates: `404`
296-
When `404` is returned, any previously submitted configuration changes
297-
from LPS are reverted.
296+
When `404` is returned, any previously submitted local network configuration
297+
is reverted.
298298

299299
Request:
300300

301301
The request MIME type MUST be `application/x-proto-binary`.
302302
The request MUST contain the body of a single protobuf message of type
303303
[NetworkInfo](./proto/profile/network.proto).
304304
Device publishes network information repeatedly to keep LPS updated and
305-
to allow the server to submit configuration changes.
305+
to allow the server to submit local configuration updates.
306306
Local server MAY throttle or cancel this communication stream by returning
307307
the `404` code.
308308

@@ -312,61 +312,67 @@ the `404` code.
312312
* Status of controller connectivity
313313
* A fallback network configuration, used when the latest configuration
314314
fails to provide working controller connectivity.
315-
* Status of any locally-made configuration changes submitted previously
316-
by the Local Profile Server (LPS), indicating success or errors if changes
317-
failed.
315+
* Status of the local network configuration submitted previously
316+
by the Local Profile Server (LPS), indicating whether it was successfully
317+
applied or if errors occurred.
318318

319319
Response:
320320

321321
The response MAY contain the body of a single protobuf message of type
322-
[NetworkConfigChange](./proto/profile/network.proto), encoded as
322+
[LocalNetworkConfig](./proto/profile/network.proto), encoded as
323323
`application/x-proto-binary`.
324-
If no changes are required, the Local Profile Server MAY return HTTP 204
325-
(`No Content`).
324+
If no further updates are needed to the local configuration, the server MAY return
325+
HTTP 204 (`No Content`), and EVE will continue using the most recently submitted
326+
local configuration.
326327

327-
`NetworkConfigChange` contains:
328+
`LocalNetworkConfig` contains:
328329

329330
* An authorization token (`server_token`) to verify the request against
330331
the controller-provisioned secret.
331-
* New or updated network configuration for one or more adapters.
332+
* Declarative network configuration for ports managed locally.
332333

333334
Behavior:
334335

335-
* EVE validates the received configuration to ensure it is well-formed and only
336-
includes adapters for which local modifications are permitted by the
337-
controller user.
338-
* Locally-modifiable fields include the IP configuration, wireless settings,
336+
* EVE validates the received local configuration to ensure it is well-formed
337+
and that the submitted `server_token` matches the value provisioned
338+
by the controller.
339+
* The controller may specify, on a per-port basis, whether local modifications
340+
are allowed (see `SystemAdapter.allow_local_modifications`).
341+
Ports that are not permitted to receive local configuration are skipped,
342+
and an error is reported for each such port in `LocalNetworkConfigInfo`.
343+
* If the controller revokes local modification permissions or un-configures LPS,
344+
EVE reverts affected adapters to the controller configuration.
345+
* Locally-manageable fields include the IP configuration, wireless settings,
339346
and proxy configuration — the attributes defined in [NetworkPortConfig](proto/profile/network.proto).
340347
Fields that affect overall network topology, such as interface usage, cost,
341-
or assigned labels, are not locally-modifiable and remain under controller
348+
or assigned labels, are not locally-manageable and remain under controller
342349
management.
343-
* Any local modification to a port replaces the entire set of locally-modifiable
350+
* Local port configuration overrides the entire set of locally-manageable
344351
fields. Partial updates are not supported — fields omitted or set to empty/zero
345352
values are applied as such, rather than inheriting values from the controller
346-
configuration. The locally-modifiable portion is treated as a single unit,
353+
configuration. The locally-manageable portion is treated as a single unit,
347354
so the controller cannot manage some of these fields while the local user
348355
manages others.
349-
* Fields that are not included in the set of locally-changeable attributes
356+
* Fields that are not included in the set of locally-manageable attributes
350357
(e.g., interface usage, cost) continue to follow the controller-provided
351358
configuration, either the latest or the active fallback configuration,
352359
as appropriate.
353-
* If the controller revokes local modification permissions or un-configures LPS,
354-
EVE reverts affected adapters to the controller configuration.
355360
* When LPS (temporarily or indefinitely) throttles/cancels the communication
356-
stream by returning `404`, all previously submitted network configuration
357-
changes are reverted.
358-
* If LPS becomes inaccessible or unresponsive, previously submitted network
359-
configuration changes remain in effect. To revert these changes from a crashed
361+
stream by returning `404`, previously submitted local network configuration
362+
is reverted.
363+
* If LPS becomes inaccessible or unresponsive, a previously submitted network
364+
configuration remains in effect. To revert local config received from a crashed
360365
or misbehaving LPS, the controller user must explicitly revoke permissions
361366
or disable the LPS.
362-
* EVE disables fallback mechanism only for locally modified adapters with respect
363-
to fields that can be locally changed. All other adapters, or fields that are
364-
not locally-changeable, such as interface usage or cost, continue using either
365-
the latest or fallback controller configuration, depending on connectivity status.
366-
* The current controller connectivity status is included in the request to help
367-
the local operator make informed changes.
368-
* When configuration changes fail validation or application, EVE reports errors
369-
back in `NetworkInfo`.
367+
* EVE disables fallback mechanism only for adapters with a local configuration
368+
with respect to fields that can be locally managed. All other adapters, or fields
369+
that are not locally-manageable, such as interface usage or cost, continue using
370+
either the latest or fallback controller configuration, depending on connectivity
371+
status.
372+
* The published controller connectivity status helps the local operator create
373+
a local configuration that ensures proper connectivity.
374+
* When local configuration fails validation or application, EVE reports errors
375+
back in `NetworkInfo.local_config`.
370376

371377
## Security
372378

proto/evecommon/netcmn.proto

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ option java_package = "org.lfedge.eve.common";
1010
option java_multiple_files = true;
1111
option java_outer_classname = "Evecommon";
1212

13+
import "google/protobuf/timestamp.proto";
14+
1315
message ipRange {
1416
string start = 1;
1517
string end = 2;
@@ -250,4 +252,56 @@ enum CellularAuthProtocol {
250252
CELLULAR_AUTH_PROTOCOL_CHAP = 2;
251253
// Both PAP and CHAP.
252254
CELLULAR_AUTH_PROTOCOL_PAP_AND_CHAP = 3;
255+
}
256+
257+
// NetworkConfigOrigin enumerates all possible origins of a network port configuration.
258+
enum NetworkConfigOrigin {
259+
// Unknown or unset origin.
260+
NETWORK_CONFIG_ORIGIN_UNSPECIFIED = 0;
261+
// Config received from the controller.
262+
NETWORK_CONFIG_ORIGIN_CONTROLLER = 1;
263+
// Initial device config embedded in the EVE installer, signed by the controller.
264+
NETWORK_CONFIG_ORIGIN_BOOTSTRAP = 2;
265+
// Manually created JSON config injected into the installer.
266+
NETWORK_CONFIG_ORIGIN_OVERRIDE = 3;
267+
// Fallback configuration automatically generated to enable DHCP on all Ethernet ports.
268+
// Used when no network config is available or when "network.fallback.any.eth" is enabled
269+
// and none of the existing configs provide controller connectivity.
270+
NETWORK_CONFIG_ORIGIN_LASTRESORT = 4;
271+
// Config entered via the terminal UI (TUI).
272+
NETWORK_CONFIG_ORIGIN_TUI = 5;
273+
// Configuration signed by the controller and delivered through the
274+
// Local Operator Console (LOC) in an air-gapped environment.
275+
NETWORK_CONFIG_ORIGIN_LOC = 6;
276+
// Config changes made locally through the Local Profile Server (LPS).
277+
NETWORK_CONFIG_ORIGIN_LPS = 7;
278+
}
279+
280+
// PortConfigSource describes the origin of the configuration used for a network port.
281+
// It helps distinguish between controller-provided, locally-modified, or initial configs.
282+
message PortConfigSource {
283+
// Indicates where EVE obtained the network config.
284+
org.lfedge.eve.common.NetworkConfigOrigin origin = 1;
285+
286+
// Timestamp when this port’s configuration was originally submitted
287+
// or created at its source.
288+
//
289+
// Meaning depends on the origin:
290+
// - Controller, LOC, bootstrap: timestamp provided by the controller.
291+
// - Local override.json: when the file was first loaded by EVE.
292+
// - Last-resort: when EVE generated the fallback config.
293+
// - LPS modifications: when the modified config was received.
294+
// - TUI: when the user submitted the configuration.
295+
//
296+
// This is different from DevicePortStatus.timePriority, which is used
297+
// to compare and prioritize different sources of network configuration
298+
// (and may be synthetic for some sources, e.g. year 2000 for override.json,
299+
// epoch 0 for last-resort). By contrast, submitted_at represents when this
300+
// port’s configuration first came into existence, regardless of when or whether
301+
// the device applied it.
302+
//
303+
// Note: this is a per-port timestamp. The underlying network config may
304+
// cover multiple ports, but only the portion relevant to this port is
305+
// reflected here.
306+
google.protobuf.Timestamp submitted_at = 2;
253307
}

proto/info/info.proto

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -838,59 +838,7 @@ message DevicePort {
838838
uint32 mtu = 34; // MTU of the port
839839

840840
// Identifies the source of this network port configuration.
841-
PortConfigSource config_source = 40;
842-
}
843-
844-
// NetworkConfigOrigin enumerates all possible origins of a network port configuration.
845-
enum NetworkConfigOrigin {
846-
// Unknown or unset origin.
847-
NETWORK_CONFIG_ORIGIN_UNSPECIFIED = 0;
848-
// Config received from the controller.
849-
NETWORK_CONFIG_ORIGIN_CONTROLLER = 1;
850-
// Initial device config embedded in the EVE installer, signed by the controller.
851-
NETWORK_CONFIG_ORIGIN_BOOTSTRAP = 2;
852-
// Manually created JSON config injected into the installer.
853-
NETWORK_CONFIG_ORIGIN_OVERRIDE = 3;
854-
// Fallback configuration automatically generated to enable DHCP on all Ethernet ports.
855-
// Used when no network config is available or when "network.fallback.any.eth" is enabled
856-
// and none of the existing configs provide controller connectivity.
857-
NETWORK_CONFIG_ORIGIN_LASTRESORT = 4;
858-
// Config entered via the terminal UI (TUI).
859-
NETWORK_CONFIG_ORIGIN_TUI = 5;
860-
// Configuration signed by the controller and delivered through the
861-
// Local Operator Console (LOC) in an air-gapped environment.
862-
NETWORK_CONFIG_ORIGIN_LOC = 6;
863-
// Config changes made locally through the Local Profile Server (LPS).
864-
NETWORK_CONFIG_ORIGIN_LPS = 7;
865-
}
866-
867-
// PortConfigSource describes the origin of the configuration used for a network port.
868-
// It helps distinguish between controller-provided, locally-modified, or initial configs.
869-
message PortConfigSource {
870-
// Indicates where EVE obtained the network config.
871-
NetworkConfigOrigin origin = 1;
872-
873-
// Timestamp when this port’s configuration was originally submitted
874-
// or created at its source.
875-
//
876-
// Meaning depends on the origin:
877-
// - Controller, LOC, bootstrap: timestamp provided by the controller.
878-
// - Local override.json: when the file was first loaded by EVE.
879-
// - Last-resort: when EVE generated the fallback config.
880-
// - LPS modifications: when the modified config was received.
881-
// - TUI: when the user submitted the configuration.
882-
//
883-
// This is different from DevicePortStatus.timePriority, which is used
884-
// to compare and prioritize different sources of network configuration
885-
// (and may be synthetic for some sources, e.g. year 2000 for override.json,
886-
// epoch 0 for last-resort). By contrast, submitted_at represents when this
887-
// port’s configuration first came into existence, regardless of when or whether
888-
// the device applied it.
889-
//
890-
// Note: this is a per-port timestamp. The underlying network config may
891-
// cover multiple ports, but only the portion relevant to this port is
892-
// reflected here.
893-
google.protobuf.Timestamp submitted_at = 2;
841+
org.lfedge.eve.common.PortConfigSource config_source = 40;
894842
}
895843

896844
message ProxyStatus {

0 commit comments

Comments
 (0)