summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2017-10-02 09:03:19 +0200
committerLubomir Rintel <lkundrak@v3.sk>2017-10-11 11:52:00 +0200
commit5b91b5d400cbddb98dccd7133c8a57b2cd8d9d42 (patch)
treebdd8a7ce8efe8a556d4b4dbdfe0f4ffd3c20d755
parent2b01af8e11919ff412f022a43bf5eaff36f71c66 (diff)
downloadNetworkManager-5b91b5d400cbddb98dccd7133c8a57b2cd8d9d42.tar.gz
libnm-core: add ovs-port setting
-rw-r--r--Makefile.am2
-rw-r--r--clients/common/settings-docs.c.in7
-rw-r--r--libnm-core/nm-connection.c17
-rw-r--r--libnm-core/nm-connection.h2
-rw-r--r--libnm-core/nm-core-internal.h1
-rw-r--r--libnm-core/nm-core-types.h1
-rw-r--r--libnm-core/nm-setting-ovs-port.c412
-rw-r--r--libnm-core/nm-setting-ovs-port.h69
-rw-r--r--libnm-core/nm-setting.c2
-rw-r--r--libnm/libnm.ver1
-rw-r--r--po/POTFILES.in1
11 files changed, 515 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 11d5ac00e3..fa687b933e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -394,6 +394,7 @@ libnm_core_lib_h_pub_real = \
libnm-core/nm-setting-macvlan.h \
libnm-core/nm-setting-olpc-mesh.h \
libnm-core/nm-setting-ovs-interface.h \
+ libnm-core/nm-setting-ovs-port.h \
libnm-core/nm-setting-ppp.h \
libnm-core/nm-setting-pppoe.h \
libnm-core/nm-setting-proxy.h \
@@ -470,6 +471,7 @@ libnm_core_lib_c_real = \
libnm-core/nm-setting-macvlan.c \
libnm-core/nm-setting-olpc-mesh.c \
libnm-core/nm-setting-ovs-interface.c \
+ libnm-core/nm-setting-ovs-port.c \
libnm-core/nm-setting-ppp.c \
libnm-core/nm-setting-pppoe.c \
libnm-core/nm-setting-proxy.c \
diff --git a/clients/common/settings-docs.c.in b/clients/common/settings-docs.c.in
index a7311d107f..37a108c818 100644
--- a/clients/common/settings-docs.c.in
+++ b/clients/common/settings-docs.c.in
@@ -264,6 +264,13 @@
#define DESCRIBE_DOC_NM_SETTING_MACVLAN_TAP N_("Whether the interface should be a MACVTAP.")
#define DESCRIBE_DOC_NM_SETTING_OVS_INTERFACE_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
#define DESCRIBE_DOC_NM_SETTING_OVS_INTERFACE_TYPE N_("The interface type. Either \"internal\", or empty.")
+#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_BOND_DOWNDELAY N_("None")
+#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_BOND_MODE N_("Bonding mode. One of \"active-backup\", \"balance-slb\", or \"balance-tcp\".")
+#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_BOND_UPDELAY N_("None")
+#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_LACP N_("LACP mode. One of \"active\", \"off\", or \"passive\".")
+#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_NAME N_("The setting's name, which uniquely identifies the setting within the connection. Each setting type has a name unique to that type, for example \"ppp\" or \"wireless\" or \"wired\".")
+#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_TAG N_("None")
+#define DESCRIBE_DOC_NM_SETTING_OVS_PORT_VLAN_MODE N_("None")
#define DESCRIBE_DOC_NM_SETTING_PPP_BAUD N_("If non-zero, instruct pppd to set the serial port to the specified baudrate. This value should normally be left as 0 to automatically choose the speed.")
#define DESCRIBE_DOC_NM_SETTING_PPP_CRTSCTS N_("If TRUE, specify that pppd should set the serial port to use hardware flow control with RTS and CTS signals. This value should normally be set to FALSE.")
#define DESCRIBE_DOC_NM_SETTING_PPP_LCP_ECHO_FAILURE N_("If non-zero, instruct pppd to presume the connection to the peer has failed if the specified number of LCP echo-requests go unanswered by the peer. The \"lcp-echo-interval\" property must also be set to a non-zero value if this property is used.")
diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c
index 815f096109..bda2f3b711 100644
--- a/libnm-core/nm-connection.c
+++ b/libnm-core/nm-connection.c
@@ -1975,6 +1975,7 @@ nm_connection_is_virtual (NMConnection *connection)
|| !strcmp (type, NM_SETTING_MACSEC_SETTING_NAME)
|| !strcmp (type, NM_SETTING_MACVLAN_SETTING_NAME)
|| !strcmp (type, NM_SETTING_OVS_INTERFACE_SETTING_NAME)
+ || !strcmp (type, NM_SETTING_OVS_PORT_SETTING_NAME)
|| !strcmp (type, NM_SETTING_VXLAN_SETTING_NAME))
return TRUE;
@@ -2344,6 +2345,22 @@ nm_connection_get_setting_ovs_interface (NMConnection *connection)
}
/**
+ * nm_connection_get_setting_ovs_port:
+ * @connection: the #NMConnection
+ *
+ * A shortcut to return any #NMSettingOvsPort the connection might contain.
+ *
+ * Returns: (transfer none): an #NMSettingOvsPort if the connection contains one, otherwise %NULL
+ *
+ * Since: 1.10
+ **/
+NMSettingOvsPort *
+nm_connection_get_setting_ovs_port (NMConnection *connection)
+{
+ return _connection_get_setting_check (connection, NM_TYPE_SETTING_OVS_PORT);
+}
+
+/**
* nm_connection_get_setting_ppp:
* @connection: the #NMConnection
*
diff --git a/libnm-core/nm-connection.h b/libnm-core/nm-connection.h
index 4942fbde68..537c0a8d76 100644
--- a/libnm-core/nm-connection.h
+++ b/libnm-core/nm-connection.h
@@ -215,6 +215,8 @@ NMSettingMacvlan * nm_connection_get_setting_macvlan (NMConnec
NMSettingOlpcMesh * nm_connection_get_setting_olpc_mesh (NMConnection *connection);
NM_AVAILABLE_IN_1_10
NMSettingOvsInterface * nm_connection_get_setting_ovs_interface (NMConnection *connection);
+NM_AVAILABLE_IN_1_10
+NMSettingOvsPort * nm_connection_get_setting_ovs_port (NMConnection *connection);
NMSettingPpp * nm_connection_get_setting_ppp (NMConnection *connection);
NMSettingPppoe * nm_connection_get_setting_pppoe (NMConnection *connection);
NM_AVAILABLE_IN_1_6
diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h
index 9614dcf8fb..c020b25b63 100644
--- a/libnm-core/nm-core-internal.h
+++ b/libnm-core/nm-core-internal.h
@@ -57,6 +57,7 @@
#include "nm-setting-macvlan.h"
#include "nm-setting-olpc-mesh.h"
#include "nm-setting-ovs-interface.h"
+#include "nm-setting-ovs-port.h"
#include "nm-setting-ppp.h"
#include "nm-setting-pppoe.h"
#include "nm-setting-serial.h"
diff --git a/libnm-core/nm-core-types.h b/libnm-core/nm-core-types.h
index b9d8a43179..ede3c7dc52 100644
--- a/libnm-core/nm-core-types.h
+++ b/libnm-core/nm-core-types.h
@@ -51,6 +51,7 @@ typedef struct _NMSettingMacsec NMSettingMacsec;
typedef struct _NMSettingMacvlan NMSettingMacvlan;
typedef struct _NMSettingOlpcMesh NMSettingOlpcMesh;
typedef struct _NMSettingOvsInterface NMSettingOvsInterface;
+typedef struct _NMSettingOvsPort NMSettingOvsPort;
typedef struct _NMSettingPpp NMSettingPpp;
typedef struct _NMSettingPppoe NMSettingPppoe;
typedef struct _NMSettingSerial NMSettingSerial;
diff --git a/libnm-core/nm-setting-ovs-port.c b/libnm-core/nm-setting-ovs-port.c
new file mode 100644
index 0000000000..c45ab48c0c
--- /dev/null
+++ b/libnm-core/nm-setting-ovs-port.c
@@ -0,0 +1,412 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * 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 of the License, or (at your option) any later version.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2017 Red Hat, Inc.
+ */
+
+#include "nm-default.h"
+
+#include "nm-setting-ovs-port.h"
+
+#include "nm-connection-private.h"
+#include "nm-setting-connection.h"
+#include "nm-setting-private.h"
+
+/**
+ * SECTION:nm-setting-ovs-port
+ * @short_description: Describes connection properties for OpenVSwitch ports.
+ *
+ * The #NMSettingOvsPort object is a #NMSetting subclass that describes properties
+ * necessary for OpenVSwitch ports.
+ **/
+
+/**
+ * NMSettingOvsPort:
+ *
+ * OvsPort Link Settings
+ */
+struct _NMSettingOvsPort {
+ NMSetting parent;
+
+ char *vlan_mode;
+ guint tag;
+ char *lacp;
+ char *bond_mode;
+ guint bond_updelay;
+ guint bond_downdelay;
+};
+
+struct _NMSettingOvsPortClass {
+ NMSettingClass parent;
+};
+
+G_DEFINE_TYPE_WITH_CODE (NMSettingOvsPort, nm_setting_ovs_port, NM_TYPE_SETTING,
+ _nm_register_setting (OVS_PORT, NM_SETTING_PRIORITY_HW_BASE))
+NM_SETTING_REGISTER_TYPE (NM_TYPE_SETTING_OVS_PORT)
+
+enum {
+ PROP_0,
+ PROP_VLAN_MODE,
+ PROP_TAG,
+ PROP_LACP,
+ PROP_BOND_MODE,
+ PROP_BOND_UPDELAY,
+ PROP_BOND_DOWNDELAY,
+ LAST_PROP
+};
+
+/**
+ * nm_setting_ovs_port_new:
+ *
+ * Creates a new #NMSettingOvsPort object with default values.
+ *
+ * Returns: (transfer full): the new empty #NMSettingOvsPort object
+ *
+ * Since: 1.10
+ **/
+NMSetting *
+nm_setting_ovs_port_new (void)
+{
+ return (NMSetting *) g_object_new (NM_TYPE_SETTING_OVS_PORT, NULL);
+}
+
+/**
+ * nm_setting_ovs_port_get_vlan_mode:
+ * @s_ovs_port: the #NMSettingOvsPort
+ *
+ * Returns: the #NMSettingOvsPort:vlan-mode property of the setting
+ *
+ * Since: 1.10
+ **/
+const char *
+nm_setting_ovs_port_get_vlan_mode (NMSettingOvsPort *s_ovs_port)
+{
+ g_return_val_if_fail (NM_IS_SETTING_OVS_PORT (s_ovs_port), NULL);
+
+ return s_ovs_port->vlan_mode;
+}
+
+/**
+ * nm_setting_ovs_port_get_tag:
+ * @s_ovs_port: the #NMSettingOvsPort
+ *
+ * Returns: the #NMSettingOvsPort:tag property of the setting
+ *
+ * Since: 1.10
+ **/
+guint
+nm_setting_ovs_port_get_tag (NMSettingOvsPort *s_ovs_port)
+{
+ g_return_val_if_fail (NM_IS_SETTING_OVS_PORT (s_ovs_port), 0);
+
+ return s_ovs_port->tag;
+}
+
+/**
+ * nm_setting_ovs_port_get_lacp:
+ * @s_ovs_port: the #NMSettingOvsPort
+ *
+ * Returns: the #NMSettingOvsPort:lacp property of the setting
+ *
+ * Since: 1.10
+ **/
+const char *
+nm_setting_ovs_port_get_lacp (NMSettingOvsPort *s_ovs_port)
+{
+ g_return_val_if_fail (NM_IS_SETTING_OVS_PORT (s_ovs_port), NULL);
+
+ return s_ovs_port->lacp;
+}
+
+/**
+ * nm_setting_ovs_port_get_bond_mode:
+ * @s_ovs_port: the #NMSettingOvsPort
+ *
+ * Returns: the #NMSettingOvsPort:bond-mode property of the setting
+ *
+ * Since: 1.10
+ **/
+const char *
+nm_setting_ovs_port_get_bond_mode (NMSettingOvsPort *s_ovs_port)
+{
+ g_return_val_if_fail (NM_IS_SETTING_OVS_PORT (s_ovs_port), NULL);
+
+ return s_ovs_port->bond_mode;
+}
+
+/**
+ * nm_setting_ovs_port_get_bond_updelay:
+ * @s_ovs_port: the #NMSettingOvsPort
+ *
+ * Returns: the #NMSettingOvsPort:bond-updelay property of the setting
+ *
+ * Since: 1.10
+ **/
+guint
+nm_setting_ovs_port_get_bond_updelay (NMSettingOvsPort *s_ovs_port)
+{
+ g_return_val_if_fail (NM_IS_SETTING_OVS_PORT (s_ovs_port), 0);
+
+ return s_ovs_port->bond_updelay;
+}
+
+/**
+ * nm_setting_ovs_port_get_bond_downdelay:
+ * @s_ovs_port: the #NMSettingOvsPort
+ *
+ * Returns: the #NMSettingOvsPort:bond-downdelay property of the setting
+ *
+ * Since: 1.10
+ **/
+guint
+nm_setting_ovs_port_get_bond_downdelay (NMSettingOvsPort *s_ovs_port)
+{
+ g_return_val_if_fail (NM_IS_SETTING_OVS_PORT (s_ovs_port), 0);
+
+ return s_ovs_port->bond_downdelay;
+}
+
+static void
+set_property (GObject *object, guint prop_id,
+ const GValue *value, GParamSpec *pspec)
+{
+ NMSettingOvsPort *s_ovs_port = NM_SETTING_OVS_PORT (object);
+
+ switch (prop_id) {
+ case PROP_VLAN_MODE:
+ g_free (s_ovs_port->vlan_mode);
+ s_ovs_port->vlan_mode = g_value_dup_string (value);
+ break;
+ case PROP_TAG:
+ s_ovs_port->tag = g_value_get_uint (value);
+ break;
+ case PROP_LACP:
+ g_free (s_ovs_port->lacp);
+ s_ovs_port->lacp = g_value_dup_string (value);
+ break;
+ case PROP_BOND_MODE:
+ g_free (s_ovs_port->bond_mode);
+ s_ovs_port->bond_mode = g_value_dup_string (value);
+ break;
+ case PROP_BOND_UPDELAY:
+ s_ovs_port->bond_updelay = g_value_get_uint (value);
+ break;
+ case PROP_BOND_DOWNDELAY:
+ s_ovs_port->bond_downdelay = g_value_get_uint (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+get_property (GObject *object, guint prop_id,
+ GValue *value, GParamSpec *pspec)
+{
+ NMSettingOvsPort *s_ovs_port = NM_SETTING_OVS_PORT (object);
+
+ switch (prop_id) {
+ case PROP_VLAN_MODE:
+ g_value_set_string (value, s_ovs_port->vlan_mode);
+ break;
+ case PROP_TAG:
+ g_value_set_uint (value, s_ovs_port->tag);
+ break;
+ case PROP_LACP:
+ g_value_set_string (value, s_ovs_port->lacp);
+ break;
+ case PROP_BOND_MODE:
+ g_value_set_string (value, s_ovs_port->bond_mode);
+ break;
+ case PROP_BOND_UPDELAY:
+ g_value_set_uint (value, s_ovs_port->bond_updelay);
+ break;
+ case PROP_BOND_DOWNDELAY:
+ g_value_set_uint (value, s_ovs_port->bond_downdelay);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static int
+verify (NMSetting *setting, NMConnection *connection, GError **error)
+{
+ NMSettingOvsPort *s_ovs_port = NM_SETTING_OVS_PORT (setting);
+
+ if (!_nm_connection_verify_required_interface_name (connection, error))
+ return FALSE;
+
+ if (!NM_IN_STRSET (s_ovs_port->vlan_mode, "access", "native-tagged", "native-untagged", "trunk", NULL)) {
+ g_set_error (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("'%s' is not allowed in vlan_mode"),
+ s_ovs_port->vlan_mode);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_OVS_PORT_SETTING_NAME, NM_SETTING_OVS_PORT_VLAN_MODE);
+ return FALSE;
+ }
+
+ if (s_ovs_port->tag >= 4095) {
+ g_set_error (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("the tag id must be in range 0-4094 but is %u"),
+ s_ovs_port->tag);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_OVS_PORT_SETTING_NAME, NM_SETTING_OVS_PORT_TAG);
+ return FALSE;
+ }
+
+ if (!NM_IN_STRSET (s_ovs_port->lacp, "active", "off", "passive", NULL)) {
+ g_set_error (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("'%s' is not allowed in lacp"),
+ s_ovs_port->lacp);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_OVS_PORT_SETTING_NAME, NM_SETTING_OVS_PORT_LACP);
+ return FALSE;
+ }
+
+ if (!NM_IN_STRSET (s_ovs_port->bond_mode, "active-backup", "balance-slb", "balance-tcp", NULL)) {
+ g_set_error (error,
+ NM_CONNECTION_ERROR,
+ NM_CONNECTION_ERROR_INVALID_PROPERTY,
+ _("'%s' is not allowed in bond_mode"),
+ s_ovs_port->bond_mode);
+ g_prefix_error (error, "%s.%s: ", NM_SETTING_OVS_PORT_SETTING_NAME, NM_SETTING_OVS_PORT_BOND_MODE);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+finalize (GObject *object)
+{
+ NMSettingOvsPort *s_ovs_port = NM_SETTING_OVS_PORT (object);
+
+ g_free (s_ovs_port->vlan_mode);
+ g_free (s_ovs_port->lacp);
+ g_free (s_ovs_port->bond_mode);
+
+ G_OBJECT_CLASS (nm_setting_ovs_port_parent_class)->finalize (object);
+}
+
+static void
+nm_setting_ovs_port_init (NMSettingOvsPort *s_ovs_port)
+{
+}
+
+static void
+nm_setting_ovs_port_class_init (NMSettingOvsPortClass *setting_class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (setting_class);
+ NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class);
+
+ object_class->set_property = set_property;
+ object_class->get_property = get_property;
+ object_class->finalize = finalize;
+ parent_class->verify = verify;
+
+ /**
+ * NMSettingOvsPort:vlan_mode:
+ *
+ * The VLAN mode. One of "access", "native-tagged", "native-untagged",
+ * "trunk" or unset.
+ **/
+ g_object_class_install_property
+ (object_class, PROP_VLAN_MODE,
+ g_param_spec_string (NM_SETTING_OVS_PORT_VLAN_MODE, "", "",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ NM_SETTING_PARAM_INFERRABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingOvsPort:vlan_tag:
+ *
+ * The VLAN tag in the range 0-4095.
+ **/
+ g_object_class_install_property
+ (object_class, PROP_TAG,
+ g_param_spec_uint (NM_SETTING_OVS_PORT_TAG, "", "",
+ 0, 4095, 0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ NM_SETTING_PARAM_INFERRABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingOvsPort:lacp:
+ *
+ * LACP mode. One of "active", "off", or "passive".
+ **/
+ g_object_class_install_property
+ (object_class, PROP_LACP,
+ g_param_spec_string (NM_SETTING_OVS_PORT_LACP, "", "",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ NM_SETTING_PARAM_INFERRABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingOvsPort:bond-mode:
+ *
+ * Bonding mode. One of "active-backup", "balance-slb", or "balance-tcp".
+ **/
+ g_object_class_install_property
+ (object_class, PROP_BOND_MODE,
+ g_param_spec_string (NM_SETTING_OVS_PORT_BOND_MODE, "", "",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ NM_SETTING_PARAM_INFERRABLE |
+ G_PARAM_STATIC_STRINGS));
+
+
+ /**
+ * NMSettingOvsPort:updelay:
+ *
+ * The time port must be active befor it starts forwarding traffic.
+ **/
+ g_object_class_install_property
+ (object_class, PROP_BOND_UPDELAY,
+ g_param_spec_uint (NM_SETTING_OVS_PORT_BOND_UPDELAY, "", "",
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ NM_SETTING_PARAM_INFERRABLE |
+ G_PARAM_STATIC_STRINGS));
+
+ /**
+ * NMSettingOvsPort:downdelay:
+ *
+ * The time port must be inactive in order to be considered down.
+ **/
+ g_object_class_install_property
+ (object_class, PROP_BOND_DOWNDELAY,
+ g_param_spec_uint (NM_SETTING_OVS_PORT_BOND_DOWNDELAY, "", "",
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT |
+ NM_SETTING_PARAM_INFERRABLE |
+ G_PARAM_STATIC_STRINGS));
+}
diff --git a/libnm-core/nm-setting-ovs-port.h b/libnm-core/nm-setting-ovs-port.h
new file mode 100644
index 0000000000..61ff19b81f
--- /dev/null
+++ b/libnm-core/nm-setting-ovs-port.h
@@ -0,0 +1,69 @@
+/*
+ * 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 of the License, or (at your option) any later version.
+ *
+ * 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, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2017 Red Hat, Inc.
+ */
+
+#ifndef __NM_SETTING_OVS_PORT_H__
+#define __NM_SETTING_OVS_PORT_H__
+
+#if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
+#error "Only <NetworkManager.h> can be included directly."
+#endif
+
+#include "nm-setting.h"
+
+G_BEGIN_DECLS
+
+#define NM_TYPE_SETTING_OVS_PORT (nm_setting_ovs_port_get_type ())
+#define NM_SETTING_OVS_PORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_OVS_PORT, NMSettingOvsPort))
+#define NM_SETTING_OVS_PORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_OVS_PORTCONFIG, NMSettingOvsPortClass))
+#define NM_IS_SETTING_OVS_PORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_OVS_PORT))
+#define NM_IS_SETTING_OVS_PORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_OVS_PORT))
+#define NM_SETTING_OVS_PORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_OVS_PORT, NMSettingOvsPortClass))
+
+#define NM_SETTING_OVS_PORT_SETTING_NAME "ovs-port"
+
+#define NM_SETTING_OVS_PORT_VLAN_MODE "vlan-mode"
+#define NM_SETTING_OVS_PORT_TAG "tag"
+#define NM_SETTING_OVS_PORT_LACP "lacp"
+#define NM_SETTING_OVS_PORT_BOND_MODE "bond-mode"
+#define NM_SETTING_OVS_PORT_BOND_UPDELAY "bond-updelay"
+#define NM_SETTING_OVS_PORT_BOND_DOWNDELAY "bond-downdelay"
+
+typedef struct _NMSettingOvsPortClass NMSettingOvsPortClass;
+
+NM_AVAILABLE_IN_1_10
+GType nm_setting_ovs_port_get_type (void);
+NM_AVAILABLE_IN_1_10
+NMSetting *nm_setting_ovs_port_new (void);
+
+NM_AVAILABLE_IN_1_10
+const char *nm_setting_ovs_port_get_vlan_mode (NMSettingOvsPort *s_ovs_port);
+NM_AVAILABLE_IN_1_10
+guint nm_setting_ovs_port_get_tag (NMSettingOvsPort *s_ovs_port);
+NM_AVAILABLE_IN_1_10
+const char *nm_setting_ovs_port_get_lacp (NMSettingOvsPort *s_ovs_port);
+NM_AVAILABLE_IN_1_10
+const char *nm_setting_ovs_port_get_bond_mode (NMSettingOvsPort *s_ovs_port);
+NM_AVAILABLE_IN_1_10
+guint nm_setting_ovs_port_get_bond_updelay (NMSettingOvsPort *s_ovs_port);
+NM_AVAILABLE_IN_1_10
+guint nm_setting_ovs_port_get_bond_downdelay (NMSettingOvsPort *s_ovs_port);
+
+G_END_DECLS
+
+#endif /* __NM_SETTING_OVS_PORT_H__ */
diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c
index 9ebaf20682..3f1671249d 100644
--- a/libnm-core/nm-setting.c
+++ b/libnm-core/nm-setting.c
@@ -260,6 +260,8 @@ _nm_setting_slave_type_is_valid (const char *slave_type, const char **out_port_t
port_type = NM_SETTING_BRIDGE_PORT_SETTING_NAME;
else if (!strcmp (slave_type, NM_SETTING_OVS_INTERFACE_SETTING_NAME))
;
+ else if (!strcmp (slave_type, NM_SETTING_OVS_PORT_SETTING_NAME))
+ ;
else if (!strcmp (slave_type, NM_SETTING_TEAM_SETTING_NAME))
port_type = NM_SETTING_TEAM_PORT_SETTING_NAME;
else
diff --git a/libnm/libnm.ver b/libnm/libnm.ver
index 9e49e1db46..5b0f04ff2c 100644
--- a/libnm/libnm.ver
+++ b/libnm/libnm.ver
@@ -1191,6 +1191,7 @@ global:
nm_setting_bridge_get_group_forward_mask;
nm_setting_ip_config_get_route_table;
nm_setting_ovs_interface_get_type;
+ nm_setting_ovs_port_get_type;
nm_setting_pppoe_get_parent;
nm_setting_wireless_security_get_pmf;
nm_setting_wireless_security_get_wps_method;
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 74acf87301..afff63a898 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -76,6 +76,7 @@ libnm-core/nm-setting-macsec.c
libnm-core/nm-setting-macvlan.c
libnm-core/nm-setting-olpc-mesh.c
libnm-core/nm-setting-ovs-interface.c
+libnm-core/nm-setting-ovs-port.c
libnm-core/nm-setting-ppp.c
libnm-core/nm-setting-pppoe.c
libnm-core/nm-setting-proxy.c