summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit
Commit message (Collapse)AuthorAgeFilesLines
* Handle multiple ports in AddFloatingIPqueens-em3.14.3melanie witt2018-11-081-8/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AddFloatingIP refers to an old nova proxy API to neutron that was deprecated in nova. The neutron API for floating IP associate requires a port to be specified. Currently, the code is selecting the first port if the server has multiple ports. But, an attempt to associate the first port with a floating IP can fail if the first port is not on a network that is attached to an external gateway. In order to make the command work better for users who have a server with multiple ports, we can: 1. Select the port corresponding to the fixed_ip_address, if one was specified 2. Try to associate the floating IP with each port until one of the attempts succeeds, else re-raise the last exception. (404 ExternalGatewayForFloatingIPNotFound from neutron) This also fixes incorrect FakeFloatingIP attributes that were being set in the TestServerAddFloatingIPNetwork unit tests, which were causing the tests to use None as parsed args for ip-address and --fixed-ip-address and thus bypassing code in the 'if parsed_args.fixed_ip_address:' block. Task: 27800 Story: 2004263 Change-Id: I11fbcebf6b00f12a030b000c84dcf1d6b5e86250 (cherry picked from commit 013c9a4f3a44cb0b81fc7affe9b933e701cb5dba) (cherry picked from commit e09c358e7b35ac938595aad90c5c42dfe402a42a)
* Merge "Default --nic to 'auto' if creating a server with >= 2.37" into ↵Zuul2018-11-022-0/+52
|\ | | | | | | stable/queens
| * Default --nic to 'auto' if creating a server with >= 2.37Matt Riedemann2018-10-252-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Compute API version >= 2.37 requires a 'networks' value in the server create request. The novaclient CLI defaults this to 'auto' if not specified, but the novaclient ServerManager.create python API binding code does not, as it wants clients to be explicit. For the purposes of the OSC CLI, we should follow suit and if the user is requesting OS_COMPUTE_API_VERSION>=2.37 without specific nics, we should just default to 'auto'. Change-Id: Ib760c55e31209223338a4086ff1f4fee88dc6959 Closes-Bug: #1750395 (cherry picked from commit 1008544882fbdae16b045abca05cf3e2e8a14787) (cherry picked from commit 4944d4eaa9aaeffdee358680550ac7d7f0c6e8d8)
* | Merge "Allow endpoint filtering on both project and project-domain" into ↵Zuul2018-11-021-0/+41
|\ \ | |/ |/| | | stable/queens
| * Allow endpoint filtering on both project and project-domainJulie Pichon2018-10-151-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | The --project and --project-domain flags are currently mutually exclusive for listing endpoints, however the --project-domain argument is supposed to help with filtering projects with colliding names. They should be allowed together. Story: 2004018 Task: 27006 Change-Id: I7340e01f509e3515f07cb46f175fb603f1ce8b67 (cherry picked from commit 91a2d888625488da3f65ad372b4248e9747b9a3e)
* | Don't sent disk_over_commit if nova api > 2.24Artom Lifshitz2018-10-251-0/+35
|/ | | | | | | | | | | In API microversion 2.25 Nova removed the disk_over_commit parameter to the live migration server action. This patch makes sure that we don't include it in our request if we're running with 2.25 or higher. Story: #2002963 Task: #22966 Change-Id: I1bbdd33be96d82422a05982508e370237c3560f3 (cherry picked from commit d6121782d3aa6a95b883220b27a154e641b61f7f)
* Merge "Fix 'project purge' deleting wrong project's servers and volumes" ↵Zuul2018-10-031-12/+18
|\ | | | | | | into stable/queens
| * Fix 'project purge' deleting wrong project's servers and volumesJulie Pichon2018-09-171-12/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Project purge would delete the servers and volumes for the project the user is currently authenticated for, regardless of the --project flag. Note: This change means that no server at all will be deleted if the logged in user doesn't have the get_all_tenants permission set in the Nova policy (default: admin_api). This doesn't appear to be an issue with Cinder as the default rule appears to be admin_or_owner. Change-Id: If1c54e24e1482438b81c3c32fd5fc9fdd7a7be04 Story: 1747988 Task: 26495 (cherry picked from commit 1b66ad9067cc404ebfdc8569822d226d5bffddd6)
* | Do not require port argument when updating floating IPyanpuqing2018-08-211-0/+64
|/ | | | | | | | | | | | | | | | | | | When setting floating ip other properties, port argument is force to use. The patch modifies the command, when setting floating ip other properties, like tags, no need port argument. Change-Id: I908712c8913f32d3dd5fdfefe7347277d72f66de Story: 1751431 Task: 13865 Closes-Bug: #1778666 (cherry picked from commit 402c9a21b347509520be206e28ee7d0ef4004b92) Small changes due to changes in tag handling and how unit tests are working. Conflicts: doc/source/cli/command-objects/floating-ip.rst openstackclient/network/v2/floating_ip.py openstackclient/tests/unit/network/v2/test_floating_ip_network.py
* Re-implement novaclient bits removed in 10.03.14.2Dean Troyer2018-04-204-80/+410
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a) /os-floating-ips was removed in Compute API 2.36 and from novaclient's Python API in 10.0 Add to api.computev2: floating_ip_add() floating_ip_remove() Convert add floating IP command to nova-net/neutron split: "server add floating ip" "server remove floating ip" b) /os-hosts was removed in Compute API 2.43 and from novaclient's Python API in 10.0. Add to api.computev2: host_list() host_set() host_show() Convert host commands to use intenal api: "host list" "host set" "host show" c) The introduction of the Network-style commands into the server group broke cliff's autoprogram directive as it executes the get_parser() methods without fully initializing the Command object. NOTE: This is really three reviews squashed to get through the gate in one pass. Closes-Bug: #1745795 Change-Id: I5116086f9a9e4b2b31a744bf8f4558c79f0bfe59 (cherry picked from commit 53e7aab7ed4d6c981ca067c1db8bce290a5f0055)
* neutron: add --mtu for create/set network3.14.1Emilien Macchi2018-03-262-0/+10
| | | | | | | | Support Neutron network mtu configuration with a new argument, --mtu that allows CLI users to set MTU for Neutron networks. Change-Id: I93d23581c7e8c84eaf9bb3b293360036f60f456b (cherry picked from commit 18563b4132f794cc6612c2897795f96a31b565ae)
* Merge "Check that Glance returns image data before processing it"Zuul2018-01-221-0/+51
|\
| * Check that Glance returns image data before processing itMike Fedosin2018-01-051-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now if Glance v2 cannot find image data it returns an empty response with 204 status code, instead of raising an error. Glance client handles this situation and wraps the response with a RequestIdProxy object, whose 'wrapped' attribute is None. But when openstack client tries to parse this object using glanceclient's save_image util function, it fails with "NoneType object is not iterable" message, for the object doesn't contain any data. This patch adds additional check to prevent such behaviour and raises SystemExit exception if no data was returned from the server. Glance v1 is not affected, because it raises an error if can't find an image data. Change-Id: I016a60462ba586f9fa7585c2cfafffd7be38de7b Closes-Bug: #1741223
* | Merge "Add floating IP qos_policy actions"Zuul2018-01-112-0/+130
|\ \
| * | Add floating IP qos_policy actionsLIU Yulong2018-01-112-0/+130
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now we can associate a qos policy to the floating IP, and dissociate it. The commands are: $ openstack floating ip create --qos-policy ... $ openstack floating ip set --qos-policy ... $ openstack floating ip set --no-qos-policy ... $ openstack floating ip unset --qos-policy These commands are based on the neutron change: I4efe9e49d268dffeb3df4de4ea1780152218633b Partially-Implements blueprint: floating-ip-rate-limit Change-Id: I932b32f78cc5a2b53926feaec1a0b392cf7e8b57
* | Allow ports filtering with device_idHongbin Lu2018-01-031-0/+19
|/ | | | | | | | | | Right now, if a neutron port is owned by a container powered by Kuryr, there is no way to list and filter those ports because OSC assumed a neutron port is owned by either a server or router. This patch adds support for that by introducing an option '--device-id' to the 'port list' command. Change-Id: Ib1fd27e8d843a99fb02ccabd8a12a24ac27cec9c
* Merge "Send 'changes-since' instead of 'changes_since' query parameter"3.13.0Zuul2017-12-131-2/+2
|\
| * Send 'changes-since' instead of 'changes_since' query parameterDaniel Speichert2017-12-111-2/+2
| | | | | | | | | | | | | | | | | | | | Per API reference, only 'changes-since' is accepted and the variant with underscore is ignored, making the CLI functionality broken. [dtroyer] added release note and fixed unit tests. Change-Id: I0c596531a8af03da17d5ce39d75b12e941403aa5 Closes-Bug: 1732216
* | Merge "Add support for endpoing filter commands"Zuul2017-12-132-0/+166
|\ \
| * | Add support for endpoing filter commandsJose Castro Leon2017-11-212-0/+166
| |/ | | | | | | | | | | | | | | | | Implements the commands that allow to link and endpoint to a project for endpoint filter management. Implements: blueprint keystone-endpoint-filter Change-Id: Iecf61495664fb8413d35ef69f07ea929d190d002
* | Merge "Fix credentials in create, update and list."Zuul2017-12-111-14/+0
|\ \
| * | Fix credentials in create, update and list.yangweiwei2017-11-171-14/+0
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Now, keystone has supported serverl auth method, like 'totp'. Before we use this method, we should create the credential first. And we need create it with type 'totp'. But now we cannot create credential with this method. Also, I think the type should not have constrains. We can create any type in keystone project. So, we should do these actions too. The type would be more which We cannot control. Change-Id: Ie0482da3133fb515e4bb8e45f8c54f509589cc5e Closes-bug: #1731848
* | Fix SDK Connection creation alternative to ProfileDean Troyer2017-12-071-4/+16
| | | | | | | | | | | | | | | | | | Do a dummy import to determine which SDK is installed (Pre/post merge). This solves the DevStack error "Cloud defaults was not found" in -tips jobs. Depends-On: Ia111f127fbdceac2afe20fd9d1fe032145cdd72c Change-Id: I60c2d418dd5a393eee2cc2a5c2fdebfffdabf2d3
* | Remove a bunch of things we promised to remove in 2H 2017Dean Troyer2017-11-301-1/+1
| | | | | | | | Change-Id: I060559fe13e354fe87551cd9dd82774bddb54640
* | Remove hard-coded policy choices for creating a server groupMatt Riedemann2017-11-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | The hard-coded choices for the server group policy make it impossible to create a server group with the soft-affinity or soft-anti-affinity policy rules which were added in compute API microversion 2.15. This removes the hard-coded choices so that the policy is restricted on the server side rather than the client side. Change-Id: Ib3dc39422ac1015872d56ae2fdeddf0f29613494 Closes-Bug: #1732938
* | Merge "Network: Add interfaces info in router show"Zuul2017-11-161-4/+19
|\ \
| * | Network: Add interfaces info in router showycx2017-11-151-4/+19
| |/ | | | | | | | | | | | | | | | | | | | | | | Add a list of interfaces info in the output of 'openstack router show'. The information of router interface are: IP address, subnet ID and port ID. Co-Authored-By: Dongcan Ye <hellochosen@gmail.com> Change-Id: I1252986122122defffe795292b83dc4e84481c7e Closes-Bug: #1675489
* | Add RemoveNetwork command to serverHongbin Lu2017-11-141-0/+51
|/ | | | | | | This command will detach a server from a network. All server's neutron ports that belongs to the specified networks will be removed. Change-Id: I83a064ed62ab00c6f1016900b9cf30f1c15b8382
* Merge "Neutron agent delete: remove the wrong argument"Zuul2017-11-071-16/+7
|\
| * Neutron agent delete: remove the wrong argumentnpraveen352017-11-061-16/+7
| | | | | | | | | | | | | | | | | | | | The take_action() function was calling get_agent() with the wrong attribute, causing agent deletion to fail. It turns out calling get_agent() isn't necessary; this removes the call entirely and moves the 'ignore_missing' argument to the delete_agent() function. Change-Id: Iaa3754a3be0765112f396495fa5fb2e32e6eae4e Closes-Bug: #1711301
* | Merge "Network: Add supports rbac target-all-projects"Zuul2017-11-071-0/+24
|\ \ | |/ |/|
| * Network: Add supports rbac target-all-projectsDongcan Ye2017-11-051-0/+24
| | | | | | | | | | | | | | | | | | Add a boolean option "target-all-projects", which allows creating rbac policy for all projects. Change-Id: Ie3af83a1bba7dd66e83b0595bb276bf8fd105831 Closes-Bug: #1728525 Closes-Bug: #1704834
* | Merge "Display Network QoS rule type details"Zuul2017-11-061-0/+55
|\ \
| * | Display Network QoS rule type detailsSławek Kapłoński2017-11-051-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Neutron API now supports getting details of supported QoS rule type. This patch adds support for this feature to OpenStack client. Change-Id: I74d16563ce2236a7c899f5994f1dab43ace02138 Depends-On: I448b5d4f8e4ef42eafe50d9d6c63d0be666f98fc Related-Bug: #1686035
* | | Rehome test units libPierre Hanselmann2017-11-023-3/+5
| |/ |/| | | | | | | | | Rehoming deprecated libs for the ones provided in osc-lib. Change-Id: Idb4a27f2c8edf48909ef010e3c7a1a5c0c16efc5
* | Merge "Added AddNetwork command to server"Zuul2017-10-301-0/+47
|\ \
| * | Added AddNetwork command to serverHongbin Lu2017-10-261-0/+47
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Currently, if users want to add another NIC to a running instance, they need to (i) create a neutron port and (ii) add the port to the server via teh AddPort command. It would be more convenient to have a single command to achieve the equivalent. Novaclient already support adding network to an instance via the interface-attach command. This patch introduces a similar capability in OSC. Change-Id: Ia3e39c57ae7ecb96aae1b66adc52c289daccb6ec
* | Add server rescue unit testsDean Troyer2017-10-271-0/+85
|/ | | | | | Added to support the new options to server rescue command. Change-Id: Ia9dca85e05488fa8d5f57cd5e8920e94b8f65c22
* Merge "Allow creating security rules without protocol"Zuul2017-10-211-0/+30
|\
| * Allow creating security rules without protocolDaniel Speichert2017-10-171-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | In order to create a rule for any protocol, the client must not specify the protocol in the API call. This is currently impossible because protocol defaults to TCP. In order not to change the default behavior, a "new" protocol name is added: "any", which makes this CLI skip sending the protocol field altogether. Change-Id: I58853d3745f3631007e5e9780c0c5c2526b730a3 Closes-Bug: 1712242
* | Merge "Accept 0 for --min-disk and --min-ram"Zuul2017-10-212-0/+52
|\ \ | |/ |/|
| * Accept 0 for --min-disk and --min-ramShogoAdachi2017-10-202-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The current openstackclient implementation cannot accept 0 for --min-disk and --min-ram with the "openstack image set" command. If theses options get set to 0, the option parser in openstackclient wrongly interprets 0 as no option value. The 0 is valid for these options if administrators want to make it the default(no minimum requirements). This patch fix the parser so that it avoids only 'None'. Change-Id: Ie8ee37484c02c26f54adc56263fcd167c0ce7eb3 Closes-bug: #1719499
* | Merge "Optimize getting endpoint list"Jenkins2017-10-131-0/+2
|\ \
| * | Optimize getting endpoint listAnton Frolov2017-09-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently ListEndpoint.take_action method unconditionally iterates over all endpoints and issue GET /v3/services/<ep.service_id> request for each endpoint. In case of HTTPS keystone endpoint this can take significant amout of time, and it only getting worse in case of multiple regions. This commit change this logic to making just two GET requests: first it gets endpoint list, then it gets service list, searching service in the list instead of issuing GET /v3/services/<id> request. Change-Id: I22b61c0b45b0205a2f5a4608c2473cb7814fe3cf Closes-Bug: 1719413
* | | Support creating unaddress neutron portHongbin Lu2017-09-291-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce an option '--no-fixed-ip' on port create command. If this option is specified and '--fixed-ip' is unspecified, OSC will send a request to neutron with 'fixed_ips' as an empty list, which will create an unaddress neutron port. Note: The use cases of unaddress port was outlined in: https://specs.openstack.org/openstack/neutron-specs/specs/liberty/unaddressed-port.html (dtroyer: add Depends-On for Zuul v3 test) Depends-On: I39e8e49243ab0bda631600715c971c55a34e2fd9 Change-Id: Ibe38598acbbcd0d353c952fc2a6fa67780762151 Closes-Bug: #1717829
* | | Merge "Support icmp-type and icmp-code to be set as zero"Jenkins2017-09-271-0/+170
|\ \ \
| * | | Support icmp-type and icmp-code to be set as zerogvrangan2017-09-261-0/+170
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | When icmp-type or icmp-code are set to 0, the current implementation ignores the value, this fix will allow the value to be copied and displayed Change-Id: I96133a57883d22e98fcbb9fe0328d9e050472469 Signed-off-by: gvrangan <venkatrangang@hcl.com>
* | | Fix 'project purge' deletes ALL images problemlihaijing2017-09-263-12/+14
|/ / | | | | | | | | Closes-Bug: #1717130 Change-Id: I33c6fc7897dfee85d1c197a1267bde4abfa5bbd9
* | Correct import of keystoneauth1 sessionGage Hugo2017-09-121-1/+1
|/ | | | | | | | keystoneclient.session has been long deprecated in favor of keystoneauth1.session. This change corrects the import in the tests to use the correct library's session. Change-Id: Ic24ebde59e4b9eb70d6f14c1e0536f8d24f0de73
* Merge "flake8-import-order: Ensure to place project imports last"Jenkins2017-08-242-3/+3
|\