Skip to content

Commit

Permalink
Update property should not be read only (Azure#3472)
Browse files Browse the repository at this point in the history
* Expose new fields for bgp and community object

* Update api version

* remove unneeded files

* remove unneeded files

* update version

* add tests

* add customized init

* fix format

* update tests

* update property

* update version

* update tests

* fix version

* update version

* fix version and tests
  • Loading branch information
dihan0604 authored and shahabhijeet committed Jul 18, 2017
1 parent c0f33ce commit d3cc5d0
Show file tree
Hide file tree
Showing 8 changed files with 691 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ public PatchRouteFilter()
public IList<RouteFilterRule> Rules { get; set; }

/// <summary>
/// Gets a collection of references to express route circuit peerings.
/// Gets or sets a collection of references to express route circuit
/// peerings.
/// </summary>
[JsonProperty(PropertyName = "properties.peerings")]
public IList<ExpressRouteCircuitPeering> Peerings { get; private set; }
public IList<ExpressRouteCircuitPeering> Peerings { get; set; }

/// <summary>
/// Gets the provisioning state of the resource. Possible values are:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ public RouteFilter()
public IList<RouteFilterRule> Rules { get; set; }

/// <summary>
/// Gets a collection of references to express route circuit peerings.
/// Gets or sets a collection of references to express route circuit
/// peerings.
/// </summary>
[JsonProperty(PropertyName = "properties.peerings")]
public IList<ExpressRouteCircuitPeering> Peerings { get; private set; }
public IList<ExpressRouteCircuitPeering> Peerings { get; set; }

/// <summary>
/// Gets the provisioning state of the resource. Possible values are:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ static RouteFilterRule()
public string ProvisioningState { get; private set; }

/// <summary>
/// Gets the name of the resource that is unique within a resource
/// group. This name can be used to access the resource.
/// Gets or sets the name of the resource that is unique within a
/// resource group. This name can be used to access the resource.
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; private set; }
public string Name { get; set; }

/// <summary>
/// Gets or sets resource location.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<PackageId>Microsoft.Azure.Management.Network</PackageId>
<Description>Provides management capabilities for Network services.</Description>
<AssemblyName>Microsoft.Azure.Management.Network</AssemblyName>
<VersionPrefix>11.1.1-preview</VersionPrefix>
<VersionPrefix>12.0.0-preview</VersionPrefix>
<PackageTags>Microsoft Azure Network management;Network;Network management;windowsazureofficial</PackageTags>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net452;netstandard1.4</TargetFrameworks>
<Version>11.1.1-preview</Version>
<Version>12.0.0-preview</Version>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
[assembly: AssemblyTitle("Microsoft Azure Network Management Library")]
[assembly: AssemblyDescription("Provides Microsoft Azure Network management functions for managing the Microsoft Azure Network service.")]

[assembly: AssemblyVersion("11.0.0.0")]
[assembly: AssemblyFileVersion("11.0.0.0")]
[assembly: AssemblyVersion("12.0.0.0")]
[assembly: AssemblyFileVersion("12.0.0.0")]

[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Azure .NET SDK")]
Expand Down

Large diffs are not rendered by default.

22 changes: 19 additions & 3 deletions src/SDKs/Network/Network.Tests/Tests/ExpressRouteTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,28 @@ public void RouteFilterApiTest()
filterName, location, networkManagementClient);

Assert.Equal(filter.Name, filterName);
Assert.Empty(filter.Rules);

// Update filter with rules
var rule = TestHelper.CreateDefaultRouteFilterRule(resourceGroupName,
// Update route filter with rule by put on parent resources
filter = TestHelper.CreateDefaultRouteFilter(resourceGroupName,
filterName, location, networkManagementClient, true);

Assert.Equal(filter.Name, filterName);
Assert.NotEmpty(filter.Rules);

// Update route filter and delete rules
filter = TestHelper.CreateDefaultRouteFilter(resourceGroupName,
filterName, location, networkManagementClient);

Assert.Equal(filter.Name, filterName);
Assert.Empty(filter.Rules);

filter = TestHelper.CreateDefaultRouteFilterRule(resourceGroupName,
filterName, ruleName, location, networkManagementClient);

// Delete resource group
Assert.Equal(filter.Name, filterName);
Assert.NotEmpty(filter.Rules);

resourcesClient.ResourceGroups.Delete(resourceGroupName);
}
}
Expand Down
17 changes: 16 additions & 1 deletion src/SDKs/Network/Network.Tests/Tests/TestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public static ExpressRouteCircuit UpdateDefaultExpressRouteCircuitWithMicrosoftP


public static RouteFilter CreateDefaultRouteFilter(string resourceGroupName, string filterName, string location,
NetworkManagementClient nrpClient)
NetworkManagementClient nrpClient, bool containsRule = false)
{
var filter = new RouteFilter()
{
Expand All @@ -156,6 +156,21 @@ public static RouteFilter CreateDefaultRouteFilter(string resourceGroupName, str
}
};

if (containsRule)
{
var rule = new RouteFilterRule()
{
Name = "test",
Access = ExpressRouteTests.Filter_Access,
Communities = new List<string> { ExpressRouteTests.Filter_Commmunity },
Location = location
};

var rules = new List<RouteFilterRule>();
rules.Add(rule);
filter.Rules = rules;
}

// Put route filter
var filterResponse = nrpClient.RouteFilters.CreateOrUpdate(resourceGroupName, filterName, filter);
Assert.Equal("Succeeded", filterResponse.ProvisioningState);
Expand Down

0 comments on commit d3cc5d0

Please sign in to comment.