Skip to content

Commit 829e303

Browse files
authored
Add CCEv2 and CSS (#34)
* Add initial support for CSS * Initial support for CCEv2 (in reality api v3) Add initial support for the CCEv2 support. To enable it add 'cce_api_version: 3' into the clouds.yaml or OS_CCE_API_VERSION=3 * fix listing cce cluster nodes * Add CCEv2 unit tests * Add CSS unit tests * Add base functional test for css nothing useful, except that it inits * Add support for OSC CCEV2 (v3) * fix test failures
1 parent bef6deb commit 829e303

48 files changed

Lines changed: 3338 additions & 75 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ Cloud Container Engine (CCE) command-line client
33
================================================
44

55
The CCE client is the command-line interface (CLI) for
6-
the Cloud Container Engine (CCE) API and its extensions.
6+
the Cloud Container Engine (CCE) API and its extensions for the CCE v2.
7+
It can be enabled by either adding `cce_api_version: 3` into the clouds.yaml
8+
or `OS_CCE_API_VERSION=3` environment variable or flag to the OSC.
79

810
For help on a specific `cce` command, enter:
911

@@ -13,8 +15,8 @@ For help on a specific `cce` command, enter:
1315
1416
.. _cluster:
1517

16-
Cluster operations
17-
------------------
18+
Cluster v2 operations
19+
---------------------
1820

19-
.. autoprogram-cliff:: openstack.cce.v1
21+
.. autoprogram-cliff:: openstack.cce.v3
2022
:command: cce cluster *

doc/source/cli/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ OpenStackClient CLI Usage
66

77
anti_ddos.rst
88
auto_scaling.rst
9-
cce.rst
9+
cce_v2.rst
1010
cts.rst
1111
dcs.rst
1212
deh.rst

doc/source/user/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ control which services can be used.
117117
Workflow <https://docs.openstack.org/python-openstacksdk/latest/user/proxies/workflow>
118118
Anti DDoS Service <proxies/anti_ddos>
119119
AutoScaling Service <proxies/auto_scaling>
120-
Cloud Container Engine <proxies/cce>
120+
Cloud Container Engine v1<proxies/cce_v1>
121+
Cloud Container Engine v2<proxies/cce_v3>
121122
Cloud Trace Service <proxies/cts>
122123
Distributed Cache Service <proxies/dcs>
123124
Dedicated Host Service <proxies/deh>
File renamed without changes.

doc/source/user/proxies/cce_v3.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
CCE API
2+
=======
3+
4+
.. automodule:: otcextensions.sdk.cce.v3._proxy
5+
6+
The Cloud Container Engine Class
7+
--------------------------------
8+
9+
The cce high-level interface is available through the ``cce``
10+
member of a :class:`~openstack.connection.Connection` object. The
11+
``cce`` member will only be added if the ``otcextensions.sdk.register_otc_extensions(conn)`` method is called.
12+
13+
Cluster Operations
14+
^^^^^^^^^^^^^^^^^^
15+
16+
.. autoclass:: otcextensions.sdk.cce.v3._proxy.Proxy
17+
18+
.. automethod:: otcextensions.sdk.cce.v3._proxy.Proxy.clusters
19+
.. automethod:: otcextensions.sdk.cce.v3._proxy.Proxy.get_cluster
20+
.. automethod:: otcextensions.sdk.cce.v3._proxy.Proxy.find_cluster
21+
.. automethod:: otcextensions.sdk.cce.v3._proxy.Proxy.delete_cluster
22+
23+
24+
Cluster Nodes Operations
25+
^^^^^^^^^^^^^^^^^^^^^^^^
26+
27+
.. autoclass:: otcextensions.sdk.cce.v3._proxy.Proxy
28+
29+
.. automethod:: otcextensions.sdk.cce.v3._proxy.Proxy.cluster_nodes
30+
.. automethod:: otcextensions.sdk.cce.v3._proxy.Proxy.get_cluster_node
31+
.. automethod:: otcextensions.sdk.cce.v3._proxy.Proxy.find_cluster_node
32+
.. automethod:: otcextensions.sdk.cce.v3._proxy.Proxy.delete_cluster_node
33+
.. automethod:: otcextensions.sdk.cce.v3._proxy.Proxy.create_cluster_node

doc/source/user/resources/cce/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ AutoScaling Resources
66

77
v1/cluster
88
v1/cluster_node
9+
v3/cluster
10+
v3/cluster_node
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
otcextensions.sdk.cce.v3.cluster
2+
================================
3+
4+
.. automodule:: otcextensions.sdk.cce.v3.cluster
5+
6+
The CCE Cluster Class
7+
---------------------
8+
9+
The ``Cluster`` class inherits from :class:`~otcextensions.sdk.sdk_resource.Resource`.
10+
11+
.. autoclass:: otcextensions.sdk.cce.v3.cluster.Cluster
12+
:members:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
otcextensions.sdk.cce.v3.cluster_node
2+
=====================================
3+
4+
.. automodule:: otcextensions.sdk.cce.v3.cluster_node
5+
6+
The CCE Cluster Host (Node) Class
7+
---------------------------------
8+
9+
The ``ClusterHost`` class inherits from :class:`~otcextensions.sdk.sdk_resource.Resource`.
10+
11+
.. autoclass:: otcextensions.sdk.cce.v3.cluster_node.ClusterNode
12+
:members:

open_points

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ This document gathers issues, which are found during diggint the API and other O
4141
* Subnet is most likely net_id
4242
* In AS sys disk has type "SYS", in CCE - "root"
4343
* Node delete possible only by name, and not id
44+
* service catalog configuration is broken v1 vs v2(v3) with no corrupted discovery and new service type
4445

4546
# DCS:
4647

@@ -67,6 +68,11 @@ This document gathers issues, which are found during diggint the API and other O
6768
* create policy requires frequency to be set
6869
* shift implemented stuff to osc
6970

71+
# CSS:
72+
73+
* upon creation httpsEnable is str, upon read - bool
74+
* flavors is not OpenStack compatible
75+
7076
# HEAT:
7177

7278
* very old level, blocking many OpenSource projects, including i.e. ansible-openshift, RedhatDNS.
@@ -106,7 +112,7 @@ This document gathers issues, which are found during diggint the API and other O
106112

107113
# DeH
108114

109-
* Tag support is not OS compatible
115+
* Tag support is not OS compatible
110116

111117
# OpenStackSDK:
112118

otcextensions/common/format.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,55 @@ def serialize(cls, value):
4444
% value)
4545

4646

47+
class Bool_10(format.Formatter):
48+
@classmethod
49+
def deserialize(cls, value):
50+
"""Convert a boolean string to a boolean"""
51+
if isinstance(value, bool):
52+
return value
53+
expr = str(value).lower()
54+
if "1" == expr:
55+
return True
56+
elif "0" == expr:
57+
return False
58+
else:
59+
raise ValueError("Unable to deserialize boolean string: %s"
60+
% value)
61+
62+
@classmethod
63+
def serialize(cls, value):
64+
"""Convert a boolean to a boolean string"""
65+
if value in ["1", "0"]:
66+
return str(value).upper()
67+
if isinstance(value, bool):
68+
if value:
69+
return "1"
70+
else:
71+
return "0"
72+
else:
73+
raise ValueError("Unable to serialize boolean string: %s"
74+
% value)
75+
76+
77+
class BoolStr_1(format.BoolStr):
78+
"""Deserialize bool, which can be either bool or string
79+
"""
80+
81+
@classmethod
82+
def deserialize(cls, value):
83+
"""Convert a boolean string to a boolean"""
84+
if isinstance(value, bool):
85+
return value
86+
expr = str(value).lower()
87+
if "true" == expr:
88+
return True
89+
elif "false" == expr:
90+
return False
91+
else:
92+
raise ValueError("Unable to deserialize boolean string: %s"
93+
% value)
94+
95+
4796
class ListRef(format.Formatter):
4897
"""A formatter used to serialize/deserialize list reference
4998

0 commit comments

Comments
 (0)