[pve-devel] [PATCH proxmox-ve-rs 12/21] sdn: add config module
Stefan Hanreich
s.hanreich at proxmox.com
Tue Jul 16 11:28:19 CEST 2024
On 6/27/24 12:54, Gabriel Goller wrote:
> On 26.06.2024 14:15, Stefan Hanreich wrote:
>> diff --git a/proxmox-ve-config/src/sdn/config.rs
>> b/proxmox-ve-config/src/sdn/config.rs
>> new file mode 100644
>> index 0000000..8454adf
>> --- /dev/null
>> +++ b/proxmox-ve-config/src/sdn/config.rs
>> @@ -0,0 +1,571 @@
>> [snip]
>> +impl Display for DhcpType {
>> + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
>> + f.write_str(match self {
>> + DhcpType::Dnsmasq => "dnsmasq",
>> + })
>> + }
>> +}
>> +
>> +/// struct for deserializing a zone entry of the SDN running config
>
> I think we usually begin doc-strings with a capital letter :)
>
>> +#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Hash, PartialOrd,
>> Ord)]
>> +pub struct ZoneRunningConfig {
>> + #[serde(rename = "type")]
>> + ty: ZoneType,
>> + dhcp: DhcpType,
>> +}
>> +
>> +/// struct for deserializing the zones of the SDN running config
>> +#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Default)]
>> +pub struct ZonesRunningConfig {
>> + ids: HashMap<ZoneName, ZoneRunningConfig>,
>> +}
>> +
>> +/// represents the dhcp-range property string used in the SDN
>> configuration
>> +#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Hash, PartialOrd,
>> Ord)]
>> +pub struct DhcpRange {
>> + #[serde(rename = "start-address")]
>> + start: IpAddr,
>> + #[serde(rename = "end-address")]
>> + end: IpAddr,
>> +}
>> +
>> +impl ApiType for DhcpRange {
>> + const API_SCHEMA: proxmox_schema::Schema = ObjectSchema::new(
>> + "DHCP range",
>> + &[
>> + (
>> + "end-address",
>> + false,
>> + &StringSchema::new("start address of DHCP
>> range").schema(),
>
> Shouldn't this be "end address..." or is this intended?
> Same below.
Good catch, seems like i messed up when copy-pasting.
>> + ),
>> + (
>> + "start-address",
>> + false,
>> + &StringSchema::new("end address of DHCP
>> range").schema(),
>> + ),
>> + ],
>> + )
>> + .schema();
>> +}
>> +
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
More information about the pve-devel
mailing list