Skip to content

Commit 9321997

Browse files
docs: [google-cloud-network-management] Update comments for Connectivity Test (#13669)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 737495961 Source-Link: googleapis/googleapis@2852893 Source-Link: googleapis/googleapis-gen@3109e20 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW5ldHdvcmstbWFuYWdlbWVudC8uT3dsQm90LnlhbWwiLCJoIjoiMzEwOWUyMDYzZjVlZGYxNWJjNGE2ZGQwYWQzMTA3MmM4YTRhMjY2ZCJ9 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 5cde00f commit 9321997

File tree

2 files changed

+74
-85
lines changed

2 files changed

+74
-85
lines changed

packages/google-cloud-network-management/google/cloud/network_management_v1/types/connectivity_test.py

Lines changed: 27 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -50,56 +50,25 @@ class ConnectivityTest(proto.Message):
5050
Required. Source specification of the
5151
Connectivity Test.
5252
You can use a combination of source IP address,
53-
virtual machine (VM) instance, or Compute Engine
54-
network to uniquely identify the source
55-
location.
56-
57-
Examples:
58-
59-
If the source IP address is an internal IP
60-
address within a Google Cloud Virtual Private
61-
Cloud (VPC) network, then you must also specify
62-
the VPC network. Otherwise, specify the VM
63-
instance, which already contains its internal IP
64-
address and VPC network information.
65-
66-
If the source of the test is within an
67-
on-premises network, then you must provide the
68-
destination VPC network.
53+
URI of a supported endpoint, project ID, or VPC
54+
network to identify the source location.
6955
70-
If the source endpoint is a Compute Engine VM
71-
instance with multiple network interfaces, the
72-
instance itself is not sufficient to identify
73-
the endpoint. So, you must also specify the
74-
source IP address or VPC network.
75-
76-
A reachability analysis proceeds even if the
56+
Reachability analysis might proceed even if the
7757
source location is ambiguous. However, the test
78-
result may include endpoints that you don't
79-
intend to test.
58+
result might include endpoints or use a source
59+
that you don't intend to test.
8060
destination (google.cloud.network_management_v1.types.Endpoint):
8161
Required. Destination specification of the
8262
Connectivity Test.
8363
You can use a combination of destination IP
84-
address, Compute Engine VM instance, or VPC
85-
network to uniquely identify the destination
64+
address, URI of a supported endpoint, project
65+
ID, or VPC network to identify the destination
8666
location.
8767
88-
Even if the destination IP address is not
89-
unique, the source IP location is unique.
90-
Usually, the analysis can infer the destination
91-
endpoint from route information.
92-
93-
If the destination you specify is a VM instance
94-
and the instance has multiple network
95-
interfaces, then you must also specify either a
96-
destination IP address or VPC network to
97-
identify the destination interface.
98-
99-
A reachability analysis proceeds even if the
68+
Reachability analysis proceeds even if the
10069
destination location is ambiguous. However, the
101-
result can include endpoints that you don't
102-
intend to test.
70+
test result might include endpoints or use a
71+
destination that you don't intend to test.
10372
protocol (str):
10473
IP Protocol of the test. When not provided,
10574
"TCP" is assumed.
@@ -142,8 +111,8 @@ class ConnectivityTest(proto.Message):
142111
test, updating an existing test, or triggering a
143112
one-time rerun of an existing test.
144113
bypass_firewall_checks (bool):
145-
Whether the test should skip firewall
146-
checking. If not provided, we assume false.
114+
Whether the analysis should skip firewall
115+
checking. Default value is false.
147116
"""
148117

149118
name: str = proto.Field(
@@ -237,7 +206,8 @@ class Endpoint(proto.Message):
237206
are also used for protocol forwarding, Private
238207
Service Connect and other network services to
239208
provide forwarding information in the control
240-
plane. Format:
209+
plane. Applicable only to destination endpoint.
210+
Format:
241211
242212
projects/{project}/global/forwardingRules/{id}
243213
or
@@ -272,33 +242,36 @@ class Endpoint(proto.Message):
272242
redis_instance (str):
273243
A `Redis
274244
Instance <https://cloud.google.com/memorystore/docs/redis>`__
275-
URI.
245+
URI. Applicable only to destination endpoint.
276246
redis_cluster (str):
277247
A `Redis
278248
Cluster <https://cloud.google.com/memorystore/docs/cluster>`__
279-
URI.
249+
URI. Applicable only to destination endpoint.
280250
cloud_function (google.cloud.network_management_v1.types.Endpoint.CloudFunctionEndpoint):
281251
A `Cloud Function <https://cloud.google.com/functions>`__.
252+
Applicable only to source endpoint.
282253
app_engine_version (google.cloud.network_management_v1.types.Endpoint.AppEngineVersionEndpoint):
283254
An `App Engine <https://cloud.google.com/appengine>`__
284255
`service
285256
version <https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions>`__.
257+
Applicable only to source endpoint.
286258
cloud_run_revision (google.cloud.network_management_v1.types.Endpoint.CloudRunRevisionEndpoint):
287259
A `Cloud Run <https://cloud.google.com/run>`__
288260
`revision <https://cloud.google.com/run/docs/reference/rest/v1/namespaces.revisions/get>`__
261+
Applicable only to source endpoint.
289262
network (str):
290-
A Compute Engine network URI.
263+
A VPC network URI.
291264
network_type (google.cloud.network_management_v1.types.Endpoint.NetworkType):
292265
Type of the network where the endpoint is
293266
located. Applicable only to source endpoint, as
294267
destination network type can be inferred from
295268
the source.
296269
project_id (str):
297270
Project ID where the endpoint is located.
298-
The Project ID can be derived from the URI if
299-
you provide a VM instance or network URI.
300-
The following are two cases where you must
301-
provide the project ID:
271+
The project ID can be derived from the URI if
272+
you provide a endpoint or network URI.
273+
The following are two cases where you may need
274+
to provide the project ID:
302275
303276
1. Only the IP address is specified, and the IP
304277
address is within a Google Cloud project.
@@ -322,8 +295,9 @@ class NetworkType(proto.Enum):
322295
for the source or destination network.
323296
NON_GCP_NETWORK (2):
324297
A network hosted outside of Google Cloud.
325-
This can be an on-premises network, or a network
326-
hosted by another cloud provider.
298+
This can be an on-premises network, an internet
299+
resource or a network hosted by another cloud
300+
provider.
327301
"""
328302
NETWORK_TYPE_UNSPECIFIED = 0
329303
GCP_NETWORK = 1

packages/google-cloud-network-management/noxfile.py

Lines changed: 47 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def prerelease_deps(session, protobuf_implementation):
385385
"""
386386
Run all tests with pre-release versions of dependencies installed
387387
rather than the standard non pre-release versions.
388-
Pre-releases versions can be installed using
388+
Pre-release versions can be installed using
389389
`pip install --pre <package>`.
390390
"""
391391

@@ -395,16 +395,16 @@ def prerelease_deps(session, protobuf_implementation):
395395
# Install all dependencies
396396
session.install("-e", ".")
397397

398-
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
399398
# Install dependencies for the unit test environment
399+
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
400400
session.install(*unit_deps_all)
401401

402+
# Install dependencies for the system test environment
402403
system_deps_all = (
403404
SYSTEM_TEST_STANDARD_DEPENDENCIES
404405
+ SYSTEM_TEST_EXTERNAL_DEPENDENCIES
405406
+ SYSTEM_TEST_EXTRAS
406407
)
407-
# Install dependencies for the system test environment
408408
session.install(*system_deps_all)
409409

410410
# Because we test minimum dependency versions on the minimum Python
@@ -429,37 +429,44 @@ def prerelease_deps(session, protobuf_implementation):
429429
# Install dependencies specified in `testing/constraints-X.txt`.
430430
session.install(*constraints_deps)
431431

432+
# Note: If a dependency is added to the `prerel_deps` list,
433+
# the `core_dependencies_from_source` list in the `core_deps_from_source`
434+
# nox session should also be updated.
432435
prerel_deps = [
433-
"protobuf",
434-
# dependency of grpc
435-
"six",
436-
"grpc-google-iam-v1",
437436
"googleapis-common-protos",
438-
"grpcio",
439-
"grpcio-status",
440437
"google-api-core",
441438
"google-auth",
439+
"grpc-google-iam-v1",
440+
"grpcio",
441+
"grpcio-status",
442+
"protobuf",
442443
"proto-plus",
443-
"google-cloud-testutils",
444-
# dependencies of google-cloud-testutils"
445-
"click",
446444
]
447445

448446
for dep in prerel_deps:
449-
session.install("--pre", "--no-deps", "--upgrade", dep)
450-
451-
# Remaining dependencies
452-
other_deps = [
453-
"requests",
454-
]
455-
session.install(*other_deps)
456-
457-
# Print out prerelease package versions
458-
session.run(
459-
"python", "-c", "import google.protobuf; print(google.protobuf.__version__)"
460-
)
461-
session.run("python", "-c", "import grpc; print(grpc.__version__)")
462-
session.run("python", "-c", "import google.auth; print(google.auth.__version__)")
447+
session.install("--pre", "--no-deps", "--ignore-installed", dep)
448+
# TODO(https://github.com/grpc/grpc/issues/38965): Add `grpcio-status``
449+
# to the dictionary below once this bug is fixed.
450+
# TODO(https://github.com/googleapis/google-cloud-python/issues/13643): Add
451+
# `googleapis-common-protos` and `grpc-google-iam-v1` to the dictionary below
452+
# once this bug is fixed.
453+
package_namespaces = {
454+
"google-api-core": "google.api_core",
455+
"google-auth": "google.auth",
456+
"grpcio": "grpc",
457+
"protobuf": "google.protobuf",
458+
"proto-plus": "proto",
459+
}
460+
461+
version_namespace = package_namespaces.get(dep)
462+
463+
print(f"Installed {dep}")
464+
if version_namespace:
465+
session.run(
466+
"python",
467+
"-c",
468+
f"import {version_namespace}; print({version_namespace}.__version__)",
469+
)
463470

464471
session.run(
465472
"py.test",
@@ -476,12 +483,12 @@ def prerelease_deps(session, protobuf_implementation):
476483
["python", "upb"],
477484
)
478485
def core_deps_from_source(session, protobuf_implementation):
479-
"""Run all tests with local versions of core dependencies installed,
480-
rather than pulling core dependencies from PyPI.
486+
"""Run all tests with core dependencies installed from source
487+
rather than pulling the dependencies from PyPI.
481488
"""
482489

483490
# Install all dependencies
484-
session.install(".")
491+
session.install("-e", ".")
485492

486493
# Install dependencies for the unit test environment
487494
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
@@ -497,7 +504,7 @@ def core_deps_from_source(session, protobuf_implementation):
497504

498505
# Because we test minimum dependency versions on the minimum Python
499506
# version, the first version we test with in the unit tests sessions has a
500-
# constraints file containing all dependencies and extras that should be installed.
507+
# constraints file containing all dependencies and extras.
501508
with open(
502509
CURRENT_DIRECTORY
503510
/ "testing"
@@ -517,16 +524,24 @@ def core_deps_from_source(session, protobuf_implementation):
517524
# Install dependencies specified in `testing/constraints-X.txt`.
518525
session.install(*constraints_deps)
519526

527+
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2358): `grpcio` and
528+
# `grpcio-status` should be added to the list below so that they are installed from source,
529+
# rather than PyPI.
530+
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2357): `protobuf` should be
531+
# added to the list below so that it is installed from source, rather than PyPI
532+
# Note: If a dependency is added to the `core_dependencies_from_source` list,
533+
# the `prerel_deps` list in the `prerelease_deps` nox session should also be updated.
520534
core_dependencies_from_source = [
535+
f"{CURRENT_DIRECTORY}/../googleapis-common-protos",
521536
"google-api-core @ git+https://github.com/googleapis/python-api-core.git",
522537
"google-auth @ git+https://github.com/googleapis/google-auth-library-python.git",
523-
f"{CURRENT_DIRECTORY}/../googleapis-common-protos",
524538
f"{CURRENT_DIRECTORY}/../grpc-google-iam-v1",
525539
"proto-plus @ git+https://github.com/googleapis/proto-plus-python.git",
526540
]
527541

528542
for dep in core_dependencies_from_source:
529-
session.install(dep, "--ignore-installed", "--no-deps")
543+
session.install(dep, "--no-deps", "--ignore-installed")
544+
print(f"Installed {dep}")
530545

531546
session.run(
532547
"py.test",

0 commit comments

Comments
 (0)