Commit Graph

28 Commits

Author SHA1 Message Date
Brian Haley cf37563c83 Remove deprecated vsctl ovsdb_interface api
This was deprecated in https://review.openstack.org/#/c/503070/
so remove all the vsctl-related code, leaving just the native
ovsdb api.

Also removed renamed ovs_vsctl_timeout value, which was changed
to ovsdb_timeout in https://review.openstack.org/#/c/518391/

Change-Id: I50dfcea3deb41df1bd01fd06b76522453a6ba50b
2018-10-11 14:59:34 -04:00
Brian Haley 90cd939047 Fix W503 pep8 warnings
Fix W503 (line break before binary operator) pep8 warnings
and no longer ignore new failures.

Trivialfix

Change-Id: I7539f3b7187f2ad40681781f74b6e05a01bac474
2018-04-17 14:22:58 +00:00
Sławek Kapłoński b026da9097 Switch to use directly ovsdbapp.api module
In neutron.agent.ovsdb.api module there were some deprecated
"redirections" to classes from ovsdbapp.api module.

Now those redirections are removed and classes from ovsdbapp.api are
used directly.

Change-Id: I7ffc0d2e8f590795000ba9891f6b2ae62a05fee6
2018-01-15 12:52:29 +01:00
Jenkins a6d4773e55 Merge "Add stubs for new ovsdbapp API functions" 2017-08-17 21:43:49 +00:00
Terry Wilson 3103a11f95 Add stubs for new ovsdbapp API functions
Neutron doesn't use these methods, but they will be added to
ovsdbapp 1.0, and being abstractmethods, would cause an error. The
methods are added in I664add660ce0ec3b0da23325ad38580d850e1f29 and
I9352ffe0f245c579fd766ecd00e8ca512f806798.

Change-Id: Ibfdea4890f7d01ddd38872db40a9829d6b6bdf90
2017-08-16 11:56:45 -05:00
Inessa Vasilevskaya 7322bd6efb Make code follow log translation guideline
Since Pike log messages should not be translated.
This patch removes calls to i18n _LC, _LI, _LE, _LW from
logging logic throughout the code. Translators definition
from neutron._i18n is removed as well.
This patch also removes log translation verification from
ignore directive in tox.ini.

Change-Id: If9aa76fcf121c0e61a7c08088006c5873faee56e
2017-08-14 02:01:48 +00:00
Terry Wilson e6333593ae Use the ovsdbapp library
This patch uses the ovsdbapp Python library, which is the new
project based on the Neutron OVSDB API.

The CLI implementation of the OVSDB API remains in the Neutron
tree.

Neutron continues providing the (deprecated) ability to allow
the OVSDB API to be imported from Neutron.

The deleted tests exist in the ovsdbapp project. More will be
moved later, but many of the tests in the Neutron tree use
ovs_lib, which doesn't exist in ovsdbapp so those tests will
probably stay in the Neutron tree.

Closes-Bug: #1684277
Depends-On: I3d3535b1d6fe37c78a9399903b65bbd688b1c4b9
Change-Id: Ic8c7db0e80d0ad104242322d3f1f70cab8caab92
2017-04-20 20:13:48 -05:00
fpxie 574312165b Replace six.iteritems with dict.items(Part-2)
according to https://wiki.openstack.org/wiki/Python3, now we should avoid
using six.iteritems and replace it with dict.items.

Change-Id: I58a399baa2275f280acc0e6d649f81838648ce5c
Closes-Bug: #1680761
2017-04-18 18:56:46 +08:00
Jakub Libosvar acfbd2d490 Move ovsdb_nested transaction to ovs_lib
The patch introduces new abstract method to the API abstract class. The
method is supposed to return a new Transaction object. Each
API object is capable of store one nested transaction which is returned
by context manager in case some transaction already exists.

As there are no projects in OpenStack that use inheritance directly from
API abstract class, it's safe to make this new create_transaction() abstract method.
Only projects that currenlty use ovsdb API are networking-ovn,
dragonflow and networking-l2gw. OVN and Dragonflow use only IDL
implementation and L2GW copies the code of API abstract class.

Closes-bug 1653517

Change-Id: I55dd417cae7ebbe0668ba5606949ce4ab045d251
2017-02-02 18:56:03 +00:00
Luong Anh Tuan 4f3be300b2 Replaces uuid.uuid4 with uuidutils.generate_uuid()
Openstack common has a wrapper for generating uuids.We should
use that function when generating uuids for consistency.

Change-Id: Id13e01ba59f37a5be90db1fe778e9735f0e8b9b6
Closes-Bug: #1082248
2017-01-05 11:57:24 +00:00
Isaku Yamahata 7d42176853 ovsdb: don't erase existing ovsdb managers
The current existing agent erases already set ovsdb managers
entries. In some use cases, cloud admin sets ovsdb managers.
eg, for SDN controllers or monitoring purpose. Neutron agent
shouldn't unconditionally erase the existing ovsdb managers.

This patch implements a new api add_manager (along with
get_manager and remove_manager) to the ovsdb api which will
allow us to configure a manager on a switch without overriding
the existing managers.

Closes-Bug: #1614766
Change-Id: Ibf9bd02fac3070d166546cac478ef984e4e43f28
Co-Authored-By: sridhargaddam <sgaddam@redhat.com>
Co-Authored-By: Terry Wilson <twilson@redhat.com>
2016-11-23 07:21:08 +00:00
Terry Wilson 135a3fdc17 Add db_add to OVSDB API
It is at times useful to append to an OVSDB row in a single
transaction instead of doing separate transactions to pull back a
value, then another to modify and append to it. This patch adds

API.db_add(self, table, record, column, *values)

to the OVSDB API and adds it to the vsctl and native
implementations. It follows the format of ovs-vsctl's 'add'
command which works on both sets and maps. For map columns, its
behavior is to set a key in a column if it is not already set. For
sets, it appends to the current values stored in the column.

For maps, values can be passed as
  (..., {'key': value}, {'key2': value2, ...)
or
 (..., {'key': value, 'key2': value})

Change-Id: Ib6ce75846f9b13c1c33f0ced5ccc619ee7860dc1
2016-10-12 12:47:17 +00:00
Terry Wilson 1f4f806584 Handle uuid references within an ovsdb transaction
Enable the OVSDB API implementations to handle referencing a newly
created object within the same transaction. For vsctl, this is via
the --id=@name construct. For native, this is via storing the
created row as the result, then replacing the result when the
transaction completes. This uses an api.Command object passed as
part of a column value in a db_set/db_create operation as a
reference to that object in a transaction. For example, do:

with self.ovsdb.transaction() as txn:
    queue = txn.add(self.ovsdb.db_create("Queue", ...))
    qos = txn.add(self.ovsdb.db_create("QoS", queues={0: queue}))
    port = txn.add(self.ovsdb.db_set("Port", pname, ('qos', qos)))

instead of having to do 5 separate transactions to: create a
queue, find the queue, create the QoS entry, find the QoS entry,
and finally to update the port with the QoS entry.

Change-Id: I1781794958af1483dabc0f5d17f2df6fea828564
Closes-Bug: #1615105
2016-10-03 02:44:52 -05:00
Emma Foley dcf6ffe185 Fixes typos Openstack -> OpenStack
Occurances of Openstack (incorrect capitalization) are replaced with
OpenStack

Change-Id: I7f33060a2dd430cdd49aebf9420e3cd54d21c72c
Closes-Bug: #1535246
2016-01-18 16:04:56 +00:00
Doug Wiegley dd726ed494 Move i18n to _i18n, as per oslo_i18n guidelines
- This does NOT break other projects that rely on neutron.i18n,
  as this change includes a debtcollector shim to maintain those
  older entry points, until they can migrate.
- Also updates _i18n.py to the latest pattern defined by oslo_i18n
- Guidance and template are from the reference:
  http://docs.openstack.org/developer/oslo.i18n/usage.html

Partially-Closes-Bug: #1519493
Change-Id: I1aa3a5fd837d9156da4643a367013c869ed8bf9d
2015-12-01 19:29:10 -07:00
Gary Kotton 3858846770 Log error instead of exception trace
In impl_vsctl we rather use LOG.error instead of
LOG.exception. In these case the exception trace did not provide
any valuable information.

Change-Id: Ia02f000d460b3aee72a31e9963e5d0e0d4c68315
Closes-bug: #1518429
2015-11-23 05:53:18 -08:00
Sean Mooney 63b0336282 Add config option to specify ovs datapath.
This change introduces a new datapath_type parameter
to allow specification of the ovs datapath to be used.
This change introduces new functional and unit tests.

DocImpact
Change-Id: I929d8d15fc6cfdb799c53ef0f3722f4ed5c1096d
Partial-Bug: #1469871
2015-08-21 12:18:32 +01:00
Ihar Hrachyshka fcc5d5bcf7 Merge remote-tracking branch 'origin/feature/qos' into merge-branch
Change-Id: I1c1fd593235fda1cdd053980f50eff21ca9011b6
2015-07-24 14:24:10 +02:00
Yalei Wang b4e42a3418 Add new ovs DB API to inquire interfaces name list in a bridge
In OVS, ports don't equal to interfaces when a bond port created. This patch
add the new API get_iface_name_list to get the interfaces' name, and it's
supplementary to the current get_port_name_list API.

Change-Id: I29c220e099b8dcf78248e2d660c435578bb2932d
Partial-Bug: #1460494
2015-07-22 15:15:12 +08:00
Gal Sagie be1d242fa3 Add Create/Destroy API to OVS QoS BW Limiting
Add infrastructure needed for the implementations
(CLI and native) and add API to ovs_lib
Add functional tests for ovs_lib

blueprint ml2-ovs-qos-with-bwlimiting

Change-Id: Ided0740548987ca91f1549f251c7906e6449f91d
2015-07-01 10:04:54 +00:00
Jenkins b06b4cafc5 Merge "Python 3: do not index a dict_values object" 2015-06-08 09:35:22 +00:00
rossella 62d37f9187 Make _val_to_py and _py_to_val not private
Move _val_to_py and _py_to_val to neutron.agent.ovsdb.api
and remove the underscore since they will be used by other
classes.

Change-Id: I3a469ab3b1c1d83ad20dc6c77f1072fc6d546419
2015-06-05 12:23:47 +00:00
Cyril Roelandt 38eae7acb3 Python 3: do not index a dict_values object
In Python 3, dict.values() return a dict_values object instead of a list, as in
Python 2. This object cannot be indexed.

Change-Id: Ia4fdb4cafb1811c55dc8f14e303ab2db1b1110b3
Blueprint: neutron-python3
2015-06-05 00:03:24 +02:00
Cyril Roelandt 6c1cb05302 Python 3: use six.string_types instead of basestring
In Python 3, there is no "basestring". In Python 3, "six.string_types" is
"basestring", and "str" in Python 3.

Change-Id: Ic22e932cbf3c4b75cd424f4b41428da869f197cf
Blueprint: neutron-python3
2015-05-21 04:03:17 +02:00
Adelina Tuvenie f0d9410a82 OVS agent support on Hyper-V
This patch abstracts away platform specific differences in
agent/linux/utils.py and agent/linux/polling.py in order for
OVS neutron agent to work on Hyper-V.

agent.linux.utils uses fcntl that is not available on Windows and
also uses rootwrap which is no necessary on Windows.

ovsdb_monitor.SimpleInterfaceMonitor works only on GNU/Linux because
agent.linux.async_process uses platfom specific components like the
kill command.

Unit tests have been updated accordingly

Implements blueprint: hyper-v-ovs-agent

Change-Id: I3326414335467d9dc5da03e6d1016d0e32330dd0
2015-03-25 13:48:33 -07:00
Ihar Hrachyshka 22328baf1f Migrate to oslo.log
It's mostly a matter of changing imports to a new location.

Non-obvious changes needed:
* pass overwrite= argument to oslo_context since oslo.log reads context
  from its thread local store and not local.store from incubator
* don't store context at local.store now that there is no code that
  would consume it
* LOG.deprecated() -> versionutils.report_deprecated_feature()
* dropped LOG.audit check from hacking rule since now the method does
  not exist
* WritableLogger is now located in oslo_log.loggers

Dropped log module from the tree. Also dropped local module that is now
of no use (and obsolete, as per oslo team).

Added versionutils back to openstack-common.conf since now we use the
module directly from neutron code and not just as a dependency of some
other oslo-incubator module.

Note: tempest tests are expected to be broken now, so instead of fixing
all the oslo.log related issues for the subtree in this patch, I only
added TODOs with directions for later fix.

Closes-Bug: #1425013
Change-Id: I310e059a815377579de6bb2aa204de168e72571e
2015-03-12 11:22:56 +01:00
Terry Wilson d336623d55 Remove root_helper arg for ovs_lib
Stop passing root_helper in ovs_lib classes and instead rely on
execute() looking up the root_helper from the config.

Partially-Implements: blueprint rootwrap-daemon-mode
Change-Id: I24c29a1964582dabaa04358e05be903c8cb49229
2015-02-12 15:33:31 -06:00
Terry Wilson fa22605c15 Reorganize OVSDB API
This reorganization makes adding a second implementation of the
API a lot cleaner.

Partially-Implements: blueprint vsctl-to-ovsdb
Change-Id: Ice869f33b6023d3693ad732276267621912c691b
2015-01-22 09:32:29 -06:00