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

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import unittest

import azure.mgmt.network.v2020_03_01
import azure.mgmt.network
from devtools_testutils import AzureMgmtTestCase, RandomNameResourceGroupPreparer

AZURE_LOCATION = 'eastus'
Expand All @@ -31,7 +31,7 @@ class MgmtNetworkTest(AzureMgmtTestCase):
def setUp(self):
super(MgmtNetworkTest, self).setUp()
self.mgmt_client = self.create_mgmt_client(
azure.mgmt.network.v2020_03_01.NetworkManagementClient
azure.mgmt.network.NetworkManagementClient
)

@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import time

from azure.core.exceptions import HttpResponseError
import azure.mgmt.network.v2020_03_01
import azure.mgmt.network
from devtools_testutils import AzureMgmtTestCase, RandomNameResourceGroupPreparer

AZURE_LOCATION = 'eastus'
Expand All @@ -43,7 +43,7 @@ class MgmtNetworkTest(AzureMgmtTestCase):
def setUp(self):
super(MgmtNetworkTest, self).setUp()
self.mgmt_client = self.create_mgmt_client(
azure.mgmt.network.v2020_03_01.NetworkManagementClient
azure.mgmt.network.NetworkManagementClient
)

def create_network_interface(self, group_name, location, nic_name, subnet_id, ipconfig):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

import unittest

import azure.mgmt.network.v2020_03_01
import azure.mgmt.network
from devtools_testutils import AzureMgmtTestCase, RandomNameResourceGroupPreparer

AZURE_LOCATION = 'eastus'
Expand All @@ -43,7 +43,7 @@ class MgmtNetworkTest(AzureMgmtTestCase):
def setUp(self):
super(MgmtNetworkTest, self).setUp()
self.mgmt_client = self.create_mgmt_client(
azure.mgmt.network.v2020_03_01.NetworkManagementClient
azure.mgmt.network.NetworkManagementClient
)

@RandomNameResourceGroupPreparer(location=AZURE_LOCATION)
Expand Down
131 changes: 68 additions & 63 deletions sdk/network/azure-mgmt-network/tests/test_cli_mgmt_network_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ def test_network_watcher_monitor(self, resource_group):
INTERFACE_NAME = self.get_resource_name("interface")
VIRTUAL_MACHINE_NAME = self.get_resource_name("virtualmachine")
CONNECTION_MONITOR_NAME = self.get_resource_name("connectionmonitor")
CONNECTION_MONITOR_NAME_V2 = self.get_resource_name("connectionmonitorv2")
VIRTUAL_MACHINE_EXTENSION_NAME = self.get_resource_name("virtualmachineextension")

if self.is_live:
Expand All @@ -483,70 +484,70 @@ def test_network_watcher_monitor(self, resource_group):
result = self.mgmt_client.network_watchers.create_or_update(resource_group.name, NETWORK_WATCHER_NAME, BODY)

# # Create connection monitor V2[put]
# BODY = {
# "properties": {
# "endpoints": [
# {
# "name": "vm1",
# "resource_id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + RESOURCE_GROUP + "/providers/Microsoft.Compute/virtualMachines/" + VIRTUAL_MACHINE_NAME + ""
# },
# {
# "name": "CanaryWorkspaceVamshi",
# "resource_id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + RESOURCE_GROUP + "/providers/Microsoft.OperationalInsights/workspaces/" + WORKSPACE_NAME + "",
# "filter": {
# "type": "Include",
# "items": [
# {
# "type": "AgentAddress",
# "address": "npmuser"
# }
# ]
# }
# },
# {
# "name": "bing",
# "address": "bing.com"
# },
# {
# "name": "google",
# "address": "google.com"
# }
# ],
# "test_configurations": [
# {
# "name": "testConfig1",
# "test_frequency_sec": "60",
# "protocol": "Tcp",
# "tcp_configuration": {
# "port": "80",
# "disable_trace_route": False
# }
# }
# ],
# "test_groups": [
# {
# "name": "test1",
# "disable": False,
# "test_configurations": [
# "testConfig1"
# ],
# "sources": [
# "vm1",
# "CanaryWorkspaceVamshi"
# ],
# "destinations": [
# "bing",
# "google"
# ]
# }
# ],
# "outputs": []
# }
# }
# result = self.mgmt_client.connection_monitors.begin_create_or_update(resource_group.name, NETWORK_WATCHER_NAME, CONNECTION_MONITOR_NAME, BODY)
# result = result.result()
BODY = {
"location": "eastus",
"endpoints": [
{
"name": "vm1",
"resource_id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + RESOURCE_GROUP + "/providers/Microsoft.Compute/virtualMachines/" + VIRTUAL_MACHINE_NAME + ""
},
# {
# "name": "CanaryWorkspaceVamshi",
# "resource_id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + RESOURCE_GROUP + "/providers/Microsoft.OperationalInsights/workspaces/" + WORKSPACE_NAME + "",
# "filter": {
# "type": "Include",
# "items": [
# {
# "type": "AgentAddress",
# "address": "npmuser"
# }
# ]
# }
# },
{
"name": "bing",
"address": "bing.com"
},
{
"name": "google",
"address": "google.com"
}
],
"test_configurations": [
{
"name": "testConfig1",
"test_frequency_sec": "60",
"protocol": "Tcp",
"tcp_configuration": {
"port": "80",
"disable_trace_route": False
}
}
],
"test_groups": [
{
"name": "test1",
"disable": False,
"test_configurations": [
"testConfig1"
],
"sources": [
"vm1",
# "CanaryWorkspaceVamshi"
],
"destinations": [
"bing",
"google"
]
}
],
"outputs": []
}
result = self.mgmt_client.connection_monitors.begin_create_or_update(resource_group.name, NETWORK_WATCHER_NAME, CONNECTION_MONITOR_NAME_V2, BODY)
result = result.result()

# Create connection monitor V1[put]
# [Kaihui] v1 only supports api version <= 2019-06-01
BODY = {
"location": AZURE_LOCATION,
"source": {
Expand All @@ -570,7 +571,7 @@ def test_network_watcher_monitor(self, resource_group):
# List connection monitors[get]
result = self.mgmt_client.connection_monitors.list(resource_group.name, NETWORK_WATCHER_NAME)

# # Query connection monitor[post]
# Query connection monitor[post]
result = self.mgmt_client.connection_monitors.begin_query(resource_group.name, NETWORK_WATCHER_NAME, CONNECTION_MONITOR_NAME)
result = result.result()

Expand All @@ -595,6 +596,10 @@ def test_network_watcher_monitor(self, resource_group):
result = self.mgmt_client.connection_monitors.begin_delete(resource_group.name, NETWORK_WATCHER_NAME, CONNECTION_MONITOR_NAME)
result = result.result()

# Delete connection monitor[delete]
result = self.mgmt_client.connection_monitors.begin_delete(resource_group.name, NETWORK_WATCHER_NAME, CONNECTION_MONITOR_NAME_V2)
result = result.result()

# Delete network watcher[delete]
result = self.mgmt_client.network_watchers.begin_delete(resource_group.name, NETWORK_WATCHER_NAME)
result = result.result()
Expand Down