Support IPv6 addresses better

When adding a security group rule, if no IP address is given
we will use '0.0.0.0/0', but if the ethertype is IPv6 we will
leave it as None.  Change this to be '::/0' to match what we
do for IPv4 - use the "any" address.  The neutron server
treats them both the same when checking for duplicates.

Because there are most likely entries in the DB using None
for the IP, print them as '0.0.0.0/0' or '::/0' so it is more
obvious what address they are actually referring to.

Also change to display the Ethertype column by default
instead of with --long, since easily knowing IPv4 or IPv6
is useful.

Change-Id: Ic396fc23caa66b6b0034c5d30b27c6ed499de5a6
Closes-bug: #1735575
This commit is contained in:
Brian Haley
2017-11-30 17:53:29 -05:00
parent b41d7518c3
commit 969e6abd20
5 changed files with 79 additions and 15 deletions

@@ -27,8 +27,9 @@ Create a new security group rule
.. option:: --remote-ip <ip-address>
Remote IP address block
(may use CIDR notation; default for IPv4 rule: 0.0.0.0/0)
Remote IP address block (may use CIDR notation;
default for IPv4 rule: 0.0.0.0/0,
default for IPv6 rule: ::/0)
.. option:: --remote-group <group>
@@ -134,6 +135,7 @@ List security group rules
openstack security group rule list
[--all-projects]
[--protocol <protocol>]
[--ethertype <ethertype>]
[--ingress | --egress]
[--long]
[<group>]
@@ -151,7 +153,6 @@ List security group rules
*Compute version 2 does not have additional fields to display.*
.. option:: --protocol
List rules by the IP protocol (ah, dhcp, egp, esp, gre, icmp, igmp,
@@ -161,6 +162,12 @@ List security group rules
*Network version 2*
.. option:: --ethertype
List rules by the Ethertype (IPv4 or IPv6)
*Network version 2*
.. option:: --ingress
List rules applied to incoming network traffic