Ugly output on security-group-show/list

Bug #1153766 reported by Salvatore Orlando
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-neutronclient
Fix Released
Medium
Akihiro Motoki

Bug Description

Security group rules are currently returned to the user as a dump of a dict, resulting in barely readable output.
The quantum CLI might provide a prettier output, perhaps by showing only a few fields for each rule.

For example: ethertype; direction; port_min-port_max; [source_group_id]

This is the current output:
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| description | |
| id | a6ddbea2-dbff-40f7-a18c-6157720051c1 |
| name | pippo |
| security_group_rules | {"remote_group_id": null, "direction": "egress", "remote_ip_prefix": null, "protocol": null, "tenant_id": "bccca3d87b364c9594cd7a5736dc36cc", "port_range_max": null, "security_group_id": "a6ddbea2-dbff-40f7-a18c-6157720051c1", "port_range_min": null, "ethertype": "IPv4", "id": "96f2ad29-56ff-4890-a7dd-4778dbc8c17e"} |
| | {"remote_group_id": null, "direction": "egress", "remote_ip_prefix": null, "protocol": null, "tenant_id": "bccca3d87b364c9594cd7a5736dc36cc", "port_range_max": null, "security_group_id": "a6ddbea2-dbff-40f7-a18c-6157720051c1", "port_range_min": null, "ethertype": "IPv6", "id": "fd0cc39e-7cd2-4d91-9bbf-5e22fb05ef60"} |
| tenant_id | bccca3d87b364c9594cd7a5736dc36cc |
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

This the desired one:

+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| description | |
| id | a6ddbea2-dbff-40f7-a18c-6157720051c1 |
| name | pippo |
| security_group_rules | IPv4; egress; security_group:a6ddbea2-dbff-40f7-a18c-6157720051c1|
| | IPv6; egress; security_group: fd0cc39e-7cd2-4d91-9bbf-5e22fb05ef60 |
| tenant_id | bccca3d87b364c9594cd7a5736dc36cc |
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Akihiro Motoki (amotoki)
summary: - Ugly output on security-group-list
+ Ugly output on security-group-show
Akihiro Motoki (amotoki)
summary: - Ugly output on security-group-show
+ Ugly output on security-group-show/list
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/25707

Changed in python-quantumclient:
assignee: Salvatore Orlando (salvatore-orlando) → Akihiro Motoki (amotoki)
status: New → In Progress
Revision history for this message
Akihiro Motoki (amotoki) wrote :

I uploaded the review. I would like to get feedbacks about the direction.

With my patch, security-group-list/show produces the following ouptuts.
Conversion from security-group-id to security group name is supported and it can be disabled by --no-nameconv option.

$ quantum security-group-list -c name -c security_group_rules
+---------+-------------------------------------+
| name | security_group_rules |
+---------+-------------------------------------+
| default | ingress; IPv4; remote_group:default |
| | egress; IPv6 |
| | egress; IPv4 |
| | ingress; IPv6; remote_group:default |
+---------+-------------------------------------+
$ quantum security-group-show default
+----------------------+--------------------------------------+
| Field | Value |
+----------------------+--------------------------------------+
| description | default |
| id | 6d1f7746-88c1-416c-8bc0-83bbd559b389 |
| name | default |
| security_group_rules | ingress; IPv4; remote_group:default |
| | egress; IPv6 |
| | egress; IPv4 |
| | ingress; IPv6; remote_group:default |
| tenant_id | ffc9febde5ae48c9a7c50ab3d8a35706 |
+----------------------+--------------------------------------+
$ quantum security-group-show --no-nameconv default
+----------------------+--------------------------------------+
| Field | Value |
+----------------------+--------------------------------------+
| description | default |
| id | 6d1f7746-88c1-416c-8bc0-83bbd559b389 |
| name | default |
| security_group_rules | ingress; IPv4; remote_group:default |
| | egress; IPv6 |
| | egress; IPv4 |
| | ingress; IPv6; remote_group:default |
| tenant_id | ffc9febde5ae48c9a7c50ab3d8a35706 |
+----------------------+--------------------------------------+

Revision history for this message
Rami Vaknin (rvaknin) wrote :

I'm not sure this suppressed representation is common in other openstack cli commands output but I really like it, I see that the patch was abandoned?

Akihiro Motoki (amotoki)
Changed in python-neutronclient:
milestone: 3.0.0 → none
Akihiro Motoki (amotoki)
Changed in python-neutronclient:
assignee: Akihiro Motoki (amotoki) → nobody
status: In Progress → Confirmed
Hideki Saito (saitou)
Changed in python-neutronclient:
assignee: nobody → Hideki Saito (saitou)
Hideki Saito (saitou)
Changed in python-neutronclient:
assignee: Hideki Saito (saitou) → nobody
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-neutronclient (master)

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

Changed in python-neutronclient:
assignee: nobody → Akihiro Motoki (amotoki)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Kyle Mestery (mestery)
Changed in python-neutronclient:
milestone: none → 2.3.12
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-neutronclient (master)

Reviewed: https://review.openstack.org/160225
Committed: https://git.openstack.org/cgit/openstack/python-neutronclient/commit/?id=5a6e6089265a5749641a4a91e1c4c877b9e8b314
Submitter: Jenkins
Branch: master

commit 5a6e6089265a5749641a4a91e1c4c877b9e8b314
Author: Akihiro Motoki <email address hidden>
Date: Mon Mar 2 13:22:19 2015 +0900

    Show rules in handy format in security-group-list

    Previously security group rules in security-group-list was just
    JSON dump of security group rules if security_group_rules field
    is requested to display and it leads to long lines.

    This commit defines a formater for sg rules for ListSecurityGroup.
    It changes the default columns to show "security_group_rules".
    I believe it is useful for users because we don't need to run
    neutron security-group-rule-list to know rules.

    Closes-Bug: #1153766
    Change-Id: I5e1b93bea6ab1121f85dc19d2e75fffd065cd627

Changed in python-neutronclient:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/160222
Committed: https://git.openstack.org/cgit/openstack/python-neutronclient/commit/?id=07334cbce112ebac8ad852b0b06fbd5cf99a016a
Submitter: Jenkins
Branch: master

commit 07334cbce112ebac8ad852b0b06fbd5cf99a016a
Author: Akihiro Motoki <email address hidden>
Date: Sun Mar 1 22:13:46 2015 +0900

    Make secgroup rules more readable in security-group-show

    Previously security_group_rules in security-group-show is
    displayed in JSON dump in a format of one line per rule,
    but each line is too long and hard to understand rules.
    After this commit each rule is displayed as JSON dump with
    indentation and we can easily read security group rules.

    Partial-Bug: #1153766
    Change-Id: I0a0d4afad340aee0346c73cf8881900375978858

Kyle Mestery (mestery)
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.