Update or delete 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, see Create and run Connectivity Tests.

To learn about Connectivity Tests, see the overview.

Before you begin

Before you can use Connectivity Tests, set up the following items in Google Cloud:

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

    Go to the project selector

    Select or create a Google Cloud project.

  2. Ensure that billing is enabled for your Google Cloud project.
  3. Install the gcloud command-line tool, which is part of the Cloud SDK. To install the latest version of the gcloud tool, see the Cloud SDK documentation.

    For a list of all commands, see the gcloud command reference.

  4. Enable the Network Management API. Enabling the API provides you with the following:

    • Example API calls that use the Network Management API

      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.

    • Sample code that uses the API Python client

      The example code 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 about the API Python client, see the following:

  5. Obtain the permissions that you need to run and view tests. For details, see Assign access.

Update a test

Follow the steps in this section to update a test. You can change any field except the name of the test.

To check the status of the update test operation while it's running, see Check a running test operation.

Console

From the main Connectivity Tests page

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

    Go to Connectivity Tests

  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 VM instances

  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.

Delete one or more tests

Follow the steps in this section to delete a test.

To check the status of the delete test operation while it's running, see Check a running test operation.

Console

From the main Connectivity Tests page

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

    Go to Connectivity Tests

  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 VM instances

  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