Commit Graph

28 Commits

Author SHA1 Message Date
Rodolfo Alonso Hernandez eb99c22213 Remove "distutils" library
Library "distutils" will be marked as deprecated in Python 3.10:
https://peps.python.org/pep-0386/

This patch does the following replacements, that provide the same
functionality and API:
- distutils.version.StrictVersion -> packaging.version.Version
- distutils.spawn.find_executable -> shutil.which

Closes-Bug: #1973780
Change-Id: Iad96ad3e7055f71c629efbe80070adbe297cd7aa
2022-05-12 23:50:07 +00:00
Slawek Kaplonski 282ccbb8f0 [Fullstack] Remove dhcp agent in tests where it isn't necessary
In fullstack tests like test_connectivity or test_securitygroup using
dhcp agent isn't really needed. We are testing dhcp agents and
configuration of the IP addresses using DHCP in the tests from the
test_dhcp_agent module.
So this patch disables usage of the dhcp agent where it's not really
needed to save some resources (less agents running during tests) and to
minimize potential failures in the tests.

Additionally this patch also adds method
block_until_all_dhcp_config_done() to the FakeFullstackMachinesList
class and uses it in tests when fake VMs are using DHCP. That will
hopefully help better understand where the issue is in case of failures
like described in the related bug.

Related-Bug: #1962854
Change-Id: Ib6ca18b5a0ae101ad6424637abff3d992737f6f4
2022-03-23 16:52:48 +01:00
LIU Yulong 3b46df4847 Change fullstack dhclient lease file to tmp folder
Each cases are sharing the common lease path for dhclient,
for instance, in CentOS it is: /var/lib/dhclient/dhclient.leases.
That means all fullstack cases will use this file to store
fake VM's NIC DHCP lease information.

After run several times of fullstack cases, the dhclient will
get failed to set the test fake VM port's IP due to the mess
settings in this file.

This patch sets each fake VM's NIC lease file path to the
tmp folder with it's port id.

This may fix some cases that cannot set the IP addr to the test
device properly via DHCP.

Closes-Bug: #1934646
Change-Id: Ia87fa7c08df473acbcf1600035d99a83ed4b4375
2021-07-05 19:05:12 +08:00
LIU Yulong 4b22eea4be Add fullstack test case for OVS DHCP extension
This patch will create two fake VMs to verify the DHCP R/R
for its NIC. Ping 4/6 will be run after the interface request
and config the IP address via DHCPv4/6 by using dhclient.

For fullstack test fake environment, setting enable_traditional_dhcp
to False means enable DHCP extension for OVS agent automatically.

Partially-Implements: bp/distributed-dhcp-for-ml2-ovs
Closes-Bug: #1900934
Change-Id: I40d6464953fbc4d4ca2c05a6051eba43cd05fedd
2021-06-28 17:27:47 +08:00
Nurmatov Mamatisa 437a311eca Using 31-Bit and 32-Bit prefixes for IPv4 reasonably
When needing to create a point to point connection via a subnet,
generally and /31 is the recommended cidr. Neutron supports /31
disabling dhcp and gateway on a subnet. /32 is also supported in
openstack.

Closes-Bug: #1580927
Change-Id: I3bfa3efb9fb8076656b16c89d2f35d74efde12b7
2021-06-09 07:35:54 +00:00
Rodolfo Alonso Hernandez 7a204f63e9 [fullstack] Be able to delete port when fake VM is destroyed
When a VM fixture is destroyed, the port now can be deleted instead
of unbinding it. That will update the ML2 plugin cache. When the port
is actually deleted from the system, the ML2 agent should detect it
and trigger the deletion process.

Change-Id: I0ecbaf6f6e0b5b6b538956f2b47e7f11ce21341b
Closes-Bug: #1909234
2021-01-13 16:40:41 +00:00
Rodolfo Alonso Hernandez a438745fbd Filter only IPv4 addresses when looking for gateway
Trivial-Fix

Change-Id: I4e3199284065bc68090d340c0b3e637259a3f170
2019-09-13 10:43:46 +00:00
Rodolfo Alonso Hernandez 0699713609 Implement "ip route" commands using Pyroute2
Commands implemented:
* Add route
* List routes

Related-Bug: #1492714

Change-Id: I5e5e9f6981024317773979d9d2d77db3f5e7ec98
2019-06-27 10:07:52 +00:00
Hongbin Lu 02dabd6f10 Add debug information of the dhclient process
Log the standard output/error of the dhclient process which provides
more information of the execution of the DHCP client script.

Change-Id: I6a057d089ee21ea2898078fb7b11dce00a570ec0
2018-12-13 22:12:05 +00:00
Lucian Petrut 89915a752e Trivial: Move platform independent modules to common dir
async_process.py and ovsdb_monitor.py are now platform
independent, for which reason we can move them to
neutron/agent/common.

Note that a few subprojects are using async_process. We'll use
debtcollector so that we don't break those projects, while logging
a deprecation warning.

Change-Id: I6a7418cb8680cd71fe16c5d98b9b09ef2d260d37
2018-08-14 09:54:01 +03:00
Brian Haley 7cfdf4aa81 Fix all pep8 E129 errors
Fixed all pep8 E129 errors and changed tox.ini to no longer
ignore them.

Change-Id: I0b06d99ce1d473b79a4cfdd173baa4f02e653847
2018-05-03 13:44:04 +09:00
Jakub Libosvar 75d28cbc73 fullstack: Migration from iptables_hybrid to openvswitch
Add test validating migration from iptables_hybrid firewall driver to
openvswitch. The test creates simple environment with a single node then
spawns two vms, each has its own security group. Then firewall is
switched and OVS agent is restarted. Connectivity is then validated
again, security groups are removed, tested no traffic is allowed and
then security groups are added back to make sure new firewall driver
works with updates.

Change-Id: Idef80c76c1b82be9f1007f17ea661c9ccdc2b1ae
2018-04-26 16:44:24 +00:00
Sławek Kapłoński 92959238a3 [Fullstack] Respawn dhclient process in case of error
When dhclient process is started as async process by fake machine resource,
it might happen that "None" will be returned as first line of output
from this process. This is treated as an error and dhclient is halted
immediately.
Because of that fake machine don't have configured IP address and
test fails.

This patch adds "respawn_timeout" value set to 5 seconds for dhclient
async process. When dhclient process is restarted it should works fine
and IP address should be then configured properly.

Change-Id: Ie056578abbe6e18c8415c6e61d755f2248a70541
Closes-Bug: #1728948
2018-02-19 19:47:26 +00:00
Sławek Kapłoński dd3abf8ee8 [Fullstack] Fix destroy of VM fixture
When FakeFullstackMachine is connected to Linuxbridge
instead of Open vSwitch bridge, bridge object don't have
delete_port() method and it is not necessary to remove
"tap" device from host namespace.
This device will be removed together with deletion of
VM namespace.

Change-Id: I57a2ef84104b0951d77a8fc79265236d8d8dddf4
Closes-Bug: #1735571
2017-12-01 13:53:09 +00:00
Brian Haley 4f627b4e8d Change ip_lib network namespace code to use pyroute2
Change network namespace add/delete/list code to use
pyroute2 library instead of calling /sbin/ip.

Also changed all in-tree callers to use the new calls.

Closes-bug: #1717582
Related-bug: #1492714

Change-Id: Id802e77543177fbb95ff15c2c7361172e8824633
2017-10-04 21:09:28 +00:00
Jakub Libosvar bc979efdb8 fullstack: Don't let dhcp agents failover
It turned out dhcp tests work only because agents are considered dead
after 10 seconds while they report to server every 60 seconds. This led
to calling network resync after agent revival and hiding the fact dhcp
agent is not capable of receiving any amqp messages.

This patch sets the report interval of agents to the half of
agent_down_time on server side and uses eventlet dhcp agent in order to
trigger eventlet monkey patching code.

Eventlet was behind the failure with messages not getting processed. As
[1] notes: "Note: If the “eventlet” executor is used, the threading and
time library need to be monkeypatched."

Because each port calls dhclient to obtain IP address and each dhclient
instance overwrites /etc/resolv.conf there was added a script that
generates fullstack-dhclient-script from an existing dhclient-script
before starting fulltstack tests. This generated script is passed to
each dhclient process running in fake fullstack machine using -sf
parameter.

[1] https://docs.openstack.org/developer/oslo.messaging/server.html

Related-bug: 1453350

Change-Id: I0336176b9c364fe3a95be5cef9e7a3af1ef9d7e9
2017-04-20 14:04:50 +00:00
Boden R 7bd521e7ce use neutron_lib's portbindings api-def
Neutron-lib 1.1.0 is now out and contains the portbindings
API definition (as per commit [1]). This patch moves neutron
references over to the neutron-lib version.

NeutronLibImpact
- Consumers using the public constants within neutron's
portbindings API extension must now use the values
from neutron-lib.

[1] 87e42f993c07ae320159d5123662ee9f3bd4d903

Change-Id: I669af9b4c712877772d91a03857ab108714001d4
2017-03-31 09:16:22 -06:00
Sławek Kapłoński f38688cfec Fullstack test for DHCP agent
This patch adds basic support for DHCP agent resource in fullstack
tests suite.
FakeFullstackMachine can now be set to use DHCP and IP address is then
configured with DHCP using dhclient tool.

It also adds base tests for basic DHCP agent functionallities:
* schedule network to DHCP agent
* provide IP address for port (FakeMachine) by DHCP agent

Tests are done with Linuxbridge and Openvswitch L2 agents with basic
configuration in both cases.

Change-Id: I2ecf15c12d5d5e957fe1b08113b5cc13e746ec2d
2016-12-15 11:31:07 +00:00
Jenkins 640fd9d2fd Merge "fullstack: test for IPv6 north-south traffic" 2016-11-09 12:02:45 +00:00
Jakub Libosvar f0439a04ad fullstack: VLAN aware VMs test
Patch tests basic life-cycle of a trunk associated with a port. Test
creates a trunk with one subport - this tests interaction between
agent and ovsdb handler that calls via RPC to server.
Later a new subport is added which tests RPC interaction between
server and agent. Then deletes the first created subport. Finally trunk
is removed and checked that no patch ports remain on the integration
bridge.

Future work:
 - Run this test with linuxbridge
 - Test re-using port associated with trunk.
 - Test re-using subports.
 - Test with OVS firewall.

Partially-implements: blueprint vlan-aware-vms
Change-Id: Ie79a010e6751c1f1c2be5b1bf52511b9e100ad20
2016-09-29 13:23:39 -04:00
Assaf Muller e49b707c73 Fullstack: Add helper FakeFullstackMachinesList
Clean up the tests a bit by adding a helper that groups up
fake VMs and allows to execute commands on them all.

Change-Id: I82609adc9edd252ac1581f73cd86c627b2075abc
2016-09-23 09:41:56 -04:00
sridhargaddam 989aba6a2b fullstack: test for IPv6 north-south traffic
This patch validates north south IPv6 traffic through legacy router.

Partial-Bug: #1583028
Change-Id: I12cccdb01960e89ddfc795b587d617da37c9fee6
2016-08-22 06:43:27 +00:00
Jakub Libosvar aea93a4a5d fullstack: Add hybrid plug support
Whether hybrid plugging should be used for vm or not is part of
vif_details that Neutron API sends on port creation. This patch uses
this information to decide and creates hybrid plug if it should.

I also spotted that we use interface driver. I don't think that this is
what we should be doing for fullstack vms, we should rather simulate how
nova plugs tap into integration bridge. Interface driver is used for l3
and dhcp ports.

Current implementation of hybrid plugging should be in parity with
non-hybrid (i.e. does what interface driver). There will be either
followup to fix it or I'll do it as a part of this patch.

Change-Id: I40cadc6c4f537dab960157dcffba615815b9325f
2016-07-19 07:25:42 +00:00
Jakub Libosvar a626172706 Move wait_until_true to neutron.common.utils
We need to be able to re-use wait_until_true in tempest scenario tests.
There is tempest bug https://bugs.launchpad.net/tempest/+bug/1592345
that prevents us to do so.

Also wait_until_true is not linux specific so it makes more sense to
have it in common package.

Change-Id: Ib8b0e51dbd9edaa58391774d428a737836dfdf77
2016-06-27 11:40:11 +00:00
sridhargaddam 45d363241d fullstack: test for IPv6 east-west traffic
This patch validates east west IPv6 traffic through legacy router.

Partial-Bug: #1583028
Change-Id: Id18065340d49dfd389d88cc625f5a80be8da9a50
2016-05-27 17:17:04 +00:00
Sławek Kapłoński 2254acef06 Add fullstack resources for linuxbridge agent
This patch adds resources, fixtures and base test_connectivity tests
for host with linuxbridge agent.

Model of host with linuxbridge agent is made in separate namespace
named "host-XXX". It has got connectivity with rabbit via ovs port.
Same port is used also to provide connectivity with different "hosts"

Co-Authored-By: Mathieu Rohon <mathieu.rohon@gmail.com>

Change-Id: I6230d8d09f77bd20674bf6c3be69fbc1627d66f8
Closes-bug: #1518675
2016-02-19 13:12:25 +00:00
Jakub Libosvar 1b94f3f3d9 Add QoS fullstack test
Test the qos policy and rule CRUD lifecycle with port. Future plans are
to add similar testing with ports belonging to network with set qos
policy.

Change-Id: Iebe9b3e9d612d3533381a8cf4d0b9c587f8fda42
2015-09-15 15:42:26 +00:00
Assaf Muller 53fe9ddd6c Add a fullstack fake VM, basic connectivity test
* Full stack tests' fake VMs are represented via a namespace,
  MAC, IP address and default gateway. They're plugged to an OVS
  bridge via an OVS internal port. As opposed to the current
  fake machine class used in functional testing, this new fake
  machine also creates a Neutron port via the API and sets the
  IP and MAC according to it. It also sets additional attributes
  on the OVS port to allow the OVS agent to do its magic.
* The functional fake machine and the full stack fake machine
  should continue to share commonalities.
* The fullstack fake machine currently takes the IP address
  from the port and statically assigns it to the namespace
  device. Later when I'll add support for the DHCP agent
  in full stack testing this assignment will look for the dhcp
  attribute of the subnet and either assign the IP address
  via 'ip' or call a dhcp client.
* Added a basic L2 connectivity test between two such machines
  on the same Neutron network.
* OVSPortFixture now uses OVSInterfaceDriver to plug the port
  instead of replicate a lot of the code. I had to make a
  small change to _setup_arp_spoof_for_port since all OVS ports
  are now created with their external-ids set.

Change-Id: Ib985b7e742f58f1a6eb6fc598df3cbac31046951
2015-08-19 20:09:55 +03:00