27 Commits

Author SHA1 Message Date
Stephen Finucane
6475dc58e8 Blacken openstackclient.network
Black used with the '-l 79 -S' flags.

A future change will ignore this commit in git-blame history by adding a
'git-blame-ignore-revs' file.

Change-Id: I8048746dbc2ef0cb582f68934734db4c1153d779
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2023-05-10 10:51:30 +01:00
Monty Taylor
372f7caa08 Make Profile fallback go bye-bye
It's time to move on with life.

(dtroyer) This requires sdk >= 0.10.0 (0.9.19 is in
global-requirements.txt) and osc-lib >= 1.8.0 (1.8.0 is already in g-r).
Once we have sdk bumped make_client() becomes just a pass-through for
the plugin interface and existing code compatibility.

Change-Id: Ie3d7c442da4257b11140c109e9df69b629336f42
2018-03-14 10:57:13 -05:00
Monty Taylor
5e411fbce7
Fix use of new openstacksdk connection
We store the created conn on the instance, but we never pull it back off
if there is already one present.

Change-Id: I2d890dd206d4ddf67fa42d798e6fd2c652799785
2018-01-23 08:08:26 -06:00
Dean Troyer
a018c6d5d8
Rework Network client config for new SDK Connection
network.client.make_client() has always put a copy of it's SDK Connection
directly into ClientManager, the new-style Connection create will move
into osc-lib ClientManager, do it here too until then.

Change-Id: I1edfd19c9e73320768fb9640931fafe857c980b4
2018-01-22 16:51:03 -06:00
Dean Troyer
1d914dd9ad Fix SDK Connection creation alternative to Profile
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
2017-12-07 08:10:23 -06:00
Monty Taylor
80da4d6cf8
Add logic to handle old and new sdk constructor
SDK is removing Profile, but currently has compat code to support this
invocation in OSC. While the intent is to protect people from upgrade
breakage, it's python, and packaging things have a tendency to get
strange. By putting in a little belt and suspenders if block here, we
can hopefully protect folks who upgrade sdk for some reason without
upgrading python-openstackclient.

Change-Id: Id678e97a2b99dbbfc772acc8c6ba283db551723d
2017-11-16 08:09:11 -06:00
Dean Troyer
73809a98ed Remove remaining uses of SDK Proxy.session
SDK commit Ie67c240e3caa5e100ce07db3862718195c894748 exposed lingering uses
of Proxy.session in OSC.  Get rid of them.

Change-Id: Icab230f1897a446cf3deb0e3d0550d24e11a0ef3
2017-02-19 15:47:20 -06:00
Dean Troyer
6a15f90dae osc-lib: shell
Convert to using ClientManager and OpenStackShell from osc-lib.
* Change all internal uses of ClientManager private attributes that are
  now public in osc-lib's ClientManager.  Leave back-compat copies in
  place in OSC's clientManager so we don't break plugins.
* Put some work-arounds in place for changes in osc-lib that we need until
  a new release makes it through the g-r and u-c change process.
* Add a test for Unicode decoding of argv in shell.main() to parallel
  the one in osc-lib.

Change-Id: I85289740d4ca081f2aca8c9b40ec422ad25d302c
2016-08-05 13:48:55 -05:00
Stuart McLaren
7c603e4a67 Ensure endpoint type is used for network commands
Currently OS_ENDPOINT_TYPE and --os-interface are being ignored for
network commands. This means the public URL is always used.

Make sure that these are picked up correctly so we hit the correct
endpoint (internal/admin/etc.) for commands such as:

 $ openstack --os-interface internal network list

Change-Id: Iac05204e3056e386d84d3644b5da1a2bb322bb0a
Closes-bug: 1592368
2016-06-14 11:20:16 +00:00
Dean Troyer
e5e29a8fef osc-lib: utils
Use osc-lib directly for utils.

Leave openstackclient.common.utils for deprecation period.

Change-Id: I5bd9579abc4e07f45219ccd0565626e6667472f7
2016-06-13 10:50:44 -05:00
Tang Chen
5a3a7867a8 Trivial: Fix i18n support in network/common.py
Some missing i18n problems in network.

Change-Id: I45a09a6ada1aad5a64256c0d0a0a2b6e250df670
2016-05-31 20:31:28 +08:00
Cedric Brandily
02a46a067b Fix client certificate/key support for Network v2 commands
Currently network v2 commands don't support client certificate/key
because they were not passed to OpenStackSDK Connection which is used
by network v2 commands.

This changes corrects the integration with OpenStacKSDK to pass client
certificate/key.

Closes-Bug: #1569513
Related-Bug: #1569508
Depends-On: Ic093f8515e7b15931994e4516ebec8f4399d021e
Change-Id: Ie37e8e988ca695a09894c6c93560dacd83f17030
2016-04-19 13:00:54 +02:00
Andrey Larionov
8c6b5a087a Initialize neutron client with region name
All clients except neutron are initialized with region name.
This makes unable to use network related commands of
openstackclient in multi-region configurations

Change-Id: I200dc9a2f938c3e69357f91c79810df167e4fccb
Closes-bug: 1570491
2016-04-18 19:54:58 +03:00
Richard Theis
b5f10f43eb Fix SSL/TLS verification for network commands
The network commands ignored the --insecure and --os-cacert
options and OS_CACERT environment variable which prevented
them from properly completing SSL/TLS verification. This
resulted in the network commands failing with
"An SSL error occurred."

Change-Id: I15167631ef58335e1476c16b828b079e3b0f13c1
Closes-Bug: #1560157
2016-04-08 09:33:33 -05:00
Tang Chen
4be716eb27 Migrate network client to SDK.
The previous patches have migrate all network commands to
the new version using sdk. This patch will remove the
temporary method, and implement a new make_client() to
create sdk network client.

And also, find() in openstackclient/network/common.py must
support sdk. The logic of this function will become much
easier than before, so this patch also removes two useless
test cases of find().

This patch will also remove the patched methods in tests.

Change-Id: Ic2f7bca073beb9757172d16f95d9b82c48cbbc12
Implements: blueprint neutron-client
Co-Authored-By: Terry Howe <terrylhowe@gmail.com>
Co-Authored-By: Tang Chen <tangchen@cn.fujitsu.com>
2015-12-09 09:30:29 +08:00
Monty Taylor
441543d67f Set default network api to 2.0 instead of 2
neutronclient expects 2.0 as the version if you go through the discovery
constructor. For that reason, 2.0 is the 'correct' version to set in
config files or environment variables for if you're using things that
are not OSC. However, if you do that, OSC prints a warning that 2.0 is
not in the supported network version list.

Let's support both so that users don't get a confuse.

Change-Id: I7412519693f75fcd29f5621ce9e5a2df2da92684
2015-11-09 09:31:37 -05:00
TerryHowe
b3335b3474 Do not set default versions in parsed args
Setting default versions in parsed args makes it so OCC
cannot tell if the argument was parsed, an environment
variable was set or it is just defaulted.  In order to
set api versions from OCC, it will have to be defaulted
after processing OCC.

Closes-Bug: #1453229
Change-Id: I4d065919397b783f3bdd4022c986c0234a7a16e6
2015-07-18 06:28:09 -06:00
TerryHowe
36391a81a3 Rename endpoint type to interface
Change-Id: I4e21d09bc747e8210f4f79a1d6c4c7ccf2f25d1c
Closes-Bug: #1454392
2015-07-15 10:11:59 -06:00
Roxana Gherle
5521e4c504 Add --os-endpoint-type cli optional argument
User should be able to specify the endpoint type through
a CLI optional argument/ENV variable setting. We will name this new
optional argument: --os-endpoint-type (Env: OS_ENDPOINT_TYPE) and
based on the value given, the service API will use that specific
endpoint type. Possible values: public, admin, internal.

DocImpact
Closes-Bug: #1454392
Change-Id: Ife3d4e46b44c0ddcd712b1130e27e362545a9a29
2015-07-02 10:10:46 -07:00
Dean Troyer
748e0ab6ce Begin low-level API for Network v2
api.network.APIv2 starts with network_list() support to flush out
the skeleton of the Network API.

list_dhcp_agent() supports the --dhcp option of 'network list'

Change-Id: I9a2b90cde84eced1f2ea6a014b769e2bae668211
2015-01-22 10:06:15 -06:00
Vladimir Eremin
3296781b2c Use session for neutron client
python-openstack client is now using sessions to create clients. This
patch implements creating Network client using sessions.

Related to c3c6edbe8a083aef0fb6aea3cb461ff8e715fc59

Change-Id: If90ac705eb11dfc1e3abbe2ce18c3d8ccefdbdfb
Closes-Bug: 1411179
2015-01-15 10:33:39 +00:00
Dean Troyer
2166d7d3af Remove ClientManager._service_catalog
Anything that needs a service catalog can get it directly from
auth_ref.service_catalog, no need to carry the extra attribute.

ClientManager.get_endpoint_for_service_type() reamins the proper
method to get an endpoint for clients that still need one directly.

Change-Id: I809091c9c71d08f29606d7fd8b500898ff2cb8ae
2014-10-18 00:01:52 -05:00
Dean Troyer
0de67016c7 Remove now-unnecessary client creation hacks
Clients that can use ksc Session don't need the old junk to
fake auth anymore:
* compute
* volume

Clients that still need to be fed credentials can pick directly
from the auth object in clientmanager.  The _token attribute is
removed, the token can be retrieved from the auth object:

  openstackclient/tests/common/test_clientmanager.py

This change will break any plugin that relies on getting a token
from instance._token. They should be updated to use the above, or
preferable, to use keystoneclient.session.Session to create its
HTTP interface object.

Change-Id: I877a29de97a42f85f12a14c274fc003e6fba5135
2014-10-18 00:01:45 -05:00
Monty Taylor
3af547a1a6 Fix operation on clouds with availability-zones
In a cloud with AZs, you can get multiple entries back from the service
catalog - one for each AZ and then one that is AZ agnostic that's tied
to the region. If the region_name is plumbed all the way through, this
works as intended.

Change-Id: I3b365ea306e8111fc80830672ae8080a5d1dc8e0
2014-10-11 14:30:04 -07:00
Dean Troyer
21bd4619ae Clean up make_client() logging
Change-Id: I0b6760a6401b50e3dfb891af75424ae89df42ebc
2014-07-08 01:44:55 -05:00
Terry Howe
b157dc937e Move network stuff to v2 instead of v2_0
Rename network stuff v2

Change-Id: Ia9b8feda20dfd35b0f3712b8e2419d0bf5da0acd
2014-07-07 06:08:02 -06:00
Terry Howe
8f59524c3e Network CRUD
bp/neutron
https://wiki.openstack.org/wiki/OpenStackClient/Commands#Network_2

Change-Id: I89ee083154afa544b03587e84becace36d9d522a
2014-06-24 15:00:25 -06:00