├── .coveragerc ├── .gitignore ├── .gitreview ├── .pylintrc ├── .stestr.conf ├── .zuul.yaml ├── CONTRIBUTING.rst ├── HACKING.rst ├── LICENSE ├── README.rst ├── doc ├── requirements.txt └── source │ ├── cli │ ├── index.rst │ ├── osc │ │ └── v2 │ │ │ ├── bgp-dynamic-routing.rst │ │ │ ├── firewall-group.rst │ │ │ ├── firewall-policy.rst │ │ │ ├── firewall-rule.rst │ │ │ ├── network-log.rst │ │ │ ├── networking-bgpvpn.rst │ │ │ ├── networking-sfc.rst │ │ │ ├── subnet-onboard.rst │ │ │ ├── vpn-endpoint-group.rst │ │ │ ├── vpn-ike-policy.rst │ │ │ ├── vpn-ipsec-policy.rst │ │ │ ├── vpn-ipsec-site-connection.rst │ │ │ └── vpn-service.rst │ └── osc_plugins.rst │ ├── conf.py │ ├── contributor │ ├── index.rst │ └── transition_to_osc.rst │ ├── index.rst │ └── reference │ └── index.rst ├── neutronclient ├── __init__.py ├── _i18n.py ├── client.py ├── common │ ├── __init__.py │ ├── clientmanager.py │ ├── constants.py │ ├── exceptions.py │ ├── extension.py │ ├── serializer.py │ ├── utils.py │ └── validators.py ├── neutron │ ├── __init__.py │ ├── client.py │ └── v2_0 │ │ ├── __init__.py │ │ ├── address_scope.py │ │ ├── agent.py │ │ ├── agentscheduler.py │ │ ├── auto_allocated_topology.py │ │ ├── availability_zone.py │ │ ├── bgp │ │ ├── __init__.py │ │ ├── dragentscheduler.py │ │ ├── peer.py │ │ └── speaker.py │ │ ├── contrib │ │ ├── __init__.py │ │ └── _fox_sockets.py │ │ ├── dns.py │ │ ├── extension.py │ │ ├── flavor │ │ ├── __init__.py │ │ ├── flavor.py │ │ └── flavor_profile.py │ │ ├── floatingip.py │ │ ├── fw │ │ ├── __init__.py │ │ ├── firewall.py │ │ ├── firewallpolicy.py │ │ └── firewallrule.py │ │ ├── lb │ │ ├── __init__.py │ │ ├── healthmonitor.py │ │ ├── member.py │ │ ├── pool.py │ │ ├── v2 │ │ │ ├── __init__.py │ │ │ ├── healthmonitor.py │ │ │ ├── l7policy.py │ │ │ ├── l7rule.py │ │ │ ├── listener.py │ │ │ ├── loadbalancer.py │ │ │ ├── member.py │ │ │ └── pool.py │ │ └── vip.py │ │ ├── metering.py │ │ ├── network.py │ │ ├── network_ip_availability.py │ │ ├── port.py │ │ ├── purge.py │ │ ├── qos │ │ ├── __init__.py │ │ ├── bandwidth_limit_rule.py │ │ ├── dscp_marking_rule.py │ │ ├── minimum_bandwidth_rule.py │ │ ├── policy.py │ │ └── rule.py │ │ ├── quota.py │ │ ├── rbac.py │ │ ├── router.py │ │ ├── securitygroup.py │ │ ├── servicetype.py │ │ ├── subnet.py │ │ ├── subnetpool.py │ │ ├── tag.py │ │ └── vpn │ │ ├── __init__.py │ │ ├── endpoint_group.py │ │ ├── ikepolicy.py │ │ ├── ipsec_site_connection.py │ │ ├── ipsecpolicy.py │ │ ├── utils.py │ │ └── vpnservice.py ├── osc │ ├── __init__.py │ ├── plugin.py │ ├── utils.py │ └── v2 │ │ ├── __init__.py │ │ ├── dynamic_routing │ │ ├── __init__.py │ │ ├── bgp_dragent.py │ │ ├── bgp_peer.py │ │ ├── bgp_speaker.py │ │ └── constants.py │ │ ├── fwaas │ │ ├── __init__.py │ │ ├── constants.py │ │ ├── firewallgroup.py │ │ ├── firewallpolicy.py │ │ └── firewallrule.py │ │ ├── lbaas │ │ └── __init__.py │ │ ├── logging │ │ ├── __init__.py │ │ └── network_log.py │ │ ├── networking_bgpvpn │ │ ├── __init__.py │ │ ├── bgpvpn.py │ │ ├── constants.py │ │ ├── network_association.py │ │ ├── port_association.py │ │ ├── resource_association.py │ │ └── router_association.py │ │ ├── sfc │ │ ├── __init__.py │ │ ├── sfc_flow_classifier.py │ │ ├── sfc_port_chain.py │ │ ├── sfc_port_pair.py │ │ ├── sfc_port_pair_group.py │ │ └── sfc_service_graph.py │ │ ├── subnet_onboard │ │ ├── __init__.py │ │ └── subnet_onboard.py │ │ ├── utils.py │ │ └── vpnaas │ │ ├── __init__.py │ │ ├── endpoint_group.py │ │ ├── ikepolicy.py │ │ ├── ipsec_site_connection.py │ │ ├── ipsecpolicy.py │ │ ├── utils.py │ │ └── vpnservice.py ├── tests │ ├── __init__.py │ └── unit │ │ ├── __init__.py │ │ ├── osc │ │ ├── __init__.py │ │ └── v2 │ │ │ ├── __init__.py │ │ │ ├── dynamic_routing │ │ │ ├── __init__.py │ │ │ ├── fakes.py │ │ │ ├── test_bgp_dragent.py │ │ │ ├── test_bgp_peer.py │ │ │ └── test_bgp_speaker.py │ │ │ ├── fakes.py │ │ │ ├── fwaas │ │ │ ├── __init__.py │ │ │ ├── common.py │ │ │ ├── fakes.py │ │ │ ├── test_firewallgroup.py │ │ │ ├── test_firewallpolicy.py │ │ │ └── test_firewallrule.py │ │ │ ├── lbaas │ │ │ └── __init__.py │ │ │ ├── logging │ │ │ ├── __init__.py │ │ │ ├── fakes.py │ │ │ └── test_network_log.py │ │ │ ├── networking_bgpvpn │ │ │ ├── __init__.py │ │ │ ├── fakes.py │ │ │ ├── test_bgpvpn.py │ │ │ ├── test_resource_association.py │ │ │ └── test_router_association.py │ │ │ ├── sfc │ │ │ ├── __init__.py │ │ │ ├── fakes.py │ │ │ ├── test_flow_classifier.py │ │ │ ├── test_port_chain.py │ │ │ ├── test_port_pair.py │ │ │ ├── test_port_pair_group.py │ │ │ └── test_service_graph.py │ │ │ ├── subnet_onboard │ │ │ ├── __init__.py │ │ │ └── test_network_onboard_subnets.py │ │ │ └── vpnaas │ │ │ ├── __init__.py │ │ │ ├── common.py │ │ │ ├── fakes.py │ │ │ ├── test_endpoint_group.py │ │ │ ├── test_ikepolicy.py │ │ │ ├── test_ipsec_site_connection.py │ │ │ ├── test_ipsecpolicy.py │ │ │ └── test_vpnservice.py │ │ ├── test_casual_args.py │ │ ├── test_command_meta.py │ │ ├── test_exceptions.py │ │ ├── test_http.py │ │ ├── test_utils.py │ │ └── test_validators.py ├── v2_0 │ ├── __init__.py │ └── client.py └── version.py ├── releasenotes ├── notes │ ├── .placeholder │ ├── Define-IpAddressAlreadyAllocatedClient-exception-e8600ca5ba1c7f45.yaml │ ├── add-aggressive-negotiation-mode-5218b1baff930eb8.yaml │ ├── add-auto-allocated-topology-delete-aaccd60bd0f2e7b2.yaml │ ├── add-get-me-a-network-5ab2d60bf6f257b1.yaml │ ├── add-l7-content-policies-capability-0f17cd06f044c83c.yaml │ ├── add-lb-status-tree-723f23c09617de3b.yaml │ ├── add-neutron-purge-a89e3d1179dce4b1.yaml │ ├── add-new-session-clear-option-3c0b78ebc133a10c.yaml │ ├── add-no-shared-option-to-qos-policy-update-56ac41fb3af7e309.yaml │ ├── add-osc-dynamic-routing-support-11130b2f440c0ac2.yaml │ ├── add-osc-trunk-commands-7e77283a369729c5.yaml │ ├── add-quota-default-show-c2ab35b791dcdcbc.yaml │ ├── add-rbac-qos-type-support-c42e31fadd7b.yaml │ ├── add-service-graph-ce4a25b3e32d70a6.yaml │ ├── add-sfc-commands.yaml │ ├── add-shared-pools-support-6f79b565afad3e47.yaml │ ├── add-subnet-onboard-e60772bc4984f698.yaml │ ├── add-support-to-floating-ip-port-forwardings-9dc838a5c5727eb7.yaml │ ├── add-tag-support-bad62d60ecc7075c.yaml │ ├── availability-zone-support-8e66f55e46b7ef9a.yaml │ ├── bgp-dynamic-routing-b97a1c81d3007049.yaml │ ├── bug-1676922-81341b70bc6f055a.yaml │ ├── bulk-delete-support-94a353db08efec8d.yaml │ ├── default-subnetpool-support-c0d34870e9d3e814.yaml │ ├── deprecate-bgp-speaker-show-dragents-2fcce99cf6bb5b60.yaml │ ├── deprecate-cli-7be1123817969439.yaml │ ├── direct-physical-vnic-port-create-736d8b2600faf22b.yaml │ ├── docs-improvements-17e31babe38e2962.yaml │ ├── drop-nuage-commands-df10aab6ccd77ed2.yaml │ ├── drop-python-2.7-f615ebae463b2143.yaml │ ├── drop-python-3-6-and-3-7-73767fa0bbe89a6e.yaml │ ├── drop-xml-support-41babecb1784d996.yaml │ ├── dscp_qos-4a26d3c0363624b0.yaml │ ├── extraroute-atomic-b11919d8e33b0d92.yaml │ ├── fix-exception-typeerror-4.1.0-b37d738146575ed5.yaml │ ├── fix-quota-update-zero-args-d596c4169c2d2e30.yaml │ ├── fix-rbac-create-command-dd40a474f0f092db.yaml │ ├── fix-token-endpoint-auth-support-26bf7ee12e4ec833.yaml │ ├── global_request_id-56856a93b982a6b3.yaml │ ├── keystonev3-7f9ede9c21b30841.yaml │ ├── log-request-id-64bef955b8292c18.yaml │ ├── minimum-packet-rate-34576b8fd98a3034.yaml │ ├── network-ip-availability-ac9a462f42fe9db4.yaml │ ├── neutron-cli-deprecation-398823c87270a296.yaml │ ├── no-new-binding-code-b03c9abbcaf2839e.yaml │ ├── osprofiler-support-9ba539761ae437e9.yaml │ ├── paket_rate_limit-1266a2a30f18727f.yaml │ ├── port-bindings-c3f36bd76ece0a71.yaml │ ├── qos_minimum_bandwidth-dc4adb23c51de30b.yaml │ ├── quota-update-for-LB-b21e7bc9e4a10f3e.yaml │ ├── quota-update-for-rbac-192a8e65bf481941.yaml │ ├── relnotes-from-3.0.0-d7306f5af5e3868d.yaml │ ├── remote_fwg-0f5362e5be8b2e84.yaml │ ├── remove-bgp-speaker-show-dragents-0a0db4b72b2feffc.yaml │ ├── remove-case-dependency-773ccb3237c38e81.yaml │ ├── remove-cli-code-53969e9aa927e530.yaml │ ├── remove-deprecated-option-b53f5d7e6a16ce95.yaml │ ├── remove-public-and-private-parameters-d683e7c30ecedc3b.yaml │ ├── remove-py38-26a1befde3f44b82.yaml │ ├── return-request-id-to-caller-15b1d23a4ddc27a3.yaml │ ├── segments-8557f5b0caa5ee26.yaml │ ├── sfc-tap-service-function-support-a05242f25f79066b.yaml │ ├── show-tenant-id-admin-listing-dc13ee7eb889d418.yaml │ ├── start-using-reno-9081b3e4c1951fdb.yaml │ ├── support-bgpvpn-route-control-aeda3e698486f73b.yaml │ ├── support-firewall-group-resource-type-5ad1b69cabcb4aa6.yaml │ ├── support-fwaasv2-cli-7f21676c551f8ae0.yaml │ ├── support-logging-cli-cd02d3bb03367106.yaml │ ├── support-networking-bgpvpn-cli-fdd0cc3a5b14983d.yaml │ ├── support-routes-advertise-9356a38cf3e2fe5a.yaml │ ├── support-vni-in-networking-bgpvpn-cli-d284b73b40b79495.yaml │ ├── support-vpnaas-cli-9478fb7cfe603e26.yaml │ └── tag-support-subnet-port-subnetpool-router-6250ec4714ee8690.yaml └── source │ ├── 2023.1.rst │ ├── 2023.2.rst │ ├── 2024.1.rst │ ├── 2024.2.rst │ ├── 2025.1.rst │ ├── _static │ └── .placeholder │ ├── _templates │ └── .placeholder │ ├── conf.py │ ├── index.rst │ ├── locale │ └── en_GB │ │ └── LC_MESSAGES │ │ └── releasenotes.po │ ├── mitaka.rst │ ├── newton.rst │ ├── ocata.rst │ ├── old_relnotes.rst │ ├── pike.rst │ ├── queens.rst │ ├── rocky.rst │ ├── stein.rst │ ├── train.rst │ ├── unreleased.rst │ ├── ussuri.rst │ ├── victoria.rst │ ├── wallaby.rst │ ├── xena.rst │ ├── yoga.rst │ └── zed.rst ├── requirements.txt ├── setup.cfg ├── setup.py ├── test-requirements.txt └── tox.ini /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | branch = True 3 | source = neutronclient 4 | omit = neutronclient/tests/* 5 | 6 | [report] 7 | ignore_errors = True 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.DS_Store 3 | *.egg 4 | *.sw? 5 | AUTHORS 6 | ChangeLog 7 | build/* 8 | build-stamp 9 | cover/* 10 | doc/build/ 11 | doc/source/api/ 12 | releasenotes/build/ 13 | python_neutronclient.egg-info/* 14 | neutron/vcsversion.py 15 | neutronclient/versioninfo 16 | run_tests.err.log 17 | run_tests.log 18 | .autogenerated 19 | .coverage 20 | .stestr/ 21 | .tox/ 22 | .venv/ 23 | -------------------------------------------------------------------------------- /.gitreview: -------------------------------------------------------------------------------- 1 | [gerrit] 2 | host=review.opendev.org 3 | port=29418 4 | project=openstack/python-neutronclient.git 5 | -------------------------------------------------------------------------------- /.pylintrc: -------------------------------------------------------------------------------- 1 | # The format of this file isn't really documented; just use --generate-rcfile 2 | [MASTER] 3 | # Add to the black list. It should be a base name, not a 4 | # path. You may set this option multiple times. 5 | ignore=test 6 | 7 | [Messages Control] 8 | # NOTE(justinsb): We might want to have a 2nd strict pylintrc in future 9 | # C0111: Don't require docstrings on every method 10 | # W0511: TODOs in code comments are fine. 11 | # W0142: *args and **kwargs are fine. 12 | # W0622: Redefining id is fine. 13 | disable=C0111,W0511,W0142,W0622 14 | 15 | [Basic] 16 | # Variable names can be 1 to 31 characters long, with lowercase and underscores 17 | variable-rgx=[a-z_][a-z0-9_]{0,30}$ 18 | 19 | # Argument names can be 2 to 31 characters long, with lowercase and underscores 20 | argument-rgx=[a-z_][a-z0-9_]{1,30}$ 21 | 22 | # Method names should be at least 3 characters long 23 | # and be lowercased with underscores 24 | method-rgx=([a-z_][a-z0-9_]{2,50}|setUp|tearDown)$ 25 | 26 | # Module names matching quantum-* are ok (files in bin/) 27 | module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+)|(quantum-[a-z0-9_-]+))$ 28 | 29 | # Don't require docstrings on tests. 30 | no-docstring-rgx=((__.*__)|([tT]est.*)|setUp|tearDown)$ 31 | 32 | [Design] 33 | max-public-methods=100 34 | min-public-methods=0 35 | max-args=6 36 | 37 | [Variables] 38 | 39 | # List of additional names supposed to be defined in builtins. Remember that 40 | # you should avoid to define new builtins when possible. 41 | # _ is used by our localization 42 | additional-builtins=_ 43 | -------------------------------------------------------------------------------- /.stestr.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | test_path=${OS_TEST_PATH:-./neutronclient/tests/unit} 3 | top_dir=./ 4 | -------------------------------------------------------------------------------- /.zuul.yaml: -------------------------------------------------------------------------------- 1 | - project: 2 | templates: 3 | - openstack-cover-jobs 4 | - openstack-python3-jobs 5 | - publish-openstack-docs-pti 6 | - check-requirements 7 | - lib-forward-testing-python3 8 | - release-notes-jobs-python3 9 | - openstackclient-plugin-jobs 10 | experimental: 11 | jobs: 12 | - neutronclient-grenade-neutron-lib: 13 | irrelevant-files: 14 | - ^(test-|)requirements.txt$ 15 | - ^setup.cfg$ 16 | 17 | - job: 18 | name: neutronclient-grenade-neutron-lib 19 | parent: grenade 20 | description: | 21 | neutron-lib grenade job. 22 | The version of this job on the current branch is py3 based, 23 | while any branch before ussuri needs to use the py2 version, 24 | which is defined in openstack-zuul-jobs with the old name 25 | (legacy-grenade-dsvm-neutron-libs). 26 | Users of this job needs to pay attention of the version used. 27 | Former names for this job were: 28 | * legacy-grenade-dsvm-neutron-libs 29 | * neutron-lib-grenade-dsvm 30 | required-projects: 31 | - openstack/keystoneauth 32 | - openstack/neutron 33 | - openstack/neutron-lib 34 | - openstack/os-client-config 35 | - openstack/python-cinderclient 36 | - openstack/python-glanceclient 37 | - openstack/python-ironicclient 38 | - openstack/python-keystoneclient 39 | - openstack/python-neutronclient 40 | - openstack/python-novaclient 41 | -------------------------------------------------------------------------------- /CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | If you would like to contribute to the development of OpenStack, 2 | you must follow the steps documented at: 3 | 4 | http://docs.openstack.org/infra/manual/developers.html#development-workflow 5 | 6 | Once those steps have been completed, changes to OpenStack 7 | should be submitted for review via the Gerrit tool, following 8 | the workflow documented at: 9 | 10 | http://docs.openstack.org/infra/manual/developers.html#development-workflow 11 | 12 | Pull requests submitted through GitHub will be ignored. 13 | 14 | Bugs should be filed on Launchpad, not GitHub: 15 | 16 | https://bugs.launchpad.net/python-neutronclient 17 | -------------------------------------------------------------------------------- /HACKING.rst: -------------------------------------------------------------------------------- 1 | Neutron Style Commandments 2 | ================================ 3 | 4 | - Step 1: Read the OpenStack Style Commandments 5 | https://docs.openstack.org/hacking/latest/ 6 | - Step 2: Read on 7 | 8 | 9 | Running Tests 10 | ------------- 11 | The testing system is based on a combination of tox and testr. The canonical 12 | approach to running tests is to simply run the command `tox`. This will 13 | create virtual environments, populate them with depenedencies and run all of 14 | the tests that OpenStack CI systems run. Behind the scenes, tox is running 15 | `testr run --parallel`, but is set up such that you can supply any additional 16 | testr arguments that are needed to tox. For example, you can run: 17 | `tox -- --analyze-isolation` to cause tox to tell testr to add 18 | --analyze-isolation to its argument list. 19 | 20 | It is also possible to run the tests inside of a virtual environment 21 | you have created, or it is possible that you have all of the dependencies 22 | installed locally already. In this case, you can interact with the testr 23 | command directly. Running `testr run` will run the entire test suite. `testr 24 | run --parallel` will run it in parallel (this is the default incantation tox 25 | uses.) More information about testr can be found at: 26 | http://wiki.openstack.org/testr 27 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | ======================== 2 | Team and repository tags 3 | ======================== 4 | 5 | .. image:: https://governance.openstack.org/tc/badges/python-neutronclient.svg 6 | :target: https://governance.openstack.org/tc/reference/tags/index.html 7 | 8 | .. Change things from this point on 9 | 10 | Python bindings to the Neutron API 11 | ================================== 12 | 13 | .. image:: https://img.shields.io/pypi/v/python-neutronclient.svg 14 | :target: https://pypi.org/project/python-neutronclient/ 15 | :alt: Latest Version 16 | 17 | This is a client library for Neutron built on the Neutron API. It 18 | provides a Python API (the ``neutronclient`` module). 19 | 20 | .. note:: This project has been deprecated. The CLI code has been deleted 21 | and is not accessible anymore. The Python bindings are still in use by 22 | other projects but no new features will be added to this project. 23 | Any new feature should be proposed to OpenStack SDK and OpenStack 24 | Client. 25 | 26 | * License: Apache License, Version 2.0 27 | * `PyPi`_ - package installation 28 | * `Online Documentation`_ 29 | * `Launchpad project`_ - release management 30 | * `Blueprints`_ - feature specifications 31 | * `Bugs`_ - issue tracking 32 | * `Source`_ 33 | * `Developer's Guide`_ 34 | 35 | .. _PyPi: https://pypi.org/project/python-neutronclient 36 | .. _Online Documentation: https://docs.openstack.org/python-neutronclient/latest/ 37 | .. _Launchpad project: https://launchpad.net/python-neutronclient 38 | .. _Blueprints: https://blueprints.launchpad.net/python-neutronclient 39 | .. _Bugs: https://bugs.launchpad.net/python-neutronclient 40 | .. _Source: https://opendev.org/openstack/python-neutronclient 41 | .. _Developer's Guide: http://docs.openstack.org/infra/manual/developers.html 42 | .. _Release Notes: https://docs.openstack.org/releasenotes/python-neutronclient 43 | -------------------------------------------------------------------------------- /doc/requirements.txt: -------------------------------------------------------------------------------- 1 | # The order of packages is significant, because pip processes them in the order 2 | # of appearance. Changing the order has an impact on the overall integration 3 | # process, which may cause wedges in the gate later. 4 | openstackdocstheme>=2.2.0 # Apache-2.0 5 | reno>=3.1.0 # Apache-2.0 6 | sphinx>=2.0.0,!=2.1.0 # BSD 7 | cliff>=3.4.0 # Apache-2.0 8 | -------------------------------------------------------------------------------- /doc/source/cli/index.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Licensed under the Apache License, Version 2.0 (the "License"); you may 3 | not use this file except in compliance with the License. You may obtain 4 | a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 11 | License for the specific language governing permissions and limitations 12 | under the License. 13 | 14 | 15 | Convention for heading levels in Neutron devref: 16 | ======= Heading 0 (reserved for the title in a document) 17 | ------- Heading 1 18 | ~~~~~~~ Heading 2 19 | +++++++ Heading 3 20 | ''''''' Heading 4 21 | (Avoid deeper levels because they do not render well.) 22 | 23 | ========= 24 | Using CLI 25 | ========= 26 | 27 | There is `OpenStackClient (OSC) 28 | `__ 29 | which support the Networking API 30 | 31 | OpenStackClient 32 | --------------- 33 | 34 | OpenStackClient provides 35 | `the basic network commands `__ 36 | and python-neutronclient provides :doc:`extensions ` 37 | (aka OSC plugins) for advanced networking services. 38 | 39 | .. toctree:: 40 | :maxdepth: 1 41 | 42 | Basic network commands 43 | Network commands for advanced networking services 44 | Mapping Guide from neutron CLI 45 | 46 | neutron CLI 47 | ----------- 48 | 49 | .. warning:: 50 | 51 | neutron CLI is removed. Use openstack CLI instead. See `openstack CLI command list 52 | `__ 53 | and :doc:`its extensions for advanced networking services `. 54 | The command mapping from neutron CLI to openstack CLI is available 55 | `here `__. 56 | -------------------------------------------------------------------------------- /doc/source/cli/osc/v2/bgp-dynamic-routing.rst: -------------------------------------------------------------------------------- 1 | =================== 2 | BGP Dynamic Routing 3 | =================== 4 | 5 | BGP dynamic routing enables announcement of project subnet prefixes 6 | via BGP. Admins create BGP speakers and BGP peers. BGP peers can be 7 | associated with BGP speakers, thereby enabling peering sessions with 8 | operator infrastructure. BGP speakers can be associated with networks, 9 | which controls which routes are announced to peers. 10 | 11 | Network v2 12 | 13 | .. autoprogram-cliff:: openstack.neutronclient.v2 14 | :command: bgp speaker create 15 | 16 | .. autoprogram-cliff:: openstack.neutronclient.v2 17 | :command: bgp speaker delete 18 | 19 | .. autoprogram-cliff:: openstack.neutronclient.v2 20 | :command: bgp speaker list 21 | 22 | .. autoprogram-cliff:: openstack.neutronclient.v2 23 | :command: bgp speaker set 24 | 25 | .. autoprogram-cliff:: openstack.neutronclient.v2 26 | :command: bgp speaker show 27 | 28 | .. autoprogram-cliff:: openstack.neutronclient.v2 29 | :command: bgp speaker add network 30 | 31 | .. autoprogram-cliff:: openstack.neutronclient.v2 32 | :command: bgp speaker remove network 33 | 34 | .. autoprogram-cliff:: openstack.neutronclient.v2 35 | :command: bgp speaker add peer 36 | 37 | .. autoprogram-cliff:: openstack.neutronclient.v2 38 | :command: bgp speaker remove peer 39 | 40 | .. autoprogram-cliff:: openstack.neutronclient.v2 41 | :command: bgp speaker list advertised routes 42 | 43 | .. autoprogram-cliff:: openstack.neutronclient.v2 44 | :command: bgp peer * 45 | 46 | .. autoprogram-cliff:: openstack.neutronclient.v2 47 | :command: bgp dragent * 48 | -------------------------------------------------------------------------------- /doc/source/cli/osc/v2/firewall-group.rst: -------------------------------------------------------------------------------- 1 | ============== 2 | firewall group 3 | ============== 4 | 5 | A **firewall group** is a perimeter firewall management to Networking. 6 | Firewall group uses iptables to apply firewall policy to all VM ports and 7 | router ports within a project. 8 | 9 | Network v2 10 | 11 | .. 'firewall group *' cannot be used below as it matches 'firewall group rule 12 | *' or 'firewall group policy *'. 13 | 14 | .. autoprogram-cliff:: openstack.neutronclient.v2 15 | :command: firewall group create 16 | 17 | .. autoprogram-cliff:: openstack.neutronclient.v2 18 | :command: firewall group delete 19 | 20 | .. autoprogram-cliff:: openstack.neutronclient.v2 21 | :command: firewall group list 22 | 23 | .. autoprogram-cliff:: openstack.neutronclient.v2 24 | :command: firewall group set 25 | 26 | .. autoprogram-cliff:: openstack.neutronclient.v2 27 | :command: firewall group show 28 | 29 | .. autoprogram-cliff:: openstack.neutronclient.v2 30 | :command: firewall group unset 31 | -------------------------------------------------------------------------------- /doc/source/cli/osc/v2/firewall-policy.rst: -------------------------------------------------------------------------------- 1 | ===================== 2 | firewall group policy 3 | ===================== 4 | 5 | A **firewall group policy** is an ordered collection of firewall rules. 6 | A firewall policy can be shared across projects. Thus it can also be made part 7 | of an audit workflow wherein the firewall_policy can be audited by the 8 | relevant entity that is authorized (and can be different from the projects 9 | which create or use the firewall group policy). 10 | 11 | Network v2 12 | 13 | .. autoprogram-cliff:: openstack.neutronclient.v2 14 | :command: firewall group policy * 15 | -------------------------------------------------------------------------------- /doc/source/cli/osc/v2/firewall-rule.rst: -------------------------------------------------------------------------------- 1 | =================== 2 | firewall group rule 3 | =================== 4 | 5 | A **firewall group rule** represents a collection of attributes like ports, IP 6 | addresses which define match criteria and action (allow, or deny) that needs to 7 | be taken on the matched data traffic. 8 | 9 | Network v2 10 | 11 | .. autoprogram-cliff:: openstack.neutronclient.v2 12 | :command: firewall group rule * 13 | -------------------------------------------------------------------------------- /doc/source/cli/osc/v2/network-log.rst: -------------------------------------------------------------------------------- 1 | =========== 2 | network log 3 | =========== 4 | 5 | A **network log** is a container to group security groups or ports for logging. 6 | Specified resources can be logged via these event (``ALL``, ``ACCEPT`` or 7 | ``DROP``). 8 | 9 | Network v2 10 | 11 | .. autoprogram-cliff:: openstack.neutronclient.v2 12 | :command: network loggable resources list 13 | 14 | .. autoprogram-cliff:: openstack.neutronclient.v2 15 | :command: network log * 16 | -------------------------------------------------------------------------------- /doc/source/cli/osc/v2/networking-bgpvpn.rst: -------------------------------------------------------------------------------- 1 | ====== 2 | bgpvpn 3 | ====== 4 | 5 | A **bgpvpn** resource contains a set of parameters to define a BGP-based VPN. 6 | BGP-based IP VPNs networks are widely used in the industry especially for 7 | enterprises. The networking BGP VPN project aims at supporting inter-connection 8 | between L3VPNs and Neutron resources, i.e. Networks, Routers and Ports. 9 | 10 | Network v2 11 | 12 | .. autoprogram-cliff:: openstack.neutronclient.v2 13 | :command: bgpvpn create 14 | 15 | .. autoprogram-cliff:: openstack.neutronclient.v2 16 | :command: bgpvpn delete 17 | 18 | .. autoprogram-cliff:: openstack.neutronclient.v2 19 | :command: bgpvpn list 20 | 21 | .. autoprogram-cliff:: openstack.neutronclient.v2 22 | :command: bgpvpn set 23 | 24 | .. autoprogram-cliff:: openstack.neutronclient.v2 25 | :command: bgpvpn show 26 | 27 | .. autoprogram-cliff:: openstack.neutronclient.v2 28 | :command: bgpvpn unset 29 | 30 | .. autoprogram-cliff:: openstack.neutronclient.v2 31 | :command: bgpvpn network association * 32 | 33 | .. autoprogram-cliff:: openstack.neutronclient.v2 34 | :command: bgpvpn router association * 35 | 36 | .. autoprogram-cliff:: openstack.neutronclient.v2 37 | :command: bgpvpn port association * 38 | -------------------------------------------------------------------------------- /doc/source/cli/osc/v2/networking-sfc.rst: -------------------------------------------------------------------------------- 1 | ============== 2 | networking sfc 3 | ============== 4 | 5 | **Service Function Chaining** is a mechanism for overriding the basic destination based forwarding 6 | that is typical of IP networks. Service Function Chains consist of an ordered sequence of 7 | Service Functions (SFs). SFs are virtual machines (or potentially physical devices) that perform a 8 | network function such as firewall, content cache, packet inspection, or any other function that 9 | requires processing of packets in a flow from point A to point B even though the SFs are not 10 | literally between point A and B from a routing table perspective. 11 | 12 | Network v2 13 | 14 | .. autoprogram-cliff:: openstack.neutronclient.v2 15 | :command: sfc flow classifier * 16 | 17 | .. autoprogram-cliff:: openstack.neutronclient.v2 18 | :command: sfc port chain * 19 | 20 | .. autoprogram-cliff:: openstack.neutronclient.v2 21 | :command: sfc port pair create 22 | 23 | .. autoprogram-cliff:: openstack.neutronclient.v2 24 | :command: sfc port pair delete 25 | 26 | .. autoprogram-cliff:: openstack.neutronclient.v2 27 | :command: sfc port pair list 28 | 29 | .. autoprogram-cliff:: openstack.neutronclient.v2 30 | :command: sfc port pair set 31 | 32 | .. autoprogram-cliff:: openstack.neutronclient.v2 33 | :command: sfc port pair show 34 | 35 | .. autoprogram-cliff:: openstack.neutronclient.v2 36 | :command: sfc port pair group * 37 | 38 | .. autoprogram-cliff:: openstack.neutronclient.v2 39 | :command: sfc service graph * 40 | -------------------------------------------------------------------------------- /doc/source/cli/osc/v2/subnet-onboard.rst: -------------------------------------------------------------------------------- 1 | ======================= 2 | network onboard subnets 3 | ======================= 4 | 5 | **network onboard subnets** enables a subnet to be adopted or 6 | "onboarded" into an existing subnet pool. The CIDR of the subnet 7 | is checked for uniqueness across any applicable address scopes 8 | and all subnets allocated from the target subnet pool. Once 9 | onboarded, the subnet CIDR is added to the prefix list of the 10 | subnet pool and the subnet appears as though it has been allocated 11 | from the subnet pool. The subnet also begins participating in the 12 | applicable address scope if the subnet pool belongs to one. 13 | 14 | Network v2 15 | 16 | .. autoprogram-cliff:: openstack.neutronclient.v2 17 | :command: network onboard subnets 18 | -------------------------------------------------------------------------------- /doc/source/cli/osc/v2/vpn-endpoint-group.rst: -------------------------------------------------------------------------------- 1 | ================== 2 | VPN Endpoint Group 3 | ================== 4 | 5 | The **Endpoint Group** is used to configure multiple local and remote subnets 6 | in vpnservice object. 7 | 8 | Network v2 9 | 10 | .. autoprogram-cliff:: openstack.neutronclient.v2 11 | :command: vpn endpoint group * 12 | -------------------------------------------------------------------------------- /doc/source/cli/osc/v2/vpn-ike-policy.rst: -------------------------------------------------------------------------------- 1 | ============== 2 | VPN IKE Policy 3 | ============== 4 | 5 | The **IKE Policy** is used for phases one and two negotiation of the 6 | VPN connection. You can specify both the authentication and encryption 7 | algorithms for connections. 8 | 9 | Network v2 10 | 11 | .. autoprogram-cliff:: openstack.neutronclient.v2 12 | :command: vpn ike policy * 13 | -------------------------------------------------------------------------------- /doc/source/cli/osc/v2/vpn-ipsec-policy.rst: -------------------------------------------------------------------------------- 1 | ================ 2 | VPN IPsec Policy 3 | ================ 4 | 5 | The **IPsec Policy** specifies the authentication and encryption algorithms 6 | and encapsulation mode to use for the established VPN connection. 7 | 8 | Network v2 9 | 10 | .. autoprogram-cliff:: openstack.neutronclient.v2 11 | :command: vpn ipsec policy * 12 | -------------------------------------------------------------------------------- /doc/source/cli/osc/v2/vpn-ipsec-site-connection.rst: -------------------------------------------------------------------------------- 1 | ========================= 2 | VPN IPsec Site Connection 3 | ========================= 4 | 5 | Creates a site-to-site **IPsec Site Connection** for a VPN service. 6 | 7 | Network v2 8 | 9 | .. autoprogram-cliff:: openstack.neutronclient.v2 10 | :command: vpn ipsec site connection * 11 | -------------------------------------------------------------------------------- /doc/source/cli/osc/v2/vpn-service.rst: -------------------------------------------------------------------------------- 1 | =========== 2 | VPN Service 3 | =========== 4 | 5 | The **VPN Service** is associated with a router. After you 6 | create the service, it can contain multiple VPN connections. 7 | 8 | Network v2 9 | 10 | .. autoprogram-cliff:: openstack.neutronclient.v2 11 | :command: vpn service * 12 | -------------------------------------------------------------------------------- /doc/source/cli/osc_plugins.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Licensed under the Apache License, Version 2.0 (the "License"); you may 3 | not use this file except in compliance with the License. You may obtain 4 | a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 11 | License for the specific language governing permissions and limitations 12 | under the License. 13 | 14 | 15 | Convention for heading levels in Neutron devref: 16 | ======= Heading 0 (reserved for the title in a document) 17 | ------- Heading 1 18 | ~~~~~~~ Heading 2 19 | +++++++ Heading 3 20 | ''''''' Heading 4 21 | (Avoid deeper levels because they do not render well.) 22 | 23 | Advanced Network Commands in OpenStack Client 24 | ============================================= 25 | 26 | The following list covers the extended commands for advanced network 27 | services available in ``openstack`` command. 28 | 29 | These commands can be referenced by doing ``openstack help`` and 30 | the detail of individual command can be referred by 31 | ``openstack help ``. 32 | 33 | .. toctree:: 34 | :glob: 35 | :maxdepth: 2 36 | 37 | osc/v2/* 38 | -------------------------------------------------------------------------------- /doc/source/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | 4 | # -- General configuration --------------------------------------------- 5 | 6 | # Add any Sphinx extension module names here, as strings. They can be 7 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 8 | extensions = [ 9 | 'sphinx.ext.autodoc', 10 | 'reno.sphinxext', 11 | 'openstackdocstheme', 12 | 'cliff.sphinxext', 13 | ] 14 | 15 | # openstackdocstheme options 16 | openstackdocs_repo_name = 'openstack/python-neutronclient' 17 | openstackdocs_pdf_link = True 18 | openstackdocs_bug_project = 'python-neutronclient' 19 | openstackdocs_bug_tag = 'doc' 20 | 21 | # Add any paths that contain templates here, relative to this directory. 22 | templates_path = ['_templates'] 23 | 24 | # The suffix of source filenames. 25 | source_suffix = '.rst' 26 | 27 | # The master toctree document. 28 | master_doc = 'index' 29 | 30 | # General information about the project. 31 | copyright = 'OpenStack Foundation' 32 | 33 | # If true, '()' will be appended to :func: etc. cross-reference text. 34 | add_function_parentheses = True 35 | 36 | # If true, the current module name will be prepended to all description 37 | # unit titles (such as .. function::). 38 | add_module_names = True 39 | 40 | # The name of the Pygments (syntax highlighting) style to use. 41 | pygments_style = 'sphinx' 42 | 43 | # -- Options for HTML output --------------------------------------------- 44 | 45 | # The theme to use for HTML and HTML Help pages. Major themes that come with 46 | # Sphinx are currently 'default' and 'sphinxdoc'. 47 | html_theme = 'openstackdocs' 48 | 49 | # Output file base name for HTML help builder. 50 | htmlhelp_basename = 'neutronclientdoc' 51 | 52 | # -- Options for LaTeX output ------------------------------------------------ 53 | 54 | latex_documents = [ 55 | ('index', 'doc-python-neutronclient.tex', 56 | 'python-neutronclient Documentation', 57 | 'Neutron Contributors', 'manual'), 58 | ] 59 | 60 | # Disable usage of xindy https://bugzilla.redhat.com/show_bug.cgi?id=1643664 61 | latex_use_xindy = False 62 | 63 | latex_domain_indices = False 64 | 65 | latex_elements = { 66 | 'makeindex': '', 67 | 'printindex': '', 68 | 'preamble': r'\setcounter{tocdepth}{5}', 69 | } 70 | 71 | # -- Options for cliff.sphinxext plugin --------------------------------------- 72 | 73 | autoprogram_cliff_application = 'openstack' 74 | -------------------------------------------------------------------------------- /doc/source/contributor/index.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Licensed under the Apache License, Version 2.0 (the "License"); you may 3 | not use this file except in compliance with the License. You may obtain 4 | a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 11 | License for the specific language governing permissions and limitations 12 | under the License. 13 | 14 | 15 | Convention for heading levels in Neutron devref: 16 | ======= Heading 0 (reserved for the title in a document) 17 | ------- Heading 1 18 | ~~~~~~~ Heading 2 19 | +++++++ Heading 3 20 | ''''''' Heading 4 21 | (Avoid deeper levels because they do not render well.) 22 | 23 | ================= 24 | Contributor Guide 25 | ================= 26 | 27 | In the Contributor Guide, you will find information on neutronclient's 28 | lower level programming details or APIs as well as the transition to 29 | OpenStack client. 30 | 31 | .. toctree:: 32 | :maxdepth: 2 33 | 34 | transition_to_osc 35 | -------------------------------------------------------------------------------- /doc/source/index.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Licensed under the Apache License, Version 2.0 (the "License"); you may 3 | not use this file except in compliance with the License. You may obtain 4 | a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 11 | License for the specific language governing permissions and limitations 12 | under the License. 13 | 14 | Convention for heading levels in Neutron devref: 15 | ======= Heading 0 (reserved for the title in a document) 16 | ------- Heading 1 17 | ~~~~~~~ Heading 2 18 | +++++++ Heading 3 19 | ''''''' Heading 4 20 | (Avoid deeper levels because they do not render well.) 21 | 22 | ================================== 23 | python-neutronclient documentation 24 | ================================== 25 | 26 | This is a client for OpenStack Networking API. It provides 27 | :doc:`Python API bindings ` (the neutronclient module). 28 | 29 | There is 30 | `OpenStack Client (OSC) `__. 31 | CLI which support the Networking API. 32 | 33 | User Documentation 34 | ------------------ 35 | 36 | .. toctree:: 37 | :maxdepth: 2 38 | 39 | cli/index 40 | reference/index 41 | 42 | Contributor Guide 43 | ----------------- 44 | 45 | In the :doc:`Contributor Guide `, you will find 46 | information on neutronclient's lower level programming details or APIs 47 | as well as the transition to OpenStack client. 48 | 49 | .. toctree:: 50 | :maxdepth: 2 51 | 52 | contributor/index 53 | 54 | .. note:: 55 | 56 | neutron CLI has been deprecated from Ocata release. 57 | We do not add, change and drop any existing commands any more. 58 | We only accept changes on OSC plugin, neutronclient python bindings 59 | and bug fixes on the deprecated CLI (``neutron`` command). 60 | 61 | History 62 | ------- 63 | 64 | Release notes is available at 65 | http://docs.openstack.org/releasenotes/python-neutronclient/. 66 | -------------------------------------------------------------------------------- /doc/source/reference/index.rst: -------------------------------------------------------------------------------- 1 | .. 2 | Licensed under the Apache License, Version 2.0 (the "License"); you may 3 | not use this file except in compliance with the License. You may obtain 4 | a copy of the License at 5 | 6 | http://www.apache.org/licenses/LICENSE-2.0 7 | 8 | Unless required by applicable law or agreed to in writing, software 9 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 10 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 11 | License for the specific language governing permissions and limitations 12 | under the License. 13 | 14 | 15 | Convention for heading levels in Neutron devref: 16 | ======= Heading 0 (reserved for the title in a document) 17 | ------- Heading 1 18 | ~~~~~~~ Heading 2 19 | +++++++ Heading 3 20 | ''''''' Heading 4 21 | (Avoid deeper levels because they do not render well.) 22 | 23 | neutronclient Python API 24 | ======================== 25 | 26 | Basic Usage 27 | ----------- 28 | 29 | First create a client instance using a keystoneauth Session. For more 30 | information on this keystoneauth API, see `Using Sessions`_. 31 | 32 | .. _Using Sessions: https://docs.openstack.org/keystoneauth/latest/using-sessions.html 33 | 34 | .. code-block:: python 35 | 36 | from keystoneauth1 import identity 37 | from keystoneauth1 import session 38 | from neutronclient.v2_0 import client 39 | username='username' 40 | password='password' 41 | project_name='demo' 42 | project_domain_id='default' 43 | user_domain_id='default' 44 | auth_url='http://auth.example.com:5000/v3' 45 | auth = identity.Password(auth_url=auth_url, 46 | username=username, 47 | password=password, 48 | project_name=project_name, 49 | project_domain_id=project_domain_id, 50 | user_domain_id=user_domain_id) 51 | sess = session.Session(auth=auth) 52 | neutron = client.Client(session=sess) 53 | 54 | If you are using Identity v2.0 API (DEPRECATED), create an auth plugin using 55 | the appropriate parameters and `keystoneauth1.identity` will handle Identity 56 | API version discovery. Then you can create a Session and a Neutronclient just 57 | like the previous example. 58 | 59 | .. code-block:: python 60 | 61 | auth = identity.Password(auth_url=auth_url, 62 | username=username, 63 | password=password, 64 | project_name=project_name) 65 | # create a Session and a Neutronclient 66 | 67 | Now you can call various methods on the client instance. 68 | 69 | .. code-block:: python 70 | 71 | network = {'name': 'mynetwork', 'admin_state_up': True} 72 | neutron.create_network({'network':network}) 73 | networks = neutron.list_networks(name='mynetwork') 74 | print networks 75 | network_id = networks['networks'][0]['id'] 76 | neutron.delete_network(network_id) 77 | 78 | Alternatively, you can create a client instance using an auth token 79 | and a service endpoint URL directly. 80 | 81 | .. code-block:: python 82 | 83 | from neutronclient.v2_0 import client 84 | neutron = client.Client(endpoint_url='http://192.168.206.130:9696/', 85 | token='d3f9226f27774f338019aa2611112ef6') 86 | 87 | You can get ``X-Openstack-Request-Id`` as ``request_ids`` from the result. 88 | 89 | .. code-block:: python 90 | 91 | network = {'name': 'mynetwork', 'admin_state_up': True} 92 | neutron.create_network({'network':network}) 93 | networks = neutron.list_networks(name='mynetwork') 94 | print networks.request_ids 95 | # -> ['req-978a0160-7ab0-44f0-8a93-08e9a4e785fa'] 96 | -------------------------------------------------------------------------------- /neutronclient/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/__init__.py -------------------------------------------------------------------------------- /neutronclient/_i18n.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | import oslo_i18n 14 | 15 | 16 | DOMAIN = 'neutronclient' 17 | 18 | _translators = oslo_i18n.TranslatorFactory(domain=DOMAIN) 19 | 20 | # The translation function using the well-known name "_" 21 | _ = _translators.primary 22 | 23 | # The contextual translation function using the name "_C" 24 | _C = _translators.contextual_form 25 | 26 | # The plural translation function using the name "_P" 27 | _P = _translators.plural_form 28 | 29 | 30 | def get_available_languages(): 31 | return oslo_i18n.get_available_languages(DOMAIN) 32 | -------------------------------------------------------------------------------- /neutronclient/common/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/common/__init__.py -------------------------------------------------------------------------------- /neutronclient/common/clientmanager.py: -------------------------------------------------------------------------------- 1 | # Copyright 2012 OpenStack Foundation. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | """Manage access to the clients, including authenticating when needed. 18 | """ 19 | 20 | import debtcollector.renames 21 | 22 | from neutronclient import client 23 | from neutronclient.neutron import client as neutron_client 24 | 25 | 26 | class ClientCache(object): 27 | """Descriptor class for caching created client handles.""" 28 | 29 | def __init__(self, factory): 30 | self.factory = factory 31 | self._handle = None 32 | 33 | def __get__(self, instance, owner): 34 | # Tell the ClientManager to login to keystone 35 | if self._handle is None: 36 | self._handle = self.factory(instance) 37 | return self._handle 38 | 39 | 40 | class ClientManager(object): 41 | """Manages access to API clients, including authentication.""" 42 | neutron = ClientCache(neutron_client.make_client) 43 | # Provide support for old quantum commands (for example 44 | # in stable versions) 45 | quantum = neutron 46 | 47 | @debtcollector.renames.renamed_kwarg( 48 | 'tenant_id', 'project_id', replace=True) 49 | @debtcollector.renames.renamed_kwarg( 50 | 'tenant_name', 'project_name', replace=True) 51 | def __init__(self, token=None, url=None, 52 | auth_url=None, 53 | endpoint_type=None, 54 | project_name=None, 55 | project_id=None, 56 | username=None, 57 | user_id=None, 58 | password=None, 59 | region_name=None, 60 | api_version=None, 61 | auth_strategy=None, 62 | insecure=False, 63 | ca_cert=None, 64 | log_credentials=False, 65 | service_type=None, 66 | service_name=None, 67 | timeout=None, 68 | retries=0, 69 | raise_errors=True, 70 | session=None, 71 | auth=None, 72 | ): 73 | self._token = token 74 | self._url = url 75 | self._auth_url = auth_url 76 | self._service_type = service_type 77 | self._service_name = service_name 78 | self._endpoint_type = endpoint_type 79 | self._project_name = project_name 80 | self._project_id = project_id 81 | self._username = username 82 | self._user_id = user_id 83 | self._password = password 84 | self._region_name = region_name 85 | self._api_version = api_version 86 | self._service_catalog = None 87 | self._auth_strategy = auth_strategy 88 | self._insecure = insecure 89 | self._ca_cert = ca_cert 90 | self._log_credentials = log_credentials 91 | self._timeout = timeout 92 | self._retries = retries 93 | self._raise_errors = raise_errors 94 | self._session = session 95 | self._auth = auth 96 | return 97 | 98 | def initialize(self): 99 | if not self._url: 100 | httpclient = client.construct_http_client( 101 | username=self._username, 102 | user_id=self._user_id, 103 | project_name=self._project_name, 104 | project_id=self._project_id, 105 | password=self._password, 106 | region_name=self._region_name, 107 | auth_url=self._auth_url, 108 | service_type=self._service_type, 109 | service_name=self._service_name, 110 | endpoint_type=self._endpoint_type, 111 | insecure=self._insecure, 112 | ca_cert=self._ca_cert, 113 | timeout=self._timeout, 114 | session=self._session, 115 | auth=self._auth, 116 | log_credentials=self._log_credentials) 117 | httpclient.authenticate() 118 | # Populate other password flow attributes 119 | self._token = httpclient.auth_token 120 | self._url = httpclient.endpoint_url 121 | -------------------------------------------------------------------------------- /neutronclient/common/constants.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 OpenStack Foundation. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | # implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | 17 | TYPE_BOOL = "bool" 18 | TYPE_INT = "int" 19 | TYPE_LONG = "long" 20 | TYPE_FLOAT = "float" 21 | TYPE_LIST = "list" 22 | TYPE_DICT = "dict" 23 | 24 | PLURALS = {'networks': 'network', 25 | 'ports': 'port', 26 | 'subnets': 'subnet', 27 | 'subnetpools': 'subnetpool', 28 | 'dns_nameservers': 'dns_nameserver', 29 | 'host_routes': 'host_route', 30 | 'allocation_pools': 'allocation_pool', 31 | 'fixed_ips': 'fixed_ip', 32 | 'extensions': 'extension'} 33 | -------------------------------------------------------------------------------- /neutronclient/common/extension.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Rackspace Hosting Inc. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | from stevedore import extension 17 | 18 | from neutronclient.neutron import v2_0 as neutronV20 19 | 20 | 21 | def _discover_via_entry_points(): 22 | emgr = extension.ExtensionManager('neutronclient.extension', 23 | invoke_on_load=False) 24 | return ((ext.name, ext.plugin) for ext in emgr) 25 | 26 | 27 | class NeutronClientExtension(neutronV20.NeutronCommand): 28 | pagination_support = False 29 | _formatters = {} 30 | sorting_support = False 31 | 32 | 33 | class ClientExtensionShow(NeutronClientExtension, neutronV20.ShowCommand): 34 | def take_action(self, parsed_args): 35 | # NOTE(mdietz): Calls 'execute' to provide a consistent pattern 36 | # for any implementers adding extensions with 37 | # regard to any other extension verb. 38 | return self.execute(parsed_args) 39 | 40 | def execute(self, parsed_args): 41 | return super(ClientExtensionShow, self).take_action(parsed_args) 42 | 43 | 44 | class ClientExtensionList(NeutronClientExtension, neutronV20.ListCommand): 45 | def take_action(self, parsed_args): 46 | # NOTE(mdietz): Calls 'execute' to provide a consistent pattern 47 | # for any implementers adding extensions with 48 | # regard to any other extension verb. 49 | return self.execute(parsed_args) 50 | 51 | def execute(self, parsed_args): 52 | return super(ClientExtensionList, self).take_action(parsed_args) 53 | 54 | 55 | class ClientExtensionDelete(NeutronClientExtension, neutronV20.DeleteCommand): 56 | def take_action(self, parsed_args): 57 | # NOTE(mdietz): Calls 'execute' to provide a consistent pattern 58 | # for any implementers adding extensions with 59 | # regard to any other extension verb. 60 | return self.execute(parsed_args) 61 | 62 | def execute(self, parsed_args): 63 | return super(ClientExtensionDelete, self).take_action(parsed_args) 64 | 65 | 66 | class ClientExtensionCreate(NeutronClientExtension, neutronV20.CreateCommand): 67 | def take_action(self, parsed_args): 68 | # NOTE(mdietz): Calls 'execute' to provide a consistent pattern 69 | # for any implementers adding extensions with 70 | # regard to any other extension verb. 71 | return self.execute(parsed_args) 72 | 73 | def execute(self, parsed_args): 74 | return super(ClientExtensionCreate, self).take_action(parsed_args) 75 | 76 | 77 | class ClientExtensionUpdate(NeutronClientExtension, neutronV20.UpdateCommand): 78 | def take_action(self, parsed_args): 79 | # NOTE(mdietz): Calls 'execute' to provide a consistent pattern 80 | # for any implementers adding extensions with 81 | # regard to any other extension verb. 82 | return self.execute(parsed_args) 83 | 84 | def execute(self, parsed_args): 85 | return super(ClientExtensionUpdate, self).take_action(parsed_args) 86 | -------------------------------------------------------------------------------- /neutronclient/common/serializer.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 OpenStack Foundation. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | from oslo_serialization import jsonutils 17 | 18 | from neutronclient._i18n import _ 19 | from neutronclient.common import exceptions as exception 20 | 21 | 22 | class ActionDispatcher(object): 23 | """Maps method name to local methods through action name.""" 24 | 25 | def dispatch(self, *args, **kwargs): 26 | """Find and call local method.""" 27 | action = kwargs.pop('action', 'default') 28 | action_method = getattr(self, str(action), self.default) 29 | return action_method(*args, **kwargs) 30 | 31 | def default(self, data): 32 | raise NotImplementedError() 33 | 34 | 35 | class DictSerializer(ActionDispatcher): 36 | """Default request body serialization.""" 37 | 38 | def serialize(self, data, action='default'): 39 | return self.dispatch(data, action=action) 40 | 41 | def default(self, data): 42 | return "" 43 | 44 | 45 | class JSONDictSerializer(DictSerializer): 46 | """Default JSON request body serialization.""" 47 | 48 | def default(self, data): 49 | def sanitizer(obj): 50 | return str(obj) 51 | return jsonutils.dumps(data, default=sanitizer) 52 | 53 | 54 | class TextDeserializer(ActionDispatcher): 55 | """Default request body deserialization.""" 56 | 57 | def deserialize(self, datastring, action='default'): 58 | return self.dispatch(datastring, action=action) 59 | 60 | def default(self, datastring): 61 | return {} 62 | 63 | 64 | class JSONDeserializer(TextDeserializer): 65 | 66 | def _from_json(self, datastring): 67 | try: 68 | return jsonutils.loads(datastring) 69 | except ValueError: 70 | msg = _("Cannot understand JSON") 71 | raise exception.MalformedResponseBody(reason=msg) 72 | 73 | def default(self, datastring): 74 | return {'body': self._from_json(datastring)} 75 | 76 | 77 | # NOTE(maru): this class is duplicated from neutron.wsgi 78 | class Serializer(object): 79 | """Serializes and deserializes dictionaries to certain MIME types.""" 80 | 81 | def __init__(self, metadata=None): 82 | """Create a serializer based on the given WSGI environment. 83 | 84 | 'metadata' is an optional dict mapping MIME types to information 85 | needed to serialize a dictionary to that type. 86 | 87 | """ 88 | self.metadata = metadata or {} 89 | 90 | def _get_serialize_handler(self, content_type): 91 | handlers = { 92 | 'application/json': JSONDictSerializer(), 93 | } 94 | 95 | try: 96 | return handlers[content_type] 97 | except Exception: 98 | raise exception.InvalidContentType(content_type=content_type) 99 | 100 | def serialize(self, data): 101 | """Serialize a dictionary into the specified content type.""" 102 | return self._get_serialize_handler("application/json").serialize(data) 103 | 104 | def deserialize(self, datastring): 105 | """Deserialize a string to a dictionary. 106 | 107 | The string must be in the format of a supported MIME type. 108 | """ 109 | return self.get_deserialize_handler("application/json").deserialize( 110 | datastring) 111 | 112 | def get_deserialize_handler(self, content_type): 113 | handlers = { 114 | 'application/json': JSONDeserializer(), 115 | } 116 | 117 | try: 118 | return handlers[content_type] 119 | except Exception: 120 | raise exception.InvalidContentType(content_type=content_type) 121 | -------------------------------------------------------------------------------- /neutronclient/common/validators.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014 NEC Corporation 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | import netaddr 17 | 18 | from neutronclient._i18n import _ 19 | from neutronclient.common import exceptions 20 | 21 | 22 | def validate_int_range(parsed_args, attr_name, min_value=None, max_value=None): 23 | val = getattr(parsed_args, attr_name, None) 24 | if val is None: 25 | return 26 | try: 27 | if not isinstance(val, int): 28 | int_val = int(val, 0) 29 | else: 30 | int_val = val 31 | if ((min_value is None or min_value <= int_val) and 32 | (max_value is None or int_val <= max_value)): 33 | return 34 | except (ValueError, TypeError): 35 | pass 36 | 37 | if min_value is not None and max_value is not None: 38 | msg = (_('%(attr_name)s "%(val)s" should be an integer ' 39 | '[%(min)i:%(max)i].') % 40 | {'attr_name': attr_name.replace('_', '-'), 41 | 'val': val, 'min': min_value, 'max': max_value}) 42 | elif min_value is not None: 43 | msg = (_('%(attr_name)s "%(val)s" should be an integer ' 44 | 'greater than or equal to %(min)i.') % 45 | {'attr_name': attr_name.replace('_', '-'), 46 | 'val': val, 'min': min_value}) 47 | elif max_value is not None: 48 | msg = (_('%(attr_name)s "%(val)s" should be an integer ' 49 | 'smaller than or equal to %(max)i.') % 50 | {'attr_name': attr_name.replace('_', '-'), 51 | 'val': val, 'max': max_value}) 52 | else: 53 | msg = (_('%(attr_name)s "%(val)s" should be an integer.') % 54 | {'attr_name': attr_name.replace('_', '-'), 55 | 'val': val}) 56 | 57 | raise exceptions.CommandError(msg) 58 | 59 | 60 | def validate_ip_subnet(parsed_args, attr_name): 61 | val = getattr(parsed_args, attr_name) 62 | if not val: 63 | return 64 | try: 65 | netaddr.IPNetwork(val) 66 | except (netaddr.AddrFormatError, ValueError): 67 | raise exceptions.CommandError( 68 | (_('%(attr_name)s "%(val)s" is not a valid CIDR.') % 69 | {'attr_name': attr_name.replace('_', '-'), 'val': val})) 70 | -------------------------------------------------------------------------------- /neutronclient/neutron/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/neutron/__init__.py -------------------------------------------------------------------------------- /neutronclient/neutron/client.py: -------------------------------------------------------------------------------- 1 | # Copyright 2012 OpenStack Foundation. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | from neutronclient.common import utils 18 | 19 | 20 | API_NAME = 'network' 21 | API_VERSIONS = { 22 | '2.0': 'neutronclient.v2_0.client.Client', 23 | '2': 'neutronclient.v2_0.client.Client', 24 | } 25 | 26 | 27 | def make_client(instance): 28 | """Returns an neutron client.""" 29 | neutron_client = utils.get_client_class( 30 | API_NAME, 31 | instance._api_version, 32 | API_VERSIONS, 33 | ) 34 | instance.initialize() 35 | url = instance._url 36 | url = url.rstrip("/") 37 | client = neutron_client(username=instance._username, 38 | project_name=instance._project_name, 39 | password=instance._password, 40 | region_name=instance._region_name, 41 | auth_url=instance._auth_url, 42 | endpoint_url=url, 43 | endpoint_type=instance._endpoint_type, 44 | token=instance._token, 45 | auth_strategy=instance._auth_strategy, 46 | insecure=instance._insecure, 47 | ca_cert=instance._ca_cert, 48 | retries=instance._retries, 49 | raise_errors=instance._raise_errors, 50 | session=instance._session, 51 | auth=instance._auth) 52 | return client 53 | 54 | 55 | def Client(api_version, *args, **kwargs): 56 | """Return an neutron client. 57 | 58 | @param api_version: only 2.0 is supported now 59 | """ 60 | neutron_client = utils.get_client_class( 61 | API_NAME, 62 | api_version, 63 | API_VERSIONS, 64 | ) 65 | return neutron_client(*args, **kwargs) 66 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/address_scope.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Huawei Technologies India Pvt. Ltd.. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | from neutronclient._i18n import _ 18 | from neutronclient.common import utils 19 | from neutronclient.neutron import v2_0 as neutronV20 20 | 21 | 22 | class ListAddressScope(neutronV20.ListCommand): 23 | """List address scopes that belong to a given tenant.""" 24 | 25 | resource = 'address_scope' 26 | list_columns = ['id', 'name', 'ip_version'] 27 | pagination_support = True 28 | sorting_support = True 29 | 30 | 31 | class ShowAddressScope(neutronV20.ShowCommand): 32 | """Show information about an address scope.""" 33 | 34 | resource = 'address_scope' 35 | 36 | 37 | class CreateAddressScope(neutronV20.CreateCommand): 38 | """Create an address scope for a given tenant.""" 39 | 40 | resource = 'address_scope' 41 | 42 | def add_known_arguments(self, parser): 43 | parser.add_argument( 44 | '--shared', 45 | action='store_true', 46 | help=_('Set the address scope as shared.')) 47 | parser.add_argument( 48 | 'name', 49 | metavar='NAME', 50 | help=_('Specify the name of the address scope.')) 51 | parser.add_argument( 52 | 'ip_version', 53 | metavar='IP_VERSION', 54 | type=int, 55 | choices=[4, 6], 56 | help=_('Specify the address family of the address scope.')) 57 | 58 | def args2body(self, parsed_args): 59 | body = {'name': parsed_args.name, 60 | 'ip_version': parsed_args.ip_version} 61 | if parsed_args.shared: 62 | body['shared'] = True 63 | neutronV20.update_dict(parsed_args, body, ['tenant_id']) 64 | return {self.resource: body} 65 | 66 | 67 | class DeleteAddressScope(neutronV20.DeleteCommand): 68 | """Delete an address scope.""" 69 | 70 | resource = 'address_scope' 71 | 72 | 73 | class UpdateAddressScope(neutronV20.UpdateCommand): 74 | """Update an address scope.""" 75 | 76 | resource = 'address_scope' 77 | 78 | def add_known_arguments(self, parser): 79 | parser.add_argument('--name', 80 | help=_('Updated name of the address scope.')) 81 | utils.add_boolean_argument( 82 | parser, '--shared', 83 | help=_('Set sharing of address scope. ' 84 | '(True means shared)')) 85 | 86 | def args2body(self, parsed_args): 87 | body = {} 88 | neutronV20.update_dict(parsed_args, body, ['name', 'shared']) 89 | return {self.resource: body} 90 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/agent.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 OpenStack Foundation. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | from neutronclient._i18n import _ 18 | from neutronclient.neutron import v2_0 as neutronV20 19 | 20 | 21 | def _format_timestamp(component): 22 | try: 23 | return component['heartbeat_timestamp'].split(".", 2)[0] 24 | except (TypeError, KeyError): 25 | return '' 26 | 27 | 28 | class ListAgent(neutronV20.ListCommand): 29 | """List agents.""" 30 | 31 | resource = 'agent' 32 | list_columns = ['id', 'agent_type', 'host', 'availability_zone', 'alive', 33 | 'admin_state_up', 'binary'] 34 | _formatters = {'heartbeat_timestamp': _format_timestamp} 35 | sorting_support = True 36 | 37 | def extend_list(self, data, parsed_args): 38 | for agent in data: 39 | if 'alive' in agent: 40 | agent['alive'] = ":-)" if agent['alive'] else 'xxx' 41 | 42 | 43 | class ShowAgent(neutronV20.ShowCommand): 44 | """Show information of a given agent.""" 45 | 46 | resource = 'agent' 47 | allow_names = False 48 | json_indent = 5 49 | 50 | 51 | class DeleteAgent(neutronV20.DeleteCommand): 52 | """Delete a given agent.""" 53 | 54 | resource = 'agent' 55 | allow_names = False 56 | 57 | 58 | class UpdateAgent(neutronV20.UpdateCommand): 59 | """Updates the admin status and description for a specified agent.""" 60 | 61 | resource = 'agent' 62 | allow_names = False 63 | 64 | def add_known_arguments(self, parser): 65 | parser.add_argument( 66 | '--admin-state-down', 67 | dest='admin_state', 68 | action='store_false', 69 | help=_('Set admin state up of the agent to false.')) 70 | parser.add_argument( 71 | '--description', 72 | help=_('Description for the agent.')) 73 | 74 | def args2body(self, parsed_args): 75 | body = {'admin_state_up': parsed_args.admin_state} 76 | neutronV20.update_dict(parsed_args, body, 77 | ['description']) 78 | return {self.resource: body} 79 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/availability_zone.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | from neutronclient._i18n import _ 14 | from neutronclient.neutron import v2_0 as neutronv20 15 | 16 | 17 | def add_az_hint_argument(parser, resource): 18 | parser.add_argument( 19 | '--availability-zone-hint', metavar='AVAILABILITY_ZONE', 20 | action='append', dest='availability_zone_hints', 21 | help=_('Availability Zone for the %s ' 22 | '(requires availability zone extension, ' 23 | 'this option can be repeated).') % resource) 24 | 25 | 26 | def args2body_az_hint(parsed_args, resource): 27 | if parsed_args.availability_zone_hints: 28 | resource['availability_zone_hints'] = ( 29 | parsed_args.availability_zone_hints) 30 | 31 | 32 | class ListAvailabilityZone(neutronv20.ListCommand): 33 | """List availability zones.""" 34 | 35 | resource = 'availability_zone' 36 | list_columns = ['name', 'resource', 'state'] 37 | pagination_support = True 38 | sorting_support = True 39 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/bgp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/neutron/v2_0/bgp/__init__.py -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/contrib/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/neutron/v2_0/contrib/__init__.py -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/contrib/_fox_sockets.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Rackspace Hosting Inc. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | from neutronclient._i18n import _ 18 | from neutronclient.common import extension 19 | 20 | 21 | def _add_updatable_args(parser): 22 | parser.add_argument( 23 | 'name', 24 | help=_('Name of this fox socket.')) 25 | 26 | 27 | def _updatable_args2body(parsed_args, body, client): 28 | if parsed_args.name: 29 | body['name'] = parsed_args.name 30 | 31 | 32 | class FoxInSocket(extension.NeutronClientExtension): 33 | """Define required variables for resource operations.""" 34 | 35 | resource = 'fox_socket' 36 | resource_plural = '%ss' % resource 37 | object_path = '/%s' % resource_plural 38 | resource_path = '/%s/%%s' % resource_plural 39 | versions = ['2.0'] 40 | 41 | 42 | class FoxInSocketsList(extension.ClientExtensionList, FoxInSocket): 43 | """List fox sockets.""" 44 | 45 | shell_command = 'fox-sockets-list' 46 | list_columns = ['id', 'name'] 47 | pagination_support = True 48 | sorting_support = True 49 | 50 | 51 | class FoxInSocketsCreate(extension.ClientExtensionCreate, FoxInSocket): 52 | """Create a fox socket.""" 53 | 54 | shell_command = 'fox-sockets-create' 55 | list_columns = ['id', 'name'] 56 | 57 | def add_known_arguments(self, parser): 58 | _add_updatable_args(parser) 59 | 60 | def args2body(self, parsed_args): 61 | body = {} 62 | client = self.get_client() 63 | _updatable_args2body(parsed_args, body, client) 64 | return {'fox_socket': body} 65 | 66 | 67 | class FoxInSocketsUpdate(extension.ClientExtensionUpdate, FoxInSocket): 68 | """Update a fox socket.""" 69 | 70 | shell_command = 'fox-sockets-update' 71 | list_columns = ['id', 'name'] 72 | 73 | def add_known_arguments(self, parser): 74 | # _add_updatable_args(parser) 75 | parser.add_argument( 76 | '--name', 77 | help=_('Name of this fox socket.')) 78 | 79 | def args2body(self, parsed_args): 80 | body = {'name': parsed_args.name} 81 | return {'fox_socket': body} 82 | 83 | 84 | class FoxInSocketsDelete(extension.ClientExtensionDelete, FoxInSocket): 85 | """Delete a fox socket.""" 86 | 87 | shell_command = 'fox-sockets-delete' 88 | 89 | 90 | class FoxInSocketsShow(extension.ClientExtensionShow, FoxInSocket): 91 | """Show a fox socket.""" 92 | 93 | shell_command = 'fox-sockets-show' 94 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/dns.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 IBM 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | from neutronclient._i18n import _ 17 | 18 | 19 | def add_dns_argument_create(parser, resource, attribute): 20 | # Add dns_name and dns_domain support to network, port and floatingip 21 | # create 22 | argument = '--dns-%s' % attribute 23 | parser.add_argument( 24 | argument, 25 | help=_('Assign DNS %(attribute)s to the %(resource)s ' 26 | '(requires DNS integration ' 27 | 'extension)') % {'attribute': attribute, 'resource': resource}) 28 | 29 | 30 | def args2body_dns_create(parsed_args, resource, attribute): 31 | # Add dns_name and dns_domain support to network, port and floatingip 32 | # create 33 | destination = 'dns_%s' % attribute 34 | argument = getattr(parsed_args, destination) 35 | if argument: 36 | resource[destination] = argument 37 | 38 | 39 | def add_dns_argument_update(parser, resource, attribute): 40 | # Add dns_name and dns_domain support to network, port and floatingip 41 | # update 42 | argument = '--dns-%s' % attribute 43 | no_argument = '--no-dns-%s' % attribute 44 | dns_args = parser.add_mutually_exclusive_group() 45 | dns_args.add_argument( 46 | argument, 47 | help=_('Assign DNS %(attribute)s to the %(resource)s ' 48 | '(requires DNS integration ' 49 | 'extension.)') % {'attribute': attribute, 'resource': resource}) 50 | dns_args.add_argument( 51 | no_argument, action='store_true', 52 | help=_('Unassign DNS %(attribute)s from the %(resource)s ' 53 | '(requires DNS integration ' 54 | 'extension.)') % {'attribute': attribute, 'resource': resource}) 55 | 56 | 57 | def args2body_dns_update(parsed_args, resource, attribute): 58 | # Add dns_name and dns_domain support to network, port and floatingip 59 | # update 60 | destination = 'dns_%s' % attribute 61 | no_destination = 'no_dns_%s' % attribute 62 | argument = getattr(parsed_args, destination) 63 | no_argument = getattr(parsed_args, no_destination) 64 | if argument: 65 | resource[destination] = argument 66 | if no_argument: 67 | resource[destination] = "" 68 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/extension.py: -------------------------------------------------------------------------------- 1 | # Copyright 2012 OpenStack Foundation. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | from neutronclient.neutron import v2_0 as cmd_base 18 | 19 | 20 | class ListExt(cmd_base.ListCommand): 21 | """List all extensions.""" 22 | 23 | resource = 'extension' 24 | list_columns = ['alias', 'name'] 25 | 26 | 27 | class ShowExt(cmd_base.ShowCommand): 28 | """Show information of a given resource.""" 29 | 30 | resource = "extension" 31 | allow_names = False 32 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/flavor/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/neutron/v2_0/flavor/__init__.py -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/flavor/flavor_profile.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Hewlett-Packard Development Company, L.P. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | import argparse 17 | 18 | from neutronclient._i18n import _ 19 | from neutronclient.common import utils 20 | from neutronclient.neutron import v2_0 as neutronV20 21 | 22 | 23 | class ListFlavorProfile(neutronV20.ListCommand): 24 | """List Neutron service flavor profiles.""" 25 | 26 | resource = 'service_profile' 27 | list_columns = ['id', 'description', 'enabled', 'metainfo'] 28 | pagination_support = True 29 | sorting_support = True 30 | 31 | 32 | class ShowFlavorProfile(neutronV20.ShowCommand): 33 | """Show information about a given Neutron service flavor profile.""" 34 | 35 | resource = 'service_profile' 36 | 37 | 38 | class CreateFlavorProfile(neutronV20.CreateCommand): 39 | """Create a Neutron service flavor profile.""" 40 | 41 | resource = 'service_profile' 42 | 43 | def add_known_arguments(self, parser): 44 | parser.add_argument( 45 | '--description', 46 | help=_('Description for the flavor profile.')) 47 | parser.add_argument( 48 | '--driver', 49 | help=_('Python module path to driver.')) 50 | parser.add_argument( 51 | '--metainfo', 52 | help=_('Metainfo for the flavor profile.')) 53 | utils.add_boolean_argument( 54 | parser, 55 | '--enabled', 56 | default=argparse.SUPPRESS, 57 | help=_('Sets enabled flag.')) 58 | 59 | def args2body(self, parsed_args): 60 | body = {} 61 | neutronV20.update_dict(parsed_args, body, 62 | ['description', 'driver', 'enabled', 63 | 'metainfo']) 64 | return {self.resource: body} 65 | 66 | 67 | class DeleteFlavorProfile(neutronV20.DeleteCommand): 68 | """Delete a given Neutron service flavor profile.""" 69 | 70 | resource = 'service_profile' 71 | 72 | 73 | class UpdateFlavorProfile(neutronV20.UpdateCommand): 74 | """Update a given Neutron service flavor profile.""" 75 | 76 | resource = 'service_profile' 77 | 78 | def add_known_arguments(self, parser): 79 | parser.add_argument( 80 | '--description', 81 | help=_('Description for the flavor profile.')) 82 | parser.add_argument( 83 | '--driver', 84 | help=_('Python module path to driver.')) 85 | parser.add_argument( 86 | '--metainfo', 87 | help=_('Metainfo for the flavor profile.')) 88 | utils.add_boolean_argument( 89 | parser, 90 | '--enabled', 91 | default=argparse.SUPPRESS, 92 | help=_('Sets enabled flag.')) 93 | 94 | def args2body(self, parsed_args): 95 | body = {} 96 | neutronV20.update_dict(parsed_args, body, 97 | ['description', 'driver', 'enabled', 98 | 'metainfo']) 99 | return {self.resource: body} 100 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/fw/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/neutron/v2_0/fw/__init__.py -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/lb/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/neutron/v2_0/lb/__init__.py -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/lb/member.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Mirantis Inc. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | from neutronclient._i18n import _ 18 | from neutronclient.neutron import v2_0 as neutronV20 19 | 20 | 21 | class ListMember(neutronV20.ListCommand): 22 | """List members that belong to a given tenant.""" 23 | 24 | resource = 'member' 25 | list_columns = [ 26 | 'id', 'address', 'protocol_port', 'weight', 'admin_state_up', 'status' 27 | ] 28 | pagination_support = True 29 | sorting_support = True 30 | 31 | 32 | class ShowMember(neutronV20.ShowCommand): 33 | """Show information of a given member.""" 34 | 35 | resource = 'member' 36 | allow_names = False 37 | 38 | 39 | class CreateMember(neutronV20.CreateCommand): 40 | """Create a member.""" 41 | 42 | resource = 'member' 43 | 44 | def add_known_arguments(self, parser): 45 | parser.add_argument( 46 | '--admin-state-down', 47 | dest='admin_state', action='store_false', 48 | help=_('Set admin state up to false.')) 49 | parser.add_argument( 50 | '--weight', 51 | help=_('Weight of pool member in the pool (default:1, [0..256]).')) 52 | parser.add_argument( 53 | '--address', 54 | required=True, 55 | help=_('IP address of the pool member on the pool network.')) 56 | parser.add_argument( 57 | '--protocol-port', 58 | required=True, 59 | help=_('Port on which the pool member listens for requests or ' 60 | 'connections.')) 61 | parser.add_argument( 62 | 'pool_id', metavar='POOL', 63 | help=_('ID or name of the pool this vip belongs to.')) 64 | 65 | def args2body(self, parsed_args): 66 | _pool_id = neutronV20.find_resourceid_by_name_or_id( 67 | self.get_client(), 'pool', parsed_args.pool_id) 68 | body = {'pool_id': _pool_id, 69 | 'admin_state_up': parsed_args.admin_state} 70 | neutronV20.update_dict( 71 | parsed_args, 72 | body, 73 | ['address', 'protocol_port', 'weight', 'tenant_id'] 74 | ) 75 | return {self.resource: body} 76 | 77 | 78 | class UpdateMember(neutronV20.UpdateCommand): 79 | """Update a given member.""" 80 | 81 | resource = 'member' 82 | 83 | 84 | class DeleteMember(neutronV20.DeleteCommand): 85 | """Delete a given member.""" 86 | 87 | resource = 'member' 88 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/lb/pool.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Mirantis Inc. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | from neutronclient._i18n import _ 18 | from neutronclient.neutron import v2_0 as neutronV20 19 | 20 | 21 | def _format_provider(pool): 22 | return pool.get('provider') or 'N/A' 23 | 24 | 25 | class ListPool(neutronV20.ListCommand): 26 | """List pools that belong to a given tenant.""" 27 | 28 | resource = 'pool' 29 | list_columns = ['id', 'name', 'provider', 'lb_method', 'protocol', 30 | 'admin_state_up', 'status'] 31 | _formatters = {'provider': _format_provider} 32 | pagination_support = True 33 | sorting_support = True 34 | 35 | 36 | class ShowPool(neutronV20.ShowCommand): 37 | """Show information of a given pool.""" 38 | 39 | resource = 'pool' 40 | 41 | 42 | class CreatePool(neutronV20.CreateCommand): 43 | """Create a pool.""" 44 | 45 | resource = 'pool' 46 | 47 | def add_known_arguments(self, parser): 48 | parser.add_argument( 49 | '--admin-state-down', 50 | dest='admin_state', action='store_false', 51 | help=_('Set admin state up to false.')) 52 | parser.add_argument( 53 | '--description', 54 | help=_('Description of the pool.')) 55 | parser.add_argument( 56 | '--lb-method', 57 | required=True, 58 | choices=['ROUND_ROBIN', 'LEAST_CONNECTIONS', 'SOURCE_IP'], 59 | help=_('The algorithm used to distribute load between the members ' 60 | 'of the pool.')) 61 | parser.add_argument( 62 | '--name', 63 | required=True, 64 | help=_('The name of the pool.')) 65 | parser.add_argument( 66 | '--protocol', 67 | required=True, 68 | choices=['HTTP', 'HTTPS', 'TCP'], 69 | help=_('Protocol for balancing.')) 70 | parser.add_argument( 71 | '--subnet-id', metavar='SUBNET', 72 | required=True, 73 | help=_('The subnet on which the members of the pool will be ' 74 | 'located.')) 75 | parser.add_argument( 76 | '--provider', 77 | help=_('Provider name of the loadbalancer service.')) 78 | 79 | def args2body(self, parsed_args): 80 | _subnet_id = neutronV20.find_resourceid_by_name_or_id( 81 | self.get_client(), 'subnet', parsed_args.subnet_id) 82 | body = {'admin_state_up': parsed_args.admin_state, 83 | 'subnet_id': _subnet_id} 84 | neutronV20.update_dict(parsed_args, body, 85 | ['description', 'lb_method', 'name', 86 | 'protocol', 'tenant_id', 'provider']) 87 | return {self.resource: body} 88 | 89 | 90 | class UpdatePool(neutronV20.UpdateCommand): 91 | """Update a given pool.""" 92 | 93 | resource = 'pool' 94 | 95 | 96 | class DeletePool(neutronV20.DeleteCommand): 97 | """Delete a given pool.""" 98 | 99 | resource = 'pool' 100 | 101 | 102 | class RetrievePoolStats(neutronV20.ShowCommand): 103 | """Retrieve stats for a given pool.""" 104 | 105 | resource = 'pool' 106 | 107 | def take_action(self, parsed_args): 108 | neutron_client = self.get_client() 109 | pool_id = neutronV20.find_resourceid_by_name_or_id( 110 | self.get_client(), 'pool', parsed_args.id) 111 | params = {} 112 | if parsed_args.fields: 113 | params = {'fields': parsed_args.fields} 114 | 115 | data = neutron_client.retrieve_pool_stats(pool_id, **params) 116 | self.format_output_data(data) 117 | stats = data['stats'] 118 | if 'stats' in data: 119 | return zip(*sorted(stats.items())) 120 | else: 121 | return None 122 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/lb/v2/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/neutron/v2_0/lb/v2/__init__.py -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/lb/vip.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Mirantis Inc. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | from neutronclient._i18n import _ 18 | from neutronclient.neutron import v2_0 as neutronV20 19 | 20 | 21 | class ListVip(neutronV20.ListCommand): 22 | """List vips that belong to a given tenant.""" 23 | 24 | resource = 'vip' 25 | list_columns = ['id', 'name', 'algorithm', 'address', 'protocol', 26 | 'admin_state_up', 'status'] 27 | pagination_support = True 28 | sorting_support = True 29 | 30 | 31 | class ShowVip(neutronV20.ShowCommand): 32 | """Show information of a given vip.""" 33 | 34 | resource = 'vip' 35 | 36 | 37 | class CreateVip(neutronV20.CreateCommand): 38 | """Create a vip.""" 39 | 40 | resource = 'vip' 41 | 42 | def add_known_arguments(self, parser): 43 | parser.add_argument( 44 | 'pool_id', metavar='POOL', 45 | help=_('ID or name of the pool to which this vip belongs.')) 46 | parser.add_argument( 47 | '--address', 48 | help=_('IP address of the vip.')) 49 | parser.add_argument( 50 | '--admin-state-down', 51 | dest='admin_state', action='store_false', 52 | help=_('Set admin state up to false.')) 53 | parser.add_argument( 54 | '--connection-limit', 55 | help=_('The maximum number of connections per second allowed for ' 56 | 'the vip. Valid values: a positive integer or -1 ' 57 | 'for unlimited (default).')) 58 | parser.add_argument( 59 | '--description', 60 | help=_('Description of the vip to be created.')) 61 | parser.add_argument( 62 | '--name', 63 | required=True, 64 | help=_('Name of the vip to be created.')) 65 | parser.add_argument( 66 | '--protocol-port', 67 | required=True, 68 | help=_('TCP port on which to listen for client traffic that is ' 69 | 'associated with the vip address.')) 70 | parser.add_argument( 71 | '--protocol', 72 | required=True, choices=['TCP', 'HTTP', 'HTTPS'], 73 | help=_('Protocol for balancing.')) 74 | parser.add_argument( 75 | '--subnet-id', metavar='SUBNET', 76 | required=True, 77 | help=_('The subnet on which to allocate the vip address.')) 78 | 79 | def args2body(self, parsed_args): 80 | _pool_id = neutronV20.find_resourceid_by_name_or_id( 81 | self.get_client(), 'pool', parsed_args.pool_id) 82 | _subnet_id = neutronV20.find_resourceid_by_name_or_id( 83 | self.get_client(), 'subnet', parsed_args.subnet_id) 84 | 85 | body = {'pool_id': _pool_id, 86 | 'admin_state_up': parsed_args.admin_state, 87 | 'subnet_id': _subnet_id} 88 | neutronV20.update_dict(parsed_args, body, 89 | ['address', 'connection_limit', 'description', 90 | 'name', 'protocol_port', 'protocol', 91 | 'tenant_id']) 92 | return {self.resource: body} 93 | 94 | 95 | class UpdateVip(neutronV20.UpdateCommand): 96 | """Update a given vip.""" 97 | 98 | resource = 'vip' 99 | 100 | 101 | class DeleteVip(neutronV20.DeleteCommand): 102 | """Delete a given vip.""" 103 | 104 | resource = 'vip' 105 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/metering.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2013 eNovance SAS 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | from neutronclient._i18n import _ 16 | from neutronclient.common import utils 17 | from neutronclient.neutron import v2_0 as neutronv20 18 | 19 | 20 | class ListMeteringLabel(neutronv20.ListCommand): 21 | """List metering labels that belong to a given tenant.""" 22 | 23 | resource = 'metering_label' 24 | list_columns = ['id', 'name', 'description', 'shared'] 25 | pagination_support = True 26 | sorting_support = True 27 | 28 | 29 | class ShowMeteringLabel(neutronv20.ShowCommand): 30 | """Show information of a given metering label.""" 31 | 32 | resource = 'metering_label' 33 | allow_names = True 34 | 35 | 36 | class CreateMeteringLabel(neutronv20.CreateCommand): 37 | """Create a metering label for a given tenant.""" 38 | 39 | resource = 'metering_label' 40 | 41 | def add_known_arguments(self, parser): 42 | parser.add_argument( 43 | 'name', metavar='NAME', 44 | help=_('Name of the metering label to be created.')) 45 | parser.add_argument( 46 | '--description', 47 | help=_('Description of the metering label to be created.')) 48 | parser.add_argument( 49 | '--shared', 50 | action='store_true', 51 | help=_('Set the label as shared.')) 52 | 53 | def args2body(self, parsed_args): 54 | body = {'name': parsed_args.name} 55 | neutronv20.update_dict(parsed_args, body, 56 | ['tenant_id', 'description', 'shared']) 57 | return {'metering_label': body} 58 | 59 | 60 | class DeleteMeteringLabel(neutronv20.DeleteCommand): 61 | """Delete a given metering label.""" 62 | 63 | resource = 'metering_label' 64 | allow_names = True 65 | 66 | 67 | class ListMeteringLabelRule(neutronv20.ListCommand): 68 | """List metering labels that belong to a given label.""" 69 | 70 | resource = 'metering_label_rule' 71 | list_columns = ['id', 'excluded', 'direction', 'remote_ip_prefix'] 72 | pagination_support = True 73 | sorting_support = True 74 | 75 | 76 | class ShowMeteringLabelRule(neutronv20.ShowCommand): 77 | """Show information of a given metering label rule.""" 78 | 79 | resource = 'metering_label_rule' 80 | allow_names = False 81 | 82 | 83 | class CreateMeteringLabelRule(neutronv20.CreateCommand): 84 | """Create a metering label rule for a given label.""" 85 | 86 | resource = 'metering_label_rule' 87 | 88 | def add_known_arguments(self, parser): 89 | parser.add_argument( 90 | 'label_id', metavar='LABEL', 91 | help=_('ID or name of the label.')) 92 | parser.add_argument( 93 | 'remote_ip_prefix', metavar='REMOTE_IP_PREFIX', 94 | help=_('CIDR to match on.')) 95 | parser.add_argument( 96 | '--direction', 97 | default='ingress', choices=['ingress', 'egress'], 98 | type=utils.convert_to_lowercase, 99 | help=_('Direction of traffic, default: ingress.')) 100 | parser.add_argument( 101 | '--excluded', 102 | action='store_true', 103 | help=_('Exclude this CIDR from the label, default: not excluded.')) 104 | 105 | def args2body(self, parsed_args): 106 | neutron_client = self.get_client() 107 | label_id = neutronv20.find_resourceid_by_name_or_id( 108 | neutron_client, 'metering_label', parsed_args.label_id) 109 | 110 | body = {'metering_label_id': label_id, 111 | 'remote_ip_prefix': parsed_args.remote_ip_prefix} 112 | neutronv20.update_dict(parsed_args, body, 113 | ['direction', 'excluded']) 114 | return {'metering_label_rule': body} 115 | 116 | 117 | class DeleteMeteringLabelRule(neutronv20.DeleteCommand): 118 | """Delete a given metering label.""" 119 | 120 | resource = 'metering_label_rule' 121 | allow_names = False 122 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/network_ip_availability.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | # 13 | 14 | from cliff import show 15 | 16 | from neutronclient._i18n import _ 17 | from neutronclient.neutron import v2_0 as neutronV20 18 | 19 | 20 | class ListIpAvailability(neutronV20.ListCommand): 21 | """List IP usage of networks""" 22 | 23 | resource = 'network_ip_availability' 24 | resource_plural = 'network_ip_availabilities' 25 | list_columns = ['network_id', 'network_name', 'total_ips', 'used_ips'] 26 | paginations_support = True 27 | sorting_support = True 28 | 29 | filter_attrs = [ 30 | {'name': 'ip_version', 31 | 'help': _('Returns IP availability for the network subnets ' 32 | 'with a given IP version. Default: 4'), 33 | 'argparse_kwargs': {'type': int, 34 | 'choices': [4, 6], 35 | 'default': 4} 36 | }, 37 | {'name': 'network_id', 38 | 'help': _('Returns IP availability for the network ' 39 | 'matching a given network ID.')}, 40 | {'name': 'network_name', 41 | 'help': _('Returns IP availability for the network ' 42 | 'matching a given name.')}, 43 | {'name': 'tenant_id', 44 | 'help': _('Returns IP availability for the networks ' 45 | 'with a given tenant ID.')}, 46 | ] 47 | 48 | 49 | class ShowIpAvailability(neutronV20.NeutronCommand, show.ShowOne): 50 | """Show IP usage of specific network""" 51 | 52 | resource = 'network_ip_availability' 53 | 54 | def get_parser(self, prog_name): 55 | parser = super(ShowIpAvailability, self).get_parser(prog_name) 56 | parser.add_argument( 57 | 'network_id', metavar='NETWORK', 58 | help=_('ID or name of network to look up.')) 59 | return parser 60 | 61 | def take_action(self, parsed_args): 62 | self.log.debug('run(%s)', parsed_args) 63 | neutron_client = self.get_client() 64 | _id = neutronV20.find_resourceid_by_name_or_id( 65 | neutron_client, 'network', parsed_args.network_id) 66 | data = neutron_client.show_network_ip_availability(_id) 67 | self.format_output_data(data) 68 | resource = data[self.resource] 69 | if self.resource in data: 70 | return zip(*sorted(resource.items())) 71 | else: 72 | return None 73 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/qos/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/neutron/v2_0/qos/__init__.py -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/qos/bandwidth_limit_rule.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Huawei Technologies India Pvt Ltd, Inc. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | 18 | from neutronclient._i18n import _ 19 | from neutronclient.common import exceptions 20 | from neutronclient.neutron import v2_0 as neutronv20 21 | from neutronclient.neutron.v2_0.qos import rule as qos_rule 22 | 23 | 24 | BANDWIDTH_LIMIT_RULE_RESOURCE = 'bandwidth_limit_rule' 25 | 26 | 27 | def add_bandwidth_limit_arguments(parser): 28 | parser.add_argument( 29 | '--max-kbps', 30 | help=_('Maximum bandwidth in kbps.')) 31 | parser.add_argument( 32 | '--max-burst-kbps', 33 | help=_('Maximum burst bandwidth in kbps.')) 34 | 35 | 36 | def update_bandwidth_limit_args2body(parsed_args, body): 37 | max_kbps = parsed_args.max_kbps 38 | max_burst_kbps = parsed_args.max_burst_kbps 39 | if not (max_kbps or max_burst_kbps): 40 | raise exceptions.CommandError(_("Must provide max-kbps" 41 | " or max-burst-kbps option.")) 42 | neutronv20.update_dict(parsed_args, body, 43 | ['max_kbps', 'max_burst_kbps', 'tenant_id']) 44 | 45 | 46 | class CreateQoSBandwidthLimitRule(qos_rule.QosRuleMixin, 47 | neutronv20.CreateCommand): 48 | """Create a qos bandwidth limit rule.""" 49 | 50 | resource = BANDWIDTH_LIMIT_RULE_RESOURCE 51 | 52 | def add_known_arguments(self, parser): 53 | super(CreateQoSBandwidthLimitRule, self).add_known_arguments(parser) 54 | add_bandwidth_limit_arguments(parser) 55 | 56 | def args2body(self, parsed_args): 57 | body = {} 58 | update_bandwidth_limit_args2body(parsed_args, body) 59 | return {self.resource: body} 60 | 61 | 62 | class ListQoSBandwidthLimitRules(qos_rule.QosRuleMixin, 63 | neutronv20.ListCommand): 64 | """List all qos bandwidth limit rules belonging to the specified policy.""" 65 | 66 | resource = BANDWIDTH_LIMIT_RULE_RESOURCE 67 | _formatters = {} 68 | pagination_support = True 69 | sorting_support = True 70 | 71 | 72 | class ShowQoSBandwidthLimitRule(qos_rule.QosRuleMixin, neutronv20.ShowCommand): 73 | """Show information about the given qos bandwidth limit rule.""" 74 | 75 | resource = BANDWIDTH_LIMIT_RULE_RESOURCE 76 | allow_names = False 77 | 78 | 79 | class UpdateQoSBandwidthLimitRule(qos_rule.QosRuleMixin, 80 | neutronv20.UpdateCommand): 81 | """Update the given qos bandwidth limit rule.""" 82 | 83 | resource = BANDWIDTH_LIMIT_RULE_RESOURCE 84 | allow_names = False 85 | 86 | def add_known_arguments(self, parser): 87 | super(UpdateQoSBandwidthLimitRule, self).add_known_arguments(parser) 88 | add_bandwidth_limit_arguments(parser) 89 | 90 | def args2body(self, parsed_args): 91 | body = {} 92 | update_bandwidth_limit_args2body(parsed_args, body) 93 | return {self.resource: body} 94 | 95 | 96 | class DeleteQoSBandwidthLimitRule(qos_rule.QosRuleMixin, 97 | neutronv20.DeleteCommand): 98 | """Delete a given qos bandwidth limit rule.""" 99 | 100 | resource = BANDWIDTH_LIMIT_RULE_RESOURCE 101 | allow_names = False 102 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/qos/dscp_marking_rule.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Comcast, Inc. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | from neutronclient._i18n import _ 18 | from neutronclient.common import exceptions 19 | from neutronclient.neutron import v2_0 as neutronv20 20 | from neutronclient.neutron.v2_0.qos import rule as qos_rule 21 | 22 | 23 | DSCP_MARKING_RESOURCE = 'dscp_marking_rule' 24 | # DSCP DETAILS 25 | # 0 - none | 8 - cs1 | 10 - af11 | 12 - af12 | 14 - af13 | 26 | # 16 - cs2 | 18 - af21 | 20 - af22 | 22 - af23 | 24 - cs3 | 27 | # 26 - af31 | 28 - af32 | 30 - af33 | 32 - cs4 | 34 - af41 | 28 | # 36 - af42 | 38 - af43 | 40 - cs5 | 46 - ef | 48 - cs6 | 29 | # 56 - cs7 30 | 31 | DSCP_VALID_MARKS = [0, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 32 | 34, 36, 38, 40, 46, 48, 56] 33 | 34 | 35 | def add_dscp_marking_arguments(parser): 36 | parser.add_argument( 37 | '--dscp-mark', 38 | required=True, 39 | type=str, 40 | help=_('DSCP mark: value can be 0, even numbers from 8-56, \ 41 | excluding 42, 44, 50, 52, and 54.')) 42 | 43 | 44 | def update_dscp_args2body(parsed_args, body): 45 | dscp_mark = parsed_args.dscp_mark 46 | if int(dscp_mark) not in DSCP_VALID_MARKS: 47 | raise exceptions.CommandError(_("DSCP mark: %s not supported. " 48 | "Please note value can either be 0 " 49 | "or any even number from 8-56 " 50 | "excluding 42, 44, 50, 52 and " 51 | "54.") % dscp_mark) 52 | neutronv20.update_dict(parsed_args, body, 53 | ['dscp_mark']) 54 | 55 | 56 | class CreateQoSDscpMarkingRule(qos_rule.QosRuleMixin, 57 | neutronv20.CreateCommand): 58 | """Create a QoS DSCP marking rule.""" 59 | 60 | resource = DSCP_MARKING_RESOURCE 61 | 62 | def add_known_arguments(self, parser): 63 | super(CreateQoSDscpMarkingRule, self).add_known_arguments(parser) 64 | add_dscp_marking_arguments(parser) 65 | 66 | def args2body(self, parsed_args): 67 | body = {} 68 | update_dscp_args2body(parsed_args, body) 69 | return {self.resource: body} 70 | 71 | 72 | class ListQoSDscpMarkingRules(qos_rule.QosRuleMixin, 73 | neutronv20.ListCommand): 74 | """List all QoS DSCP marking rules belonging to the specified policy.""" 75 | 76 | _formatters = {} 77 | pagination_support = True 78 | sorting_support = True 79 | resource = DSCP_MARKING_RESOURCE 80 | 81 | 82 | class ShowQoSDscpMarkingRule(qos_rule.QosRuleMixin, 83 | neutronv20.ShowCommand): 84 | """Show information about the given qos dscp marking rule.""" 85 | 86 | resource = DSCP_MARKING_RESOURCE 87 | allow_names = False 88 | 89 | 90 | class UpdateQoSDscpMarkingRule(qos_rule.QosRuleMixin, 91 | neutronv20.UpdateCommand): 92 | """Update the given QoS DSCP marking rule.""" 93 | 94 | allow_names = False 95 | resource = DSCP_MARKING_RESOURCE 96 | 97 | def add_known_arguments(self, parser): 98 | super(UpdateQoSDscpMarkingRule, self).add_known_arguments(parser) 99 | add_dscp_marking_arguments(parser) 100 | 101 | def args2body(self, parsed_args): 102 | body = {} 103 | update_dscp_args2body(parsed_args, body) 104 | return {self.resource: body} 105 | 106 | 107 | class DeleteQoSDscpMarkingRule(qos_rule.QosRuleMixin, 108 | neutronv20.DeleteCommand): 109 | """Delete a given qos dscp marking rule.""" 110 | 111 | allow_names = False 112 | resource = DSCP_MARKING_RESOURCE 113 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/qos/minimum_bandwidth_rule.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 Intel Corporation. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | from neutronclient._i18n import _ 18 | from neutronclient.common import utils 19 | from neutronclient.neutron import v2_0 as neutronv20 20 | from neutronclient.neutron.v2_0.qos import rule as qos_rule 21 | 22 | 23 | MINIMUM_BANDWIDTH_RULE_RESOURCE = 'minimum_bandwidth_rule' 24 | 25 | 26 | def add_minimum_bandwidth_arguments(parser): 27 | parser.add_argument( 28 | '--min-kbps', 29 | required=True, 30 | type=str, 31 | help=_('QoS minimum bandwidth assurance, expressed in kilobits ' 32 | 'per second.')) 33 | # NOTE(ralonsoh): the only direction implemented is "egress". Please, 34 | # refer to the spec (https://review.opendev.org/#/c/316082/). 35 | parser.add_argument( 36 | '--direction', 37 | # NOTE(ihrachys): though server picks the default for us (egress), it's 38 | # better to require the argument to make the UI more explicit and the 39 | # intentions more clear in the future when we add other values for the 40 | # attribute on server side. 41 | required=True, 42 | type=utils.convert_to_lowercase, 43 | choices=['egress'], 44 | help=_('Traffic direction.')) 45 | 46 | 47 | def update_minimum_bandwidth_args2body(parsed_args, body): 48 | neutronv20.update_dict(parsed_args, body, ['min_kbps', 'direction']) 49 | 50 | 51 | class CreateQoSMinimumBandwidthRule(qos_rule.QosRuleMixin, 52 | neutronv20.CreateCommand): 53 | """Create a qos minimum bandwidth rule.""" 54 | 55 | resource = MINIMUM_BANDWIDTH_RULE_RESOURCE 56 | 57 | def add_known_arguments(self, parser): 58 | super(CreateQoSMinimumBandwidthRule, self).add_known_arguments( 59 | parser) 60 | add_minimum_bandwidth_arguments(parser) 61 | 62 | def args2body(self, parsed_args): 63 | body = {} 64 | update_minimum_bandwidth_args2body(parsed_args, body) 65 | return {self.resource: body} 66 | 67 | 68 | class ListQoSMinimumBandwidthRules(qos_rule.QosRuleMixin, 69 | neutronv20.ListCommand): 70 | """List all qos minimum bandwidth rules belonging to the specified policy. 71 | 72 | """ 73 | 74 | resource = MINIMUM_BANDWIDTH_RULE_RESOURCE 75 | _formatters = {} 76 | pagination_support = True 77 | sorting_support = True 78 | 79 | 80 | class ShowQoSMinimumBandwidthRule(qos_rule.QosRuleMixin, 81 | neutronv20.ShowCommand): 82 | """Show information about the given qos minimum bandwidth rule.""" 83 | 84 | resource = MINIMUM_BANDWIDTH_RULE_RESOURCE 85 | allow_names = False 86 | 87 | 88 | class UpdateQoSMinimumBandwidthRule(qos_rule.QosRuleMixin, 89 | neutronv20.UpdateCommand): 90 | """Update the given qos minimum bandwidth rule.""" 91 | 92 | resource = MINIMUM_BANDWIDTH_RULE_RESOURCE 93 | allow_names = False 94 | 95 | def add_known_arguments(self, parser): 96 | super(UpdateQoSMinimumBandwidthRule, self).add_known_arguments( 97 | parser) 98 | add_minimum_bandwidth_arguments(parser) 99 | 100 | def args2body(self, parsed_args): 101 | body = {} 102 | update_minimum_bandwidth_args2body(parsed_args, body) 103 | return {self.resource: body} 104 | 105 | 106 | class DeleteQoSMinimumBandwidthRule(qos_rule.QosRuleMixin, 107 | neutronv20.DeleteCommand): 108 | """Delete a given qos minimum bandwidth rule.""" 109 | 110 | resource = MINIMUM_BANDWIDTH_RULE_RESOURCE 111 | allow_names = False 112 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/qos/rule.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Huawei Technologies India Pvt Ltd, Inc. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | 18 | from neutronclient._i18n import _ 19 | from neutronclient.neutron import v2_0 as neutronv20 20 | from neutronclient.neutron.v2_0.qos import policy as qos_policy 21 | 22 | 23 | def add_policy_argument(parser): 24 | parser.add_argument( 25 | 'policy', metavar='QOS_POLICY', 26 | help=_('ID or name of the QoS policy.')) 27 | 28 | 29 | def add_rule_argument(parser): 30 | parser.add_argument( 31 | 'rule', metavar='QOS_RULE', 32 | help=_('ID of the QoS rule.')) 33 | 34 | 35 | def update_policy_args2body(parsed_args, body): 36 | neutronv20.update_dict(parsed_args, body, ['policy']) 37 | 38 | 39 | def update_rule_args2body(parsed_args, body): 40 | neutronv20.update_dict(parsed_args, body, ['rule']) 41 | 42 | 43 | class QosRuleMixin(object): 44 | def add_known_arguments(self, parser): 45 | add_policy_argument(parser) 46 | 47 | def set_extra_attrs(self, parsed_args): 48 | self.parent_id = qos_policy.get_qos_policy_id(self.get_client(), 49 | parsed_args.policy) 50 | 51 | def args2body(self, parsed_args): 52 | body = {} 53 | update_policy_args2body(parsed_args, body) 54 | return {'qos_rule': body} 55 | 56 | 57 | class ListQoSRuleTypes(neutronv20.ListCommand): 58 | """List available qos rule types.""" 59 | 60 | resource = 'rule_type' 61 | shadow_resource = 'qos_rule_type' 62 | pagination_support = True 63 | sorting_support = True 64 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/rbac.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Huawei Technologies India Pvt Ltd. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | from neutronclient._i18n import _ 17 | from neutronclient.common import utils 18 | from neutronclient.neutron import v2_0 as neutronV20 19 | 20 | # key=object_type: value={key=resource, value=cmd_resource} 21 | RBAC_OBJECTS = {'network': {'network': 'network'}, 22 | 'qos-policy': {'policy': 'qos_policy'}} 23 | 24 | 25 | def _get_cmd_resource(obj_type): 26 | resource = list(RBAC_OBJECTS[obj_type])[0] 27 | cmd_resource = RBAC_OBJECTS[obj_type][resource] 28 | return resource, cmd_resource 29 | 30 | 31 | def get_rbac_obj_params(client, obj_type, obj_id_or_name): 32 | resource, cmd_resource = _get_cmd_resource(obj_type) 33 | obj_id = neutronV20.find_resourceid_by_name_or_id( 34 | client=client, resource=resource, name_or_id=obj_id_or_name, 35 | cmd_resource=cmd_resource) 36 | 37 | return obj_id, cmd_resource 38 | 39 | 40 | class ListRBACPolicy(neutronV20.ListCommand): 41 | """List RBAC policies that belong to a given tenant.""" 42 | 43 | resource = 'rbac_policy' 44 | list_columns = ['id', 'object_type', 'object_id'] 45 | pagination_support = True 46 | sorting_support = True 47 | allow_names = False 48 | 49 | 50 | class ShowRBACPolicy(neutronV20.ShowCommand): 51 | """Show information of a given RBAC policy.""" 52 | 53 | resource = 'rbac_policy' 54 | allow_names = False 55 | 56 | 57 | class CreateRBACPolicy(neutronV20.CreateCommand): 58 | """Create a RBAC policy for a given tenant.""" 59 | 60 | resource = 'rbac_policy' 61 | 62 | def add_known_arguments(self, parser): 63 | parser.add_argument( 64 | 'name', 65 | metavar='RBAC_OBJECT', 66 | help=_('ID or name of the RBAC object.')) 67 | parser.add_argument( 68 | '--type', choices=RBAC_OBJECTS.keys(), 69 | required=True, 70 | type=utils.convert_to_lowercase, 71 | help=_('Type of the object that RBAC policy affects.')) 72 | parser.add_argument( 73 | '--target-tenant', 74 | default='*', 75 | help=_('ID of the tenant to which the RBAC ' 76 | 'policy will be enforced.')) 77 | parser.add_argument( 78 | '--action', choices=['access_as_external', 'access_as_shared'], 79 | type=utils.convert_to_lowercase, 80 | required=True, 81 | help=_('Action for the RBAC policy.')) 82 | 83 | def args2body(self, parsed_args): 84 | neutron_client = self.get_client() 85 | _object_id, _object_type = get_rbac_obj_params(neutron_client, 86 | parsed_args.type, 87 | parsed_args.name) 88 | body = { 89 | 'object_id': _object_id, 90 | 'object_type': _object_type, 91 | 'target_tenant': parsed_args.target_tenant, 92 | 'action': parsed_args.action, 93 | } 94 | return {self.resource: body} 95 | 96 | 97 | class UpdateRBACPolicy(neutronV20.UpdateCommand): 98 | """Update RBAC policy for given tenant.""" 99 | 100 | resource = 'rbac_policy' 101 | allow_names = False 102 | 103 | def add_known_arguments(self, parser): 104 | parser.add_argument( 105 | '--target-tenant', 106 | help=_('ID of the tenant to which the RBAC ' 107 | 'policy will be enforced.')) 108 | 109 | def args2body(self, parsed_args): 110 | body = {'target_tenant': parsed_args.target_tenant} 111 | return {self.resource: body} 112 | 113 | 114 | class DeleteRBACPolicy(neutronV20.DeleteCommand): 115 | """Delete a RBAC policy.""" 116 | 117 | resource = 'rbac_policy' 118 | allow_names = False 119 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/servicetype.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 OpenStack Foundation. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | from neutronclient.neutron import v2_0 as neutronV20 18 | 19 | 20 | class ListServiceProvider(neutronV20.ListCommand): 21 | """List service providers.""" 22 | 23 | resource = 'service_provider' 24 | list_columns = ['service_type', 'name', 'default'] 25 | _formatters = {} 26 | pagination_support = True 27 | sorting_support = True 28 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/tag.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | from neutronclient._i18n import _ 14 | from neutronclient.common import exceptions 15 | from neutronclient.neutron import v2_0 as neutronv20 16 | 17 | 18 | # List of resources can be set tag 19 | TAG_RESOURCES = ['network', 'subnet', 'port', 'router', 'subnetpool'] 20 | 21 | 22 | def _convert_resource_args(client, parsed_args): 23 | resource_type = client.get_resource_plural(parsed_args.resource_type) 24 | resource_id = neutronv20.find_resourceid_by_name_or_id( 25 | client, parsed_args.resource_type, parsed_args.resource) 26 | return resource_type, resource_id 27 | 28 | 29 | def _add_common_arguments(parser): 30 | parser.add_argument('--resource-type', 31 | choices=TAG_RESOURCES, 32 | dest='resource_type', 33 | required=True, 34 | help=_('Resource Type.')) 35 | parser.add_argument('--resource', 36 | required=True, 37 | help=_('Resource name or ID.')) 38 | 39 | 40 | class AddTag(neutronv20.NeutronCommand): 41 | """Add a tag into the resource.""" 42 | 43 | def get_parser(self, prog_name): 44 | parser = super(AddTag, self).get_parser(prog_name) 45 | _add_common_arguments(parser) 46 | parser.add_argument('--tag', 47 | required=True, 48 | help=_('Tag to be added.')) 49 | return parser 50 | 51 | def take_action(self, parsed_args): 52 | client = self.get_client() 53 | if not parsed_args.tag: 54 | raise exceptions.CommandError( 55 | _('Cannot add an empty value as tag')) 56 | resource_type, resource_id = _convert_resource_args(client, 57 | parsed_args) 58 | client.add_tag(resource_type, resource_id, parsed_args.tag) 59 | 60 | 61 | class ReplaceTag(neutronv20.NeutronCommand): 62 | """Replace all tags on the resource.""" 63 | 64 | def get_parser(self, prog_name): 65 | parser = super(ReplaceTag, self).get_parser(prog_name) 66 | _add_common_arguments(parser) 67 | parser.add_argument('--tag', 68 | metavar='TAG', 69 | action='append', 70 | dest='tags', 71 | required=True, 72 | help=_('Tag (This option can be repeated).')) 73 | return parser 74 | 75 | def take_action(self, parsed_args): 76 | client = self.get_client() 77 | resource_type, resource_id = _convert_resource_args(client, 78 | parsed_args) 79 | body = {'tags': parsed_args.tags} 80 | client.replace_tag(resource_type, resource_id, body) 81 | 82 | 83 | class RemoveTag(neutronv20.NeutronCommand): 84 | """Remove a tag on the resource.""" 85 | 86 | def get_parser(self, prog_name): 87 | parser = super(RemoveTag, self).get_parser(prog_name) 88 | _add_common_arguments(parser) 89 | tag_opt = parser.add_mutually_exclusive_group() 90 | tag_opt.add_argument('--all', 91 | action='store_true', 92 | help=_('Remove all tags on the resource.')) 93 | tag_opt.add_argument('--tag', 94 | help=_('Tag to be removed.')) 95 | return parser 96 | 97 | def take_action(self, parsed_args): 98 | if not parsed_args.all and not parsed_args.tag: 99 | raise exceptions.CommandError( 100 | _("--all or --tag must be specified")) 101 | client = self.get_client() 102 | resource_type, resource_id = _convert_resource_args(client, 103 | parsed_args) 104 | if parsed_args.all: 105 | client.remove_tag_all(resource_type, resource_id) 106 | else: 107 | client.remove_tag(resource_type, resource_id, parsed_args.tag) 108 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/vpn/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/neutron/v2_0/vpn/__init__.py -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/vpn/endpoint_group.py: -------------------------------------------------------------------------------- 1 | # (c) Copyright 2015 Cisco Systems, Inc. 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | from neutronclient._i18n import _ 18 | from neutronclient.neutron import v2_0 as neutronv20 19 | 20 | 21 | def add_known_endpoint_group_arguments(parser, is_create=True): 22 | parser.add_argument( 23 | '--name', 24 | help=_('Set a name for the endpoint group.')) 25 | parser.add_argument( 26 | '--description', 27 | help=_('Set a description for the endpoint group.')) 28 | if is_create: 29 | parser.add_argument( 30 | '--type', 31 | required=is_create, 32 | help=_('Type of endpoints in group (e.g. subnet, cidr, vlan).')) 33 | parser.add_argument( 34 | '--value', 35 | action='append', dest='endpoints', 36 | required=is_create, 37 | help=_('Endpoint(s) for the group. Must all be of the same type.')) 38 | 39 | 40 | class ListEndpointGroup(neutronv20.ListCommand): 41 | """List VPN endpoint groups that belong to a given tenant.""" 42 | 43 | resource = 'endpoint_group' 44 | list_columns = ['id', 'name', 'type', 'endpoints'] 45 | _formatters = {} 46 | pagination_support = True 47 | sorting_support = True 48 | 49 | 50 | class ShowEndpointGroup(neutronv20.ShowCommand): 51 | """Show a specific VPN endpoint group.""" 52 | 53 | resource = 'endpoint_group' 54 | 55 | 56 | class CreateEndpointGroup(neutronv20.CreateCommand): 57 | """Create a VPN endpoint group.""" 58 | resource = 'endpoint_group' 59 | 60 | def add_known_arguments(self, parser): 61 | add_known_endpoint_group_arguments(parser) 62 | 63 | def subnet_name2id(self, endpoint): 64 | return neutronv20.find_resourceid_by_name_or_id(self.get_client(), 65 | 'subnet', endpoint) 66 | 67 | def args2body(self, parsed_args): 68 | if parsed_args.type == 'subnet': 69 | endpoints = [self.subnet_name2id(ep) 70 | for ep in parsed_args.endpoints] 71 | else: 72 | endpoints = parsed_args.endpoints 73 | 74 | body = {'endpoints': endpoints} 75 | 76 | neutronv20.update_dict(parsed_args, body, 77 | ['name', 'description', 78 | 'tenant_id', 'type']) 79 | return {self.resource: body} 80 | 81 | 82 | class UpdateEndpointGroup(neutronv20.UpdateCommand): 83 | """Update a given VPN endpoint group.""" 84 | 85 | resource = 'endpoint_group' 86 | 87 | def add_known_arguments(self, parser): 88 | add_known_endpoint_group_arguments(parser, is_create=False) 89 | 90 | def args2body(self, parsed_args): 91 | body = {} 92 | neutronv20.update_dict(parsed_args, body, 93 | ['name', 'description']) 94 | return {self.resource: body} 95 | 96 | 97 | class DeleteEndpointGroup(neutronv20.DeleteCommand): 98 | """Delete a given VPN endpoint group.""" 99 | 100 | resource = 'endpoint_group' 101 | -------------------------------------------------------------------------------- /neutronclient/neutron/v2_0/vpn/vpnservice.py: -------------------------------------------------------------------------------- 1 | # (c) Copyright 2013 Hewlett-Packard Development Company, L.P. 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | from neutronclient._i18n import _ 18 | from neutronclient.common import utils 19 | from neutronclient.neutron import v2_0 as neutronv20 20 | 21 | 22 | def add_common_args(parser): 23 | parser.add_argument( 24 | '--name', 25 | help=_('Name for the VPN service.')) 26 | parser.add_argument( 27 | '--description', 28 | help=_('Description for the VPN service.')) 29 | 30 | 31 | def common_args2body(parsed_args, body): 32 | neutronv20.update_dict(parsed_args, body, 33 | ['name', 'description']) 34 | 35 | 36 | class ListVPNService(neutronv20.ListCommand): 37 | """List VPN service configurations that belong to a given tenant.""" 38 | 39 | resource = 'vpnservice' 40 | list_columns = [ 41 | 'id', 'name', 'router_id', 'status' 42 | ] 43 | _formatters = {} 44 | pagination_support = True 45 | sorting_support = True 46 | 47 | 48 | class ShowVPNService(neutronv20.ShowCommand): 49 | """Show information of a given VPN service.""" 50 | 51 | resource = 'vpnservice' 52 | help_resource = 'VPN service' 53 | 54 | 55 | class CreateVPNService(neutronv20.CreateCommand): 56 | """Create a VPN service.""" 57 | resource = 'vpnservice' 58 | 59 | def add_known_arguments(self, parser): 60 | parser.add_argument( 61 | '--admin-state-down', 62 | dest='admin_state', action='store_false', 63 | help=_('Set admin state up to false.')) 64 | parser.add_argument( 65 | 'router', metavar='ROUTER', 66 | help=_('Router unique identifier for the VPN service.')) 67 | parser.add_argument( 68 | 'subnet', nargs='?', metavar='SUBNET', 69 | help=_('[DEPRECATED in Mitaka] Unique identifier for the local ' 70 | 'private subnet.')) 71 | add_common_args(parser) 72 | 73 | def args2body(self, parsed_args): 74 | if parsed_args.subnet: 75 | _subnet_id = neutronv20.find_resourceid_by_name_or_id( 76 | self.get_client(), 'subnet', parsed_args.subnet) 77 | else: 78 | _subnet_id = None 79 | _router_id = neutronv20.find_resourceid_by_name_or_id( 80 | self.get_client(), 'router', 81 | parsed_args.router) 82 | 83 | body = {'subnet_id': _subnet_id, 84 | 'router_id': _router_id, 85 | 'admin_state_up': parsed_args.admin_state} 86 | neutronv20.update_dict(parsed_args, body, 87 | ['tenant_id']) 88 | common_args2body(parsed_args, body) 89 | return {self.resource: body} 90 | 91 | 92 | class UpdateVPNService(neutronv20.UpdateCommand): 93 | """Update a given VPN service.""" 94 | 95 | resource = 'vpnservice' 96 | help_resource = 'VPN service' 97 | 98 | def add_known_arguments(self, parser): 99 | add_common_args(parser) 100 | utils.add_boolean_argument( 101 | parser, '--admin-state-up', 102 | help=_('Update the admin state for the VPN Service.' 103 | '(True means UP)')) 104 | 105 | def args2body(self, parsed_args): 106 | body = {} 107 | common_args2body(parsed_args, body) 108 | neutronv20.update_dict(parsed_args, body, 109 | ['admin_state_up']) 110 | return {self.resource: body} 111 | 112 | 113 | class DeleteVPNService(neutronv20.DeleteCommand): 114 | """Delete a given VPN service.""" 115 | 116 | resource = 'vpnservice' 117 | help_resource = 'VPN service' 118 | -------------------------------------------------------------------------------- /neutronclient/osc/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/osc/__init__.py -------------------------------------------------------------------------------- /neutronclient/osc/plugin.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | # 13 | 14 | """OpenStackClient plugin for advanced Networking service.""" 15 | 16 | import logging 17 | 18 | # TODO(rtheis/amotoki): Add functional test infrastructure for OSC 19 | # plugin commands. 20 | # TODO(amotoki): Add and update document on OSC plugin. 21 | 22 | from osc_lib import utils 23 | 24 | LOG = logging.getLogger(__name__) 25 | 26 | DEFAULT_API_VERSION = '2.0' 27 | API_VERSION_OPTION = 'os_network_api_version' 28 | # NOTE(rtheis): API_NAME must NOT be set to 'network' since 29 | # 'network' is owned by OSC! The OSC 'network' client uses 30 | # the OpenStack SDK. 31 | API_NAME = 'neutronclient' 32 | API_VERSIONS = { 33 | '2.0': 'neutronclient.v2_0.client.Client', 34 | '2': 'neutronclient.v2_0.client.Client', 35 | } 36 | 37 | 38 | def make_client(instance): 39 | """Returns an neutron client.""" 40 | neutron_client = utils.get_client_class( 41 | API_NAME, 42 | instance._api_version[API_NAME], 43 | API_VERSIONS) 44 | LOG.debug('Instantiating neutron client: %s', neutron_client) 45 | 46 | # TODO(amotoki): Check the following arguments need to be passed 47 | # to neutronclient class. Check keystoneauth code. 48 | # - endpoint_type (do we need to specify it explicitly?) 49 | # - auth (session object contains auth. Is it required?) 50 | client = neutron_client(session=instance.session, 51 | region_name=instance.region_name, 52 | endpoint_type=instance.interface, 53 | insecure=not instance.verify, 54 | ca_cert=instance.cacert) 55 | return client 56 | 57 | 58 | def build_option_parser(parser): 59 | """Hook to add global options""" 60 | 61 | # NOTE(amotoki): At now we register no option. 62 | # OSC itself has an option for Network API version # and we refer to it. 63 | return parser 64 | -------------------------------------------------------------------------------- /neutronclient/osc/v2/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/osc/v2/__init__.py -------------------------------------------------------------------------------- /neutronclient/osc/v2/dynamic_routing/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/osc/v2/dynamic_routing/__init__.py -------------------------------------------------------------------------------- /neutronclient/osc/v2/dynamic_routing/bgp_dragent.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | # 13 | 14 | from osc_lib.command import command 15 | from osc_lib import utils 16 | 17 | from neutronclient._i18n import _ 18 | 19 | 20 | def _format_alive_state(item): 21 | return ':-)' if item else 'XXX' 22 | 23 | 24 | _formatters = { 25 | 'alive': _format_alive_state 26 | } 27 | 28 | 29 | def add_common_args(parser): 30 | parser.add_argument('dragent_id', 31 | metavar='', 32 | help=_("ID of the dynamic routing agent")) 33 | parser.add_argument('bgp_speaker', 34 | metavar='', 35 | help=_("ID or name of the BGP speaker")) 36 | 37 | 38 | class AddBgpSpeakerToDRAgent(command.Command): 39 | """Add a BGP speaker to a dynamic routing agent""" 40 | 41 | def get_parser(self, prog_name): 42 | parser = super(AddBgpSpeakerToDRAgent, self).get_parser(prog_name) 43 | add_common_args(parser) 44 | return parser 45 | 46 | def take_action(self, parsed_args): 47 | client = self.app.client_manager.network 48 | speaker_id = client.find_bgp_speaker(parsed_args.bgp_speaker).id 49 | client.add_bgp_speaker_to_dragent(parsed_args.dragent_id, speaker_id) 50 | 51 | 52 | class RemoveBgpSpeakerFromDRAgent(command.Command): 53 | """Removes a BGP speaker from a dynamic routing agent""" 54 | 55 | def get_parser(self, prog_name): 56 | parser = super(RemoveBgpSpeakerFromDRAgent, self).get_parser( 57 | prog_name) 58 | add_common_args(parser) 59 | return parser 60 | 61 | def take_action(self, parsed_args): 62 | client = self.app.client_manager.network 63 | speaker_id = client.find_bgp_speaker(parsed_args.bgp_speaker).id 64 | client.remove_bgp_speaker_from_dragent(parsed_args.dragent_id, 65 | speaker_id) 66 | 67 | 68 | class ListDRAgent(command.Lister): 69 | """List dynamic routing agents""" 70 | 71 | resource = 'agent' 72 | list_columns = ['id', 'host', 'admin_state_up', 'alive'] 73 | unknown_parts_flag = False 74 | 75 | def get_parser(self, prog_name): 76 | parser = super(ListDRAgent, 77 | self).get_parser(prog_name) 78 | parser.add_argument('--bgp-speaker', 79 | metavar='', 80 | help=_("List dynamic routing agents hosting a " 81 | "BGP speaker (name or ID)")) 82 | return parser 83 | 84 | def take_action(self, parsed_args): 85 | client = self.app.client_manager.network 86 | if parsed_args.bgp_speaker is not None: 87 | speaker_id = client.find_bgp_speaker(parsed_args.bgp_speaker).id 88 | data = client.get_bgp_dragents_hosting_speaker(speaker_id) 89 | else: 90 | attrs = {'agent_type': 'BGP dynamic routing agent'} 91 | data = client.agents(**attrs) 92 | columns = ( 93 | 'id', 94 | 'agent_type', 95 | 'host', 96 | 'availability_zone', 97 | 'is_alive', 98 | 'is_admin_state_up', 99 | 'binary' 100 | ) 101 | column_headers = ( 102 | 'ID', 103 | 'Agent Type', 104 | 'Host', 105 | 'Availability Zone', 106 | 'Alive', 107 | 'State', 108 | 'Binary' 109 | ) 110 | return (column_headers, 111 | (utils.get_item_properties( 112 | s, columns,) for s in data)) 113 | -------------------------------------------------------------------------------- /neutronclient/osc/v2/dynamic_routing/constants.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | 13 | BGP_SPEAKERS = 'bgp_speakers' 14 | BGP_SPEAKER = 'bgp_speaker' 15 | BGP_PEERS = 'bgp_peers' 16 | BGP_PEER = 'bgp_peer' 17 | MIN_AS_NUM = 1 18 | MAX_AS_NUM = 4294967295 19 | -------------------------------------------------------------------------------- /neutronclient/osc/v2/fwaas/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/osc/v2/fwaas/__init__.py -------------------------------------------------------------------------------- /neutronclient/osc/v2/fwaas/constants.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2017 FUJITSU LIMITED 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | FWG = 'firewall_group' 18 | FWGS = 'firewall_groups' 19 | FWP = 'firewall_policy' 20 | FWPS = 'firewall_policies' 21 | FWR = 'firewall_rule' 22 | FWRS = 'firewall_rules' 23 | CMD_FWG = 'fwaas_' + FWG 24 | CMD_FWP = 'fwaas_' + FWP 25 | CMD_FWR = 'fwaas_' + FWR 26 | -------------------------------------------------------------------------------- /neutronclient/osc/v2/lbaas/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/osc/v2/lbaas/__init__.py -------------------------------------------------------------------------------- /neutronclient/osc/v2/logging/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/osc/v2/logging/__init__.py -------------------------------------------------------------------------------- /neutronclient/osc/v2/networking_bgpvpn/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/osc/v2/networking_bgpvpn/__init__.py -------------------------------------------------------------------------------- /neutronclient/osc/v2/networking_bgpvpn/constants.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 Juniper Networks Inc. 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | BGPVPN = 'bgpvpn' 18 | BGPVPNS = '%ss' % BGPVPN 19 | 20 | NETWORK_RESOURCE_NAME = 'network' 21 | NETWORK_ASSOC = '%s_association' % NETWORK_RESOURCE_NAME 22 | NETWORK_ASSOCS = '%ss' % NETWORK_ASSOC 23 | 24 | ROUTER_RESOURCE_NAME = 'router' 25 | ROUTER_ASSOC = '%s_association' % ROUTER_RESOURCE_NAME 26 | ROUTER_ASSOCS = '%ss' % ROUTER_ASSOC 27 | 28 | PORT_RESOURCE_NAME = 'port' 29 | PORT_ASSOC = '%s_association' % PORT_RESOURCE_NAME 30 | PORT_ASSOCS = '%ss' % PORT_ASSOC 31 | -------------------------------------------------------------------------------- /neutronclient/osc/v2/networking_bgpvpn/network_association.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 Juniper Networks Inc. 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | from osc_lib.utils import columns as column_util 18 | 19 | from neutronclient._i18n import _ 20 | from neutronclient.osc.v2.networking_bgpvpn import constants 21 | from neutronclient.osc.v2.networking_bgpvpn.resource_association import\ 22 | CreateBgpvpnResAssoc 23 | from neutronclient.osc.v2.networking_bgpvpn.resource_association import\ 24 | DeleteBgpvpnResAssoc 25 | from neutronclient.osc.v2.networking_bgpvpn.resource_association import\ 26 | ListBgpvpnResAssoc 27 | from neutronclient.osc.v2.networking_bgpvpn.resource_association import\ 28 | ShowBgpvpnResAssoc 29 | 30 | 31 | class BgpvpnNetAssoc(object): 32 | _assoc_res_name = constants.NETWORK_RESOURCE_NAME 33 | _resource = constants.NETWORK_ASSOC 34 | _resource_plural = constants.NETWORK_ASSOCS 35 | 36 | _attr_map = ( 37 | ('id', 'ID', column_util.LIST_BOTH), 38 | ('tenant_id', 'Project', column_util.LIST_LONG_ONLY), 39 | ('%s_id' % _assoc_res_name, '%s ID' % _assoc_res_name.capitalize(), 40 | column_util.LIST_BOTH), 41 | ) 42 | _formatters = {} 43 | 44 | 45 | class CreateBgpvpnNetAssoc(BgpvpnNetAssoc, CreateBgpvpnResAssoc): 46 | _description = _("Create a BGP VPN network association") 47 | pass 48 | 49 | 50 | class DeleteBgpvpnNetAssoc(BgpvpnNetAssoc, DeleteBgpvpnResAssoc): 51 | _description = _("Delete a BGP VPN network association(s) for a given BGP " 52 | "VPN") 53 | pass 54 | 55 | 56 | class ListBgpvpnNetAssoc(BgpvpnNetAssoc, ListBgpvpnResAssoc): 57 | _description = _("List BGP VPN network associations for a given BGP VPN") 58 | pass 59 | 60 | 61 | class ShowBgpvpnNetAssoc(BgpvpnNetAssoc, ShowBgpvpnResAssoc): 62 | _description = _("Show information of a given BGP VPN network association") 63 | pass 64 | -------------------------------------------------------------------------------- /neutronclient/osc/v2/sfc/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/osc/v2/sfc/__init__.py -------------------------------------------------------------------------------- /neutronclient/osc/v2/subnet_onboard/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/osc/v2/subnet_onboard/__init__.py -------------------------------------------------------------------------------- /neutronclient/osc/v2/subnet_onboard/subnet_onboard.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 SUSE Linux Products GmbH 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | """Subnet onboard action implementation""" 18 | import logging 19 | 20 | from osc_lib.command import command 21 | from osc_lib import exceptions 22 | 23 | from neutronclient._i18n import _ 24 | 25 | LOG = logging.getLogger(__name__) 26 | 27 | 28 | class NetworkOnboardSubnets(command.Command): 29 | """Onboard network subnets into a subnet pool""" 30 | 31 | def get_parser(self, prog_name): 32 | parser = super(NetworkOnboardSubnets, self).get_parser(prog_name) 33 | parser.add_argument( 34 | 'network', 35 | metavar="", 36 | help=_("Onboard all subnets associated with this network") 37 | ) 38 | parser.add_argument( 39 | 'subnetpool', 40 | metavar="", 41 | help=_("Target subnet pool for onboarding subnets") 42 | ) 43 | return parser 44 | 45 | def take_action(self, parsed_args): 46 | client = self.app.client_manager.neutronclient 47 | subnetpool_id = _get_id(client, parsed_args.subnetpool, 'subnetpool') 48 | network_id = _get_id(client, parsed_args.network, 'network') 49 | body = {'network_id': network_id} 50 | try: 51 | client.onboard_network_subnets(subnetpool_id, body) 52 | except Exception as e: 53 | msg = (_("Failed to onboard subnets for network '%(n)s': %(e)s") 54 | % {'n': parsed_args.network, 'e': e}) 55 | raise exceptions.CommandError(msg) 56 | 57 | 58 | def _get_id(client, id_or_name, resource): 59 | return client.find_resource(resource, str(id_or_name))['id'] 60 | -------------------------------------------------------------------------------- /neutronclient/osc/v2/utils.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 NEC Corporation 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | """This module is intended to contain methods specific 16 | to Networking v2 API and its extensions. 17 | """ 18 | 19 | from cliff import columns as cliff_columns 20 | 21 | 22 | class AdminStateColumn(cliff_columns.FormattableColumn): 23 | def human_readable(self): 24 | return 'UP' if self._value else 'DOWN' 25 | -------------------------------------------------------------------------------- /neutronclient/osc/v2/vpnaas/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/osc/v2/vpnaas/__init__.py -------------------------------------------------------------------------------- /neutronclient/osc/v2/vpnaas/utils.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 FUJITSU LIMITED 2 | # All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | 18 | """VPN Utilities and helper functions.""" 19 | 20 | 21 | from neutronclient._i18n import _ 22 | from neutronclient.common import exceptions 23 | 24 | DPD_SUPPORTED_ACTIONS = ['hold', 'clear', 'restart', 25 | 'restart-by-peer', 'disabled'] 26 | DPD_SUPPORTED_KEYS = ['action', 'interval', 'timeout'] 27 | 28 | lifetime_keys = ['units', 'value'] 29 | lifetime_units = ['seconds'] 30 | 31 | 32 | def validate_dpd_dict(dpd_dict): 33 | for key, value in dpd_dict.items(): 34 | if key not in DPD_SUPPORTED_KEYS: 35 | message = _( 36 | "DPD Dictionary KeyError: " 37 | "Reason-Invalid DPD key : " 38 | "'%(key)s' not in %(supported_key)s") % { 39 | 'key': key, 'supported_key': DPD_SUPPORTED_KEYS} 40 | raise exceptions.CommandError(message) 41 | if key == 'action' and value not in DPD_SUPPORTED_ACTIONS: 42 | message = _( 43 | "DPD Dictionary ValueError: " 44 | "Reason-Invalid DPD action : " 45 | "'%(key_value)s' not in %(supported_action)s") % { 46 | 'key_value': value, 47 | 'supported_action': DPD_SUPPORTED_ACTIONS} 48 | raise exceptions.CommandError(message) 49 | if key in ('interval', 'timeout'): 50 | try: 51 | if int(value) <= 0: 52 | raise ValueError() 53 | except ValueError: 54 | message = _( 55 | "DPD Dictionary ValueError: " 56 | "Reason-Invalid positive integer value: " 57 | "'%(key)s' = %(value)s") % { 58 | 'key': key, 'value': value} 59 | raise exceptions.CommandError(message) 60 | else: 61 | dpd_dict[key] = int(value) 62 | return 63 | 64 | 65 | def validate_lifetime_dict(lifetime_dict): 66 | 67 | for key, value in lifetime_dict.items(): 68 | if key not in lifetime_keys: 69 | message = _( 70 | "Lifetime Dictionary KeyError: " 71 | "Reason-Invalid unit key : " 72 | "'%(key)s' not in %(supported_key)s") % { 73 | 'key': key, 'supported_key': lifetime_keys} 74 | raise exceptions.CommandError(message) 75 | if key == 'units' and value not in lifetime_units: 76 | message = _( 77 | "Lifetime Dictionary ValueError: " 78 | "Reason-Invalid units : " 79 | "'%(key_value)s' not in %(supported_units)s") % { 80 | 'key_value': key, 'supported_units': lifetime_units} 81 | raise exceptions.CommandError(message) 82 | if key == 'value': 83 | try: 84 | if int(value) < 60: 85 | raise ValueError() 86 | except ValueError: 87 | message = _( 88 | "Lifetime Dictionary ValueError: " 89 | "Reason-Invalid value should be at least 60:" 90 | "'%(key_value)s' = %(value)s") % { 91 | 'key_value': key, 'value': value} 92 | raise exceptions.CommandError(message) 93 | else: 94 | lifetime_dict['value'] = int(value) 95 | return 96 | 97 | 98 | def lifetime_help(policy): 99 | lifetime = _("%s lifetime attributes. " 100 | "'units'-seconds, default:seconds. " 101 | "'value'-non negative integer, default:3600.") % policy 102 | return lifetime 103 | 104 | 105 | def dpd_help(policy): 106 | dpd = _(" %s Dead Peer Detection attributes." 107 | " 'action'-hold,clear,disabled,restart,restart-by-peer." 108 | " 'interval' and 'timeout' are non negative integers. " 109 | " 'interval' should be less than 'timeout' value. " 110 | " 'action', default:hold 'interval', default:30, " 111 | " 'timeout', default:120.") % policy.capitalize() 112 | return dpd 113 | -------------------------------------------------------------------------------- /neutronclient/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/tests/__init__.py -------------------------------------------------------------------------------- /neutronclient/tests/unit/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/tests/unit/__init__.py -------------------------------------------------------------------------------- /neutronclient/tests/unit/osc/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/tests/unit/osc/__init__.py -------------------------------------------------------------------------------- /neutronclient/tests/unit/osc/v2/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/tests/unit/osc/v2/__init__.py -------------------------------------------------------------------------------- /neutronclient/tests/unit/osc/v2/dynamic_routing/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/tests/unit/osc/v2/dynamic_routing/__init__.py -------------------------------------------------------------------------------- /neutronclient/tests/unit/osc/v2/dynamic_routing/test_bgp_dragent.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | # 13 | from unittest import mock 14 | 15 | from neutronclient.osc.v2.dynamic_routing import bgp_dragent 16 | from neutronclient.tests.unit.osc.v2.dynamic_routing import fakes 17 | 18 | 19 | class TestAddBgpSpeakerToDRAgent(fakes.TestNeutronDynamicRoutingOSCV2): 20 | _bgp_speaker = fakes.FakeBgpSpeaker.create_one_bgp_speaker() 21 | _bgp_dragent = fakes.FakeDRAgent.create_one_dragent() 22 | _bgp_speaker_id = _bgp_speaker['id'] 23 | _bgp_dragent_id = _bgp_dragent['id'] 24 | 25 | def setUp(self): 26 | super(TestAddBgpSpeakerToDRAgent, self).setUp() 27 | 28 | # Get the command object to test 29 | self.cmd = bgp_dragent.AddBgpSpeakerToDRAgent(self.app, self.namespace) 30 | 31 | def test_add_bgp_speaker_to_dragent(self): 32 | arglist = [ 33 | self._bgp_dragent_id, 34 | self._bgp_speaker_id, 35 | ] 36 | verifylist = [ 37 | ('dragent_id', self._bgp_dragent_id), 38 | ('bgp_speaker', self._bgp_speaker_id), 39 | ] 40 | parsed_args = self.check_parser(self.cmd, arglist, verifylist) 41 | 42 | with mock.patch.object(self.networkclient, 43 | "add_bgp_speaker_to_dragent", 44 | return_value=None): 45 | 46 | result = self.cmd.take_action(parsed_args) 47 | self.networkclient.add_bgp_speaker_to_dragent.\ 48 | assert_called_once_with( 49 | self._bgp_dragent_id, self._bgp_speaker_id) 50 | self.assertIsNone(result) 51 | 52 | 53 | class TestRemoveBgpSpeakerFromDRAgent(fakes.TestNeutronDynamicRoutingOSCV2): 54 | _bgp_speaker = fakes.FakeBgpSpeaker.create_one_bgp_speaker() 55 | _bgp_dragent = fakes.FakeDRAgent.create_one_dragent() 56 | _bgp_speaker_id = _bgp_speaker['id'] 57 | _bgp_dragent_id = _bgp_dragent['id'] 58 | 59 | def setUp(self): 60 | super(TestRemoveBgpSpeakerFromDRAgent, self).setUp() 61 | 62 | # Get the command object to test 63 | self.cmd = bgp_dragent.RemoveBgpSpeakerFromDRAgent( 64 | self.app, self.namespace) 65 | 66 | def test_remove_bgp_speaker_from_dragent(self): 67 | arglist = [ 68 | self._bgp_dragent_id, 69 | self._bgp_speaker_id, 70 | ] 71 | verifylist = [ 72 | ('dragent_id', self._bgp_dragent_id), 73 | ('bgp_speaker', self._bgp_speaker_id), 74 | ] 75 | parsed_args = self.check_parser(self.cmd, arglist, verifylist) 76 | 77 | with mock.patch.object(self.networkclient, 78 | "remove_bgp_speaker_from_dragent", 79 | return_value=None): 80 | result = self.cmd.take_action(parsed_args) 81 | self.networkclient.remove_bgp_speaker_from_dragent.\ 82 | assert_called_once_with(self._bgp_dragent_id, 83 | self._bgp_speaker_id) 84 | self.assertIsNone(result) 85 | -------------------------------------------------------------------------------- /neutronclient/tests/unit/osc/v2/fakes.py: -------------------------------------------------------------------------------- 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 2 | # not use this file except in compliance with the License. You may obtain 3 | # a copy of the License at 4 | # 5 | # http://www.apache.org/licenses/LICENSE-2.0 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10 | # License for the specific language governing permissions and limitations 11 | # under the License. 12 | # 13 | 14 | import argparse 15 | from unittest import mock 16 | 17 | from cliff import columns as cliff_columns 18 | from osc_lib.tests import utils 19 | 20 | 21 | class TestNeutronClientOSCV2(utils.TestCommand): 22 | 23 | def setUp(self): 24 | super(TestNeutronClientOSCV2, self).setUp() 25 | self.namespace = argparse.Namespace() 26 | self.app.client_manager.session = mock.Mock() 27 | self.app.client_manager.neutronclient = mock.Mock() 28 | self.neutronclient = self.app.client_manager.neutronclient 29 | 30 | self.app.client_manager.network = mock.Mock() 31 | self.networkclient = self.app.client_manager.network 32 | 33 | self.addCleanup(mock.patch.stopall) 34 | 35 | # TODO(amotoki): Move this to osc_lib 36 | def assertListItemEqual(self, expected, actual): 37 | self.assertEqual(len(expected), len(actual)) 38 | for item_expected, item_actual in zip(expected, actual): 39 | self.assertItemEqual(item_expected, item_actual) 40 | 41 | # TODO(amotoki): Move this to osc_lib 42 | def assertItemEqual(self, expected, actual): 43 | self.assertEqual(len(expected), len(actual)) 44 | for col_expected, col_actual in zip(expected, actual): 45 | if isinstance(col_expected, cliff_columns.FormattableColumn): 46 | self.assertIsInstance(col_actual, col_expected.__class__) 47 | self.assertEqual(col_expected.human_readable(), 48 | col_actual.human_readable()) 49 | else: 50 | self.assertEqual(col_expected, col_actual) 51 | -------------------------------------------------------------------------------- /neutronclient/tests/unit/osc/v2/fwaas/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/tests/unit/osc/v2/fwaas/__init__.py -------------------------------------------------------------------------------- /neutronclient/tests/unit/osc/v2/lbaas/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/tests/unit/osc/v2/lbaas/__init__.py -------------------------------------------------------------------------------- /neutronclient/tests/unit/osc/v2/logging/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/tests/unit/osc/v2/logging/__init__.py -------------------------------------------------------------------------------- /neutronclient/tests/unit/osc/v2/logging/fakes.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 FUJITSU LIMITED 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | import collections 18 | import copy 19 | from unittest import mock 20 | import uuid 21 | 22 | 23 | class FakeLogging(object): 24 | 25 | def create(self, attrs={}): 26 | """Create a fake network logs 27 | 28 | :param Dictionary attrs: 29 | A dictionary with all attributes 30 | :return: 31 | A OrderedDict faking the network log 32 | """ 33 | self.ordered.update(attrs) 34 | return copy.deepcopy(self.ordered) 35 | 36 | def bulk_create(self, attrs=None, count=2): 37 | """Create multiple fake network logs 38 | 39 | :param Dictionary attrs: 40 | A dictionary with all attributes 41 | :param int count: 42 | The number of network logs to fake 43 | :return: 44 | A list of dictionaries faking the network logs 45 | """ 46 | return [self.create(attrs=attrs) for i in range(0, count)] 47 | 48 | def get(self, attrs=None, count=2): 49 | """Create multiple fake network logs 50 | 51 | :param Dictionary attrs: 52 | A dictionary with all attributes 53 | :param int count: 54 | The number of network logs to fake 55 | :return: 56 | A list of dictionaries faking the network log 57 | """ 58 | if attrs is None: 59 | self.attrs = self.bulk_create(count=count) 60 | return mock.Mock(side_effect=attrs) 61 | 62 | 63 | class NetworkLog(FakeLogging): 64 | """Fake one or more network log""" 65 | 66 | def __init__(self): 67 | super(NetworkLog, self).__init__() 68 | self.ordered = collections.OrderedDict(( 69 | ('id', 'log-id-' + uuid.uuid4().hex), 70 | ('description', 'my-desc-' + uuid.uuid4().hex), 71 | ('enabled', False), 72 | ('name', 'my-log-' + uuid.uuid4().hex), 73 | ('target_id', None), 74 | ('project_id', 'project-id-' + uuid.uuid4().hex), 75 | ('resource_id', None), 76 | ('resource_type', 'security_group'), 77 | ('event', 'all'), 78 | )) 79 | -------------------------------------------------------------------------------- /neutronclient/tests/unit/osc/v2/networking_bgpvpn/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/tests/unit/osc/v2/networking_bgpvpn/__init__.py -------------------------------------------------------------------------------- /neutronclient/tests/unit/osc/v2/sfc/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/tests/unit/osc/v2/sfc/__init__.py -------------------------------------------------------------------------------- /neutronclient/tests/unit/osc/v2/subnet_onboard/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/tests/unit/osc/v2/subnet_onboard/__init__.py -------------------------------------------------------------------------------- /neutronclient/tests/unit/osc/v2/subnet_onboard/test_network_onboard_subnets.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019 SUSE Linux Products GmbH 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | from unittest import mock 18 | 19 | from neutronclient.osc.v2.subnet_onboard import subnet_onboard 20 | from neutronclient.tests.unit.osc.v2 import fakes as test_fakes 21 | 22 | 23 | def _get_id(client, id_or_name, resource): 24 | return id_or_name 25 | 26 | 27 | class TestNetworkOnboardSubnets(test_fakes.TestNeutronClientOSCV2): 28 | 29 | def setUp(self): 30 | super(TestNetworkOnboardSubnets, self).setUp() 31 | mock.patch( 32 | 'neutronclient.osc.v2.subnet_onboard.subnet_onboard._get_id', 33 | new=_get_id).start() 34 | 35 | self.network_id = 'my_network_id' 36 | self.subnetpool_id = 'my_subnetpool_id' 37 | 38 | # Get the command object to test 39 | self.cmd = subnet_onboard.NetworkOnboardSubnets(self.app, 40 | self.namespace) 41 | 42 | def test_options(self): 43 | arglist = [ 44 | self.network_id, 45 | self.subnetpool_id 46 | ] 47 | verifylist = [ 48 | ('network', self.network_id), 49 | ('subnetpool', self.subnetpool_id), 50 | ] 51 | parsed_args = self.check_parser(self.cmd, arglist, verifylist) 52 | self.cmd.take_action(parsed_args) 53 | self.neutronclient.onboard_network_subnets.assert_called_once_with( 54 | self.subnetpool_id, {'network_id': self.network_id}) 55 | -------------------------------------------------------------------------------- /neutronclient/tests/unit/osc/v2/vpnaas/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/tests/unit/osc/v2/vpnaas/__init__.py -------------------------------------------------------------------------------- /neutronclient/tests/unit/test_command_meta.py: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Intel 2 | # Copyright 2013 Isaku Yamahata 3 | # 4 | # All Rights Reserved. 5 | # 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 8 | # not use this file except in compliance with the License. You may obtain 9 | # a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 15 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 16 | # License for the specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | import logging 21 | 22 | import testtools 23 | 24 | from neutronclient.neutron import v2_0 as neutronV20 25 | 26 | 27 | class TestCommandMeta(testtools.TestCase): 28 | def test_neutron_command_meta_defines_log(self): 29 | class FakeCommand(neutronV20.NeutronCommand): 30 | pass 31 | 32 | self.assertTrue(hasattr(FakeCommand, 'log')) 33 | self.assertIsInstance(FakeCommand.log, logging.getLoggerClass()) 34 | self.assertEqual(__name__ + ".FakeCommand", FakeCommand.log.name) 35 | 36 | def test_neutron_command_log_defined_explicitly(self): 37 | class FakeCommand(neutronV20.NeutronCommand): 38 | log = None 39 | 40 | self.assertTrue(hasattr(FakeCommand, 'log')) 41 | self.assertIsNone(FakeCommand.log) 42 | -------------------------------------------------------------------------------- /neutronclient/tests/unit/test_exceptions.py: -------------------------------------------------------------------------------- 1 | # All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 4 | # not use this file except in compliance with the License. You may obtain 5 | # a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | # License for the specific language governing permissions and limitations 13 | # under the License. 14 | 15 | import sys 16 | from unittest import mock 17 | 18 | from oslo_utils import encodeutils 19 | import testtools 20 | 21 | from neutronclient._i18n import _ 22 | from neutronclient.common import exceptions 23 | 24 | 25 | class TestExceptions(testtools.TestCase): 26 | 27 | def test_exception_print_with_unicode(self): 28 | class TestException(exceptions.NeutronException): 29 | message = _('Exception with %(reason)s') 30 | 31 | multibyte_unicode_string = u'\uff21\uff22\uff23' 32 | e = TestException(reason=multibyte_unicode_string) 33 | 34 | with mock.patch.object(sys, 'stdout') as mock_stdout: 35 | print(e) 36 | 37 | exc_str = 'Exception with %s' % multibyte_unicode_string 38 | mock_stdout.assert_has_calls([mock.call.write(exc_str)]) 39 | 40 | def test_exception_message_with_encoded_unicode(self): 41 | class TestException(exceptions.NeutronException): 42 | message = _('Exception with %(reason)s') 43 | 44 | multibyte_string = u'\uff21\uff22\uff23' 45 | multibyte_binary = encodeutils.safe_encode(multibyte_string) 46 | e = TestException(reason=multibyte_binary) 47 | self.assertEqual('Exception with %s' % multibyte_string, 48 | str(e)) 49 | -------------------------------------------------------------------------------- /neutronclient/tests/unit/test_validators.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014 NEC Corporation 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | 16 | import testtools 17 | 18 | from neutronclient.common import exceptions 19 | from neutronclient.common import validators 20 | 21 | 22 | class FakeParsedArgs(object): 23 | pass 24 | 25 | 26 | class ValidatorTest(testtools.TestCase): 27 | 28 | def _test_validate_int(self, attr_val, attr_name='attr1', 29 | min_value=1, max_value=10): 30 | obj = FakeParsedArgs() 31 | setattr(obj, attr_name, attr_val) 32 | ret = validators.validate_int_range(obj, attr_name, 33 | min_value, max_value) 34 | # Come here only if there is no exception. 35 | self.assertIsNone(ret) 36 | 37 | def _test_validate_int_error(self, attr_val, expected_msg, 38 | attr_name='attr1', expected_exc=None, 39 | min_value=1, max_value=10): 40 | if expected_exc is None: 41 | expected_exc = exceptions.CommandError 42 | e = self.assertRaises(expected_exc, 43 | self._test_validate_int, 44 | attr_val, attr_name, min_value, max_value) 45 | self.assertEqual(expected_msg, str(e)) 46 | 47 | def test_validate_int_min_max(self): 48 | self._test_validate_int(1) 49 | self._test_validate_int(10) 50 | self._test_validate_int('1') 51 | self._test_validate_int('10') 52 | self._test_validate_int('0x0a') 53 | 54 | self._test_validate_int_error( 55 | 0, 'attr1 "0" should be an integer [1:10].') 56 | self._test_validate_int_error( 57 | 11, 'attr1 "11" should be an integer [1:10].') 58 | self._test_validate_int_error( 59 | '0x10', 'attr1 "0x10" should be an integer [1:10].') 60 | 61 | def test_validate_int_min_only(self): 62 | self._test_validate_int(1, max_value=None) 63 | self._test_validate_int(10, max_value=None) 64 | self._test_validate_int(11, max_value=None) 65 | self._test_validate_int_error( 66 | 0, 'attr1 "0" should be an integer greater than or equal to 1.', 67 | max_value=None) 68 | 69 | def test_validate_int_max_only(self): 70 | self._test_validate_int(0, min_value=None) 71 | self._test_validate_int(1, min_value=None) 72 | self._test_validate_int(10, min_value=None) 73 | self._test_validate_int_error( 74 | 11, 'attr1 "11" should be an integer smaller than or equal to 10.', 75 | min_value=None) 76 | 77 | def test_validate_int_no_limit(self): 78 | self._test_validate_int(0, min_value=None, max_value=None) 79 | self._test_validate_int(1, min_value=None, max_value=None) 80 | self._test_validate_int(10, min_value=None, max_value=None) 81 | self._test_validate_int(11, min_value=None, max_value=None) 82 | self._test_validate_int_error( 83 | 'abc', 'attr1 "abc" should be an integer.', 84 | min_value=None, max_value=None) 85 | 86 | def _test_validate_subnet(self, attr_val, attr_name='attr1'): 87 | obj = FakeParsedArgs() 88 | setattr(obj, attr_name, attr_val) 89 | ret = validators.validate_ip_subnet(obj, attr_name) 90 | # Come here only if there is no exception. 91 | self.assertIsNone(ret) 92 | 93 | def test_validate_ip_subnet(self): 94 | self._test_validate_subnet('192.168.2.0/24') 95 | self._test_validate_subnet('192.168.2.3/20') 96 | self._test_validate_subnet('192.168.2.1') 97 | 98 | e = self.assertRaises(exceptions.CommandError, 99 | self._test_validate_subnet, 100 | '192.168.2.256') 101 | self.assertEqual('attr1 "192.168.2.256" is not a valid CIDR.', str(e)) 102 | -------------------------------------------------------------------------------- /neutronclient/v2_0/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/neutronclient/v2_0/__init__.py -------------------------------------------------------------------------------- /neutronclient/version.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 Hewlett-Packard Development Company, L.P. 2 | # All Rights Reserved 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may 5 | # not use this file except in compliance with the License. You may obtain 6 | # a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | # License for the specific language governing permissions and limitations 14 | # under the License. 15 | # 16 | 17 | import pbr.version 18 | 19 | 20 | version_info = pbr.version.VersionInfo('python-neutronclient') 21 | __version__ = version_info.version_string() 22 | -------------------------------------------------------------------------------- /releasenotes/notes/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/releasenotes/notes/.placeholder -------------------------------------------------------------------------------- /releasenotes/notes/Define-IpAddressAlreadyAllocatedClient-exception-e8600ca5ba1c7f45.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | other: 3 | - | 4 | Define a new exception type ``IpAddressAlreadyAllocatedClient``. 5 | Users can catch this specific exception instead of the generic 6 | ``NeutronClientException``. 7 | -------------------------------------------------------------------------------- /releasenotes/notes/add-aggressive-negotiation-mode-5218b1baff930eb8.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | The ``--phase1-negotiation-mode`` option supports ``aggressive`` mode 5 | in VPNaaS ikepolicy commands. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/add-auto-allocated-topology-delete-aaccd60bd0f2e7b2.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - The ``auto-allocated-topology-delete`` command allows users to 4 | delete the auto allocated topology. 5 | -------------------------------------------------------------------------------- /releasenotes/notes/add-get-me-a-network-5ab2d60bf6f257b1.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | CLI support for the "get-me-a-network" feature, which simplifies 5 | the process for launching an instance with basic network 6 | connectivity. 7 | 8 | * The ``auto-allocated-topology-show`` command provides the 9 | network of the automatically allocated topology for a tenant. 10 | -------------------------------------------------------------------------------- /releasenotes/notes/add-l7-content-policies-capability-0f17cd06f044c83c.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | CLI support for Layer 7 content policies and rules. 5 | 6 | * L7 policies can be defined for listeners along 7 | with the ability to set L7 policy order. 8 | * Multiple rules can be created for an L7 policy. 9 | -------------------------------------------------------------------------------- /releasenotes/notes/add-lb-status-tree-723f23c09617de3b.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | CLI support for load balancer status tree. 5 | 6 | * The ``lbaas-loadbalancer-status`` command provides the status 7 | tree of a specific load balancer. -------------------------------------------------------------------------------- /releasenotes/notes/add-neutron-purge-a89e3d1179dce4b1.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | New command 'neutron purge ' will delete all 5 | supported resources owned by the given tenant, provided 6 | that the user has sufficient authorization and the 7 | resources in question are not shared, in use, or 8 | otherwise undeletable. 9 | 10 | Supported resources are: 11 | * Networks 12 | * Subnets 13 | * Routers 14 | * Ports 15 | * Floating IPs 16 | * Security Groups 17 | -------------------------------------------------------------------------------- /releasenotes/notes/add-new-session-clear-option-3c0b78ebc133a10c.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | A new option ``--no-session-persistence`` has been added to 5 | the ``neutron lbaas-pool-update`` CLI to clear the session persistence 6 | with which the current pool is associated. 7 | -------------------------------------------------------------------------------- /releasenotes/notes/add-no-shared-option-to-qos-policy-update-56ac41fb3af7e309.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | CLI support to set QoS policy as not shared if it was shared before. 5 | The ``qos-policy-update`` command include a ``--no-shared`` option. 6 | Closes `bug 1590942 `_. 7 | -------------------------------------------------------------------------------- /releasenotes/notes/add-osc-dynamic-routing-support-11130b2f440c0ac2.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Add OSC plugin to support "Neutron Dynamic Routing" 5 | -------------------------------------------------------------------------------- /releasenotes/notes/add-osc-trunk-commands-7e77283a369729c5.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Add ``network trunk create``, ``network trunk list``, 5 | ``network trunk set``, ``network trunk unset``, ``network trunk delete`` 6 | and ``network subport list`` OSC commands for trunk resource along with 7 | client bindings. 8 | [Blueprint `vlan-aware-vms `_] 9 | -------------------------------------------------------------------------------- /releasenotes/notes/add-quota-default-show-c2ab35b791dcdcbc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | CLI support to display the default quota reserved for a tenant. 5 | 6 | * The ``quota-default-show`` command outputs the default quota 7 | of resources for a given tenant. 8 | -------------------------------------------------------------------------------- /releasenotes/notes/add-rbac-qos-type-support-c42e31fadd7b.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | CLI support for QoS policy RBAC. 5 | 6 | * The ``rbac-create`` command include a --type qos-policy 7 | option. 8 | * The ``rbac-list`` command output includes a new 'type' column. 9 | -------------------------------------------------------------------------------- /releasenotes/notes/add-service-graph-ce4a25b3e32d70a6.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Added support for SFC Service Graph resource. 5 | Related RFE: https://bugs.launchpad.net/networking-sfc/+bug/1587486. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/add-sfc-commands.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Add OSC plugin support for the “Networking Service Function Chaining” feature commands along with client bindings. 5 | [Blueprint `openstackclient-cli-porting `_] -------------------------------------------------------------------------------- /releasenotes/notes/add-shared-pools-support-6f79b565afad3e47.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | CLI support for Neutron-LBaaS v2 shared pools added. 5 | 6 | * Pools can be created independently from listeners. 7 | * Listeners can share the same default_pool. 8 | * Makes Layer 7 switching support much more useful. 9 | -------------------------------------------------------------------------------- /releasenotes/notes/add-subnet-onboard-e60772bc4984f698.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Add ``network onboard subnets`` OSC command to enable subnet onboard support from the CLI 5 | [Blueprint `subnet-onboard `_] 6 | -------------------------------------------------------------------------------- /releasenotes/notes/add-support-to-floating-ip-port-forwardings-9dc838a5c5727eb7.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Add support to floating ip port forwarding. -------------------------------------------------------------------------------- /releasenotes/notes/add-tag-support-bad62d60ecc7075c.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | CLI support for tag. 5 | 6 | * The ``tag-add`` command sets a tag on the network resource. It also 7 | includes ``--resource-type``, ``--resource`` and ``--tag`` options. 8 | * The ``tag-replace`` command replaces tags on the network resource. It 9 | also includes ``--resource-type``, ``--resource`` and ``--tag`` 10 | options. More than one ``--tag`` options can be set. 11 | * The ``tag-remove`` command removes tags on the network resource. It also 12 | includes ``--resource-type``, ``--resource``, ``--tag`` and ``--all`` 13 | options. The ``--all`` option allow to remove all tags on the network 14 | resource. 15 | * The ``net-list`` command includes ``--tags``, ``--tags-any``, 16 | ``--not-tags`` and ``--not-tags-any`` options. -------------------------------------------------------------------------------- /releasenotes/notes/availability-zone-support-8e66f55e46b7ef9a.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | CLI support for availability zones. 5 | 6 | * The ``availability-zone-list`` command provides a list of 7 | availability zones. 8 | * The ``net-create`` and ``router-create`` commands include a 9 | ``--availability-zone-hint`` option. 10 | * The ``agent-list`` command output includes availability zones. 11 | -------------------------------------------------------------------------------- /releasenotes/notes/bgp-dynamic-routing-b97a1c81d3007049.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | CLI support for the BGP dynamic routing functionality will help 5 | advertising neutron fixed-ips and dvr host routes via BGP. -------------------------------------------------------------------------------- /releasenotes/notes/bug-1676922-81341b70bc6f055a.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | deprecations: 3 | - | 4 | The ``--public`` and ``--private`` attribute of Firewall-as-a-Service v2 5 | have been deprecated. While the ``--public`` attribute will now be replaced 6 | by ``--share``, the ``--private`` attribute will be replaced by 7 | ``--no-share``. This is because of the similarity between the behavior of 8 | ``--public`` attribute in FireWall-as-a-Service and the ``--share`` 9 | attribute used in OpenStack. This deprecation affects the following CLIs. 10 | 11 | * openstack firewall group create 12 | * openstack firewall group set 13 | * openstack firewall group unset 14 | * openstack firewall policy create 15 | * openstack firewall policy set 16 | * openstack firewall policy unset 17 | * openstack firewall rule create 18 | * openstack firewall rule set 19 | * openstack firewall rule unset 20 | -------------------------------------------------------------------------------- /releasenotes/notes/bulk-delete-support-94a353db08efec8d.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | CLI support for bulk delete. 5 | 6 | * By using this feature, multiple resource 7 | can be deleted using a single command. 8 | * Example: ``neutron router-delete router_a router_b`` 9 | deletes both router_a and router_b. 10 | -------------------------------------------------------------------------------- /releasenotes/notes/default-subnetpool-support-c0d34870e9d3e814.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | CLI support for default subnetpools. 5 | 6 | * The ``subnetpool-list`` and ``subnetpool-show`` command output includes 7 | the ``is_default`` field. 8 | * The ``subnetpool-create`` and ``subnetpool-update`` commands include a 9 | ``--is-default`` option. 10 | -------------------------------------------------------------------------------- /releasenotes/notes/deprecate-bgp-speaker-show-dragents-2fcce99cf6bb5b60.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | deprecations: 3 | - | 4 | The ``openstack bgp speaker show dragents`` CLI is deprecated and 5 | will be removed in the future. Use ``openstack bgp dragent list 6 | --bgp-speaker `` CLI instead. 7 | features: 8 | - | 9 | The ``openstack bgp dragent list`` CLI is added to support showing 10 | the list of dynamic routing agents. 11 | -------------------------------------------------------------------------------- /releasenotes/notes/deprecate-cli-7be1123817969439.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | deprecations: 3 | - The neutron CLI is now deprecated. This is the signal that it is 4 | time to start using the openstack CLI. No new features will be 5 | added to the neutron CLI, though fixes to the CLI will be assessed 6 | on a case by case basis. Fixes to the API bindings, as well as 7 | development of new API bindings as well as OSC plugins are exempt 8 | from this deprecation. 9 | -------------------------------------------------------------------------------- /releasenotes/notes/direct-physical-vnic-port-create-736d8b2600faf22b.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - Added new 'direct-physical' vnic-type option for port-create CLI command. 4 | Passing this particular value allows for a port to be create with the 5 | vnic-type used for assigning SR-IOV physical functions to 6 | instances. 7 | -------------------------------------------------------------------------------- /releasenotes/notes/docs-improvements-17e31babe38e2962.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | other: 3 | - | 4 | Addition of CLI user documentation including output filters, extra 5 | options, and operation using os-client-config. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/drop-nuage-commands-df10aab6ccd77ed2.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | upgrade: 3 | - Remove Nuage-specific commands. 4 | -------------------------------------------------------------------------------- /releasenotes/notes/drop-python-2.7-f615ebae463b2143.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | upgrade: 3 | - | 4 | Python 2.7 support has been dropped. The minimum version of Python now 5 | supported by python-neutronclient is Python 3.6. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/drop-python-3-6-and-3-7-73767fa0bbe89a6e.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | upgrade: 3 | - | 4 | Python 3.6 & 3.7 support has been dropped. The minimum version of Python now 5 | supported is Python 3.8. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/drop-xml-support-41babecb1784d996.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | upgrade: 3 | - XML request format support has been removed. 4 | deprecations: 5 | - request-format option is deprecated. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/dscp_qos-4a26d3c0363624b0.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | prelude: > 3 | Adding new QoS DSCP marking rule commands. 4 | features: 5 | - New create, update, list, show, and delete commands are added for QoS 6 | DSCP marking rule functionality. 7 | -------------------------------------------------------------------------------- /releasenotes/notes/extraroute-atomic-b11919d8e33b0d92.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | New client methods: ``add_extra_routes_to_router`` and 5 | ``remove_extra_routes_from_router``. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/fix-exception-typeerror-4.1.0-b37d738146575ed5.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | critical: 3 | - Fix a critical bug that when lazy translation is enabled 4 | NeutronClientException raises a TypeError 5 | (`bug 1552760 `_). 6 | -------------------------------------------------------------------------------- /releasenotes/notes/fix-quota-update-zero-args-d596c4169c2d2e30.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - | 4 | Fix CLI quota-update to return an error message for no args 5 | 6 | * ``quota-update`` CLI will return an error message 7 | ``Must specify a valid resource with new quota value`` if no 8 | argument is provided while executing it. If arguments are 9 | provided with CLI, no existing behavior is changed. 10 | -------------------------------------------------------------------------------- /releasenotes/notes/fix-rbac-create-command-dd40a474f0f092db.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - Fix 'bug 1596750 ' 4 | that using 'rbac-create' without specifying 'target-tenant' will 5 | return 'Request Failed internal server error while processing your 6 | request'. 7 | Update the default value of the argument '--target-tenant' to '*' 8 | -------------------------------------------------------------------------------- /releasenotes/notes/fix-token-endpoint-auth-support-26bf7ee12e4ec833.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | fixes: 3 | - Fix `bug 1450414 `_ 4 | that authentication with via ``--os-token`` and ``--os-url`` options 5 | (or corresponding environment variables) does not work 6 | after keystone v3 API support. 7 | -------------------------------------------------------------------------------- /releasenotes/notes/global_request_id-56856a93b982a6b3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Adds a new ``global_request_id`` parameter to the Client 5 | constructors, which will pass that id on all requests as the 6 | ``X-OpenStack-Request-ID`` header. 7 | -------------------------------------------------------------------------------- /releasenotes/notes/keystonev3-7f9ede9c21b30841.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | deprecations: 3 | - | 4 | Keystone v3 support for CLI 5 | 6 | * Using 'tenant_id' and 'tenant_name' arguments in API bindings is 7 | deprecated. Use 'project_id' and 'project_name' arguments instead. 8 | -------------------------------------------------------------------------------- /releasenotes/notes/log-request-id-64bef955b8292c18.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - Added support to log 'x-openstack-request-id' for each api call. -------------------------------------------------------------------------------- /releasenotes/notes/minimum-packet-rate-34576b8fd98a3034.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Added new client methods for QoS minimum packet rate rule: 5 | ``list_minimum_packet_rate_rules``, ``show_minimum_packet_rate_rule``, 6 | ``create_minimum_packet_rate_rule``, ``update_minimum_packet_rate_rule``, 7 | ``delete_minimum_packet_rate_rule``. 8 | -------------------------------------------------------------------------------- /releasenotes/notes/network-ip-availability-ac9a462f42fe9db4.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | CLI support for network IP availability 5 | 6 | * The ``net-ip-availability-list`` command provides a list of IP 7 | usage statistics for all networks. 8 | * The ``net-ip-availability-show`` command provides IP usage stats 9 | for a specific network. 10 | -------------------------------------------------------------------------------- /releasenotes/notes/neutron-cli-deprecation-398823c87270a296.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | deprecations: 3 | - | 4 | ``neutron`` CLI will be removed in 'Z' release. 5 | While it has been marked as deprecated for removal for long, 6 | all features in ``neutron`` CLI have been supported in ``openstack`` CLI 7 | (OpenStackClient) as of Xena release and the neutron team plans to 8 | remove it in 'Z' release. Consider using ``openstack`` CLI and 9 | `Mapping Guide `__ 10 | in the OSC documentation would help you. 11 | -------------------------------------------------------------------------------- /releasenotes/notes/no-new-binding-code-b03c9abbcaf2839e.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | prelude: > 3 | Openstack community decided to use one SDK for its services, that is 4 | in ``openstacksdk`` repository. To avoid duplication, sooner or later the 5 | python binding code in ``python-neutronclient`` will be deprecated, and 6 | ``Neutron`` team decided on the ``2023.1 (Antelope)`` PTG to not allow 7 | new features\' bindings implemented here. 8 | -------------------------------------------------------------------------------- /releasenotes/notes/osprofiler-support-9ba539761ae437e9.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Add osprofiler support to the neutronclient python binding. 5 | If osprofiler is initiated, neutronclient sends a special HTTP 6 | header that contains trace info. 7 | -------------------------------------------------------------------------------- /releasenotes/notes/paket_rate_limit-1266a2a30f18727f.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Added new client methods for QoS packet rate limit rule: 5 | ``list_packet_rate_limit_rules``, ``show_packet_rate_limit_rule``, 6 | ``create_packet_rate_limit_rule``, ``update_packet_rate_limit_rule``, 7 | ``delete_packet_rate_limit_rule``. 8 | -------------------------------------------------------------------------------- /releasenotes/notes/port-bindings-c3f36bd76ece0a71.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | New client methods: ``create_port_binding``, ``delete_port_binding``, 5 | ``show_port_binding``, ``list_port_bindings`` and ``activate_port_binding``. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/qos_minimum_bandwidth-dc4adb23c51de30b.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - New create, update, list, show, and delete commands are added for the QoS 4 | minimum bandwidth rule. 5 | -------------------------------------------------------------------------------- /releasenotes/notes/quota-update-for-LB-b21e7bc9e4a10f3e.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Quota of Loadbalancers and listeners can now be updated. 5 | -------------------------------------------------------------------------------- /releasenotes/notes/quota-update-for-rbac-192a8e65bf481941.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Quota for RBAC policies can now be set. 5 | -------------------------------------------------------------------------------- /releasenotes/notes/relnotes-from-3.0.0-d7306f5af5e3868d.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - Support os-client-config. OS_CLOUD environment variable is used for 4 | selecting named cloud configuration. 5 | - Support keystoneauth1 library which brings us better keystone v3 support. 6 | - Client command extension now supports a child resource. 7 | - New CLI for VPNaaS multiple local subnets. 8 | - New CLI for VPNaaS endpoint group API. 9 | - New CLI for flavor argument to loadbalancer v2 create. 10 | - New CLI for Neutron flavor framework. 11 | - Support creating floating IP on a specific subnet ID. 12 | - NSX gateway extension adds new transport type values (ipsec_gre and ipsec_stt). 13 | - New router-update option to update static routes (--route and --no-routes). 14 | - New allowed-address-pairs option to port-update 15 | upgrade: 16 | - Cisco-specific neutron client commands have been removed. 17 | These commands are ported to networking-cisco. 18 | - py26 support has been dropped. 19 | - py33 support has been dropped. 20 | fixes: 21 | - Name is no longer looked up on RBAC policies, 22 | RBAC policies have no name field so the name query to 23 | the server was always returning all entries since the 24 | name filter was ignored. (bug 1517818) 25 | other: 26 | - cliff-tablib has been removed from test dependencies. 27 | -------------------------------------------------------------------------------- /releasenotes/notes/remote_fwg-0f5362e5be8b2e84.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Adds the remote source firewall group and the remote destination 5 | firewall group field to the firewall rules. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/remove-bgp-speaker-show-dragents-0a0db4b72b2feffc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | upgrade: 3 | - | 4 | The ``openstack bgp speaker show dragents`` CLI is removed. It was 5 | deprecated in the 7.1.0 release (Ussuri). Use ``openstack bgp dragent list 6 | --bgp-speaker `` CLI instead. 7 | -------------------------------------------------------------------------------- /releasenotes/notes/remove-case-dependency-773ccb3237c38e81.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | other: 3 | - | 4 | This patch provides user the support to use 5 | any form of casing, thus removing the specific 6 | UPPER/lower case inputs required by different 7 | neutron CLIs. 8 | -------------------------------------------------------------------------------- /releasenotes/notes/remove-cli-code-53969e9aa927e530.yaml: -------------------------------------------------------------------------------- 1 | prelude: > 2 | | 3 | This new version of ``python-neutronclient`` does not include the 4 | command line interface code. The "neutron" script is no longer 5 | supported. This project only contains the OpenStack Client bindings 6 | that are currently being moved to OpenStack SDK 7 | _. 8 | deprecations: 9 | - | 10 | This project no longer provides CLI support. All code has been removed. 11 | Please use openstack CLI instead. See `openstack CLI command list 12 | `_. 13 | -------------------------------------------------------------------------------- /releasenotes/notes/remove-deprecated-option-b53f5d7e6a16ce95.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | deprecations: 3 | - | 4 | "admin-state-down" option was deprecated in Mitaka and has been removed in Newton. 5 | -------------------------------------------------------------------------------- /releasenotes/notes/remove-public-and-private-parameters-d683e7c30ecedc3b.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | upgrade: 3 | - | 4 | The deprecated options ``--public`` and ``--private`` were 5 | dropped in FWaaS v2 related commands. Use ``--share`` and 6 | ``--no-share`` instead. 7 | -------------------------------------------------------------------------------- /releasenotes/notes/remove-py38-26a1befde3f44b82.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | upgrade: 3 | - | 4 | Python 3.8 support was dropped. The minimum version of Python now supported 5 | is Python 3.9. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/return-request-id-to-caller-15b1d23a4ddc27a3.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - Neutron client returns 'x-openstack-request-id'. 4 | -------------------------------------------------------------------------------- /releasenotes/notes/segments-8557f5b0caa5ee26.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | New client methods: ``create_segment``, ``update_segment``, 5 | ``list_segments``, ``show_segment`` and ``delete_segment``. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/sfc-tap-service-function-support-a05242f25f79066b.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Add OSC support to create Port pair group for Tap service functions. 5 | -------------------------------------------------------------------------------- /releasenotes/notes/show-tenant-id-admin-listing-dc13ee7eb889d418.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - Show tenant_id when ``*-list`` command is run by admin. In neutron 4 | the list operations by admin retrieve all resources from all tenants. 5 | It is not easy to distinguish resources without tenant_id. 6 | This feature is useful for admin operations. 7 | -------------------------------------------------------------------------------- /releasenotes/notes/start-using-reno-9081b3e4c1951fdb.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | other: 3 | - Start using reno to manage release notes. 4 | -------------------------------------------------------------------------------- /releasenotes/notes/support-bgpvpn-route-control-aeda3e698486f73b.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Add BGP VPN `port association `_ 5 | support to the CLI, which are introduced for BGP VPN interconnections by the 6 | ``bgpvpn-routes-control`` API extension. 7 | -------------------------------------------------------------------------------- /releasenotes/notes/support-firewall-group-resource-type-5ad1b69cabcb4aa6.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | CLI support for the "firewal_group" as a loggable resource type for logging 5 | feature, which is enhanced FWaaS functionality, as OSC plugin commands. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/support-fwaasv2-cli-7f21676c551f8ae0.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - CLI support for the "Firewall as a Service v2" feature, which is enhanced 4 | FWaaS functionality, as OSC plugin commands. 5 | -------------------------------------------------------------------------------- /releasenotes/notes/support-logging-cli-cd02d3bb03367106.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | CLI support for 'Logging' feature, which enable to collect packet logs 5 | for specified resource. Currently, only security-group can be logged. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/support-networking-bgpvpn-cli-fdd0cc3a5b14983d.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - CLI support for the "Neutron BGP VPN Interconnection" feature, 4 | which is an API extension to support inter-connection between 5 | L3VPNs/E-VPNs and Neutron resources, as OSC plugin commands. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/support-routes-advertise-9356a38cf3e2fe5a.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | Add optional flag to control the advertisement in BGPVPNs 5 | of the routes defined on a Router resource 6 | (``bgpvpn-routes-control`` API extension). 7 | -------------------------------------------------------------------------------- /releasenotes/notes/support-vni-in-networking-bgpvpn-cli-d284b73b40b79495.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | CLI support for VXLAN VNI ID attribute in bgpvpn. 5 | An optional argument ``--vni`` is added to ``openstack bgpvpn`` 6 | commands to configure VXLAN Network Identifier when VXLAN 7 | encapsulation is used for the bgpvpn. 8 | -------------------------------------------------------------------------------- /releasenotes/notes/support-vpnaas-cli-9478fb7cfe603e26.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - | 4 | CLI support for the "VPN as a Service" feature, which is enhanced 5 | VPNaaS functionality, as OSC plugin commands. 6 | -------------------------------------------------------------------------------- /releasenotes/notes/tag-support-subnet-port-subnetpool-router-6250ec4714ee8690.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | features: 3 | - Tag operation for subnet, port, subnetpool and router resources 4 | are now supported. 5 | -------------------------------------------------------------------------------- /releasenotes/source/2023.1.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | 2023.1 Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/2023.1 7 | -------------------------------------------------------------------------------- /releasenotes/source/2023.2.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | 2023.2 Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/2023.2 7 | -------------------------------------------------------------------------------- /releasenotes/source/2024.1.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | 2024.1 Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/2024.1 7 | -------------------------------------------------------------------------------- /releasenotes/source/2024.2.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | 2024.2 Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/2024.2 7 | -------------------------------------------------------------------------------- /releasenotes/source/2025.1.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | 2025.1 Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/2025.1 7 | -------------------------------------------------------------------------------- /releasenotes/source/_static/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/releasenotes/source/_static/.placeholder -------------------------------------------------------------------------------- /releasenotes/source/_templates/.placeholder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openstack/python-neutronclient/690bb97d9dff389af273ddc517029c1612028839/releasenotes/source/_templates/.placeholder -------------------------------------------------------------------------------- /releasenotes/source/index.rst: -------------------------------------------------------------------------------- 1 | ============================== 2 | Neutron Client Release Notes 3 | ============================== 4 | 5 | .. toctree:: 6 | :maxdepth: 1 7 | 8 | unreleased 9 | 2025.1 10 | 2024.2 11 | 2024.1 12 | 2023.2 13 | 2023.1 14 | zed 15 | yoga 16 | xena 17 | wallaby 18 | victoria 19 | ussuri 20 | train 21 | stein 22 | rocky 23 | queens 24 | pike 25 | ocata 26 | newton 27 | mitaka 28 | old_relnotes 29 | -------------------------------------------------------------------------------- /releasenotes/source/mitaka.rst: -------------------------------------------------------------------------------- 1 | =================================== 2 | Mitaka Series Release Notes 3 | =================================== 4 | 5 | .. release-notes:: 6 | :branch: origin/stable/mitaka 7 | -------------------------------------------------------------------------------- /releasenotes/source/newton.rst: -------------------------------------------------------------------------------- 1 | =================================== 2 | Newton Series Release Notes 3 | =================================== 4 | 5 | .. release-notes:: 6 | :branch: origin/stable/newton 7 | -------------------------------------------------------------------------------- /releasenotes/source/ocata.rst: -------------------------------------------------------------------------------- 1 | =================================== 2 | Ocata Series Release Notes 3 | =================================== 4 | 5 | .. release-notes:: 6 | :branch: origin/stable/ocata 7 | -------------------------------------------------------------------------------- /releasenotes/source/old_relnotes.rst: -------------------------------------------------------------------------------- 1 | ================= 2 | Old Release Notes 3 | ================= 4 | 5 | 2.2.2 6 | ----- 7 | 8 | * improved support for listing a large number of filtered subnets 9 | * add --endpoint-type and OS_ENDPOINT_TYPE to shell client 10 | * made the publicURL the default endpoint instead of adminURL 11 | * add ability to update security group name (requires 2013.2-Havana or later) 12 | * add flake8 and pbr support for testing and building 13 | 14 | 2.2.0 15 | ----- 16 | 17 | * add security group commands 18 | * add Lbaas commands 19 | * allow options put after positional arguments 20 | * add NVP queue and net gateway commands 21 | * add commands for agent management extensions 22 | * add commands for DHCP and L3 agents scheduling 23 | * support XML request format 24 | * support pagination options 25 | 26 | 2.0 27 | ----- 28 | 29 | * support Neutron API 2.0 30 | -------------------------------------------------------------------------------- /releasenotes/source/pike.rst: -------------------------------------------------------------------------------- 1 | =================================== 2 | Pike Series Release Notes 3 | =================================== 4 | 5 | .. release-notes:: 6 | :branch: stable/pike 7 | -------------------------------------------------------------------------------- /releasenotes/source/queens.rst: -------------------------------------------------------------------------------- 1 | =================================== 2 | Queens Series Release Notes 3 | =================================== 4 | 5 | .. release-notes:: 6 | :branch: stable/queens 7 | -------------------------------------------------------------------------------- /releasenotes/source/rocky.rst: -------------------------------------------------------------------------------- 1 | =================================== 2 | Rocky Series Release Notes 3 | =================================== 4 | 5 | .. release-notes:: 6 | :branch: stable/rocky 7 | -------------------------------------------------------------------------------- /releasenotes/source/stein.rst: -------------------------------------------------------------------------------- 1 | =================================== 2 | Stein Series Release Notes 3 | =================================== 4 | 5 | .. release-notes:: 6 | :branch: stable/stein 7 | -------------------------------------------------------------------------------- /releasenotes/source/train.rst: -------------------------------------------------------------------------------- 1 | ========================== 2 | Train Series Release Notes 3 | ========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/train 7 | -------------------------------------------------------------------------------- /releasenotes/source/unreleased.rst: -------------------------------------------------------------------------------- 1 | ============================== 2 | Current Series Release Notes 3 | ============================== 4 | 5 | .. release-notes:: 6 | -------------------------------------------------------------------------------- /releasenotes/source/ussuri.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | Ussuri Series Release Notes 3 | =========================== 4 | 5 | .. release-notes:: 6 | :branch: stable/ussuri 7 | -------------------------------------------------------------------------------- /releasenotes/source/victoria.rst: -------------------------------------------------------------------------------- 1 | ============================= 2 | Victoria Series Release Notes 3 | ============================= 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/victoria 7 | -------------------------------------------------------------------------------- /releasenotes/source/wallaby.rst: -------------------------------------------------------------------------------- 1 | ============================ 2 | Wallaby Series Release Notes 3 | ============================ 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/wallaby 7 | -------------------------------------------------------------------------------- /releasenotes/source/xena.rst: -------------------------------------------------------------------------------- 1 | ========================= 2 | Xena Series Release Notes 3 | ========================= 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/xena 7 | -------------------------------------------------------------------------------- /releasenotes/source/yoga.rst: -------------------------------------------------------------------------------- 1 | ========================= 2 | Yoga Series Release Notes 3 | ========================= 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/yoga 7 | -------------------------------------------------------------------------------- /releasenotes/source/zed.rst: -------------------------------------------------------------------------------- 1 | ======================== 2 | Zed Series Release Notes 3 | ======================== 4 | 5 | .. release-notes:: 6 | :branch: unmaintained/zed 7 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # Requirements lower bounds listed here are our best effort to keep them up to 2 | # date but we do not test them so no guarantee of having them all correct. If 3 | # you find any incorrect lower bounds, let us know or propose a fix. 4 | pbr!=2.1.0,>=2.0.0 # Apache-2.0 5 | cliff>=3.4.0 # Apache-2.0 6 | debtcollector>=1.2.0 # Apache-2.0 7 | netaddr>=0.7.18 # BSD 8 | openstacksdk>=1.5.0 # Apache-2.0 9 | osc-lib>=1.12.0 # Apache-2.0 10 | oslo.i18n>=3.15.3 # Apache-2.0 11 | oslo.log>=3.36.0 # Apache-2.0 12 | oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0 13 | oslo.utils>=3.33.0 # Apache-2.0 14 | os-client-config>=1.28.0 # Apache-2.0 15 | keystoneauth1>=3.8.0 # Apache-2.0 16 | # keystoneclient is used only by neutronclient.osc.utils 17 | # TODO(amotoki): Drop this after osc.utils has no dependency on keystoneclient 18 | python-keystoneclient>=3.8.0 # Apache-2.0 19 | requests>=2.14.2 # Apache-2.0 20 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 Hewlett-Packard Development Company, L.P. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 | # implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | import setuptools 17 | 18 | setuptools.setup( 19 | setup_requires=['pbr>=2.0.0'], 20 | pbr=True) 21 | -------------------------------------------------------------------------------- /test-requirements.txt: -------------------------------------------------------------------------------- 1 | hacking>=6.1.0,<6.2.0 # Apache-2.0 2 | 3 | bandit!=1.6.0,>=1.1.0 # Apache-2.0 4 | coverage!=4.4,>=4.0 # Apache-2.0 5 | fixtures>=3.0.0 # Apache-2.0/BSD 6 | flake8-import-order>=0.18.0,<0.19.0 # LGPLv3 7 | oslotest>=3.2.0 # Apache-2.0 8 | osprofiler>=2.3.0 # Apache-2.0 9 | python-openstackclient>=3.12.0 # Apache-2.0 10 | python-subunit>=1.0.0 # Apache-2.0/BSD 11 | requests-mock>=1.2.0 # Apache-2.0 12 | stestr>=2.0.0 # Apache-2.0 13 | testtools>=2.2.0 # MIT 14 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | envlist = py39,pep8 3 | minversion = 3.18.0 4 | skipsdist = False 5 | ignore_basepython_conflict = True 6 | 7 | [testenv] 8 | basepython = python3 9 | setenv = VIRTUAL_ENV={envdir} 10 | LANG=en_US.UTF-8 11 | LANGUAGE=en_US:en 12 | LC_ALL=C 13 | PYTHONWARNINGS=default::DeprecationWarning 14 | usedevelop = True 15 | deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} 16 | -r{toxinidir}/requirements.txt 17 | -r{toxinidir}/test-requirements.txt 18 | # Delete bytecodes from normal directories before running tests. 19 | # Note that bytecodes in dot directories will not be deleted 20 | # to keep bytecodes of python modules installed into virtualenvs. 21 | commands = bash -c "find . -type d -name '.?*' -prune -o \ 22 | \( -type d -name '__pycache__' -o -type f -name '*.py[co]' \) \ 23 | -print0 | xargs -0 rm -rf" 24 | stestr run {posargs} 25 | allowlist_externals = bash 26 | 27 | [testenv:pep8] 28 | commands = 29 | flake8 30 | {[testenv:bandit]commands} 31 | distribute = false 32 | 33 | [testenv:venv] 34 | commands = {posargs} 35 | 36 | [testenv:cover] 37 | setenv = 38 | {[testenv]setenv} 39 | PYTHON=coverage run --source neutronclient --parallel-mode 40 | commands = 41 | stestr run {posargs} 42 | coverage combine 43 | coverage html -d cover 44 | coverage xml -o cover/coverage.xml 45 | coverage report 46 | 47 | [testenv:docs] 48 | deps = 49 | -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} 50 | -r{toxinidir}/doc/requirements.txt 51 | commands = sphinx-build -W -b html doc/source doc/build/html 52 | 53 | [testenv:pdf-docs] 54 | deps = {[testenv:docs]deps} 55 | allowlist_externals = 56 | make 57 | commands = 58 | sphinx-build -W -b latex doc/source doc/build/pdf 59 | make -C doc/build/pdf 60 | 61 | [testenv:releasenotes] 62 | deps = 63 | -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} 64 | -r{toxinidir}/doc/requirements.txt 65 | commands = sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html 66 | 67 | [flake8] 68 | # E126 continuation line over-indented for hanging indent 69 | # E128 continuation line under-indented for visual indent 70 | # H405 multi line docstring summary not separated with an empty line 71 | # I202 Additional newline in a group of imports 72 | # N530 direct neutron imports not allowed 73 | # TODO(amotoki) check the following new rules should be fixed or ignored 74 | # E731 do not assign a lambda expression, use a def 75 | # W504 line break after binary operator 76 | ignore = E126,E128,E731,I202,H405,N530,W504 77 | show-source = true 78 | exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools 79 | import-order-style = pep8 80 | 81 | # H106: Don't put vim configuration in source files 82 | # H203: Use assertIs(Not)None to check for None 83 | # H204: Use assert(Not)Equal to check for equality 84 | # H205: Use assert(Greater|Less)(Equal) for comparison 85 | # H904: Delay string interpolations at logging calls 86 | enable-extensions=H106,H203,H204,H205,H904 87 | 88 | [testenv:bandit] 89 | # B303: blacklist calls: md5, sha1 90 | # B105: The software contains a hard-coded password, which it uses for its own 91 | # inbound authentication or for outbound communication to external 92 | # components. 93 | deps = -r{toxinidir}/test-requirements.txt 94 | commands = bandit -r neutronclient -x tests -n5 -s B303,B105 95 | --------------------------------------------------------------------------------