Skip to main content

nmstate/ifaces/
dummy.rs

1// SPDX-License-Identifier: Apache-2.0
2
3use serde::{Deserialize, Serialize};
4
5use crate::{BaseInterface, InterfaceType};
6
7#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
8#[non_exhaustive]
9/// Dummy interface. Only contain information of [BaseInterface].
10/// Example yaml outpuf of `[crate::NetworkState]` with dummy interface:
11/// ```yml
12/// interfaces:
13/// - name: dummy1
14///   type: dummy
15///   state: up
16///   mac-address: BE:25:F0:6D:55:64
17///   mtu: 1500
18///   wait-ip: any
19///   ipv4:
20///     enabled: false
21///   ipv6:
22///     enabled: false
23///   accept-all-mac-addresses: false
24///   lldp:
25///     enabled: false
26///   ethtool:
27///     feature:
28///       tx-checksum-ip-generic: true
29///       tx-ipxip6-segmentation: true
30///       rx-gro: true
31///       tx-generic-segmentation: true
32///       tx-udp-segmentation: true
33///       tx-udp_tnl-csum-segmentation: true
34///       rx-udp-gro-forwarding: false
35///       tx-tcp-segmentation: true
36///       tx-sctp-segmentation: true
37///       tx-ipxip4-segmentation: true
38///       tx-nocache-copy: false
39///       tx-gre-csum-segmentation: true
40///       tx-udp_tnl-segmentation: true
41///       tx-tcp-mangleid-segmentation: true
42///       rx-gro-list: false
43///       tx-scatter-gather-fraglist: true
44///       tx-gre-segmentation: true
45///       tx-tcp-ecn-segmentation: true
46///       tx-gso-list: true
47///       highdma: true
48///       tx-tcp6-segmentation: true
49/// ```
50pub struct DummyInterface {
51    #[serde(flatten)]
52    pub base: BaseInterface,
53}
54
55impl Default for DummyInterface {
56    fn default() -> Self {
57        let mut base = BaseInterface::new();
58        base.iface_type = InterfaceType::Dummy;
59        Self { base }
60    }
61}
62
63impl DummyInterface {
64    pub fn new() -> Self {
65        Self::default()
66    }
67}