Tailor sync logic to the json_api. Since GET/DELETE/POST logic
is so similar for all resource types, a great deal of common
code can be used. Each resource must simply define a neutron db
get helper, a cvx endpoint and a conversion helper from neutron
format to CVX format.
Change-Id: I91273d3da3ddbcee970ab10dbb51d726a417fae9
The neutron.common.topics module was rehomed into neutron-lib with
commit Ie88b84949cbd55a4e7ad06341aab77b286cdc485
This patch consumes it by using neutron-lib's version of the module in
prep for Ia4a4604c259ce862597de80c6deeb3d408bf0e95
Change-Id: I300f81cb4c93a485dfef4e7d8a1ad61d239dccf5
During sync process only network segments that are bound to a port should be
sent to CVX when creating instances. For that reason, the PortBindingLevel
table should be used to get list of segments bind to a given port.
Change-Id: I712659ade0c270daa52a9cc65978f127779ce661
Instead utilize the neutron ports, ml2_port_binding_levels and
networksegments tables to determine the set of ports to provision
on cvx.
Change-Id: I78560e452b1ad9eb9a5b06db61d0c38ae8231b51
We can infer the set of tenants to provision from the neutron
networks and ports tables. This is part of a larger effort to
remove any use of arista specific tables and instead make use
of the same data stored in other neutron tables.
Change-Id: Idd6813b6ba68f49b055b94e0eabb8517b01c0390
The OpenStack JSON api is already the default. Removing
the EAPI will allow for optimizations that utilize superior
aspects of the JSON api.
Change-Id: I9ec1ab570094c6a2807b5e8e64f69ffc10e1fce6
When an interface is a member of a Port-Channel,
we should apply ACLs to the Port-Channel rather
than the interface as only the ACLs on the
Port-Channel have any effect on traffic.
Change-Id: I8661d4c15a7aaa2d2d1c9b15857e0a151d557e48
Error returns from JSON API calls are currently handled
identically to successful returns. We should differentiate
these cases by raising an exception on error return codes.
Change-Id: I703cb0cfa82f6586a2961fca3cd4b9a64c1c468e
This change broke the Arista CI. We also discovered that the Arista CI doesn't apply networking-arista changes when it runs, only neutron changes which is why the CI missed this.
This reverts commit a3aa15abd6.
Change-Id: Ida3fa67ee0290f56c66be0e3364ef5491c147eea
The OpenStack JSON api is already the default. Removing
the EAPI will allow for optimizations that utilize superior
aspects of the JSON api.
Change-Id: I3128ded38ccbf9a7c53e2c6605210981832d5c6f
If a call to send_api_request hits an exception,
it will return None. However, our code that expects iterable
types are returned from many of our GETs. This change replaces
None returns with empty dicts in such cases.
Change-Id: I6be1ee4f84fd38519d7c5ae227581a1a72964fa0
arista_ml2.py was becoming quite large and a dumping ground for
code. This change begins the process of organizing the driver in
a more structured, and manageable way.
Change-Id: I050cdbdc028d7acda940eb932df7052ad2698967
There is a CLI in CVX which configures keystone Authentication and
no need to rely on ML2 driver to send the authentication information
to CVX.
Change-Id: I9c3526ae0bc19873361c7fa8b49e9a92be5f1954
If a higher level mechanism driver assigns a physical
network to a segment that we are binding, use that
segment rather than looking up the physical network
based on host_id.
Change-Id: I5536ce61a9dd65cd8ff5eb7ee6163bbd4b115a0e
Neutron changed the way resources are extended after Pike milestone-1. As a
result, there's a race condition where the sync thread
makes calls on the plugin before the ML2 plugin has finished
initialization. ML2 supports the get_workers() command to spawn agents for ML2
drivers. This change moves the sync thread to from the API Service to a
child worker process.
Change-Id: Id36018093bc1356dbe7986cbe664f07c35d6c224
The well known service type constants are in
neutron_lib.plugins.constants, but for legacy reasons a few still exist
and are referenced from neutron_lib.constants [1] that we'd like to
remove.
This patch switches references over to neutron_lib's plugin constants.
[1] https://github.com/openstack/neutron-lib/blob/master/neutron_lib/constants.py#L353
Change-Id: Iea954a5c916b527c7bb9d1db761204c3297b1fa6
The keys to the json output of 'show network physical-topology hosts'
command changed from hostname to chassis ID. This patch makes the code to work
with older and latest version of the command's output.
Change-Id: Ibfe35e7da4555ea9a5f77645eaca0a498b83cb87
The upstream plugin will catch any exception, so there is not need to
import this exception from Neutron. We can raise our specific exception
and remove this dependency.
Change-Id: I6df50480eef474511fe18a8b7c6d5d0d1afb666b
The arista_provisioned_vms table should contain only ports which are
provisioned by the arista mechanism driver. This patch verifies the
device owner of a port before adding it to the table.
Change-Id: I0ce405f305157a0dbb4873cccbf4031256630683
With this change HPB is compatible with MLAG pairs by listing
them as peer1_peer2 in the physical network's name.
Change-Id: Idd86162b9d315c174c583f41be98b4e1a163eff5
The existing code fails to detect a port migration if the port status
is in 'DOWN' state. With this patch, detection of a port migration
relies only on change in 'binding:host_id'.
This patch also fixes failure of deleting a network due to orphan port
in the arista_provisioned_vms database by deleting all entries from the
table if they exist.
Change-Id: I4faa8c9aafc39dce9e0773fcf2ff4836b86080dd
In ocata, the tenant network port for baremetal instances
is owned by compute:<zone> instead of baremetal:<zone>. The
vnic_type for those ports is still 'baremetal', so use the
vnic_type to identify baremetal ports.
Change-Id: I677148a7964ea4b3673cc918999073b2cd5caafd
We were assuming that all ports with binding::profiles would have
local_link_information. This assumption is incorrect, so we should
handle such ports gracefully rather than throwing a KeyError.
Change-Id: Id73e43199c933bc7eb6e71f75d4e6f04cce6c091
Implements validate_network_rbac_policy_change which is
needed in NeutronNets after adding registry decorator in
neutron.db.db_base_plugin_v2.
Change-Id: Ia77fb2a5a820cab9125c0177e87418c7f0869430
This patch fixes unit tests failure due to adopting oslo-versioned
objects (ovo) for neutorn db by adding the core plugin instance to
the plugin directroy in the test.
Change-Id: Ib0de20addf428c88c169e46ac3b63e4eb0efdb2d
Recent changes to oslo.db introduced a subtle change that requires explicit
call to flush() some subtransactions. This adds flush to test case that
required flush to initialized data.
Change-Id: I4b952c9863dd8210741c780a5f13132310a8a135
This change documents option dependencies within the code and ensures
isolated test runs will work properly and not depend on other import side
effects.
Change-Id: I42aa0a496f64ecbae3f70af214b03e3dc9bae243
Change the identity API version to v3 when sending the information to
CVX as identity API v2.0 is deprecated.
Change-Id: Ia494a38526a372997dcbfbe2875ff780319f324d
Early versions of oslo.config allowed any type when overriding a config
setting. Future versions of oslo.config will default to enforcing the
type[1]. This changes silences the deprecation warning by passing the
proper value type to override.
[1] https://review.openstack.org/#/c/365476/
Change-Id: Ie9fd8f0b8e9b75492854e22e4f169ac56cfd548d
This change simplifies mock.call() comparision logic by adding a wrapper to help
when comparing the contents of list of dictionaries. The wrapper treats the list
as an unordereed collection by disregarding the order of the elements when
checking for equality. In production the lists are generated from database
queries resulting in unpredictable order.
Change-Id: I07a4003c2c4a54717654cecde76d28ad10854399
The get_session() method of oslo.db is depreceated in Ocata and slated
for removal in Pike. This change updates calls to grab the desired type
of session.
Closes-Bug: 1676883
Change-Id: I59504db34dc08c9a065559d548ad49d807bc1f94
Adding a return value avoids boolean conversion of a the mock object
which yields different calls in Python 2 and 3.
Change-Id: I2037ecf851d2a3d94612d3102f73ca8224eb5337
This change tests for the rpc value passed to the driver to be not None.
The explicity check does not change the logic and avoid a difference in
Python 2 vs Python 3 to resolve the boolean value of an object. Python 2
calls __nonzero__() to get boolean value of an object and Python 3
calls __boolean__().
Change-Id: I50a228840735bc1a7b0d857d0b28e01b4f836aef
If there is no vlan pool configured for a region, but CVX was
reachable, the arista_vlan type driver would fail to start.
We should treat this case as there being no VLANs assigned
to the region and clear out all vlan allocations from the db.
Change-Id: Ia57dcd1354ccf98647d7683af8004aebde305ff2
Remove the external dependency on jsonrpclib to better align with the
upstream OpenStack requirements. This change introduces a new
EAPIClient class for the L3 agent. In the future, the ML2 driver will be
refactored to use shared EAPI code.
Change-Id: Ia7cae6a9ae091f2ec306bd64ef1617236cfd6d83
Recently, we stopped failing network_create_postcommit to allow
networks to be created even when CVX is unavailable. This broke
the arista vlan type driver functionality in the case of segment
creates with segmentation_id specified as the base vlan type driver
adds the segmentation id to the allocation range in this case.
This change checks whether the specified VLAN is in the allocation
range and fails the call if it isn't and calls the base vlan type
driver to finish the allocation if it is.
Change-Id: I723271c0a19e29f87bcf1e34e7413733478440ec