summaryrefslogtreecommitdiff
path: root/openstackclient/network/v2/security_group_rule.py
Commit message (Collapse)AuthorAgeFilesLines
* Blacken openstackclient.networkStephen Finucane2023-05-101-75/+120
| | | | | | | | | | Black used with the '-l 79 -S' flags. A future change will ignore this commit in git-blame history by adding a 'git-blame-ignore-revs' file. Change-Id: I8048746dbc2ef0cb582f68934734db4c1153d779 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Don't show tenant_id in network objectsDr. Jens Harbott2022-06-271-1/+1
| | | | | | | | | | | | Patch [0] dropped mapping the tenant_id attribute to project_id. However, the Neutron API still returns the tenant_id attribute in addition to the project_id and so we still need to discard it from the output. [0] I5f62f2a76592eaaaed6703624e959df41a6ecc8f Signed-off-by: Dr. Jens Harbott <harbott@osism.tech> Change-Id: Iba1e003bf587802f28928cb44d160b3b3fb1f840
* Get rid of tenant_id in the network commandsArtem Goncharov2022-01-171-4/+2
| | | | | | Finally drop tenant_id completely from the networking service. Change-Id: I5f62f2a76592eaaaed6703624e959df41a6ecc8f
* Hide location columns for network objectsDr. Jens Harbott2021-12-161-1/+6
| | | | | | | | | | | | | Network objects returned from the SDK include a location column which has a reference to the cloud to which the object belongs. We don't want to include them in CLI output where they are useless. The solution implemented in [0] was dropped as a sideeffect in [1]. [0] https://review.opendev.org/c/openstack/python-openstackclient/+/679445 [1] https://review.opendev.org/c/openstack/python-openstackclient/+/815032 Signed-off-by: Dr. Jens Harbott <harbott@osism.tech> Change-Id: I9a408d9721c9c57d752afaab520cd6ee379a5184
* Remove 'get_osc_show_columns_for_sdk_resource' duplicatesStephen Finucane2021-10-211-3/+1
| | | | | | | | | | | | There were a number of 'get_osc_show_columns_for_sdk_resource' defined in-tree. However, osc-lib has provided this method for some time (since 2.2.0, June 2020 [1] - our minimum version is currently 2.3.0) so there's no need to provide our own copies. Remove them. [1] https://github.com/openstack/osc-lib/commit/29a0c5a5 Change-Id: I25695f4f9a379dd691b7eaa1e3247164668ae77e Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
* Allow to send extra attributes in Neutron related commandsSlawek Kaplonski2021-05-261-1/+5
| | | | | | | | | | To deprecate and drop support for neutronclient CLI and use only OSC we need feature parity between OSC and neutronclient. Last missing piece here is possibility to send in POST/PUT requests unknown parameters to the Neutron server. This patch adds such possibility to the OSC. Change-Id: Iba09297c2be9fb9fa0be1b3dc65755277b79230e
* Support remote-address-group in SG rulesHang Yang2021-01-121-0/+14
| | | | | | | | Add support for using remote-address-group in security group rules. Change-Id: Ib1972244d484839943bc3cda07519a6c6d4b945a Implements: blueprint address-groups-in-sg-rules Depends-On: https://review.opendev.org/755644
* Merge "Always display direction for security group rules"Zuul2020-10-131-7/+10
|\
| * Always display direction for security group rulesSam Morrison2020-03-051-7/+10
| | | | | | | | | | | | | | The --long option is still accepted but is now ignored. Change-Id: I23dd9fa7cff310ee9a62ce32b843b822b93b7548 Story: #2007323
* | Revert "Format location columns in network commands"Jens Harbott (frickler)2020-06-171-8/+2
|/ | | | | | This reverts commit 6ee7b8d138e07bfc37c5cd887f7afa49cdabb02f. Change-Id: I5f59959ba8a01aba49e29f4cb007397467344e58
* Replace six.iteritems() with .items()lihaijing2020-01-091-2/+1
| | | | | | | | | | | | | | | | 1. As mentioned in [1], we should avoid using six.iteritems to achieve iterators. We can use dict.items instead, as it will return iterators in PY3 as well. And dict.items/keys will more readable. 2. In py2, the performance about list should be negligible, see the link [2]. [1] https://wiki.openstack.org/wiki/Python3 [2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html Co-Authored-By: Akihiro Motoki <amotoki@gmail.com> Change-Id: I4b9edb326444264c0f6c4ad281acaac356a07e85 Implements: blueprint replace-iteritems-with-items
* neutron: autogenerate docsEric Fried2019-11-011-93/+112
| | | | | | | | | | | | | | | | | | | $namespace = openstack.network.v2 The subcommand documents for $namespace were hardcoded and thus prone to drift over time. This commit removes the hardcoded content and uses the autoprogram-cliff directive to generate them automatically from the subcommand configuration classes. This one turned out to be quite involved, because we support both neutron and nova-network. When running in a real cloud, the command classes detect whether the neutron service is present, assume nova-network if that service is not found, and only add parser options relevant to the detected service. But the docs need to present both sets of options. This was easy enough when they were hardcoded, but required a bit of additional infrastructure for generated docs. Change-Id: I426261eb1d86bcc68656aabd61f10b7f082da402
* Format location columns in network commandsDean Troyer2019-08-301-2/+8
| | | | | | | | | | | | These return a Munch from the SDK, which can be handled exactly like a dict so do that. Note that the location column has a nested project dict in the return value, this is addressed separately in osc_lib.format_columns in https://review.opendev.org/#/c/679474/. Change-Id: I99a6d192749a4ac76777f72be8118261c0521cb0 Signed-off-by: Dean Troyer <dtroyer@gmail.com>
* Support IPv6 addresses betterBrian Haley2019-07-151-9/+40
| | | | | | | | | | | | | | | | | | | 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
* Merge "Change default security group protocol to 'any'"Zuul2019-06-221-6/+6
|\
| * Change default security group protocol to 'any'Brian Haley2019-05-061-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The default protocol used to create a security rule was changed to ``tcp``, which was a regression from the neutron client. Change it back to ``any``, which skips sending the protocol to the API server entirely when using the Neutron v2 API. Users that had been creating rules without specifying a protocol and expecting ``tcp`` need to change to use ``--protocol tcp`` explicitly. Change-Id: Iedaa027240e00dced551513d8fa828564386b79f Closes-bug: #1716789
* | Remove deprecated network optionsSean McGinnis2019-05-191-55/+8
|/ | | | | | | | | | | | | | | | The following were deprecated for several releases and can now be removed: * Remove ``port create|set`` options ``--device-id`` and ``--port-id`` * Remove ``router set`` option ``--clear-routes`` * Remove ``security group rule create`` options ``--src-group`` and ``--src-ip`` These are backwards incompatible changes and will require a major version bump after they are merged. Change-Id: Ieae74c14f6b3e263721a3146cf76f94a9ab792f6 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com> Signed-off-by: Dean Troyer <dtroyer@gmail.com>
* Ignore case in security group rule --ethertypeJim Rollenhagen2019-04-011-0/+9
| | | | | | | | | Currently, this only allows 'IPv4' or 'IPv6', but one can imagine a user frequently typing e.g. 'ipv6' and getting frustrated. Allow any case, while still keeping correct case for the choices and the value sent to Neutron. Change-Id: I70ce1f43d32aad01b174437d03c984a5b608b161
* Allow creating security rules without protocolDaniel Speichert2017-10-171-3/+5
| | | | | | | | | | | | | In order to create a rule for any protocol, the client must not specify the protocol in the API call. This is currently impossible because protocol defaults to TCP. In order not to change the default behavior, a "new" protocol name is added: "any", which makes this CLI skip sending the protocol field altogether. Change-Id: I58853d3745f3631007e5e9780c0c5c2526b730a3 Closes-Bug: 1712242
* Support icmp-type and icmp-code to be set as zerogvrangan2017-09-261-2/+2
| | | | | | | | | When icmp-type or icmp-code are set to 0, the current implementation ignores the value, this fix will allow the value to be copied and displayed Change-Id: I96133a57883d22e98fcbb9fe0328d9e050472469 Signed-off-by: gvrangan <venkatrangang@hcl.com>
* Low-level Compute v2 API: security group rulesDean Troyer2017-04-111-9/+9
| | | | | | | | | | api.compute.APIv2 security group rule functions. novaclient 8.0 is now released without support for the previously deprecated nova-net functions, so include a new low-level REST implementation of the removed APIs. Change-Id: Ieabd61113bc6d3562738686f52bb06aa84fca765
* Low-level Compute v2 API: security groupDean Troyer2017-04-111-24/+18
| | | | | | | | | | api.compute.APIv2 starts with security group functions. novaclient 8.0 is now released without support for the previously deprecated nova-net functions, so include a new low-level REST implementation of the removed APIs. Change-Id: Id007535f0598226a8202716232313e37fe6247f9
* Fix output of ListSecurityGroupRuleJens Rosenboom2017-02-241-1/+1
| | | | | | | | The Ethertype column was always left empty because a wrong column name was being used. Change-Id: I7fc0f8d5eb7bac1efb234faba454dad0a45a7e6a Closes-Bug: 1667699
* Handle log message interpolation by the logger in network/Gábor Antal2017-02-131-4/+4
| | | | | | | | | | According to OpenStack Guideline[1], logged string message should be interpolated by the logger. [1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages Related-Bug: #1596829 Change-Id: I17467d01420750c004fbbf2a07730fc2badd62b8
* Fix security group rule list for NEtwork v2Dean Troyer2017-01-131-19/+26
| | | | | | | Fix the formatting of Port Range in the security group rule list command for Network v2 to handle SDK changes. Change-Id: Id954cbfaedbb74f60125ebda91f80db751759933
* SDK Refactor: Prepare security group rule commandsAbhishek Raut2016-11-191-9/+11
| | | | | | | | | | Prepare the OSC "security group rule" commands for the SDK refactor. See [1] for details. [1] https://etherpad.openstack.org/p/osc-network-command-sdk-support Change-Id: I5553e40fe90f3a26d3f462a69f1a424032479d49 Partially-Implements: blueprint network-command-sdk-support
* translate all command help strings3.4.0Steve Martinelli2016-11-171-4/+4
| | | | | | | | | | | | | | Leverage the new cliff command class attribute (_description) to get the help of a command, this allows us to mark strings for translation. We could not do this before since the help was grabbed from the docstring. This also depends on a new release of cliff and a bump to the minimum level in osc's requirements. Closes-Bug: 1636209 Depends-On: Id915f6aa7d95a0ff3dc6e2ceaac5decb3f3bf0da Change-Id: I8673080bb5625e8e3c499feaefd42dfc7121e96f
* Do proper deprecation for security group rule createDean Troyer2016-11-161-17/+47
| | | | | | | | | | | | | | Review I03fd0e14e470e7272930ac2651e73263b83bd4e1 renamed the --src-group and --src-ip options to --remote-group and --remote-ip but did not properly deprecate the old option names. Add deprecation warnings when the old option names are used. Also, format the warnings using the new proposed translation guideline for marking substrings to not be translated, such as literal names and option names. Change-Id: I63d085d190fc28b8637e7686016eda4efbdda1be
* Merge "Not appropriate name sg rule attribute"Jenkins2016-11-101-16/+38
|\
| * Not appropriate name sg rule attributejudy-yu2016-11-041-16/+38
| | | | | | | | | | | | | | | | | | | | For ingress rules set ip-prefix means src-ip- prefix, but for egress rules set ip-prefix means dst-ip-prefix. It is not appropriate to name src-ip directly. So as to src-group. Change-Id: I03fd0e14e470e7272930ac2651e73263b83bd4e1 Closes-bug: #1637365
* | Merge "Add direction and protocol options to os security group rule list cmd"Jenkins2016-11-101-0/+30
|\ \
| * | Add direction and protocol options to os security group rule list cmdNam Nguyen Hoai2016-10-141-0/+30
| |/ | | | | | | | | | | | | | | | | This patch added direction options (--ingress, --egress) and protocol option (--protocol) to filter rules by os security group rule list command. Change-Id: I56ace3f97eb927fd2a868f728c7347a29d028b67 Closes-Bug: #1613533 Partially-Implements: blueprint network-commands-options
* | Add 'description' optionSindhu Devale2016-11-081-0/+8
|/ | | | | | | | | This patch adds '--description' option to os security group rule create cmd. Change-Id: I604bcdeb4658d2dcc4d860a87e704e186cca5225 Partially-Implements: blueprint network-commands-options Partially-Implements: blueprint neutron-client-descriptions
* Fix a missing i18n support in security_group_rule.pyHuanxuan Ao2016-06-211-2/+2
| | | | Change-Id: Id1459366ccf894275a11c2af840568d4fd114e18
* Support bulk deletion for commands that exist in both network and compute.Huanxuan Ao2016-06-151-5/+11
| | | | | | | | | | | | | | | Some delete commands in networkv2 are exist in both network and compute, They can use NetworkAndComputeDeleteclass to supprot bulk deletion and error handling and the codes are similar, so I change them all in this patch. The changed commands including: 1.floating ip delete 2.security group delete 3.security group rule delete Also, I update unit tests and docs for these commands in this patch. Change-Id: I6c94c3d10ba579ddd9b14d17673c821e3481fd8a Partially-Implements: blueprint multi-argument-network
* osc-lib: parseractionsDean Troyer2016-06-131-1/+1
| | | | | | | Leave parseractions.py and test_parseractions.py as a sanity check during the deprecation period. Change-Id: I1a7469b6d872284e0276502a1a287bc0b87f8f83
* osc-lib: utilsDean Troyer2016-06-131-1/+1
| | | | | | | | Use osc-lib directly for utils. Leave openstackclient.common.utils for deprecation period. Change-Id: I5bd9579abc4e07f45219ccd0565626e6667472f7
* osc-lib: exceptionsDean Troyer2016-06-131-2/+3
| | | | | | | | Use osc-lib directly for exceptions. Leave openstackclient.common.exceptions for deprecation period. Change-Id: Iea3e862302372e1b31ccd27f69db59b4953ca828
* Fix i18n support for help and error msg in networkTang Chen2016-05-161-2/+2
| | | Change-Id: Iab0dc489226601ac4ff123bb758f84ff16989395
* Additional network protocol supportRichard Theis2016-05-141-32/+152
| | | | | | | | | | | | | | | | | | | | | | | | | Add the following network protocol support to the "os security group rule create" command: - Add "--icmp-type" and "--icmp-code" options for Network v2 only. These options can be used to set the ICMP type and code for ICMP IP protocols. - Change the "--proto" option to "--protocol". Using the "--proto" option is still supported, but is no longer documented and may be deprecated in a future release. - Add the following Network v2 IP protocols to the "--protocol" option: "ah", "dccp", "egp", "esp", "gre", "igmp", "ipv6-encap", "ipv6-frag", "ipv6-icmp", "ipv6-nonxt", "ipv6-opts", "ipv6-route", "ospf", "pgm", "rsvp", "sctp", "udplite", "vrrp" and integer representations [0-255]. The "os security group rule list" command now supports displaying the ICMP type and code for security group rules with the ICMP IP protocols. Change-Id: Ic84bc92bc7aa5ac08f6ef91660eb6c125a200eb3 Closes-Bug: #1519512 Implements: blueprint neutron-client
* Add options to security group rule listRichard Theis2016-04-181-3/+43
| | | | | | | | | | | Add the following options to the 'os security group rule list' command: --long: Display direction and ethertype for Network v2 --all-projects: Display information from all projects for Compute v2 Change-Id: If8a1cbd7669cdfa6577d6d2f6fffd9e999a39a82 Partial-Bug: #1519512 Implements: blueprint neutron-client
* State i18() changes and help messages improvedTang Chen2016-04-181-14/+14
| | | | | | | | Add _() to wrap help message in network commands. And also some improvement for help message. Change-Id: Ib3e498f5976ba98c44fd4eec2d1623263b3db53e Partial-bug: 1570924
* Add project options to security group rule createRichard Theis2016-04-111-0/+15
| | | | | | | | | | Add the --project and --project-domain options to the 'os security group rule create' command. These options are for Network v2 only. Change-Id: Ie3e136be076f0f2c22fbe7048d1d6eaebf5aa655 Partial-Bug: #1519512 Implements: blueprint neutron-client
* Add network options to security group rule createRichard Theis2016-04-111-12/+47
| | | | | | | | | | | | | Add the following network options to the "os security group rule" command: (1) --ingress and --egress (2) --ethertype These options enable egress and IPv6 security group rules for Network v2. Change-Id: Ie30b5e95f94e0c087b0ce81e518de72d2dda25ad Partial-Bug: #1519512 Implements: blueprint neutron-client
* Refactor security group rule list to use SDKRichard Theis2016-03-281-0/+115
| | | | | | | | | | | | | Refactored the 'os security group rule list' command to use the SDK when neutron is enabled, but continue to use the nova client when nova network is enabled. In addition, a release note was added to document the features and fixes resulting from this refactor. Change-Id: I24d04b720102ed1c60776e1ca67d4ca20e31b663 Partial-Bug: #1519512 Implements: blueprint neutron-client
* Support security group name for --src-groupRichard Theis2016-03-231-2/+10
| | | | | | | | Support security group name for the "--src-group" option on the "os security group rule create" command. Change-Id: Ic23d0671dad77566269c9a588644c8d774368733 Closes-Bug: #1540656
* Refactor security group rule create to use SDKRichard Theis2016-03-231-0/+100
| | | | | | | | | | | | | Refactored the 'os security group rule create' command to use the SDK when neutron is enabled, but continue to use the nova client when nova network is enabled. Added a release note for the change in security group rules output due to Network v2. Change-Id: I8c6c99d5272ff5d410a449f73d198d834c5cd96e Partial-Bug: #1519512 Implements: blueprint neutron-client
* Fix dict.keys() compatibility for python 3Tang Chen2016-03-121-1/+1
| | | | | | | | | | In Python 2, dict.keys() will return a list. But in Python 3, it will return an iterator. So we need to fix all the places that assuming dict.keys() is a list. Change-Id: I8d1cc536377b3e5c644cfaa0892e40d0bd7c11b1 Closes-Bug: #1556350
* Refactor security group show to use SDKRichard Theis2016-03-101-29/+2
| | | | | | | | | | | | | | Refactored the 'os security group show' command to use the SDK when neutron is enabled, but continue to use the nova client when nova network is enabled. Added a release note for the change in security group rules output due to Network v2. The column names remain unchanged to maintain backwards compatibility. Change-Id: I25233ddb8115d18b8b88affb3de13346084a339d Partial-Bug: #1519511 Implements: blueprint neutron-client
* Add "security group rule show" commandRichard Theis2016-02-231-0/+86
| | | | | | | | | | Add the "os security group rule show" command which will use the SDK when neutron is enabled, and use the nova client when nova network is enabled. Change-Id: I41efaa4468ec15e4e86d74144cc72edc25a29024 Partial-Bug: #1519512 Implements: blueprint neutron-client