router-interface-add/delete does not support 'port_id'

Bug #1061638 reported by Akihiro Motoki
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-neutronclient
Fix Released
Medium
Akihiro Motoki

Bug Description

In router-interface-add API 'port_id' can be specified as a parameter, but quantumclient CLI does not support it.
There needs a consideration to support it. We cannot specify both 'port_id' and 'subnet_id', but in the current CLI commandline 'subnet_id' is a positional parameter and we cannot make a positional parameter "Optional" due to argparse specification.
To address it, there are several options:
(1) Change 'subnet_id' to an optional parameter '--subnet subnet_id' and add '--port_id port_id'
(2) Change 'subnet_id' positional parameter to 'subnet_or_port_id' and introduce an boolean parameter '--port_id' (False means subnet_or_port_id is a subnet_id and True means subnet_or_port_id is a port_id).
(3) Add '--port_id port_id' parameter and just ignore 'subnet_id' when a port_id is specified.

Pros and Cons:
(1) It is the most reasonable for me, but it requires the change of the command line from the release version of CLI.
(2) There is no need to change the commandline of the release version of quantumclient, but it is a little confusing.
(3) Same as (2).

Similarly, router-interface-remove CLI command does not support 'port_id'.
router-interface-remove accepts three patterns of the parameters: (1) subnet_id only, (2) port_id only, (3) subnet_id and port_id.
If we want to support (2) port_id only, we need the same consideration as router-interface-add.

Any advice or comment will be appreciated.

Note that this bug exists only for CLI and python client library does not have this bug.

Akihiro Motoki (amotoki)
description: updated
Revision history for this message
yong sheng gong (gongysh) wrote :

how about adding two commands:
router-interface-add-by-port
router-interface-remove-by-port

Revision history for this message
Akihiro Motoki (amotoki) wrote :

They sound good and do not break the back-compatibility.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-quantumclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/23718

Changed in python-quantumclient:
assignee: nobody → Akihiro Motoki (amotoki)
status: New → In Progress
Akihiro Motoki (amotoki)
Changed in python-quantumclient:
importance: Undecided → Medium
milestone: none → 2.2
Changed in python-quantumclient:
milestone: 2.2 → none
milestone: none → 2.2.1
Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :

IMHO, I would avoid adding commands if it's not absolutely necessary. When you give more than one option to a user to do 'the same thing', that's when the confusion starts.

That said, how do we stand if did something like 'nova boot' does with the --nic optional param, i.e.:

we could do:

quantum router-interface-add [-h] [--request-format {json,xml}] router-id <subnet-id=uuid | port-id=uuid>

When the tag "*-id" is omitted, subnet-id is assumed. This approach has the following benefits:

- backward compatibility is preserved
- there is no need to add (maintain and test) redundant commands
- backward compatibility can be withdrawn at any point with minimum disruption to the command interface.

My 2c
Armando

Revision history for this message
Akihiro Motoki (amotoki) wrote :

Thanks Armando,
I totally agree with your point.
Your proposal looks nice to me and it is what I am looking for.

Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :

Cool, glad to be of service ;)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-quantumclient (master)

Reviewed: https://review.openstack.org/23718
Committed: http://github.com/openstack/python-quantumclient/commit/01a82383fcfe9a5145f7cc63a9b4a57e65383a34
Submitter: Jenkins
Branch: master

commit 01a82383fcfe9a5145f7cc63a9b4a57e65383a34
Author: Akihiro MOTOKI <email address hidden>
Date: Thu Mar 7 03:07:50 2013 +0900

    Support router-interface-add/delete by port_id

    Fixes bug 1061638

    Change-Id: Ie36126a38627a6707e82116fb6b7bd97755f8fd0

Changed in python-neutronclient:
status: In Progress → Fix Committed
Akihiro Motoki (amotoki)
Changed in python-neutronclient:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.