[neutron][opencontrail]Trunk ports doesn't have standard attributes

Rodolfo Alonso Hernandez ralonsoh at redhat.com
Wed May 11 07:19:29 UTC 2022

Hi Gleb:

Please check the OSC version you are using. The OSC extension for Trunks is
in the neutron-pythonclient project. And in particular, the support for the
"description" parameter was added in [1]. This is the output in a system
using master branches: [2].

In any case, what you need in "contrail-neutron-plugin" is what the API is
returning. Don't mix the OSC output and the API. If you execute [3] (as
commented in my previous mail), you'll see the "description" parameter (and
others). This is what the plugin is retrieving and the information you'll
handle. Again, please check the "fields" parameter in order not to select a
limited set of fields, discarding what you are looking for. Place a debug
line after the API call to check what you are receiving.



On Wed, May 11, 2022 at 6:55 AM Gleb Zimin <gzimin at mirantis.com> wrote:

> Thanks for reply, Rodolfo.
> When I want to show exact trunk, there is none of standard params.
> $ openstack network trunk show trunk1
> +----------------+--------------------------------------+
> | Field          | Value                                |
> +----------------+--------------------------------------+
> | admin_state_up | UP                                   |
> | id             | 96babd03-8d5c-4b80-9118-b5e0a0e8d98d |
> | name           | trunk1                               |
> | port_id        | b61ac310-35a6-41b6-9af1-8c25f73dec06 |
> | project_id     | 2923ed63b7934e4b89ce60bfe78dfd87     |
> | status         | DOWN                                 |
> | sub_ports      |                                      |
> | tenant_id      | 2923ed63b7934e4b89ce60bfe78dfd87     |
> +----------------+--------------------------------------+
> Also, if I want to set description to the trunk, I get this:
> $ openstack network trunk set trunk1 --description test
> Failed to set trunk 'trunk1': Unrecognized attribute(s) 'description'
> Neutron server returns request_ids:
> ['req-1aca1b69-fa75-466d-aef9-eb0786463555']
> This request fails on neutron side, it appears before request proceeded on
> the contrail-neutron-plugin side.
> https://github.com/openstack/neutron-lib/blob/master/neutron_lib/api/attributes.py#L284
> On Fri, May 6, 2022 at 7:13 PM Rodolfo Alonso Hernandez <
> ralonsoh at redhat.com> wrote:
>> Hello Gleb:
>> The OC plugin is using the Neutron API to execute operations on the
>> server. The "get_trunk" method calls "_get_resource" [1]. I've tested the
>> Neutron API and this is what you get from the API: [2]. All standard
>> attributes are returned.
>> Maybe this could be related to the "fields" parameter you are passing in
>> the method [3]. Check if you are filtering the API call and only retrieving
>> a certain subset of fields.
>> Regards.
>> [1]
>> https://gerrit.tungsten.io/r/gitweb?p=tungstenfabric/tf-neutron-plugin.git;a=blob;f=neutron_plugin_contrail/plugins/opencontrail/contrail_plugin.py;h=80104f1e673eb4583f7a15707c3590c510fd7667;hb=refs/heads/master#l326
>> [2]https://paste.opendev.org/show/bh1QD8VqLz4OKMKYBXUa/
>> [3]
>> https://gerrit.tungsten.io/r/gitweb?p=tungstenfabric/tf-neutron-plugin.git;a=blob;f=neutron_plugin_contrail/plugins/opencontrail/services/trunk/plugin.py;h=35fc3310911143fd3b4cf8997c23d0358d652dba;hb=refs/heads/master#l50
>> On Fri, May 6, 2022 at 4:35 PM Gleb Zimin <gzimin at mirantis.com> wrote:
>>> Environment: Openstack Victoria, OpenContrail (TungstenFabric) R2011.
>>> Problem: Trunk ports doesn't have standard attributes such as
>>> description, timestamp.
>>> I have an environment where core plugin is OpenContrail. OpenContrail
>>> has tf-neutron-plugin for proper work with neutron. There is TrunkPlugin,
>>> that proxies all trunk-related request to the OpenContrail backend. Here is
>>> the link for this plugin.
>>> https://gerrit.tungsten.io/r/gitweb?p=tungstenfabric/tf-neutron-plugin.git;a=blob;f=neutron_plugin_contrail/plugins/opencontrail/services/trunk/plugin.py;h=35fc3310911143fd3b4cf8997c23d0358d652dba;hb=refs/heads/master
>>> According to the openstack documentation: Resources that inherit from
>>> the HasStandardAttributes DB class can automatically have the extensions
>>> written for standard attributes (e.g. timestamps, revision number, etc)
>>> extend their resources by defining the ‘api_collections’ on their model.
>>> These are used by extensions for standard attr resources to generate the
>>> extended resources map.
>>> As I understood, it works only for plugins, which using Openstack
>>> database. For example, openstack native trunk plugin has models.py file
>>> where we can see this inheritance.
>>> https://github.com/openstack/neutron/blob/master/neutron/services/trunk/models.py#L26
>>> In case of OpenContrail+OpenStack Trunk plugin only redirect requests.
>>> What can I do to make Contrail Trunk plugin works in the same way?
>>> I'll appreciate any help. Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20220511/b8bb5bb7/attachment.htm>

More information about the openstack-discuss mailing list