Learn how to edit or delete Connectivity Tests by following the steps on this page. You can edit or delete tests created by you and by others.
To create, view, or rerun tests, read Running Connectivity Tests.
To learn about Connectivity Tests, read the overview.
Before you begin
Set up the following items in Google Cloud before you use Connectivity Tests:
- In the Google Cloud Console, go to the project selector page.
- Select or create a Google Cloud project.
- Make sure that billing is enabled for your Cloud project.
The procedures in this document include the following:
Example API calls that use the Network Management API. For more information, see the API documentation.
Sample code that uses the API Python client.
Using the API Python client
The example code in this document assumes that you have constructed a resource
named api
to interact with the Network Management API. To construct a
resource, use the
build
function.
See the following example:
from googleapiclient.discovery import build
api = build('networkmanagement', 'v1')
For more information, see the following:
Google API Client Library for Python Docs in GitHub. This includes installation and authentication instructions.
The Network Management API reference documentation for the API Python client.
Using the API Explorer
You can test Network Management API commands by using the API Explorer. In the Network Management API reference document, use theTry this API
column to explore API fields and
run a test.
Using the gcloud
SDK
The gcloud
command-line tool is part of the Cloud SDK. To install the
latest version of the gcloud
command-line tool, see the
Cloud SDK documentation.
For a list of all commands, see the gcloud
command reference.
Checking a running test operation
To check the status of a test operation while the operation runs, see Checking a running test operation.
Some examples of test operations are update
and delete
.
Updating a test
Follow the steps in this section to update a test. You can change any field
except the name
of the test.
Console
From the main Connectivity Tests page
- In the Google Cloud Console, go to the Connectivity Tests page.
- To update a test, click its name.
- On the Connectivity Test details page, click Edit at the top of the page.
- Modify the test options.
Click Save.
The test reruns automatically.
From the Network interface details page
- In the Google Cloud Console, go to the VM instances page.
- If it is not already selected, select the project that contains the instance for which you want to update a test.
- Click the instance for which you want to update a test.
- Under Network interfaces, select the network interface for which you want to update a test.
- Under Network analysis, click Connectivity Tests.
- Click the name of a test to update.
- On the Connectivity Test details page, click Edit at the top of the page.
- Modify the test options.
Click Save.
The test reruns automatically.
gcloud
To update a test, enter the following command using the test ID that you want to update and the command options that you want to change. The following example changes the destination IP address.
gcloud network-management connectivity-tests update NAME \ --destination-ip-address= DESTINATION_IP_ADDRESS
Replace the following values:
NAME
: the name of the Connectivity TestDESTINATION_IP_ADDRESS
: the internal or external destination IP address that you are testing to; an IPv6 address is only allowed when the test's destination is a global load balancer VIP
API
Use the networkmanagement.connectivitytests.patch
method to update (edit) a test.
PATCH https: //networkmanagement.googleapis.com/v1/{resource.name=projects/PROJECT_ID/locations/global/connectivityTests/TEST_ID} { "source": { "ipAddress": "SOURCE_IP_ADDRESS", "projectId": "SOURCE_PROJECT", }, }
Replace the following values:
PROJECT_ID
: the project ID of the source VMTEST_ID
: the ID of the Connectivity Tests object (test) that you are runningSOURCE_IP_ADDRESS
: the internal or external source IP address that you are testing from; an IPv6 address is only allowed when the test's destination is a global load balancer VIPSOURCE_PROJECT
: the project ID of the source endpoint
Python
The following example code updates the source IP address for a test. For more
information, see patch
in the API Python client reference documentation.
project_id = "PROJECT_ID" test_id = "TEST_ID" test_input = { "source": { "ipAddress": "SOURCE_IP_ADDRESS" }, } request = api.projects().locations().global_().connectivityTests().patch( name='projects/%s/locations/global/connectivityTests/%s' % (project_id, test_id), body=test_input, updateMask="source")
print(json.dumps(request.execute(), indent=4))
Replace the following values:
PROJECT_ID
: the project ID of the project in which the test was createdTEST_ID
: the ID of the Connectivity Tests object (test) that you are runningSOURCE_IP_ADDRESS
: the internal or external source IP address that you are testing from; an IPv6 address is only allowed when the test's destination is a global load balancer VIP
updateMask
is a required parameter that specifies the fields that your patch
updates. This example updates the source
field.
Deleting one or more tests
Console
From the main Connectivity Tests page
- In the Google Cloud Console, go to the Connectivity Tests page.
- Click the checkbox to the left of one or more tests to delete.
- At the top of the Cloud Console page, click Delete .
From the Connectivity Test details page
- From the main Connectivity Tests page, click the name of a test.
- At the top of the Connectivity Test details page, click Delete .
From the Network interface details page
In the Google Cloud Console, go to the VM instances page.
If it is not already selected, select the project that contains the instance from which you want to delete a test.
Click the instance from which you want to delete a test.
Under Network interfaces, select the network interface from which you want to delete a test.
Under Network analysis, click Connectivity Tests.
Select the checkbox to the left of one or more tests that you want to delete.
At the top of the list of tests, click Delete
.
gcloud
To delete a test, enter the following command. Use the test ID for the test that you want to delete.
gcloud beta network-management connectivity-tests delete NAME
Replace NAME
with the name of the
Connectivity Test.
API
Use the networkmanagement.connectivitytests.delete
method to delete a test.
DELETE https://networkmanagement.googleapis.com/v1/{name=projects/PROJECT_ID/locations/global/connectivityTests/{TEST_ID}
Replace the following values:
PROJECT_ID
: the project ID of the source VMTEST_ID
: the ID of the Connectivity Tests object (test) that you are running
Python
The following example code deletes a test. For more information, see
delete
in the API Python client reference documentation.
project_id = "PROJECT_ID" test_id = "TEST_ID" request = api.projects().locations().global_().connectivityTests().delete( name='projects/%s/locations/global/connectivityTests/%s' % (project_id, test_id))
print(json.dumps(request.execute(), indent=4))
Replace the following values:
PROJECT_ID
: the project ID of the project in which the test was createdTEST_ID
: the ID of the Connectivity Tests object (test) that you are deleting