1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
use serde::{Deserialize, Serialize};

use crate::{BaseInterface, InterfaceType};

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
/// Dummy interface. Only contain information of [BaseInterface].
/// Example yaml outpuf of `[crate::NetworkState]` with dummy interface:
/// ```yml
/// interfaces:
/// - name: dummy1
///   type: dummy
///   state: up
///   mac-address: BE:25:F0:6D:55:64
///   mtu: 1500
///   wait-ip: any
///   ipv4:
///     enabled: false
///   ipv6:
///     enabled: false
///   accept-all-mac-addresses: false
///   lldp:
///     enabled: false
///   ethtool:
///     feature:
///       tx-checksum-ip-generic: true
///       tx-ipxip6-segmentation: true
///       rx-gro: true
///       tx-generic-segmentation: true
///       tx-udp-segmentation: true
///       tx-udp_tnl-csum-segmentation: true
///       rx-udp-gro-forwarding: false
///       tx-tcp-segmentation: true
///       tx-sctp-segmentation: true
///       tx-ipxip4-segmentation: true
///       tx-nocache-copy: false
///       tx-gre-csum-segmentation: true
///       tx-udp_tnl-segmentation: true
///       tx-tcp-mangleid-segmentation: true
///       rx-gro-list: false
///       tx-scatter-gather-fraglist: true
///       tx-gre-segmentation: true
///       tx-tcp-ecn-segmentation: true
///       tx-gso-list: true
///       highdma: true
///       tx-tcp6-segmentation: true
/// ```
pub struct DummyInterface {
    #[serde(flatten)]
    pub base: BaseInterface,
}

impl Default for DummyInterface {
    fn default() -> Self {
        let mut base = BaseInterface::new();
        base.iface_type = InterfaceType::Dummy;
        Self { base }
    }
}

impl DummyInterface {
    pub fn new() -> Self {
        Self::default()
    }
}