Updating or deleting Connectivity Tests

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:

  1. In the Google Cloud Console, go to the project selector page.

    Go to the project selector page

  2. Select or create a Google Cloud project.
  3. 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:

Using the API Explorer

You can test Network Management API commands by using the API Explorer. In the Network Management API reference document, use the Try 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 gcloudcommand 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

  1. In the Google Cloud Console, go to the Connectivity Tests page.

    Go to the Connectivity Tests page

  2. To update a test, click its name.
  3. On the Connectivity Test details page, click Edit at the top of the page.
  4. Modify the test options.
  5. Click Save.

    The test reruns automatically.

From the Network interface details page

  1. In the Google Cloud Console, go to the VM instances page.

    Go to the VM instances page

  2. If it is not already selected, select the project that contains the instance for which you want to update a test.
  3. Click the instance for which you want to update a test.
  4. Under Network interfaces, select the network interface for which you want to update a test.
  5. Under Network analysis, click Connectivity Tests.
  6. Click the name of a test to update.
  7. On the Connectivity Test details page, click Edit at the top of the page.
  8. Modify the test options.
  9. 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 Test
  • DESTINATION_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 VM
  • TEST_ID: the ID of the Connectivity Tests object (test) that you are running
  • SOURCE_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
  • SOURCE_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 created
  • TEST_ID: the ID of the Connectivity Tests object (test) that you are running
  • SOURCE_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

  1. In the Google Cloud Console, go to the Connectivity Tests page.

    Go to the Connectivity Tests page

  2. Click the checkbox to the left of one or more tests to delete.
  3. At the top of the Cloud Console page, click Delete .

From the Connectivity Test details page

  1. From the main Connectivity Tests page, click the name of a test.
  2. At the top of the Connectivity Test details page, click Delete .

From the Network interface details page

  1. In the Google Cloud Console, go to the VM instances page.

    Go to the VM instances page

  2. If it is not already selected, select the project that contains the instance from which you want to delete a test.

  3. Click the instance from which you want to delete a test.

  4. Under Network interfaces, select the network interface from which you want to delete a test.

  5. Under Network analysis, click Connectivity Tests.

  6. Select the checkbox to the left of one or more tests that you want to delete.

  7. 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 VM
  • TEST_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 created
  • TEST_ID: the ID of the Connectivity Tests object (test) that you are deleting

What's next