Skip to content

Commit

Permalink
feat: [google-cloud-edgenetwork] A new field bonding_type is added …
Browse files Browse the repository at this point in the history
…to message `.google.cloud.edgenetwork.v1.Subnet` (#12842)

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 646953813

Source-Link:
googleapis/googleapis@16c01b4

Source-Link:
googleapis/googleapis-gen@1870029
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWVkZ2VuZXR3b3JrLy5Pd2xCb3QueWFtbCIsImgiOiIxODcwMDI5OWY5N2FiYjA3YzU2YmY1ZWQxMDU2MjE5ZjgwOWRlZmI0In0=

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Victor Chudnovsky <vchudnov@google.com>
  • Loading branch information
3 people authored Jun 27, 2024
1 parent 2726a72 commit 5f272b3
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/google-cloud-edgenetwork/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Python Client for Distributed Cloud Edge Network API
.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-edgenetwork.svg
:target: https://pypi.org/project/google-cloud-edgenetwork/
.. _Distributed Cloud Edge Network API: https://cloud.google.com/distributed-cloud/edge/latest/docs/overview
.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/google-cloud-edgenetwork/latest
.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/google-cloud-edgenetwork/latest/summary_overview
.. _Product Documentation: https://cloud.google.com/distributed-cloud/edge/latest/docs/overview

Quick Start
Expand Down
5 changes: 5 additions & 0 deletions packages/google-cloud-edgenetwork/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ For a list of all ``google-cloud-edgenetwork`` releases:
:maxdepth: 2

CHANGELOG

.. toctree::
:hidden:

summary_overview.md
22 changes: 22 additions & 0 deletions packages/google-cloud-edgenetwork/docs/summary_overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
This is a templated file. Adding content to this file may result in it being
reverted. Instead, if you want to place additional content, create an
"overview_content.md" file in `docs/` directory. The Sphinx tool will
pick up on the content and merge the content.
]: #

# Distributed Cloud Edge Network API API

Overview of the APIs available for Distributed Cloud Edge Network API API.

## All entries

Classes, methods and properties & attributes for
Distributed Cloud Edge Network API API.

[classes](https://cloud.google.com/python/docs/reference/google-cloud-edgenetwork/latest/summary_class.html)

[methods](https://cloud.google.com/python/docs/reference/google-cloud-edgenetwork/latest/summary_method.html)

[properties and
attributes](https://cloud.google.com/python/docs/reference/google-cloud-edgenetwork/latest/summary_property.html)
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,40 @@ class Subnet(proto.Message):
vlan_id (int):
Optional. VLAN id provided by user. If not
specified we assign one automatically.
bonding_type (google.cloud.edgenetwork_v1.types.Subnet.BondingType):
Optional. A bonding type in the subnet
creation specifies whether a VLAN being created
will be present on Bonded or Non-Bonded or Both
port types. In addition, this flag is to be used
to set the specific network configuration which
clusters can then use for their workloads based
on the bonding choice.
state (google.cloud.edgenetwork_v1.types.ResourceState):
Output only. Current stage of the resource to
the device by config push.
"""

class BondingType(proto.Enum):
r"""Bonding type in the subnet.
Values:
BONDING_TYPE_UNSPECIFIED (0):
Unspecified
Bonding type will be unspecified by default and
if the user chooses to not specify a bonding
type at time of creating the VLAN. This will be
treated as mixed bonding where the VLAN will
have both bonded and non-bonded connectivity to
machines.
BONDED (1):
Single homed.
NON_BONDED (2):
Multi homed.
"""
BONDING_TYPE_UNSPECIFIED = 0
BONDED = 1
NON_BONDED = 2

name: str = proto.Field(
proto.STRING,
number=1,
Expand Down Expand Up @@ -242,6 +271,11 @@ class Subnet(proto.Message):
proto.INT32,
number=9,
)
bonding_type: BondingType = proto.Field(
proto.ENUM,
number=11,
enum=BondingType,
)
state: "ResourceState" = proto.Field(
proto.ENUM,
number=10,
Expand Down Expand Up @@ -996,6 +1030,7 @@ class BgpStatus(proto.Enum):
The DOWN state indicating BGP session is not
established yet.
"""

UNKNOWN = 0
UP = 1
DOWN = 2
Expand Down
46 changes: 35 additions & 11 deletions packages/google-cloud-edgenetwork/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,28 @@ def install_unittest_dependencies(session, *constraints):
session.install("-e", ".", *constraints)


def default(session):
@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
@nox.parametrize(
"protobuf_implementation",
["python", "upb", "cpp"],
)
def unit(session, protobuf_implementation):
# Install all test dependencies, then install this package in-place.

if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"):
session.skip("cpp implementation is not supported in python 3.11+")

constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)
install_unittest_dependencies(session, "-c", constraints_path)

# TODO(https://github.com/googleapis/synthtool/issues/1976):
# Remove the 'cpp' implementation once support for Protobuf 3.x is dropped.
# The 'cpp' implementation requires Protobuf<4.
if protobuf_implementation == "cpp":
session.install("protobuf<4")

# Run py.test against the unit tests.
session.run(
"py.test",
Expand All @@ -181,15 +195,12 @@ def default(session):
"--cov-fail-under=0",
os.path.join("tests", "unit"),
*session.posargs,
env={
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
},
)


@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
def unit(session):
"""Run the unit test suite."""
default(session)


def install_systemtest_dependencies(session, *constraints):
# Use pre-release gRPC for system tests.
# Exclude version 1.52.0rc1 which has a known issue.
Expand Down Expand Up @@ -358,9 +369,16 @@ def docfx(session):


@nox.session(python="3.12")
def prerelease_deps(session):
@nox.parametrize(
"protobuf_implementation",
["python", "upb", "cpp"],
)
def prerelease_deps(session, protobuf_implementation):
"""Run all tests with prerelease versions of dependencies installed."""

if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"):
session.skip("cpp implementation is not supported in python 3.11+")

# Install all dependencies
session.install("-e", ".[all, tests, tracing]")
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
Expand Down Expand Up @@ -397,9 +415,9 @@ def prerelease_deps(session):
"protobuf",
# dependency of grpc
"six",
"grpc-google-iam-v1",
"googleapis-common-protos",
# Exclude version 1.52.0rc1 which has a known issue. See https://github.com/grpc/grpc/issues/32163
"grpcio!=1.52.0rc1",
"grpcio",
"grpcio-status",
"google-api-core",
"google-auth",
Expand All @@ -425,4 +443,10 @@ def prerelease_deps(session):
session.run("python", "-c", "import grpc; print(grpc.__version__)")
session.run("python", "-c", "import google.auth; print(google.auth.__version__)")

session.run("py.test", "tests/unit")
session.run(
"py.test",
"tests/unit",
env={
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -5059,6 +5059,7 @@ def test_get_subnet(request_type, transport: str = "grpc"):
ipv4_cidr=["ipv4_cidr_value"],
ipv6_cidr=["ipv6_cidr_value"],
vlan_id=733,
bonding_type=resources.Subnet.BondingType.BONDED,
state=resources.ResourceState.STATE_PENDING,
)
response = client.get_subnet(request)
Expand All @@ -5077,6 +5078,7 @@ def test_get_subnet(request_type, transport: str = "grpc"):
assert response.ipv4_cidr == ["ipv4_cidr_value"]
assert response.ipv6_cidr == ["ipv6_cidr_value"]
assert response.vlan_id == 733
assert response.bonding_type == resources.Subnet.BondingType.BONDED
assert response.state == resources.ResourceState.STATE_PENDING


Expand Down Expand Up @@ -5182,6 +5184,7 @@ async def test_get_subnet_empty_call_async():
ipv4_cidr=["ipv4_cidr_value"],
ipv6_cidr=["ipv6_cidr_value"],
vlan_id=733,
bonding_type=resources.Subnet.BondingType.BONDED,
state=resources.ResourceState.STATE_PENDING,
)
)
Expand Down Expand Up @@ -5259,6 +5262,7 @@ async def test_get_subnet_async(
ipv4_cidr=["ipv4_cidr_value"],
ipv6_cidr=["ipv6_cidr_value"],
vlan_id=733,
bonding_type=resources.Subnet.BondingType.BONDED,
state=resources.ResourceState.STATE_PENDING,
)
)
Expand All @@ -5278,6 +5282,7 @@ async def test_get_subnet_async(
assert response.ipv4_cidr == ["ipv4_cidr_value"]
assert response.ipv6_cidr == ["ipv6_cidr_value"]
assert response.vlan_id == 733
assert response.bonding_type == resources.Subnet.BondingType.BONDED
assert response.state == resources.ResourceState.STATE_PENDING


Expand Down Expand Up @@ -15321,6 +15326,7 @@ def test_get_subnet_rest(request_type):
ipv4_cidr=["ipv4_cidr_value"],
ipv6_cidr=["ipv6_cidr_value"],
vlan_id=733,
bonding_type=resources.Subnet.BondingType.BONDED,
state=resources.ResourceState.STATE_PENDING,
)

Expand All @@ -15343,6 +15349,7 @@ def test_get_subnet_rest(request_type):
assert response.ipv4_cidr == ["ipv4_cidr_value"]
assert response.ipv6_cidr == ["ipv6_cidr_value"]
assert response.vlan_id == 733
assert response.bonding_type == resources.Subnet.BondingType.BONDED
assert response.state == resources.ResourceState.STATE_PENDING


Expand Down Expand Up @@ -15632,6 +15639,7 @@ def test_create_subnet_rest(request_type):
"ipv4_cidr": ["ipv4_cidr_value1", "ipv4_cidr_value2"],
"ipv6_cidr": ["ipv6_cidr_value1", "ipv6_cidr_value2"],
"vlan_id": 733,
"bonding_type": 1,
"state": 1,
}
# The version of a generated dependency at test runtime may differ from the version used during generation.
Expand Down Expand Up @@ -16049,6 +16057,7 @@ def test_update_subnet_rest(request_type):
"ipv4_cidr": ["ipv4_cidr_value1", "ipv4_cidr_value2"],
"ipv6_cidr": ["ipv6_cidr_value1", "ipv6_cidr_value2"],
"vlan_id": 733,
"bonding_type": 1,
"state": 1,
}
# The version of a generated dependency at test runtime may differ from the version used during generation.
Expand Down

0 comments on commit 5f272b3

Please sign in to comment.