diff --git a/autotests/settings/CMakeLists.txt b/autotests/settings/CMakeLists.txt --- a/autotests/settings/CMakeLists.txt +++ b/autotests/settings/CMakeLists.txt @@ -19,6 +19,8 @@ ipv4settingtest ipv6settingtest olpcmeshsettingtest + ovsbridgesettingtest + ovsinterfacesettingtest pppsettingtest pppoesettingtest proxysettingtest diff --git a/autotests/settings/ovsbridgesettingtest.h b/autotests/settings/ovsbridgesettingtest.h new file mode 100644 --- /dev/null +++ b/autotests/settings/ovsbridgesettingtest.h @@ -0,0 +1,36 @@ +/* + Copyright 2018 Pranav Gade + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +#ifndef NETWORKMANAGERQT_OVS_BRIDGE_SETTING_TEST_H +#define NETWORKMANAGERQT_OVS_BRIDGE_SETTING_TEST_H + +#include + +class OvsBridgeSettingTest : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void testSetting_data(); + void testSetting(); +}; + +#endif // NETWORKMANAGERQT_OVS_BRIDGE_SETTING_TEST_H + diff --git a/autotests/settings/ovsbridgesettingtest.cpp b/autotests/settings/ovsbridgesettingtest.cpp new file mode 100644 --- /dev/null +++ b/autotests/settings/ovsbridgesettingtest.cpp @@ -0,0 +1,70 @@ +/* + Copyright 2018 Pranav Gade + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +#include "ovsbridgesettingtest.h" + +#include "settings/ovsbridgesetting.h" + +#include + +#include + +void OvsBridgeSettingTest::testSetting_data() +{ + QTest::addColumn("mcastSnoopingEnable"); + QTest::addColumn("rstpEnable"); + QTest::addColumn("stpEnable"); + QTest::addColumn("failMode"); + + QTest::newRow("setting1") + << true // mcastSnoopingEnable + << true // rstpEnable + << true // stpEnable + << QString("secure"); // failMode +} + +void OvsBridgeSettingTest::testSetting() +{ + QFETCH(bool, mcastSnoopingEnable); + QFETCH(bool, rstpEnable); + QFETCH(bool, stpEnable); + QFETCH(QString, failMode); + + QVariantMap map; + + map.insert(QLatin1String(NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE), mcastSnoopingEnable); + map.insert(QLatin1String(NM_SETTING_OVS_BRIDGE_RSTP_ENABLE), rstpEnable); + map.insert(QLatin1String(NM_SETTING_OVS_BRIDGE_STP_ENABLE), stpEnable); + map.insert(QLatin1String(NM_SETTING_OVS_BRIDGE_FAIL_MODE), failMode); + + NetworkManager::OvsBridgeSetting setting; + setting.fromMap(map); + + QVariantMap map1 = setting.toMap(); + + // Will fail if set some default values, because they are skipped in toMap() method + QVariantMap::const_iterator it = map.constBegin(); + while (it != map.constEnd()) { + QCOMPARE(it.value(), map1.value(it.key())); + ++it; + } +} + +QTEST_MAIN(OvsBridgeSettingTest) diff --git a/autotests/settings/ovsinterfacesettingtest.h b/autotests/settings/ovsinterfacesettingtest.h new file mode 100644 --- /dev/null +++ b/autotests/settings/ovsinterfacesettingtest.h @@ -0,0 +1,36 @@ +/* + Copyright 2018 Pranav Gade + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +#ifndef NETWORKMANAGERQT_OVS_INTERFACE_SETTING_TEST_H +#define NETWORKMANAGERQT_OVS_INTERFACE_SETTING_TEST_H + +#include + +class OvsInterfaceSettingTest : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void testSetting_data(); + void testSetting(); +}; + +#endif // NETWORKMANAGERQT_OVS_INTERFACE_SETTING_TEST_H + diff --git a/autotests/settings/ovsinterfacesettingtest.cpp b/autotests/settings/ovsinterfacesettingtest.cpp new file mode 100644 --- /dev/null +++ b/autotests/settings/ovsinterfacesettingtest.cpp @@ -0,0 +1,58 @@ +/* + Copyright 2018 Pranav Gade + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +#include "ovsinterfacesettingtest.h" + +#include "settings/ovsinterfacesetting.h" + +#include + +#include + +void OvsInterfaceSettingTest::testSetting_data() +{ + QTest::addColumn("type"); + + QTest::newRow("setting1") + << QString("internal"); // type +} + +void OvsInterfaceSettingTest::testSetting() +{ + QFETCH(QString, type); + + QVariantMap map; + + map.insert(QLatin1String(NM_SETTING_OVS_INTERFACE_TYPE), type); + + NetworkManager::OvsInterfaceSetting setting; + setting.fromMap(map); + + QVariantMap map1 = setting.toMap(); + + // Will fail if set some default values, because they are skipped in toMap() method + QVariantMap::const_iterator it = map.constBegin(); + while (it != map.constEnd()) { + QCOMPARE(it.value(), map1.value(it.key())); + ++it; + } +} + +QTEST_MAIN(OvsInterfaceSettingTest) \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -64,6 +64,8 @@ settings/ipv6setting.cpp settings/infinibandsetting.cpp settings/olpcmeshsetting.cpp + settings/ovsbridgesetting.cpp + settings/ovsinterfacesetting.cpp settings/pppsetting.cpp settings/pppoesetting.cpp settings/proxysetting.cpp diff --git a/src/settings/ovsbridgesetting.h b/src/settings/ovsbridgesetting.h new file mode 100644 --- /dev/null +++ b/src/settings/ovsbridgesetting.h @@ -0,0 +1,76 @@ +/* + Copyright 2018 Pranav Gade + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +#ifndef NETWORKMANAGERQT_OVS_BRIDGE_SETTING_H +#define NETWORKMANAGERQT_OVS_BRIDGE_SETTING_H + +#include +#include "setting.h" + +#include + +namespace NetworkManager +{ + +class OvsBridgeSettingPrivate; + +/** + * Represents ovs-bridge setting + */ +class NETWORKMANAGERQT_EXPORT OvsBridgeSetting : public Setting +{ +public: + typedef QSharedPointer Ptr; + typedef QList List; + + OvsBridgeSetting(); + explicit OvsBridgeSetting(const Ptr &other); + ~OvsBridgeSetting() override; + + QString name() const override; + + void setMcastSnoopingEnable(bool mcastSnoopingEnable); + bool mcastSnoopingEnable() const; + + void setRstpEnable(bool rstpEnable); + bool rstpEnable() const; + + void setStpEnable(bool stpEnable); + bool stpEnable() const; + + void setFailMode(const QString &mode); + QString failMode() const; + + void fromMap(const QVariantMap &setting) override; + + QVariantMap toMap() const override; + +protected: + OvsBridgeSettingPrivate *d_ptr; + +private: + Q_DECLARE_PRIVATE(OvsBridgeSetting) +}; + +NETWORKMANAGERQT_EXPORT QDebug operator<<(QDebug dbg, const OvsBridgeSetting &setting); + +} + +#endif // NETWORKMANAGERQT_OVS_BRIDGE_SETTING_H diff --git a/src/settings/ovsbridgesetting.cpp b/src/settings/ovsbridgesetting.cpp new file mode 100644 --- /dev/null +++ b/src/settings/ovsbridgesetting.cpp @@ -0,0 +1,171 @@ +/* + Copyright Pranav Gade + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +#include "ovsbridgesetting.h" +#include "ovsbridgesetting_p.h" + +#include + +#if !NM_CHECK_VERSION(1, 10, 0) +#define NM_SETTING_OVS_BRIDGE_SETTING_NAME "ovs-bridge" +#define NM_SETTING_OVS_BRIDGE_FAIL_MODE "fail-mode" +#define NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE "mcast-snooping-enable" +#define NM_SETTING_OVS_BRIDGE_RSTP_ENABLE "rstp-enable" +#define NM_SETTING_OVS_BRIDGE_STP_ENABLE "stp-enable" +#endif + +NetworkManager::OvsBridgeSettingPrivate::OvsBridgeSettingPrivate() + : name(NM_SETTING_OVS_BRIDGE_SETTING_NAME) + , mcastSnoopingEnable(false) + , rstpEnable(false) + , stpEnable(false) +{ } + +NetworkManager::OvsBridgeSetting::OvsBridgeSetting() + : Setting(Setting::OvsBridge) + , d_ptr(new OvsBridgeSettingPrivate()) +{ } + +NetworkManager::OvsBridgeSetting::OvsBridgeSetting(const Ptr &other) + : Setting(other) + , d_ptr(new OvsBridgeSettingPrivate()) +{ + setFailMode(other->failMode()); + setMcastSnoopingEnable(other->mcastSnoopingEnable()); + setRstpEnable(other->rstpEnable()); + setStpEnable(other->stpEnable()); +} + +NetworkManager::OvsBridgeSetting::~OvsBridgeSetting() +{ + delete d_ptr; +} + +QString NetworkManager::OvsBridgeSetting::name() const +{ + Q_D(const OvsBridgeSetting); + + return d->name; +} + +void NetworkManager::OvsBridgeSetting::setMcastSnoopingEnable(bool mcastSnoopingEnable) +{ + Q_D(OvsBridgeSetting); + + d->mcastSnoopingEnable = mcastSnoopingEnable; +} + +bool NetworkManager::OvsBridgeSetting::mcastSnoopingEnable() const +{ + Q_D(const OvsBridgeSetting); + + return d->mcastSnoopingEnable; +} + +void NetworkManager::OvsBridgeSetting::setRstpEnable(bool rstpEnable) +{ + Q_D(OvsBridgeSetting); + + d->rstpEnable = rstpEnable; +} + +bool NetworkManager::OvsBridgeSetting::rstpEnable() const +{ + Q_D(const OvsBridgeSetting); + + return d->rstpEnable; +} + +void NetworkManager::OvsBridgeSetting::setStpEnable(bool stpEnable) +{ + Q_D(OvsBridgeSetting); + + d->stpEnable = stpEnable; +} + +bool NetworkManager::OvsBridgeSetting::stpEnable() const +{ + Q_D(const OvsBridgeSetting); + + return d->stpEnable; +} + +void NetworkManager::OvsBridgeSetting::setFailMode(const QString &mode) +{ + Q_D(OvsBridgeSetting); + + d->failMode = mode; +} + +QString NetworkManager::OvsBridgeSetting::failMode() const +{ + Q_D(const OvsBridgeSetting); + + return d->failMode; +} + +void NetworkManager::OvsBridgeSetting::fromMap(const QVariantMap &setting) +{ + if (setting.contains(QLatin1String(NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE))) { + setMcastSnoopingEnable(setting.value(QLatin1String(NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE)).toBool()); + } + + if (setting.contains(QLatin1String(NM_SETTING_OVS_BRIDGE_RSTP_ENABLE))) { + setRstpEnable(setting.value(QLatin1String(NM_SETTING_OVS_BRIDGE_RSTP_ENABLE)).toBool()); + } + + if (setting.contains(QLatin1String(NM_SETTING_OVS_BRIDGE_STP_ENABLE))) { + setStpEnable(setting.value(QLatin1String(NM_SETTING_OVS_BRIDGE_STP_ENABLE)).toBool()); + } + + if (setting.contains(QLatin1String(NM_SETTING_OVS_BRIDGE_FAIL_MODE))) { + setFailMode(setting.value(QLatin1String(NM_SETTING_OVS_BRIDGE_FAIL_MODE)).toString()); + } +} + +QVariantMap NetworkManager::OvsBridgeSetting::toMap() const +{ + QVariantMap setting; + + setting.insert(QLatin1String(NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE), mcastSnoopingEnable()); + + setting.insert(QLatin1String(NM_SETTING_OVS_BRIDGE_RSTP_ENABLE), rstpEnable()); + + setting.insert(QLatin1String(NM_SETTING_OVS_BRIDGE_STP_ENABLE), stpEnable()); + + if (!failMode().isEmpty()) { + setting.insert(QLatin1String(NM_SETTING_OVS_BRIDGE_FAIL_MODE), failMode()); + } + + return setting; +} + +QDebug NetworkManager::operator <<(QDebug dbg, const NetworkManager::OvsBridgeSetting &setting) +{ + dbg.nospace() << "type: " << setting.typeAsString(setting.type()) << '\n'; + dbg.nospace() << "initialized: " << !setting.isNull() << '\n'; + + dbg.nospace() << NM_SETTING_OVS_BRIDGE_MCAST_SNOOPING_ENABLE << ": " << setting.mcastSnoopingEnable() << '\n'; + dbg.nospace() << NM_SETTING_OVS_BRIDGE_RSTP_ENABLE << ": " << setting.rstpEnable() << '\n'; + dbg.nospace() << NM_SETTING_OVS_BRIDGE_STP_ENABLE << ": " << setting.stpEnable() << '\n'; + dbg.nospace() << NM_SETTING_OVS_BRIDGE_FAIL_MODE << ": " << setting.failMode() << '\n'; + + return dbg.maybeSpace(); +} \ No newline at end of file diff --git a/src/settings/ovsbridgesetting_p.h b/src/settings/ovsbridgesetting_p.h new file mode 100644 --- /dev/null +++ b/src/settings/ovsbridgesetting_p.h @@ -0,0 +1,45 @@ +/* + Copyright 2018 Pranav Gade + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +#ifndef NETWORKMANAGERQT_OVS_BRIDGE_SETTING_P_H +#define NETWORKMANAGERQT_OVS_BRIDGE_SETTING_P_H + +#include + +namespace NetworkManager +{ + +class OvsBridgeSettingPrivate +{ +public: + OvsBridgeSettingPrivate(); + + QString name; + + bool mcastSnoopingEnable; + bool rstpEnable; + bool stpEnable; + QString failMode; +}; + +} + +#endif // NETWORKMANAGERQT_OVS_BRIDGE_SETTING_P_H + diff --git a/src/settings/ovsinterfacesetting.h b/src/settings/ovsinterfacesetting.h new file mode 100644 --- /dev/null +++ b/src/settings/ovsinterfacesetting.h @@ -0,0 +1,67 @@ +/* + Copyright 2018 Pranav Gade + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +#ifndef NETWORKMANAGERQT_OVS_INTERFACE_SETTING_H +#define NETWORKMANAGERQT_OVS_INTERFACE_SETTING_H + +#include +#include "setting.h" + +#include + +namespace NetworkManager +{ + +class OvsInterfaceSettingPrivate; + +/** + * Represents ovs-interface setting + */ +class NETWORKMANAGERQT_EXPORT OvsInterfaceSetting : public Setting +{ +public: + typedef QSharedPointer Ptr; + typedef QList List; + + OvsInterfaceSetting(); + explicit OvsInterfaceSetting(const Ptr &other); + ~OvsInterfaceSetting() override; + + QString name() const override; + + void setType(const QString& type); + QString type() const; + + void fromMap(const QVariantMap &setting) override; + + QVariantMap toMap() const override; + +protected: + OvsInterfaceSettingPrivate *d_ptr; + +private: + Q_DECLARE_PRIVATE(OvsInterfaceSetting) +}; + +NETWORKMANAGERQT_EXPORT QDebug operator<<(QDebug dbg, const OvsInterfaceSetting &setting); + +} + +#endif // NETWORKMANAGERQT_OVS_INTERFACE_SETTING_H diff --git a/src/settings/ovsinterfacesetting.cpp b/src/settings/ovsinterfacesetting.cpp new file mode 100644 --- /dev/null +++ b/src/settings/ovsinterfacesetting.cpp @@ -0,0 +1,100 @@ +/* + Copyright Pranav Gade + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +#include "ovsinterfacesetting.h" +#include "ovsinterfacesetting_p.h" + +#include + +#if !NM_CHECK_VERSION(1, 10, 0) +#define NM_SETTING_OVS_INTERFACE_SETTING_NAME "ovs-interface" +#define NM_SETTING_OVS_INTERFACE_TYPE "type" +#endif + +NetworkManager::OvsInterfaceSettingPrivate::OvsInterfaceSettingPrivate() + : name(NM_SETTING_OVS_INTERFACE_SETTING_NAME) +{ } + +NetworkManager::OvsInterfaceSetting::OvsInterfaceSetting() + : Setting(Setting::OvsInterface) + , d_ptr(new OvsInterfaceSettingPrivate()) +{ } + +NetworkManager::OvsInterfaceSetting::OvsInterfaceSetting(const Ptr &other) + : Setting(other) + , d_ptr(new OvsInterfaceSettingPrivate()) +{ + setType(other->type()); +} + +NetworkManager::OvsInterfaceSetting::~OvsInterfaceSetting() +{ + delete d_ptr; +} + +QString NetworkManager::OvsInterfaceSetting::name() const +{ + Q_D(const OvsInterfaceSetting); + + return d->name; +} + +void NetworkManager::OvsInterfaceSetting::setType(const QString &type) +{ + Q_D(OvsInterfaceSetting); + + d->type = type; +} + +QString NetworkManager::OvsInterfaceSetting::type() const +{ + Q_D(const OvsInterfaceSetting); + + return d->type; +} + +void NetworkManager::OvsInterfaceSetting::fromMap(const QVariantMap &setting) +{ + if (setting.contains(QLatin1String(NM_SETTING_OVS_INTERFACE_TYPE))) { + setType(setting.value(QLatin1String(NM_SETTING_OVS_INTERFACE_TYPE)).toString()); + } + +} + +QVariantMap NetworkManager::OvsInterfaceSetting::toMap() const +{ + QVariantMap setting; + + if (!type().isEmpty()) { + setting.insert(QLatin1String(NM_SETTING_OVS_INTERFACE_TYPE), type()); + } + + return setting; +} + +QDebug NetworkManager::operator <<(QDebug dbg, const NetworkManager::OvsInterfaceSetting &setting) +{ + dbg.nospace() << "type: " << setting.typeAsString(setting.type()) << '\n'; + dbg.nospace() << "initialized: " << !setting.isNull() << '\n'; + + dbg.nospace() << NM_SETTING_OVS_INTERFACE_TYPE << ": " << setting.type() << '\n'; + + return dbg.maybeSpace(); +} diff --git a/src/settings/ovsinterfacesetting_p.h b/src/settings/ovsinterfacesetting_p.h new file mode 100644 --- /dev/null +++ b/src/settings/ovsinterfacesetting_p.h @@ -0,0 +1,42 @@ +/* + Copyright 2018 Pranav Gade + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +#ifndef NETWORKMANAGERQT_OVS_INTERFACE_SETTING_P_H +#define NETWORKMANAGERQT_OVS_INTERFACE_SETTING_P_H + +#include + +namespace NetworkManager +{ + +class OvsInterfaceSettingPrivate +{ +public: + OvsInterfaceSettingPrivate(); + + QString name; + + QString type; +}; + +} + +#endif // NETWORKMANAGERQT_OVS_INTERFACE_SETTING_P_H + diff --git a/src/settings/setting.h b/src/settings/setting.h --- a/src/settings/setting.h +++ b/src/settings/setting.h @@ -75,7 +75,9 @@ Vxlan, IpTunnel, Proxy, - User + User, + OvsBridge, + OvsInterface }; enum SecretFlagType { diff --git a/src/settings/setting.cpp b/src/settings/setting.cpp --- a/src/settings/setting.cpp +++ b/src/settings/setting.cpp @@ -126,6 +126,11 @@ break; case User: typeString = QLatin1String(NM_SETTING_USER_SETTING_NAME); + case OvsInterface: + typeString = QLatin1String(NM_SETTING_OVS_INTERFACE_SETTING_NAME); + break; + case OvsBridge: + typeString = QLatin1String(NM_SETTING_OVS_BRIDGE_SETTING_NAME); break; case NetworkManager::Setting::Generic: typeString = QLatin1String(NM_SETTING_GENERIC_SETTING_NAME); @@ -189,6 +194,10 @@ type = User; } else if (typeString == QLatin1String(NM_SETTING_PROXY_SETTING_NAME)) { type = Proxy; + } else if (typeString == QLatin1String(NM_SETTING_OVS_INTERFACE_SETTING_NAME)) { + type = OvsInterface; + } else if (typeString == QLatin1String(NM_SETTING_OVS_BRIDGE_SETTING_NAME)) { + type = OvsBridge; } return type;