Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network mgmt track 2 library #23049

Merged
merged 189 commits into from
Aug 31, 2021
Merged

Network mgmt track 2 library #23049

merged 189 commits into from
Aug 31, 2021

Conversation

archerzz
Copy link
Member

@archerzz archerzz commented Aug 2, 2021

All SDK Contribution checklist:

This checklist is used to make sure that common guidelines for a pull request are followed.

  • Please open PR in Draft mode if it is:
    • Work in progress or not intended to be merged.
    • Encountering multiple pipeline failures and working on fixes.
  • If an SDK is being regenerated based on a new swagger spec, a link to the pull request containing these swagger spec changes has been included above.
  • I have read the contribution guidelines.
  • The pull request does not introduce breaking changes.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

SDK Generation Guidelines

  • The generate.cmd file for the SDK has been updated with the version of AutoRest, as well as the commitid of your swagger spec or link to the swagger spec, used to generate the code. (Track 2 only)
  • The *.csproj and AssemblyInfo.cs files have been updated with the new version of the SDK. Please double check nuget.org current release version.

Additional management plane SDK specific contribution checklist:

Note: Only applies to Microsoft.Azure.Management.[RP] or Azure.ResourceManager.[RP]

  • Include updated management metadata.
  • Update AzureRP.props to add/remove version info to maintain up to date API versions.

Management plane SDK Troubleshooting

  • If this is very first SDK for a services and you are adding new service folders directly under /SDK, please add new service label and/or contact assigned reviewer.

  • If the check fails at the Verify Code Generation step, please ensure:

    • Do not modify any code in generated folders.
    • Do not selectively include/remove generated files in the PR.
    • Do use generate.ps1/cmd to generate this PR instead of calling autorest directly.
      Please pay attention to the @microsoft.csharp version output after running generate.ps1. If it is lower than current released version (2.3.82), please run it again as it should pull down the latest version.

    Note: We have recently updated the PSH module called by generate.ps1 to emit additional data. This would help reduce/eliminate the Code Verification check error. Please run following command:

      `dotnet msbuild eng/mgmt.proj /t:Util /p:UtilityName=InstallPsModules`
    

Old outstanding PR cleanup

Please note:
If PRs (including draft) has been out for more than 60 days and there are no responses from our query or followups, they will be closed to maintain a concise list for our reviewers.

m-nash and others added 30 commits February 26, 2021 23:11
* initial checkin for core / tests

* Add readme.md file

* Fix header in readme

* remove autorest until we convert off hand written types

* update azure.core reference
remove sets to tags
ignore tests which require credentials for now

* Add the proto client which will be used until the autogen work is complete

* Add missing readmes for proto client

* update to require linq 4.0.0 so that don't have to upgrade bcl

* add changlog for CI

* change system.linq.async to update

* update to use source vs binary for the temporary generation of Azure.ResourceManager.Authorization

* Add changelog for azure.resourcemanager.authorization and update version to be beta

* update typos in readme

* update name of proto client sln

* merge in changes from proto repo this week

* fixed unit test failures
missed a few files from the merge from proto repo
updated compute and network sdk version to use latest azure.core with readonly list types

* ignore tests which require live azure until 5122 is closed

* Update failing scenario test
…5584 (#19109)

* 5584

* Update async test

* Test

* WIP: test

* Update Proto.Authorization.csproj

* Update Proto.Authorization.csproj

* Update Proto.Authorization.csproj

* Update Proto.Authorization.csproj
* add tests for ApiVersionBase

* update methods
* add tests for ArmBuilder

* Update ArmBuilderTests.cs

* Update SubscriptionContainer.cs
* Update test project to consume framework for recorded tests

* Changes required to get instrumentation working for the new armClient
added support for session recording for onetimesetup and onetimeteardown

* move unit test files

* update tests to not use username for prefix

* update targets to separate existing track 2 libraries from new core until autorest changes are finished

* merge in armbuildertest and update to use new framework

* remove necessity on session files if no onetimesetup

* Address review comments
* WIP: tenant resource

* WIP: updates

* Update ResourceIdentifier.cs

* Update ResourceIdentifier.cs

* Update ResourceType.cs

* WIP update check

* WIP

* Add readme for billing

* Stylecop

* WIP

* Remove style

* wip: update

* WIP: updates

* WIP

* WIP: update

* WIP

* Updates

* WIP: updates

* Update

* WIP: updates

* WIP

* Update tests

* WIP: updates
* Remove reference for Azure.Identity

* fixing ArmClient construction in proto client

* resync and fix build error
* Rename TryGetValue to TryGet/TryGetAsync

* Update ContainerBase.cs

* Update ContainerBase.cs

* Update TryGet method and test class

* Update CheckResourceExists.cs

* Rename TryGetValue to TryGet/TryGetAsync

* Update ContainerBase.cs

* Update ContainerBase.cs

* Update TryGet method and test class

* Update CheckResourceExists.cs

* Update ContainerBaseTest.cs

* Update TryGet Test

* Update tests
)

* Framework changes

* Azure.ResourceManager.Core changes to support client interceptors

* Test changes

* proto client changes

* updates after merge

* Address review comments

* WIP

* updates after WIP
* Sku Serialization

* Divide Sku class

* Update Sku
* WIP: updates

* WIP: updates

* Update test

* Update ResourceListOperationsTest.cs

* Update CreateSingleVmExample.cs

* Update CreateSingleVmExample.cs

* Update CreateSingleVmExample.cs

* Update CreateSingleVmExample.cs

* WIP: Updates

* Add extra line

* Update

* WIP:

* WIP: updates

* WIp: updates

* Remove API version extensions

* WIP: updates

* Updates

* Update test

* WIP updates

* Updates

* WIP

* Remove blank lines

* Update filtering

* Updates

* Update

* WIP: updates

* WIP: updates

* Add space

* Remove debug

* Updates

* WIP: updates

* WIP

* Change the accessbility to virtual for Resource.Id

* WIP: updates

* WIP Updates

* WIP updates

* WIP

* WIP

* WIP:

* revert

* WIP: updates

* WIP: updates

* WIP: updated

* WIP

Co-authored-by: YalinLi0312 <yall@microsoft.com>
* Resource Identifier changes

* Adapting Container classes to base class change in Id property

* Fixing xml documentation comments for ResourceType

* Cleaning up resource id ToStrign() and fixing ListLocations client creation

* Adjusting new tenant resource operations for resource id scheme

* Responding to review comments

* Add test coverage, retain string reresentation of resource id

* Fixing additional merge issues

* Updating comparison tests to use concrete variable types
* Plan Serialization

* Divide Plan class

* Update Plan
* Change the accessbility to virtual for Resource.Id

* rename ArmClient, ArmClientOptions, Get[Resource]Container

* updates after merge

* missing one file for rename

Co-authored-by: YalinLi0312 <yall@microsoft.com>
Co-authored-by: m-nash <prognash@microsoft.com>
* Change the accessbility to virtual for Resource.Id

* rename ArmClient, ArmClientOptions, Get[Resource]Container

* updates after merge

* missing one file for rename

* Missed 2 renames

Co-authored-by: YalinLi0312 <yall@microsoft.com>
Co-authored-by: m-nash <prognash@microsoft.com>
* WIP

* WIP

* Update ResourceOperationsBase.cs

* update for tenant extensions

* update csproj

* Update Azure.ResourceManager.Network.csproj

* update csproj

* update csproj

* WIP

* WIP

* update csproj

* update csproj

* update csproj

* add tests

* update test

* update

* fix test cases to use the diagnostics case fix a missing mocking constructor

* WIP

* update framework for tests

* Update Azure.Test.Perf.csproj

* merge

* revert list json files

* revert

* WIP

* fix ci

* Update Program.cs

* update proto

* fix test

* Update ClientContextTests.cs

* update proto

* Update Azure.ResourceManager.Billing.csproj

* update version

* update ci

* Update Azure.ResourceManager.EventHubs.csproj

* add packable

Co-authored-by: m-nash <prognash@microsoft.com>
* Resource Serialization

* Plan Serialization

* Divide Plan class

* Divide Resource class

* Update writer

* Update Plan

* TrackedResource Serialization

* Update GenericResource

* Clean Up

* Update GenericResource

* Remove read only

* Update tests
* Resource Serialization

* Divide Resource class

* Update writer

* TrackedResource Serialization

* Update Deserialization

* Update Test

* Update Tests

* Update Tracked Resource

* Fix PR

* Remove readonly
# Conflicts:
#	eng/Packages.Data.props
#	sdk/network/Azure.ResourceManager.Network/tests/Helpers/NetworkManagementTestUtilities.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Helpers/NetworkTestsManagementClientBase.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Helpers/ResourcesManagementTestUtilities.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/ApplicationGatewayTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/CheckConnectivityTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/ConnectionMonitorTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/ExpandResourceTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/ExpressRouteTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/FlowLogTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/GatewayOperationsTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/LoadBalancerTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkInterfaceTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkSecurityGroupTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkWatcherTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/NextHopTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/PacketCaptureTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/TopologyTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/TroubleshootTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/VerifyIpFlowTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/ViewNsgRuleTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/VmssNetworkInterfaceTests.cs
#	sdk/network/Azure.ResourceManager.Network/tests/Tests/VmssPublicIpAddressTests.cs
- replace old `NetworkManagementClient` with `ArmClient`
- replace old network operations with mgmt track2 preview api
- update test recording
- replace old `NetworkManagementClient` and `ResourceManagementClient` with `ArmClient`
- replace old network/resource operations with mgmt track2 preview SDK
- update test recording
@archerzz archerzz requested a review from m-nash August 29, 2021 14:20
Comment out some test steps due to the following error **in playback mode only**:
> Error Message:
     Expected: not equal to "Sanitized"
  But was:  "Sanitized"

Those could be due to the fact that test framework will sanitize some content it thinks
senstivie during recording. So in the plyaback mode, the tests will fail.
Assert.NotNull(regenerateConnection_primary);
Assert.AreNotEqual(listKeysResponse.Value.PrimaryConnectionString, regenerateConnection_primary.Value.PrimaryConnectionString);
// Assert.AreNotEqual(listKeysResponse.Value.PrimaryConnectionString, regenerateConnection_primary.Value.PrimaryConnectionString);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I comment out this assertion and a few similar ones, due to the following error in playback mode only:

Error Message:
Expected: not equal to "Sanitized"
But was: "Sanitized"

Those could be due to the fact that test framework will sanitize some content it thinks sensitive during recording. So in the playback mode, the tests will fail.

@@ -52,14 +53,14 @@ public async Task EventCreateGetUpdateDelete()
{
AccessTier = AccessTier.Hot
};
await WaitForCompletionAsync(await StorageManagementClient.StorageAccounts.StartCreateAsync(resourceGroup, accountName, storageAccountCreateParameters));
await WaitForCompletionAsync(await StorageManagementClient.StorageAccounts.StartCreateAsync(resourceGroupName, accountName, storageAccountCreateParameters));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case actually doesn't work (I tried on main branch). The following error will be thrown.

"System.InvalidOperationException : Expected scope StorageAccountsOperations.StartCreate to be marked as failed > but it succeeded
Exception: System.NotSupportedException: Parent does not have a default constructor. The default constructor must be explicitly defined."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Storage is involved here, if we can confirm that we can put this test case aside, it will accelerate the publish of Storage mgmt track2 SDK preview as well.

- pull in `main` branch for resource manager 1.0.0-beta.2 and other changes
- re-generate the codes
- fix broken test cases due to interface change
update test cases to fix the borken interface
`network` has 50 swagger files which will cause out-of-memory error in autorest.
Accoring to [autorest faq], we can enlarge the memory through environment variable.
Adding `memory` in autorest config doesn't work, because either release pipeline is not using the latest version of autorest, or the change is not in latest version yet.
@@ -16,6 +16,7 @@ param (
)

$ErrorActionPreference = 'Stop'
$Env:NODE_OPTIONS = "--max-old-space-size=8192"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to fix the out-of-memory error in nodejs vm during autorest execution. There is a similar fix in

$Env:NODE_OPTIONS = "--max-old-space-size=8192"

@m-nash m-nash enabled auto-merge (squash) August 31, 2021 17:55
@m-nash m-nash merged commit 85e5e1e into main Aug 31, 2021
@m-nash m-nash deleted the feature/mgmt-track2-network branch August 31, 2021 18:32
azure-sdk pushed a commit to azure-sdk/azure-sdk-for-net that referenced this pull request Mar 16, 2023
Refactor cache swagger to deduplicate SkuName enum definitions. (Azure#23049)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.