7#include "ovsportsetting.h"
8#include "ovsportsetting_p.h"
12#if !NM_CHECK_VERSION(1, 10, 0)
13#define NM_SETTING_OVS_PORT_SETTING_NAME "ovs-port"
14#define NM_SETTING_OVS_PORT_VLAN_MODE "vlan-mode"
15#define NM_SETTING_OVS_PORT_TAG "tag"
16#define NM_SETTING_OVS_PORT_LACP "lacp"
17#define NM_SETTING_OVS_PORT_BOND_MODE "bond-mode"
18#define NM_SETTING_OVS_PORT_BOND_UPDELAY "bond-updelay"
19#define NM_SETTING_OVS_PORT_BOND_DOWNDELAY "bond-downdelay"
22NetworkManager::OvsPortSettingPrivate::OvsPortSettingPrivate()
23 : name(NM_SETTING_OVS_PORT_SETTING_NAME)
30NetworkManager::OvsPortSetting::OvsPortSetting()
31 : Setting(Setting::OvsPort)
32 , d_ptr(new OvsPortSettingPrivate())
36NetworkManager::OvsPortSetting::OvsPortSetting(
const Ptr &other)
38 , d_ptr(new OvsPortSettingPrivate())
40 setBondDowndelay(other->bondDowndelay());
41 setBondUpdelay(other->bondUpdelay());
43 setBondMode(other->bondMode());
44 setLacp(other->lacp());
45 setVlanMode(other->vlanMode());
48NetworkManager::OvsPortSetting::~OvsPortSetting()
60void NetworkManager::OvsPortSetting::setBondDowndelay(quint32 delay)
64 d->bondDowndelay = delay;
67quint32 NetworkManager::OvsPortSetting::bondDowndelay()
const
69 Q_D(
const OvsPortSetting);
71 return d->bondDowndelay;
74void NetworkManager::OvsPortSetting::setBondUpdelay(quint32 delay)
78 d->bondUpdelay = delay;
81quint32 NetworkManager::OvsPortSetting::bondUpdelay()
const
83 Q_D(
const OvsPortSetting);
85 return d->bondUpdelay;
88void NetworkManager::OvsPortSetting::setTag(quint32 tag)
95quint32 NetworkManager::OvsPortSetting::tag()
const
97 Q_D(
const OvsPortSetting);
102void NetworkManager::OvsPortSetting::setBondMode(
const QString &mode)
109QString NetworkManager::OvsPortSetting::bondMode()
const
111 Q_D(
const OvsPortSetting);
116void NetworkManager::OvsPortSetting::setLacp(
const QString &lacp)
123QString NetworkManager::OvsPortSetting::lacp()
const
125 Q_D(
const OvsPortSetting);
130void NetworkManager::OvsPortSetting::setVlanMode(
const QString &mode)
137QString NetworkManager::OvsPortSetting::vlanMode()
const
139 Q_D(
const OvsPortSetting);
146 if (setting.contains(
QLatin1String(NM_SETTING_OVS_PORT_BOND_UPDELAY))) {
147 setBondUpdelay(setting.value(
QLatin1String(NM_SETTING_OVS_PORT_BOND_UPDELAY)).toUInt());
150 if (setting.contains(
QLatin1String(NM_SETTING_OVS_PORT_BOND_DOWNDELAY))) {
151 setBondDowndelay(setting.value(
QLatin1String(NM_SETTING_OVS_PORT_BOND_DOWNDELAY)).toUInt());
154 if (setting.contains(
QLatin1String(NM_SETTING_OVS_PORT_TAG))) {
155 setTag(setting.value(
QLatin1String(NM_SETTING_OVS_PORT_TAG)).toUInt());
158 if (setting.contains(
QLatin1String(NM_SETTING_OVS_PORT_BOND_MODE))) {
159 setBondMode(setting.value(
QLatin1String(NM_SETTING_OVS_PORT_BOND_MODE)).toString());
162 if (setting.contains(
QLatin1String(NM_SETTING_OVS_PORT_LACP))) {
163 setLacp(setting.value(
QLatin1String(NM_SETTING_OVS_PORT_LACP)).toString());
166 if (setting.contains(
QLatin1String(NM_SETTING_OVS_PORT_VLAN_MODE))) {
167 setVlanMode(setting.value(
QLatin1String(NM_SETTING_OVS_PORT_VLAN_MODE)).toString());
175 if (bondUpdelay() > 0) {
176 setting.insert(
QLatin1String(NM_SETTING_OVS_PORT_BOND_UPDELAY), bondUpdelay());
179 if (bondDowndelay() > 0) {
180 setting.insert(
QLatin1String(NM_SETTING_OVS_PORT_BOND_DOWNDELAY), bondDowndelay());
184 setting.insert(
QLatin1String(NM_SETTING_OVS_PORT_TAG), tag());
187 if (!bondMode().isEmpty()) {
188 setting.insert(
QLatin1String(NM_SETTING_OVS_PORT_BOND_MODE), bondMode());
191 if (!lacp().isEmpty()) {
192 setting.insert(
QLatin1String(NM_SETTING_OVS_PORT_LACP), lacp());
195 if (!vlanMode().isEmpty()) {
196 setting.insert(
QLatin1String(NM_SETTING_OVS_PORT_VLAN_MODE), vlanMode());
204 dbg.
nospace() <<
"type: " << setting.typeAsString(setting.type()) <<
'\n';
205 dbg.
nospace() <<
"initialized: " << !setting.isNull() <<
'\n';
207 dbg.
nospace() << NM_SETTING_OVS_PORT_BOND_UPDELAY <<
": " << setting.bondUpdelay() <<
'\n';
208 dbg.
nospace() << NM_SETTING_OVS_PORT_BOND_DOWNDELAY <<
": " << setting.bondDowndelay() <<
'\n';
209 dbg.
nospace() << NM_SETTING_OVS_PORT_TAG <<
": " << setting.tag() <<
'\n';
210 dbg.
nospace() << NM_SETTING_OVS_PORT_BOND_MODE <<
": " << setting.bondMode() <<
'\n';
211 dbg.
nospace() << NM_SETTING_OVS_PORT_LACP <<
": " << setting.lacp() <<
'\n';
212 dbg.
nospace() << NM_SETTING_OVS_PORT_VLAN_MODE <<
": " << setting.vlanMode() <<
'\n';
Represents OvsPort setting.
QVariantMap toMap() const override
Must be reimplemented, default implementationd does nothing.
void fromMap(const QVariantMap &setting) override
Must be reimplemented, default implementation does nothing.
QString name() const override
Must be reimplemented, default implementationd does nothing.
void setTag(Elem &elem, Tag &&tag)