Allow configuring CAN interfaces via LEA/CLEO
A user should be able to define a network interface as either Ethernet or CAN.
For a CAN interface, further parameters should be provided.
Tasks:
- [x] Adjust opendut-types as illustrated below.
- [x] CLEO: Allow for configuring the type of an interface
- [x] LEA: Allow for configuring the type of an interface
- [x] EDGAR: Differentiate between Ethernet and CAN interfaces according to the interface type specified
- [ ] CLEO: Allow for configuring CAN parameters
- [ ] LEA: Allow for configuring CAN parameters
- [ ] EDGAR: Configure CAN interfaces according to parameters set in their configurations
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct PeerNetworkInterface {
name: NetworkInterfaceName,
configuration: PeerNetworkInterfaceConfiguration,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum PeerNetworkInterfaceConfiguration {
Ethernet,
Can {
bitrate: i32,
sample_point: f32,
time_quanta: i32,
propagation_segment: i8,
phase_buffer_segment1: i8,
phase_buffer_segment2: i8,
synchronization_jump_width: i8,
flexible_data_rate: bool,
...
},
}
opendut-types/proto/opendut/types/peer/peer.proto:
message PeerNetworkInterface {
opendut.types.util.NetworkInterfaceName name = 1;
oneof configuration {
EthernetInterfaceConfiguration ethernet = 11;
CanInterfaceConfiguration can = 12;
}
}
opendut-types/proto/opendut/types/util/net.proto:
message EthernetInterfaceConfiguration {}
message CanInterfaceConfiguration {
int32 bitrate = 1;
float sample_point = 2;
int32 time_quanta = 3;
int32 propagation_segment = 4;
int32 phase_buffer_segment1 = 5;
int32 phase_buffer_segment2 = 6;
int32 synchronization_jump_width = 7;
bool flexible_data_rate = 8;
...
}
Initially reported by @hafklin.
Hey @hafklin, I've created an issue for this.
The NetworkInterfaceName is intended as a small wrapper around just a String (following the New Type Idiom).
So, we do want to keep that as is. However, we do already have a wrapping type around NetworkInterfaceName, which is called PeerNetworkInterface, and which we can expand for this purpose.
After #156, the current state of this is that one can configure the interface type via CLEO as either CAN or Ethernet, but no selection of CAN parameters is possible.
Configuration of CAN interface in LEA will be added in #235
Completed in #276.
Sufficient CAN configuration for LEA was implemented in #276 Configuration options in CLEO will be added with #235