osi-dump 0.1.3.2.1__py3-none-any.whl → 0.1.3.2.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- osi_dump/api/neutron.py +36 -15
- osi_dump/api/octavia.py +34 -6
- osi_dump/api/placement.py +25 -3
- osi_dump/exporter/load_balancer/excel_load_balancer_exporter.py +3 -2
- osi_dump/util/openstack_util.py +26 -0
- {osi_dump-0.1.3.2.1.dist-info → osi_dump-0.1.3.2.2.dist-info}/METADATA +1 -1
- {osi_dump-0.1.3.2.1.dist-info → osi_dump-0.1.3.2.2.dist-info}/RECORD +10 -10
- {osi_dump-0.1.3.2.1.dist-info → osi_dump-0.1.3.2.2.dist-info}/WHEEL +0 -0
- {osi_dump-0.1.3.2.1.dist-info → osi_dump-0.1.3.2.2.dist-info}/entry_points.txt +0 -0
- {osi_dump-0.1.3.2.1.dist-info → osi_dump-0.1.3.2.2.dist-info}/top_level.txt +0 -0
osi_dump/api/neutron.py
CHANGED
@@ -10,34 +10,55 @@ logger = logging.getLogger(__name__)
|
|
10
10
|
|
11
11
|
|
12
12
|
def get_floating_ip_project(connection: Connection, floating_ip_id: str):
|
13
|
-
neutron_endpoint = os_util.get_endpoint(
|
13
|
+
# neutron_endpoint = os_util.get_endpoint(
|
14
|
+
# connection=connection, service_type="network", interface="public"
|
15
|
+
# )
|
16
|
+
|
17
|
+
neutron_endpoints = os_util.get_endpoints(
|
14
18
|
connection=connection, service_type="network", interface="public"
|
15
19
|
)
|
16
20
|
|
17
|
-
|
18
|
-
url = f"{neutron_endpoint}/v2.0/floatingips/{floating_ip_id}?fields=project_id"
|
19
|
-
response = connection.session.get(url)
|
21
|
+
response = None
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
+
for endpoint in neutron_endpoints:
|
24
|
+
try:
|
25
|
+
url = f"{endpoint}/v2.0/floatingips/{floating_ip_id}?fields=project_id"
|
26
|
+
response = connection.session.get(url)
|
27
|
+
if response.status_code == 200:
|
28
|
+
break
|
29
|
+
except Exception as e:
|
30
|
+
print(e)
|
23
31
|
|
24
|
-
|
32
|
+
if response is None:
|
33
|
+
return None
|
25
34
|
|
26
|
-
return
|
35
|
+
return response.json()["floatingip"]["project_id"]
|
27
36
|
|
28
37
|
|
29
38
|
def get_router_project(connection: Connection, router_id: str):
|
30
|
-
neutron_endpoint = os_util.get_endpoint(
|
31
|
-
|
39
|
+
# neutron_endpoint = os_util.get_endpoint(
|
40
|
+
# connection=connection, service_type="network", interface="internal"
|
41
|
+
# )
|
42
|
+
|
43
|
+
neutron_endpoints = os_util.get_endpoints(
|
44
|
+
connection=connection, service_type="network", interface="public"
|
32
45
|
)
|
33
46
|
|
34
|
-
|
35
|
-
|
47
|
+
response = None
|
48
|
+
|
49
|
+
for endpoint in neutron_endpoints:
|
50
|
+
try:
|
51
|
+
url = f"{endpoint}/v2.0/routers/{router_id}?fields=project_id"
|
52
|
+
|
53
|
+
response = connection.session.get(url)
|
36
54
|
|
37
|
-
|
55
|
+
if response.status_code == 200:
|
56
|
+
break
|
57
|
+
except Exception as e:
|
58
|
+
print(e)
|
38
59
|
|
39
|
-
|
40
|
-
|
60
|
+
if response is None:
|
61
|
+
return None
|
41
62
|
|
42
63
|
data = response.json()
|
43
64
|
|
osi_dump/api/octavia.py
CHANGED
@@ -7,13 +7,27 @@ import osi_dump.util.openstack_util as os_util
|
|
7
7
|
|
8
8
|
|
9
9
|
def get_load_balancers(connection: Connection) -> list[LoadBalancer]:
|
10
|
-
octavia_endpoint = os_util.get_endpoint(
|
10
|
+
# octavia_endpoint = os_util.get_endpoint(
|
11
|
+
# connection=connection, service_type="load-balancer", interface="public"
|
12
|
+
# )
|
13
|
+
|
14
|
+
octavia_endpoints = os_util.get_endpoints(
|
11
15
|
connection=connection, service_type="load-balancer", interface="public"
|
12
16
|
)
|
13
17
|
|
14
|
-
|
18
|
+
response = None
|
19
|
+
|
20
|
+
for endpoint in octavia_endpoints:
|
21
|
+
try:
|
22
|
+
url = f"{endpoint}/v2.0/lbaas/loadbalancers"
|
23
|
+
response = connection.session.get(url)
|
24
|
+
if response.status_code == 200:
|
25
|
+
break
|
26
|
+
except Exception as e:
|
27
|
+
print(e)
|
15
28
|
|
16
|
-
response
|
29
|
+
if response is None:
|
30
|
+
return None
|
17
31
|
|
18
32
|
data = response.json()
|
19
33
|
|
@@ -22,13 +36,27 @@ def get_load_balancers(connection: Connection) -> list[LoadBalancer]:
|
|
22
36
|
|
23
37
|
def get_amphoraes(connection: Connection, load_balancer_id: str) -> list[dict]:
|
24
38
|
|
25
|
-
octavia_endpoint = os_util.get_endpoint(
|
39
|
+
# octavia_endpoint = os_util.get_endpoint(
|
40
|
+
# connection=connection, service_type="load-balancer", interface="public"
|
41
|
+
# )
|
42
|
+
|
43
|
+
octavia_endpoints = os_util.get_endpoints(
|
26
44
|
connection=connection, service_type="load-balancer", interface="public"
|
27
45
|
)
|
28
46
|
|
29
|
-
|
47
|
+
response = None
|
48
|
+
|
49
|
+
for endpoint in octavia_endpoints:
|
50
|
+
try:
|
51
|
+
url = f"{endpoint}/v2/octavia/amphorae?load_balancer_id={load_balancer_id}&fields=status&fields=compute_id&fields=compute_flavor"
|
52
|
+
response = connection.session.get(url)
|
53
|
+
if response.status_code == 200:
|
54
|
+
break
|
55
|
+
except Exception as e:
|
56
|
+
print(e)
|
30
57
|
|
31
|
-
response
|
58
|
+
if response is None:
|
59
|
+
return None
|
32
60
|
|
33
61
|
data = response.json()
|
34
62
|
|
osi_dump/api/placement.py
CHANGED
@@ -6,13 +6,35 @@ import osi_dump.util.openstack_util as os_util
|
|
6
6
|
|
7
7
|
def get_usage(connection: Connection, resource_provider_id: str):
|
8
8
|
|
9
|
-
placement_endpoint = os_util.get_endpoint(
|
9
|
+
# placement_endpoint = os_util.get_endpoint(
|
10
|
+
# connection=connection, service_type="placement", interface="public"
|
11
|
+
# )
|
12
|
+
|
13
|
+
# url = f"{placement_endpoint}/resource_providers/{resource_provider_id}/usages"
|
14
|
+
|
15
|
+
# response = connection.session.get(url)
|
16
|
+
|
17
|
+
# data = response.json()
|
18
|
+
|
19
|
+
# return data["usages"]
|
20
|
+
|
21
|
+
placement_endpoints = os_util.get_endpoints(
|
10
22
|
connection=connection, service_type="placement", interface="public"
|
11
23
|
)
|
12
24
|
|
13
|
-
|
25
|
+
response = None
|
26
|
+
|
27
|
+
for endpoint in placement_endpoints:
|
28
|
+
try:
|
29
|
+
url = f"{endpoint}/resource_providers/{resource_provider_id}/usages"
|
30
|
+
response = connection.session.get(url)
|
31
|
+
if response.status_code == 200:
|
32
|
+
break
|
33
|
+
except Exception as e:
|
34
|
+
print(e)
|
14
35
|
|
15
|
-
response
|
36
|
+
if response is None:
|
37
|
+
return None
|
16
38
|
|
17
39
|
data = response.json()
|
18
40
|
|
@@ -23,8 +23,9 @@ class ExcelLoadBalancerExporter(LoadBalancerExporter):
|
|
23
23
|
df = pd.json_normalize(
|
24
24
|
[load_balancer.model_dump() for load_balancer in load_balancers]
|
25
25
|
)
|
26
|
-
|
27
|
-
|
26
|
+
|
27
|
+
if "amphoraes" in df.columns:
|
28
|
+
df = util.expand_list_column(df, "amphoraes")
|
28
29
|
|
29
30
|
logger.info(f"Exporting load_balancers for {self.sheet_name}")
|
30
31
|
try:
|
osi_dump/util/openstack_util.py
CHANGED
@@ -20,3 +20,29 @@ def get_endpoint(connection: Connection, service_type: str, interface: str) -> s
|
|
20
20
|
)
|
21
21
|
|
22
22
|
return ret
|
23
|
+
|
24
|
+
|
25
|
+
def get_endpoints(
|
26
|
+
connection: Connection, service_type: str, interface: str
|
27
|
+
) -> list[str]:
|
28
|
+
endpoint = connection.endpoint_for(service_type=service_type, interface=interface)
|
29
|
+
|
30
|
+
parsed_endpoint = urllib.parse.urlparse(endpoint)
|
31
|
+
|
32
|
+
new_hostname = urllib.parse.urlparse(connection.auth["auth_url"]).hostname
|
33
|
+
|
34
|
+
port = parsed_endpoint.port
|
35
|
+
|
36
|
+
http_ret = urllib.parse.urlunparse(
|
37
|
+
parsed_endpoint._replace(netloc=f"{new_hostname}:{port}")._replace(
|
38
|
+
scheme="http"
|
39
|
+
)
|
40
|
+
)
|
41
|
+
|
42
|
+
https_ret = urllib.parse.urlunparse(
|
43
|
+
parsed_endpoint._replace(netloc=f"{new_hostname}:{port}")._replace(
|
44
|
+
scheme="https"
|
45
|
+
)
|
46
|
+
)
|
47
|
+
|
48
|
+
return [http_ret, https_ret]
|
@@ -2,9 +2,9 @@ osi_dump/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
osi_dump/__main__.py,sha256=fCVTLFipB-P0872_4j7iOJNNosOMBj3YdHr8TH_fhRY,71
|
3
3
|
osi_dump/cli.py,sha256=vLijmcrWieCVK4cSLN2sK9ltWlercw9Zg6yBEvZtPkg,6379
|
4
4
|
osi_dump/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
osi_dump/api/neutron.py,sha256=
|
6
|
-
osi_dump/api/octavia.py,sha256=
|
7
|
-
osi_dump/api/placement.py,sha256=
|
5
|
+
osi_dump/api/neutron.py,sha256=pag_d6MsxA1gOUit4bvVUaTiTrPqLJjwz9KU_QSpxwM,1788
|
6
|
+
osi_dump/api/octavia.py,sha256=Cgzz9Pf26YFETqbXSXYSHUA_PWDy_3V4zPm0RZ8QKBo,1905
|
7
|
+
osi_dump/api/placement.py,sha256=yoWzg39b8nK2E1nrxDhLxLsa7FcBTw57gfy8b5F5ijc,1096
|
8
8
|
osi_dump/batch_handler/__init__.py,sha256=wsiE42GCjbKgXBzpiahWEDF_-IXCKzr6PyrLn0oEKSc,288
|
9
9
|
osi_dump/batch_handler/external_port_batch_handler.py,sha256=iGm0htGbLkpTX5RFPcrvXrVVn0eeTpavN3u4s58Z_pE,1783
|
10
10
|
osi_dump/batch_handler/flavor_batch_handler.py,sha256=Cxf-rkuW5MrrOyiKi9N3InsdDGku7Bf0CAaPNhhM0hE,1589
|
@@ -37,7 +37,7 @@ osi_dump/exporter/instance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
37
37
|
osi_dump/exporter/instance/excel_instance_exporter.py,sha256=8WTv3RDOdUkumyWzwUK4KAZCnnq9P2yKi5TC091I9fs,931
|
38
38
|
osi_dump/exporter/instance/instance_exporter.py,sha256=5CuKKvTa5S2_Ds7fap6tle4go9pOFmQ5VEf6O7tjwBo,161
|
39
39
|
osi_dump/exporter/load_balancer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
40
|
-
osi_dump/exporter/load_balancer/excel_load_balancer_exporter.py,sha256=
|
40
|
+
osi_dump/exporter/load_balancer/excel_load_balancer_exporter.py,sha256=gffLcLr8uvSbaf7rwZDgNRCPKh8bMIs2ShHtyotpKmw,1105
|
41
41
|
osi_dump/exporter/load_balancer/load_balancer_exporter.py,sha256=Z5uvEKz1UG_dpAw5KVh-IX5PWLzlPt7pV9773bkgjXs,175
|
42
42
|
osi_dump/exporter/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
43
43
|
osi_dump/exporter/project/excel_project_exporter.py,sha256=2U3Tvn_Bk4xEQk3Tmh-oj5WXAG1bfxI6m7WVPF1upQw,916
|
@@ -105,11 +105,11 @@ osi_dump/util/excel_autosize_column.py,sha256=zzQ6uXkQhHAqVn9fUAgNjoCH_HiNEC9Dcj
|
|
105
105
|
osi_dump/util/excel_sort_sheet.py,sha256=o4jXtP1ZFYtAGzkAP5S8Tym4h-SEoFBAI3j24y-24UM,1047
|
106
106
|
osi_dump/util/export_data_excel.py,sha256=VYSxDBZ7dgSbTj3n_8RRPqe183tILNh6wJW-UnFvJUU,882
|
107
107
|
osi_dump/util/extract_hostname.py,sha256=IpdklGHevmtRu67xeSRE_5n2mvWGI1sDsnJwExo_AR0,111
|
108
|
-
osi_dump/util/openstack_util.py,sha256=
|
108
|
+
osi_dump/util/openstack_util.py,sha256=PmoGlXNJqCQAbZBBHj-BM5JdY5g9FHERXtOn4Lv0p3k,1299
|
109
109
|
osi_dump/util/panda_excel.py,sha256=owr8AffIxqN3yY8kIv55Ox4j2dRz7kXZvSZFZeft8dw,734
|
110
110
|
osi_dump/util/validate_dir_path.py,sha256=pL_OrY8JnNwk3vj6Zp6bsZtgHXhszSGRoqIt-1G5S90,507
|
111
|
-
osi_dump-0.1.3.2.
|
112
|
-
osi_dump-0.1.3.2.
|
113
|
-
osi_dump-0.1.3.2.
|
114
|
-
osi_dump-0.1.3.2.
|
115
|
-
osi_dump-0.1.3.2.
|
111
|
+
osi_dump-0.1.3.2.2.dist-info/METADATA,sha256=H6aPKHpLdV1V9XR3iseYSQxcss1c7WOBeH02tGNq4ho,677
|
112
|
+
osi_dump-0.1.3.2.2.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
113
|
+
osi_dump-0.1.3.2.2.dist-info/entry_points.txt,sha256=ozm5sIBtXzLv6_FiUe26v1BgA3_xUReGLPhKQKZ56wQ,46
|
114
|
+
osi_dump-0.1.3.2.2.dist-info/top_level.txt,sha256=OtAAwmJfcoPvlw_Cemo_H1aXIGV_7w0O2941KQt6faQ,9
|
115
|
+
osi_dump-0.1.3.2.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|