Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,56 +50,25 @@ class ConnectivityTest(proto.Message):
Required. Source specification of the
Connectivity Test.
You can use a combination of source IP address,
virtual machine (VM) instance, or Compute Engine
network to uniquely identify the source
location.

Examples:

If the source IP address is an internal IP
address within a Google Cloud Virtual Private
Cloud (VPC) network, then you must also specify
the VPC network. Otherwise, specify the VM
instance, which already contains its internal IP
address and VPC network information.

If the source of the test is within an
on-premises network, then you must provide the
destination VPC network.
URI of a supported endpoint, project ID, or VPC
network to identify the source location.

If the source endpoint is a Compute Engine VM
instance with multiple network interfaces, the
instance itself is not sufficient to identify
the endpoint. So, you must also specify the
source IP address or VPC network.

A reachability analysis proceeds even if the
Reachability analysis might proceed even if the
source location is ambiguous. However, the test
result may include endpoints that you don't
intend to test.
result might include endpoints or use a source
that you don't intend to test.
destination (google.cloud.network_management_v1.types.Endpoint):
Required. Destination specification of the
Connectivity Test.
You can use a combination of destination IP
address, Compute Engine VM instance, or VPC
network to uniquely identify the destination
address, URI of a supported endpoint, project
ID, or VPC network to identify the destination
location.

Even if the destination IP address is not
unique, the source IP location is unique.
Usually, the analysis can infer the destination
endpoint from route information.

If the destination you specify is a VM instance
and the instance has multiple network
interfaces, then you must also specify either a
destination IP address or VPC network to
identify the destination interface.

A reachability analysis proceeds even if the
Reachability analysis proceeds even if the
destination location is ambiguous. However, the
result can include endpoints that you don't
intend to test.
test result might include endpoints or use a
destination that you don't intend to test.
protocol (str):
IP Protocol of the test. When not provided,
"TCP" is assumed.
Expand Down Expand Up @@ -142,8 +111,8 @@ class ConnectivityTest(proto.Message):
test, updating an existing test, or triggering a
one-time rerun of an existing test.
bypass_firewall_checks (bool):
Whether the test should skip firewall
checking. If not provided, we assume false.
Whether the analysis should skip firewall
checking. Default value is false.
"""

name: str = proto.Field(
Expand Down Expand Up @@ -237,7 +206,8 @@ class Endpoint(proto.Message):
are also used for protocol forwarding, Private
Service Connect and other network services to
provide forwarding information in the control
plane. Format:
plane. Applicable only to destination endpoint.
Format:

projects/{project}/global/forwardingRules/{id}
or
Expand Down Expand Up @@ -272,33 +242,36 @@ class Endpoint(proto.Message):
redis_instance (str):
A `Redis
Instance <https://cloud.google.com/memorystore/docs/redis>`__
URI.
URI. Applicable only to destination endpoint.
redis_cluster (str):
A `Redis
Cluster <https://cloud.google.com/memorystore/docs/cluster>`__
URI.
URI. Applicable only to destination endpoint.
cloud_function (google.cloud.network_management_v1.types.Endpoint.CloudFunctionEndpoint):
A `Cloud Function <https://cloud.google.com/functions>`__.
Applicable only to source endpoint.
app_engine_version (google.cloud.network_management_v1.types.Endpoint.AppEngineVersionEndpoint):
An `App Engine <https://cloud.google.com/appengine>`__
`service
version <https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions>`__.
Applicable only to source endpoint.
cloud_run_revision (google.cloud.network_management_v1.types.Endpoint.CloudRunRevisionEndpoint):
A `Cloud Run <https://cloud.google.com/run>`__
`revision <https://cloud.google.com/run/docs/reference/rest/v1/namespaces.revisions/get>`__
Applicable only to source endpoint.
network (str):
A Compute Engine network URI.
A VPC network URI.
network_type (google.cloud.network_management_v1.types.Endpoint.NetworkType):
Type of the network where the endpoint is
located. Applicable only to source endpoint, as
destination network type can be inferred from
the source.
project_id (str):
Project ID where the endpoint is located.
The Project ID can be derived from the URI if
you provide a VM instance or network URI.
The following are two cases where you must
provide the project ID:
The project ID can be derived from the URI if
you provide a endpoint or network URI.
The following are two cases where you may need
to provide the project ID:

1. Only the IP address is specified, and the IP
address is within a Google Cloud project.
Expand All @@ -322,8 +295,9 @@ class NetworkType(proto.Enum):
for the source or destination network.
NON_GCP_NETWORK (2):
A network hosted outside of Google Cloud.
This can be an on-premises network, or a network
hosted by another cloud provider.
This can be an on-premises network, an internet
resource or a network hosted by another cloud
provider.
"""
NETWORK_TYPE_UNSPECIFIED = 0
GCP_NETWORK = 1
Expand Down
79 changes: 47 additions & 32 deletions packages/google-cloud-network-management/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def prerelease_deps(session, protobuf_implementation):
"""
Run all tests with pre-release versions of dependencies installed
rather than the standard non pre-release versions.
Pre-releases versions can be installed using
Pre-release versions can be installed using
`pip install --pre <package>`.
"""

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

unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
# Install dependencies for the unit test environment
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
session.install(*unit_deps_all)

# Install dependencies for the system test environment
system_deps_all = (
SYSTEM_TEST_STANDARD_DEPENDENCIES
+ SYSTEM_TEST_EXTERNAL_DEPENDENCIES
+ SYSTEM_TEST_EXTRAS
)
# Install dependencies for the system test environment
session.install(*system_deps_all)

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

# Note: If a dependency is added to the `prerel_deps` list,
# the `core_dependencies_from_source` list in the `core_deps_from_source`
# nox session should also be updated.
prerel_deps = [
"protobuf",
# dependency of grpc
"six",
"grpc-google-iam-v1",
"googleapis-common-protos",
"grpcio",
"grpcio-status",
"google-api-core",
"google-auth",
"grpc-google-iam-v1",
"grpcio",
"grpcio-status",
"protobuf",
"proto-plus",
"google-cloud-testutils",
# dependencies of google-cloud-testutils"
"click",
]

for dep in prerel_deps:
session.install("--pre", "--no-deps", "--upgrade", dep)

# Remaining dependencies
other_deps = [
"requests",
]
session.install(*other_deps)

# Print out prerelease package versions
session.run(
"python", "-c", "import google.protobuf; print(google.protobuf.__version__)"
)
session.run("python", "-c", "import grpc; print(grpc.__version__)")
session.run("python", "-c", "import google.auth; print(google.auth.__version__)")
session.install("--pre", "--no-deps", "--ignore-installed", dep)
# TODO(https://github.com/grpc/grpc/issues/38965): Add `grpcio-status``
# to the dictionary below once this bug is fixed.
# TODO(https://github.com/googleapis/google-cloud-python/issues/13643): Add
# `googleapis-common-protos` and `grpc-google-iam-v1` to the dictionary below
# once this bug is fixed.
package_namespaces = {
"google-api-core": "google.api_core",
"google-auth": "google.auth",
"grpcio": "grpc",
"protobuf": "google.protobuf",
"proto-plus": "proto",
}

version_namespace = package_namespaces.get(dep)

print(f"Installed {dep}")
if version_namespace:
session.run(
"python",
"-c",
f"import {version_namespace}; print({version_namespace}.__version__)",
)

session.run(
"py.test",
Expand All @@ -476,12 +483,12 @@ def prerelease_deps(session, protobuf_implementation):
["python", "upb"],
)
def core_deps_from_source(session, protobuf_implementation):
"""Run all tests with local versions of core dependencies installed,
rather than pulling core dependencies from PyPI.
"""Run all tests with core dependencies installed from source
rather than pulling the dependencies from PyPI.
"""

# Install all dependencies
session.install(".")
session.install("-e", ".")

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

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

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

for dep in core_dependencies_from_source:
session.install(dep, "--ignore-installed", "--no-deps")
session.install(dep, "--no-deps", "--ignore-installed")
print(f"Installed {dep}")

session.run(
"py.test",
Expand Down