Skip to content

Commit d53a9df

Browse files
committed
Reverting changes in service fabric test and squashing all commits into one
1 parent ca77eed commit d53a9df

File tree

19 files changed

+809
-712
lines changed

19 files changed

+809
-712
lines changed

src/Common/Commands.Common.Network/Commands.Common.Network.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
<Compile Include="Common\INetworkInterfaceReference.cs" />
6767
<Compile Include="Common\IResourceReference.cs" />
6868
<Compile Include="Common\NetworkClient.cs" />
69+
<Compile Include="Common\IOperationalInsightWorkspace.cs" />
6970
<Compile Include="Version2017_03_01\ILoadBalancersOperations.cs" />
7071
<Compile Include="Version2017_03_01\INetworkInterfacesOperations.cs" />
7172
<Compile Include="Version2017_03_01\INetworkManagementClient.cs" />
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Collections.Generic;
17+
18+
namespace Microsoft.Azure.Management.Internal.Network.Common
19+
{
20+
public interface IOperationalInsightWorkspace
21+
{
22+
string ResourceId { get; set; }
23+
24+
string Location { get; set; }
25+
26+
Guid? CustomerId { get; set; }
27+
}
28+
}

src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/EnvironmentSetupHelper.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ public EnvironmentSetupHelper()
9292
module = GetModuleManifest(StorageDirectory, "Azure.Storage");
9393
LogIfNotNull($"Storage Data Plane Module path: {module}");
9494
RMStorageDataPlaneModule = module;
95+
module = GetModuleManifest(RmDirectory, "AzureRM.OperationalInsights");
96+
LogIfNotNull($"Storage Data Plane Module path: {module}");
97+
RMOperationalInsightsModule = module;
9598
module = GetModuleManifest(RmDirectory, "AzureRM.Network");
9699
LogIfNotNull($"Network Module path: {module}");
97100
RMNetworkModule = module;
@@ -152,7 +155,9 @@ public EnvironmentSetupHelper()
152155

153156
public string RMInsightsModule { get; private set; }
154157

155-
public string RMStorageModule { get; private set; }
158+
public string RMStorageModule { get; private set; }
159+
160+
public string RMOperationalInsightsModule { get; private set; }
156161

157162
//TODO: clarify (data plane should not be under ARM folder)
158163
public string RMStorageDataPlaneModule { get; private set; }

src/ResourceManager/Network/AzureRM.Network.Netcore.psd1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ PowerShellVersion = '5.1'
5454
RequiredModules = @(@{ModuleName = 'AzureRM.Profile.Netcore'; ModuleVersion = '0.11.0'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
57-
RequiredAssemblies = '.\AutoMapper.dll',
58-
'.\Microsoft.Azure.Management.Network.dll'
57+
RequiredAssemblies = '.\AutoMapper.dll','.\Microsoft.Azure.Management.Network.dll'
5958

6059
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
6160
# ScriptsToProcess = @()

src/ResourceManager/Network/AzureRM.Network.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ CLRVersion = '4.0'
5454
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '5.0.0'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
57-
RequiredAssemblies = '.\AutoMapper.dll', '.\Microsoft.Azure.Management.Network.dll', '.\Microsoft.Azure.Commands.OperationalInsights.dll','.\Microsoft.Azure.Management.OperationalInsights.dll','.\Microsoft.Azure.OperationalInsights.dll'
57+
RequiredAssemblies = '.\AutoMapper.dll', '.\Microsoft.Azure.Management.Network.dll'
5858

5959
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
6060
# ScriptsToProcess = @()

src/ResourceManager/Network/Commands.Network.Test/Commands.Network.Test.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@
6767
<Reference Include="Microsoft.Azure.Management.Network, Version=19.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6868
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.19.0.1-preview\lib\net452\Microsoft.Azure.Management.Network.dll</HintPath>
6969
</Reference>
70+
<Reference Include="Microsoft.Azure.Management.OperationalInsights, Version=0.18.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
71+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.OperationalInsights.0.18.0-preview\lib\net45\Microsoft.Azure.Management.OperationalInsights.dll</HintPath>
72+
</Reference>
7073
<Reference Include="Microsoft.Azure.Management.ResourceManager">
7174
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ResourceManager.1.6.0-preview\lib\net452\Microsoft.Azure.Management.ResourceManager.dll</HintPath>
7275
</Reference>
@@ -679,6 +682,10 @@
679682
<Project>{98cfd96b-a6bc-4f15-ae2c-603fc2b58981}</Project>
680683
<Name>Commands.Network</Name>
681684
</ProjectReference>
685+
<ProjectReference Include="..\..\OperationalInsights\Commands.OperationalInsights\Commands.OperationalInsights.csproj">
686+
<Project>{5BE35A94-C20F-4659-AA29-9B9AEBCFAF36}</Project>
687+
<Name>Commands.OperationalInsights</Name>
688+
</ProjectReference>
682689
</ItemGroup>
683690
<ItemGroup>
684691
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />

src/ResourceManager/Network/Commands.Network.Test/NetworkResourcesController.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
using Microsoft.Azure.Management.Redis;
2222
using Microsoft.Azure.Management.Resources;
2323
using Microsoft.Azure.Management.Storage;
24+
using Microsoft.Azure.Management.OperationalInsights;
2425
using Microsoft.Azure.Subscriptions;
2526
using Microsoft.Azure.Test;
2627
using Microsoft.Azure.Test.HttpRecorder;
@@ -52,6 +53,8 @@ public sealed class NetworkResourcesController
5253

5354
public StorageManagementClient StorageManagementClient { get; private set; }
5455

56+
public OperationalInsightsManagementClient OperationalInsightsManagementClient { get; private set; }
57+
5558
public InsightsManagementClient InsightsManagementClient { get; private set; }
5659

5760
public RedisManagementClient RedisManagementClient { get; private set; }
@@ -127,6 +130,7 @@ public void RunPsTestWorkflow(
127130
helper.GetRMModulePath("AzureRM.RedisCache.psd1"),
128131
helper.GetRMModulePath("AzureRM.Network.psd1"),
129132
helper.GetRMModulePath("AzureRM.Compute.psd1"),
133+
helper.GetRMModulePath("AzureRM.OperationalInsights.psd1"),
130134
helper.RMStorageDataPlaneModule,
131135
"AzureRM.Storage.ps1",
132136
"AzureRM.Resources.ps1");
@@ -177,6 +181,7 @@ private void SetupManagementClients(RestTestFramework.MockContext context)
177181
this.NetworkManagementClient = this.GetNetworkManagementClient(context);
178182
this.ComputeManagementClient = this.GetComputeManagementClient(context);
179183
this.StorageManagementClient = this.GetStorageManagementClient(context);
184+
this.OperationalInsightsManagementClient = this.GetOperationalInsightsManagementClient(context);
180185
this.AuthorizationManagementClient = this.GetAuthorizationManagementClient();
181186
this.InsightsManagementClient = this.GetInsightsManagementClient();
182187
this.RedisManagementClient = this.GetRedisManagementClient(context);
@@ -189,6 +194,7 @@ private void SetupManagementClients(RestTestFramework.MockContext context)
189194
this.NetworkManagementClient,
190195
this.ComputeManagementClient,
191196
this.StorageManagementClient,
197+
this.OperationalInsightsManagementClient,
192198
this.AuthorizationManagementClient,
193199
this.InsightsManagementClient,
194200
this.RedisManagementClient);
@@ -219,6 +225,11 @@ private StorageManagementClient GetStorageManagementClient(RestTestFramework.Moc
219225
return context.GetServiceClient<StorageManagementClient>(RestTestFramework.TestEnvironmentFactory.GetTestEnvironment());
220226
}
221227

228+
private OperationalInsightsManagementClient GetOperationalInsightsManagementClient(RestTestFramework.MockContext context)
229+
{
230+
return context.GetServiceClient<OperationalInsightsManagementClient>(RestTestFramework.TestEnvironmentFactory.GetTestEnvironment());
231+
}
232+
222233
private GalleryClient GetGalleryClient()
223234
{
224235
return TestBase.GetServiceClient<GalleryClient>(this.csmTestFactory);

src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/NetworkWatcherAPITests.ps1

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -503,25 +503,23 @@ function Test-FlowLog
503503
# Setup
504504
$resourceGroupName = Get-ResourceGroupName
505505
$nwName = Get-ResourceName
506-
$location = "eastus"
506+
#Since Traffic Analytics is not available in all Azure regions, hardcoded locations are used
507+
#Once Traffic Analytics is available in all azure regions, the below two location variables should be updated to Get-Location
508+
$location = "eastus2euap"
509+
$workspaceLocation = "eastus"
507510
$resourceTypeParent = "Microsoft.Network/networkWatchers"
508511
$nwLocation = Get-ProviderLocation $resourceTypeParent
509512
$nwRgName = Get-ResourceGroupName
510513
$domainNameLabel = Get-ResourceName
511-
$vnetName = Get-ResourceName
512-
$subnetName = Get-ResourceName
513514
$nsgName = Get-ResourceName
515+
$stoname = Get-ResourceName
514516
$workspaceName = Get-ResourceName
515517

516518
try
517519
{
518520
# Create Resource group
519521
New-AzureRmResourceGroup -Name $resourceGroupName -Location "$location"
520522

521-
# Create the Virtual Network
522-
$subnet = New-AzureRmVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix 10.0.1.0/24
523-
$vnet = New-AzureRmvirtualNetwork -Name $vnetName -ResourceGroupName $resourceGroupName -Location $location -AddressPrefix 10.0.0.0/16 -Subnet $subnet
524-
525523
# Create NetworkSecurityGroup
526524
$nsg = New-AzureRmNetworkSecurityGroup -name $nsgName -ResourceGroupName $resourceGroupName -Location $location
527525

@@ -535,18 +533,17 @@ function Test-FlowLog
535533
$nw = New-AzureRmNetworkWatcher -Name $nwName -ResourceGroupName $nwRgName -Location $location
536534

537535
# Create storage
538-
$stoname = 'sto' + $resourceGroupName
536+
$stoname = 'sto' + $stoname
539537
$stotype = 'Standard_GRS'
540-
$containerName = 'cont' + $resourceGroupName
541538

542539
New-AzureRmStorageAccount -ResourceGroupName $resourceGroupName -Name $stoname -Location $location -Type $stotype;
543540
$sto = Get-AzureRmStorageAccount -ResourceGroupName $resourceGroupName -Name $stoname;
544541

545542
# create workspace
546-
$workspaceLocation = "East US"
547-
$workspaceSku = "Standard"
543+
$workspaceName = 'tawspace' + $workspaceName
544+
$workspaceSku = 'free'
548545

549-
New-AzureRmOperationalInsightsWorkspace -ResourceGroupName $resourceGroupName -Name $workspaceName -Location $workspaceLocation -Sku $workspaceSku
546+
New-AzureRmOperationalInsightsWorkspace -ResourceGroupName $resourceGroupName -Name $workspaceName -Location $workspaceLocation -Sku $workspaceSku;
550547
$workspace = Get-AzureRmOperationalInsightsWorkspace -Name $workspaceName -ResourceGroupName $resourceGroupName
551548

552549
$job = Set-AzureRmNetworkWatcherConfigFlowLog -NetworkWatcher $nw -TargetResourceId $getNsg.Id -EnableFlowLog $true -StorageAccountId $sto.Id -EnableTrafficAnalytics:$true -Workspace $workspace -AsJob
@@ -563,17 +560,17 @@ function Test-FlowLog
563560
Assert-AreEqual $config.RetentionPolicy.Days 0
564561
Assert-AreEqual $config.RetentionPolicy.Enabled $false
565562
Assert-AreEqual $config.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.Enabled $true
566-
Assert-AreEqual $config.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.WorkspaceResourceId $workspace.Id
567-
Assert-AreEqual $config.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.WorkspaceId $workspace.CustomerId
563+
Assert-AreEqual $config.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.WorkspaceResourceId $workspace.ResourceId
564+
Assert-AreEqual $config.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.WorkspaceId $workspace.CustomerId.ToString()
568565
Assert-AreEqual $config.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.WorkspaceRegion $workspace.Location
569566
Assert-AreEqual $status.TargetResourceId $getNsg.Id
570567
Assert-AreEqual $status.StorageId $sto.Id
571568
Assert-AreEqual $status.Enabled $true
572569
Assert-AreEqual $status.RetentionPolicy.Days 0
573570
Assert-AreEqual $status.RetentionPolicy.Enabled $false
574571
Assert-AreEqual $status.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.Enabled $true
575-
Assert-AreEqual $status.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.WorkspaceResourceId $workspace.Id
576-
Assert-AreEqual $status.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.WorkspaceId $workspace.CustomerId
572+
Assert-AreEqual $status.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.WorkspaceResourceId $workspace.ResourceId
573+
Assert-AreEqual $status.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.WorkspaceId $workspace.CustomerId.ToString()
577574
Assert-AreEqual $status.FlowAnalyticsConfiguration.NetworkWatcherFlowAnalyticsConfiguration.WorkspaceRegion $workspace.Location
578575
}
579576
finally

src/ResourceManager/Network/Commands.Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.NetworkWatcherAPITests/TestFlowLog.json

Lines changed: 685 additions & 633 deletions
Large diffs are not rendered by default.

src/ResourceManager/Network/Commands.Network.Test/packages.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<package id="Microsoft.Azure.Management.Authorization" version="2.0.0" targetFramework="net452" />
1010
<package id="Microsoft.Azure.Management.Compute" version="18.0.0" targetFramework="net452" />
1111
<package id="Microsoft.Azure.Management.Network" version="19.0.1-preview" targetFramework="net452" />
12+
<package id="Microsoft.Azure.Management.OperationalInsights" version="0.18.0-preview" targetFramework="net452" />
1213
<package id="Microsoft.Azure.Management.Redis" version="3.1.1-preview" targetFramework="net45" />
1314
<package id="Microsoft.Azure.Management.ResourceManager" version="1.6.0-preview" targetFramework="net452" />
1415
<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />

src/ResourceManager/Network/Commands.Network/Commands.Network.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,10 +585,6 @@
585585
<Project>{3819d8a7-c62c-4c47-8ddd-0332d9ce1252}</Project>
586586
<Name>Commands.ResourceManager.Common</Name>
587587
</ProjectReference>
588-
<ProjectReference Include="..\..\OperationalInsights\Commands.OperationalInsights\Commands.OperationalInsights.csproj">
589-
<Project>{5BE35A94-C20F-4659-AA29-9B9AEBCFAF36}</Project>
590-
<Name>Commands.ResourceManager.OperationalInsights</Name>
591-
</ProjectReference>
592588
</ItemGroup>
593589
<ItemGroup>
594590
<Folder Include="Microsoft\Azure\Commands\Network\Models\" />

0 commit comments

Comments
 (0)