beb94c0d22
This is a partial revert of be77ed3a81. It
turns out many of the ruff rules - particularly the pycodestyle "E"
rules - are only enabled in preview mode [1]. We don't normally see this
since 'ruff format' makes these rules unnecessary. Re-enable flake8
until we decide to enable 'ruff format' (if we decide to enable it).
We run `autopep8` to fix the errors that have been introduced since that
commit and follow-up with manual fixups to get us back on the straight
and narrow.
[1] https://docs.astral.sh/ruff/rules/#error-e
Change-Id: If203af5bad388307e828d1190cfc08d335bc36a1
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
# Copyright 2024 Red Hat, Inc.
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from neutron_lib import rpc as n_rpc
|
|
from oslo_messaging import Target
|
|
|
|
|
|
class BasePluginApi:
|
|
"""Base agent side of the rpc API"""
|
|
|
|
def __init__(self, topic, namespace, version):
|
|
target = Target(
|
|
topic=topic,
|
|
namespace=namespace,
|
|
version=version)
|
|
self.client = n_rpc.get_client(target)
|
|
|
|
def get_ports(self, context, port_filters):
|
|
# NOTE(mtomaska): The MetadataRpcCallback (server side) API version 1.0
|
|
# exposes get_ports, under the PLUGIN topic and None namespace.
|
|
cctxt = self.client.prepare(version='1.0')
|
|
return cctxt.call(context, 'get_ports', filters=port_filters)
|