Matteo Scandolo | 48d3d2d | 2017-08-08 13:05:27 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain 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, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Chetan Gaonker | 80933a0 | 2017-02-15 02:04:34 +0000 | [diff] [blame] | 17 | import os |
| 18 | |
| 19 | def get_credentials(): |
| 20 | n = {} |
| 21 | n['username'] = os.environ['OS_USERNAME'] |
| 22 | n['password'] = os.environ['OS_PASSWORD'] |
| 23 | n['auth_url'] = os.environ['OS_AUTH_URL'] |
| 24 | n['tenant_name'] = os.environ['OS_TENANT_NAME'] |
| 25 | return n |
| 26 | |
| 27 | def get_cinder_credentials(): |
| 28 | n = [os.environ['OS_USERNAME'], os.environ['OS_PASSWORD'], |
| 29 | os.environ['OS_TENANT_NAME'], os.environ['OS_AUTH_URL']] |
| 30 | return n |
| 31 | |
| 32 | def get_ceilo_credentials(): |
| 33 | n = {} |
| 34 | n['os_username'] = os.environ['OS_USERNAME'] |
| 35 | n['os_password'] = os.environ['OS_PASSWORD'] |
| 36 | n['os_auth_url'] = os.environ['OS_AUTH_URL'] |
| 37 | n['os_tenant_name'] = os.environ['OS_TENANT_NAME'] |
| 38 | return n |
| 39 | |
| 40 | def get_nova_credentials(): |
| 41 | n = {} |
| 42 | n['username'] = os.environ['OS_USERNAME'] |
| 43 | n['api_key'] = os.environ['OS_PASSWORD'] |
| 44 | n['auth_url'] = os.environ['OS_AUTH_URL'] |
| 45 | n['project_id'] = os.environ['OS_TENANT_NAME'] |
| 46 | return n |
| 47 | |
| 48 | def get_nova_credentials_v2(): |
| 49 | n = {} |
Chetan Gaonker | 80933a0 | 2017-02-15 02:04:34 +0000 | [diff] [blame] | 50 | n['username'] = os.environ['OS_USERNAME'] |
| 51 | n['api_key'] = os.environ['OS_PASSWORD'] |
| 52 | n['auth_url'] = os.environ['OS_AUTH_URL'] |
| 53 | n['project_id'] = os.environ['OS_TENANT_NAME'] |
| 54 | return n |
| 55 | |
| 56 | def get_nova_credentials_v3(): |
| 57 | n = {} |
| 58 | n['version'] = '3' |
| 59 | n['username'] = os.environ['OS_USERNAME'] |
| 60 | n['password'] = os.environ['OS_PASSWORD'] |
| 61 | n['project_id'] = os.environ['OS_TENANT_NAME'] |
| 62 | n['auth_url'] = os.environ['OS_AUTH_URL'] |
| 63 | return n |
| 64 | |
| 65 | def get_nova_credentials_v11(): |
| 66 | n = {} |
| 67 | n['version'] = '1.1' |
| 68 | n['username'] = os.environ['OS_USERNAME'] |
| 69 | n['api_key'] = os.environ['OS_PASSWORD'] |
| 70 | n['auth_url'] = os.environ['OS_AUTH_URL'] |
| 71 | n['project_id'] = os.environ['OS_TENANT_NAME'] |
| 72 | return n |