Commit Graph

120 Commits

Author SHA1 Message Date
Takashi Kajinami f15a4b6206 Drop wrong stacklevel
This is follow-up of 077e43698e and fixes
the wrong stack level for deprecation warning. We don't have to look
for the point of upper caller.

Change-Id: I615d995c42e6ff689d25f5db8026d9cd684d93ad
2024-02-22 00:04:52 +09:00
Takashi Kajinami 077e43698e Deprecate Windows support
Because WinStackers project has been retired, running OpenStack on
Windows operating systems is no longer maintained.

Change-Id: Ic5971ee22aa309a8b46f21fccaa8be7c0091fb0c
2023-11-18 17:37:28 +00:00
Sean Mooney c0d101aa81 set default qos policy
This change modifies the os-vif ovs plugin to set a default
tc qdisc on ovs interface when the host os is not windows
and the system datapath is used.

This change fixes a "silent" bug in the functional test code due
to a change in an ovsdbapp function signiture to accpet a new paramater.

Closes-Bug: #2017868
Change-Id: Id9ef7074634a0f23d67a4401fa8fca363b51bb43
2023-05-09 20:02:48 +01:00
Balazs Gibizer 2f31947393 Make tox.ini tox 4.0.0 compatible
* removed skipdist=True to make sure os-vif is available in the virtual
  env
* removed basepython = python3 as we assume all developer switched to
  python3 in their env already
* removed ignore_basepython_conflict = True as without the basepython
  definition generative targets now work without conflict

Also squashed in the commit fixing the functional target as both fix is
needed to unblock the gate:

add CAP_DAC_OVERRIDE to test privsep contexts

This change modifes the privsep contexts used by the test
code to create inteface without using the os-vif plugins.

The os-vif functional tests actully create ovs and linux
brdiges and dummy netdevs. to ensure the drier work correctly
the functional tests have a simpler test only version of the
port/brige management commands that are used to prepare
and validate the test env. The simpler implementation uses
standard linux commandline tools like "ip" or "ovs-vsctl"
which on ubuntu 22.04 require the addtion of CAP_DAC_OVERRIDE
to work around socket/file ownership issues.

To avoid  adding capablities at runtime that are not required
this change modifes the existing test only context in
the os_vif.tests.functional.privsep module and add a new test
context for the vif_plug_ovs plugin

Change-Id: Ide357cb64a8d128ff8ad978abae6a039e814d8a9
2023-01-09 12:30:15 +01:00
David Vallee Delisle c9b2077786 Creating oslo.config.opts entry_points for plugins
To assist with automated configuration validation, we need entry points
for oslo.config.opts for each one of the plugins.

Change-Id: I7fc132f917949d147dd6371d54e01a6cfd995aae
2021-05-11 05:57:24 -04:00
Stephen Finucane d6e7521fc4 windows: Add missing return
We were logging in a code path but not setting a return value. This was
passing tests because it seems 'assertFalse' does a falsey check, not a
true boolean False check.

Change-Id: If0156cd4d4c1acbad683873d632ee5afb0b7b7ad
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-08-20 09:00:17 +01:00
Sean Mooney c8703df185 support pyroute2 0.5.13
This change modifes os-vif add interface to account
for the new behavior of link_lookup.
In 0.5.13 if a link is not found link_lookup returns an
empty list. In previous releases it raised ipexc.NetlinkError.

Closes-bug: #1890353

Change-Id: I567afb544425c1b91d98968a0b597be718869089
2020-08-06 11:21:28 +00:00
Takashi Natsume ee0b34eb3e Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I67fcc16530f1c46eecb62e27eb7b88d1dee6f9df
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2020-05-25 06:41:16 +00:00
Takashi Natsume 727d8da342 Remove six
Now that we no longer support py27, we can remove six.

Change-Id: Ie3ff2b7f5e8a5ff1357d6147ab1eb481f562aba3
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2020-05-02 18:28:47 +09:00
Ghanshyam Mann 840df14b56 Fix doc build job for wanring turn into error
Few warnings are now failing as error:
- duplicate autoclass for VIFDirect
- case sensitive for glossary terms 'Linux Bridge'

Change-Id: I58d7fd85d98333bee387feff7b2c3d6f2f9102f4
2020-04-23 12:14:12 -05:00
Adrian Chiris bb5e51309e Revert "[Follow Up] OVS DPDK port representors support"
it seems that relevant OVS patches still did not land [1][2].
I think we should revert and wait for the patches to merge first,
then we can go ahead and merge in os-vif with release note that states
the exact OVS version required.

[1] https://patchwork.ozlabs.org/patch/1186896/
[2] https://patchwork.ozlabs.org/patch/1215075/

This reverts commit 399e355088.

Change-Id: I7cd6112b3b35a6971d3d354abae7652344ed1c97
2020-01-22 14:39:55 +00:00
Hamdy Khader 399e355088 [Follow Up] OVS DPDK port representors support
Pass VF MAC address to ovs to set in case of netdev VIFHostDevice.

In case of DPDK representor port, Nova will pass through the VF PCI
as a hostdev and os-vif should pass the MAC to ovs as it would be
responsible for setting its MAC.
Moreover, when not using dpdk, libvirt does the mac cleanup,
since the VF is managed by libvirt, but when using DPDK,
libvirt does not manage the VF so we need to cleanup MAC address
in os-vif.

Change-Id: I5368c318cc0cfd7b5644d3da0dccbce7a48d6a85
Closes-Bug: #1829734
2020-01-15 20:42:50 +00:00
Sean Mooney 655c83d706 only disable mac ageing for ovs hybrid plug
The mac ageing configuration on linux bridges is now
conditional and caller controlled. By default mac ageing
is unspecified and will use the kernel's default of 300
seconds. For ovs with hybrid plug we override this to
0 to prevent packet loss issue during some migration
edgecases. This change reverts disabling mac ageing
for the linux bridge plugin which was accidentally
introduced during the brctl removal via inheriting the
ovs plugin's default behavior when the bridge create
code became shared.

Change-Id: I95612352de6cdb47de98eb80c208dd1a74499d41
Closes-bug: #1837252
2019-08-07 18:54:47 +01:00
Rodolfo Alonso Hernandez ee124d2e98 Remove IP proxy methods
Remove IP proxy methods in os_vif.internal.command.ip.__init__.py. Both
Windows and Linux IP implementations have the same interface, IpCommand.
Method calls (set, add, delete, exists) must be the same for both IP
classes, making those proxy calls unnecessary.

Removed a nesting level for internal IP commands. Now those commands are
located in os_vif.internal.ip.

Change-Id: Id8b71172fb06b435cf169a7e55c11233f22fa65b
Closes-Bug: #1817940
2019-04-25 13:43:34 +00:00
Zuul 67df883c60 Merge "Refactor functional base test classes" 2019-04-25 00:46:48 +00:00
Zuul dda5f06796 Merge "docs: Use sphinx.ext.autodoc for profile, datapath offload types" 2019-04-12 01:23:20 +00:00
Zuul 09d627b4d6 Merge "docs: Use sphinx.ext.autodoc for VIF types" 2019-04-12 01:14:48 +00:00
Rodolfo Alonso Hernandez c63366d67c Refactor functional base test classes
The functional base test class should be implemented under os-vif.
Other projects will inherit from this project to implement functional
test cases.

Change-Id: Ib5873687032bfb55d1847d4948f6e9679cf6d31e
Closes-Bug: #1817938
2019-04-11 17:14:12 +00:00
Rodolfo Alonso Hernandez 638861c37c Add "master" parameter to ip.set() API function
This parameter is present in the IpCommand abstract class and both
Windows and Linux implementations.

This change modifies the pyroute2 driver to lookup the
interface index of the bridge when setting the master paramater
on a port.

This change add a functional test to use the master paramater
to add an interface to a bridge and validate it works correctly.

Change-Id: I54ded32281c6a5b67b6ccb9f1bdb6e3fb6731049
Closes-Bug: #1817919
2019-02-27 19:03:20 +00:00
Zuul ca847da7a1 Merge "docs: Add API docs for profile, datapath offload types" 2019-02-26 16:45:51 +00:00
Zuul 9f43896487 Merge "docs: Add API docs for VIF types" 2019-02-26 16:12:15 +00:00
Stephen Finucane dfe319b386 docs: Use sphinx.ext.autodoc for profile, datapath offload types
This lets us keep all our docs in code where we can see them.

Change-Id: I78ae5afbf9d17ddfde57208402ed3813492c28bc
2019-02-26 10:19:19 +00:00
Stephen Finucane 8609f8a803 docs: Use sphinx.ext.autodoc for VIF types
This lets us keep all our docs in code where we can see them.

Change-Id: Ibac3e94aa3d5018afbc331982e245951dc0ccd4b
2019-02-26 10:19:14 +00:00
Sean Mooney 5ab2ee6ed0 make functional tests run on python 3
- This change updates sanitize_log_path to
  use replace instead of string.translate so that
  it works across both python 2.7 and python 3.
- This change modifies the functional tests to run under
  python 3 by default. A new functional-py27 env is
  also added.

Change-Id: Id8127ae68cb5aeebdba73bd14fc0481cd9b773d9
2019-02-25 14:37:16 +00:00
Zuul 2493f6a518 Merge "remove brctl from vif_plug_ovs" 2019-02-25 13:02:58 +00:00
Stephen Finucane dd47251f23 docs: Add API docs for profile, datapath offload types
Most of the docstrings that were missing have been taken from the
libvirt docs. Man, there is some tight coupling going on here.

Change-Id: I30fcf5cd4d695494edf8c99fb887ecefb5b404fe
2019-02-22 11:20:51 +00:00
Stephen Finucane fdcce7138f docs: Add API docs for VIF types
Change-Id: I78f2df8617e4eacfe92434d902d4905d9a3ad316
2019-02-22 10:52:10 +00:00
Sean Mooney 5027ce833c remove brctl from vif_plug_ovs
- This change extends the ip_command interface set function
  to accept a master as a parent device for a given interface.
- This change extends the impl_pyroute2 add function to
  support creating linux bridges.
- This change replaces calls to brctl with calls to the ip_command api.
- This change removes the use of tee to disable ipv6 in the ovs plugin.

Change-Id: I8308e8840e20b0a72d00880c1a7996b4c73f6a83
Partial-Bug: #1801919
2019-02-21 14:21:10 +00:00
Jan Gutter c90081bb94 Clean up versioned object backlevelling code
The backlevelling code for the VIF objects have a number of sharp edges.
This commit changes the layout of the obj_make_compatible methods to conform
to a fixed pattern.

Given the following version history:

 # Version 1.0: Initial Release based on ParentClass 1.0
 # Version 1.1: Added member_one_one
 # Version 1.2: ParentClass version increased to 1.1 from 1.0
 # Version 1.3: Added member_one_three
 # Version 1.4: ParentClass version increased to 1.2 from 1.1
 # Version 1.5: Added member_one_five

Use the following pattern for obj_make_compatible():

 0. use versionutils to calculate target_version

 1. Remove added members from the primitive in reverse order:
    - if target_version < (1, 5) and 'member_one_five' in primitive:
          del primitive['member_one_five']
    - if target_version < (1, 3) and 'member_one_three' in primitive:
          del primitive['member_one_three']
    - if target_version < (1, 1) and 'member_one_one' in primitive:
          del primitive['member_one_one']

 2. Call the parent method explicitly when the parent class caused a version
    bump in this object, in the following if/elif tree:
    - if target_version < (1, 2):
          super(MyClass, self).obj_make_compatible(primitive, '1.0')
    - elif target_version < (1, 4):
          super(MyClass, self).obj_make_compatible(primitive, '1.1')

 3. Finally, if target_version is recent enough, call the parent method with
    the current version of the parent class:
    - else:
          super(MyClass, self).obj_make_compatible(primitive, '1.2')

This pattern has been documented in: https://review.openstack.org/632321/

Change-Id: Ib7b0cca596c0cad8095ef18243b94ada2587d1cd
Signed-off-by: Jan Gutter <jan.gutter@netronome.com>
blueprint: generic-os-vif-offloads
2019-02-21 11:07:26 +00:00
Hamdy Khader 9611f04722 Add create_port field in VIFPortProfileOpenVSwitch profile
In case of Smart NIC, os-vif is used to plug the representor port to the
integration bridge, so the Neutron agent that runs on the Smart NIC must
behave like libvirt and do plug/unplug for the representor port.

Change-Id: Ic2c3c88ad0c3865dae96c717b5d137f1ea18326f
2019-02-19 15:31:43 +02:00
Rodolfo Alonso Hernandez 9340e59fa0 Add test to check os_vif.internal.command.ip.exists
Related-Bug: #1812090

Change-Id: Ifc828307bca96850af490f54bf4dc41b02555284
2019-01-22 09:19:09 +00:00
Rodolfo Alonso Hernandez 843d84c819 Import IP implementation modules outside privsep context
If the IP module is loaded inside the privsep context, the following
error will occur:
  return getattr(sys.modules[mod_str], class_str)
  "AttributeError: 'module' object has no attribute 'PyRoute2'

Change-Id: I1852038b8d40d4aa52c4f8e661bc78e54e0fc966
Closes-Bug: #1812090
2019-01-22 09:06:04 +00:00
Rodolfo Alonso Hernandez bf8ad81638 Cleanup device at the end of 'test_iproute_object_closes_correctly' test
TrivialFix

Change-Id: I597cc0d920f96f02c5b86d23e63f9dc01c1aeff9
2019-01-21 12:52:43 +00:00
Zuul 6515dc836f Merge "Apply workaround to host_info serialization test" 2019-01-17 15:38:51 +00:00
Zuul 848f7a034a Merge "Extend port profiles with datapath offload type" 2019-01-16 11:28:42 +00:00
Jan Gutter e562dd19eb Apply workaround to host_info serialization test
Random failures started appearing in the gate with the following
pattern:

    testtools.matchers._impl.MismatchError: !=:
    reference = HostInfo(plugin_info=[HostPluginInfo,HostPluginInfo])
    actual    = HostInfo(plugin_info=[HostPluginInfo,HostPluginInfo])

This change attempts to work around the issue by adopting the same
workaround as implemented in the VIF tests.

Note that the host_info class is currently largely stub code for an
unimplemented negotiation interface.

Change-Id: I1fff71ec6793e009cbee9da0656b77915591dec4
Signed-off-by: Jan Gutter <jan.gutter@netronome.com>
2019-01-16 13:13:34 +02:00
Jan Gutter e8f541fa0c Extend port profiles with datapath offload type
TC Offload capabilities have been present in Linux Kernel 4.13 for
hardware offloads. Currently OVS supports offloads (for OVS 2.8 and later)
with similar efforts planned for vrouter (OpenContrail and Tungsten
Fabric).

The existing method in os-vif is to pass the metadata required for
plugging via a VIFPortProfileOVSRepresentor port profile object. This is
used by the 'ovs' reference plugin and the external 'agilio_ovs' plugin.

With 'vrouter' being the third user of such metadata, it would be more
elegant to clean up this interface by using a composition pattern rather
than an inheritance based pattern.

Change-Id: I401ee6370dad68e62bc2d089e786a840d91d0267
Needed-By: I327894839a892a976cf314d4292b22ce247b0afa
Signed-off-by: Jan Gutter <jan.gutter@netronome.com>
blueprint: generic-os-vif-offloads
2019-01-14 17:23:22 +02:00
Rodolfo Alonso Hernandez db5216357b Create iproute.IPRoute() inside a context
IPRoute() object must be closed once is no longer used. This is done
automatically calling it inside its own context. If IPRoute() object
is not closed, the following error is raised after many calls:
  OSError: [Errno 24] Too many open files

Change-Id: I37ee291c22c2c3933ee229bfc939a4481898626c
Closes-Bug: #1807949
2018-12-12 23:40:36 +00:00
Lucian Petrut dd69c70dfb Do not import pyroute2 on Windows
Pyroute2 is not available on Windows, for which reason we need some
platform checks.

At the moment, the ovs plugin can no longer be loaded on Windows
because of this import error.

Change-Id: I4aacd17e77d3b22b8245106d325a7e393794f0a1
Closes-Bug: #1801029
2018-11-01 12:10:41 +02:00
Sean Mooney 409455d16c clean up ip_command interface
- In change I16b180a298e104f393b5f665409cdf4ba5bff203 an
  error was introduced i how _get_impl was defiend in
  os_vif/internal/command/ip/api.py. This change correct
  the error by returning a instance of the the PyRoute2
  class instead of a reference to the enclosing module.
- This change adds exists to the ip command interfece.
- This change makes the windows version also inherit from
  the ip_command abstract base class.

Closes-Bug: #1797182
Change-Id: I82377297db9e9ff7fad055dadb73864964f427d9
2018-10-10 18:14:35 +01:00
Rodolfo Alonso Hernandez 512e64d794 Remove IPTools deprecated implementation
IPTools driver [1] was implemented to avoid a bug in pyroute2 library,
currently solved. This implementation was marked as "deprecated" two
releases ago.

[1] 570c05266f

Change-Id: I16b180a298e104f393b5f665409cdf4ba5bff203
Closes-Bug: #1794524
2018-10-09 08:58:06 +01:00
Zuul ecd0b354ca Merge "add nested DPDK VIF classes for kuryr-kubernetes" 2018-10-02 15:39:19 +00:00
Rodolfo Alonso Hernandez e8d102b500 Add support for Windows network commands
Added a network library dependant on the operating system. Windows
and Linux OS are supported. The library is choosen automatically
depending on Python ``os.name``.

Linux library is based on ``ip`` commands and still relying on
``processutils`` library. Linux implementation can't use ``netifaces``
because this library doesn't provide the needed functionality. [1] will
migrate all ``ip`` commands to ``pyroute2`` library.

Windows library relies on Python's ``netifaces`` library because is
enough for the reduced set of commands used. The only functionality
implemented, to cover the bug resolution, is the device existence
check. New functionalities could be added following, for example,
the Neutron implementation.

[1] https://review.openstack.org/#/c/484386/

Closes-Bug: #1672812

Change-Id: I84e3582135ed02137366c8f55f1dd1e4c115f0b5
2018-09-26 14:40:21 +01:00
Przemyslaw Lal d42b7bbbba add nested DPDK VIF classes for kuryr-kubernetes
This change adds new nested DPDK VIF type and port profile for use with nested
DPDK driver in kuryr-kubernetes.

Co-Authored-By: Gary Loughnane <gary.loughnane@intel.com>
Co-Authored-By: Kural Ramakrishnan <kuralamudhan.ramakrishnan@intel.com>
Co-Authored-By: Marco Chiappero <marco.chiappero@intel.com>

Change-Id: Ib38c427b84606fd232c2ce35cab520790d6ad8ae
Signed-off-by: Przemyslaw Lal <przemyslawx.lal@intel.com>
2018-09-26 09:30:18 +02:00
Eric Fried 8d7c0d548d doc: Fix arg specs and object types in docs
The usage doc stated that plug and unplug accept a single argument of
type `os_vif.objects.VIF`, which isn't a thing, and then went on to give
an example showing that they take two.  The usage doc and the plug and
unplug docstrings also listed various objects at the wrong paths (e.g.
the `instance_info` param being of type `os_vif.objects.InstanceInfo`,
which also isn't a thing).

Fixed up the usage doc to list both arguments and correct the references
in the sample code; and fixed the plug/unplug docstrings
to list the proper paths to classes: os_vif.objects.vif.VIFBase and
os_vif.objects.instance_info.InstanceInfo.

Made everything in `single backticks` into a proper rst ``literal``.

Change-Id: I400838bbe9663917fe2c64f52975b77a370405b4
2018-07-16 17:55:22 +01:00
Zuul 1f00350203 Merge "Fix docstrings to work with Sphinx 1.7.4" 2018-07-11 02:18:53 +00:00
Sean Mooney ba61a98117 add noop plugin
- This change adds a noop plugin
  for use with backends that auto connect
  to VIFs.

Change-Id: I4317ac2294526863d88be16ac54ecafc85ca9e1b
2018-07-05 16:20:22 +00:00
Tony Breeds 4e1e6de6d4 Fix docstrings to work with Sphinx 1.7.4
According to the thread at
http://lists.openstack.org/pipermail/openstack-dev/2018-May/130581.html
some projects including networking-midonet can not build docs with
sphinx 1.7.4+  This seems to be becaus the parser is now more strict?

This patch *seems* to fix those doc builds

Change-Id: Ie96dca126e727fc9a34eece1590a92f7dd3af426
Partial-Bug: 1771092
2018-06-26 01:35:57 +09:00
Stephen Finucane 4e7ce55d10 Configure privsep binary
This is necessary because we're combining virtualenv's and sudo. sudo
doesn't passthrough environment variables by default, so we must do so
manually.

Change-Id: I8ef15edd1b8adae0ddad84f71379356ead5d4fd1
Related-bug: #1677238
2018-01-17 22:33:14 +00:00
Zuul 87e0edde4d Merge "adds iptools driver for ip commands" 2018-01-17 14:31:47 +00:00