@@ -63,3 +63,76 @@ function Test-NetworkVirtualApplianceConnectionGet
63
63
Clean - ResourceGroup $rgname
64
64
}
65
65
}
66
+
67
+ function Test-NetworkVirtualApplianceConnectionUpdate
68
+ {
69
+ $rgname = Get-ResourceGroupName
70
+
71
+ # The commands are not supported in all regions yet.
72
+ $location = " centraluseuap"
73
+ $nvaname = Get-ResourceName
74
+ $wanname = Get-ResourceName
75
+ $hubname = Get-ResourceName
76
+ $resourceTypeParent = " Microsoft.Network/networkVirtualAppliance"
77
+ $vendor = " ciscosdwan"
78
+ $scaleunit = 2
79
+ $version = ' latest'
80
+ $asn = 65222
81
+ $prefix = " 10.1.0.0/16"
82
+ $routeMapName = " testRouteMap"
83
+ try {
84
+ $resourceGroup = New-AzResourceGroup - Name $rgname - Location $location
85
+ $sku = New-AzVirtualApplianceSkuProperty - VendorName $vendor - BundledScaleUnit $scaleunit - MarketPlaceVersion $version
86
+ Assert-NotNull $sku
87
+
88
+ $wan = New-AzVirtualWan - ResourceGroupName $rgname - Name $wanname - Location $location
89
+ $hub = New-AzVirtualHub - ResourceGroupName $rgname - Name $hubname - Location $location - VirtualWan $wan - AddressPrefix $prefix
90
+
91
+ # Wait for Virtual Hub Routing State to become Provisioned or Failed
92
+ while ($hub.RoutingState -eq " Provisioning" )
93
+ {
94
+ Start-TestSleep - Seconds 30
95
+ $hub = Get-AzVirtualHub - ResourceGroupName $rgName - Name $hubname
96
+ }
97
+ Assert-AreEqual $hub.RoutingState " Provisioned"
98
+
99
+
100
+ $nva = New-AzNetworkVirtualAppliance - ResourceGroupName $rgname - Name $nvaname - Location $location - VirtualApplianceAsn $asn - VirtualHubId $hub.Id - Sku $sku - CloudInitConfiguration " echo hi"
101
+ Assert-NotNull $nva
102
+
103
+ $getnva = Get-AzNetworkVirtualAppliance - ResourceGroupName $rgname - Name $nvaname
104
+ Assert-NotNull $getnva
105
+ $oldRoutingConfig = $getnva.RoutingConfiguration
106
+
107
+ $getNvaConnection = Get-AzNetworkVirtualApplianceConnection - VirtualAppliance $getnva
108
+ Assert-NotNull $getNvaConnection
109
+
110
+ $rt = Get-AzVHubRouteTable - ResourceGroupName $rgname - VirtualHubName $hubname - Name " noneRouteTable"
111
+
112
+ # RouteMAp
113
+ $routeMapMatchCriterion = New-AzRouteMapRuleCriterion - MatchCondition " Equals" - AsPath @ (" 12345" )
114
+ $routeMapAction = New-AzRouteMapRuleAction - Type " Drop"
115
+ $routeMapRule = New-AzRouteMapRule - Name " rule" - MatchCriteria @ ($routeMapMatchCriterion ) - RouteMapRuleAction @ ($routeMapAction ) - NextStepIfMatched " Terminate"
116
+
117
+ New-AzRouteMap - ResourceGroupName $rgName - VirtualHubName $hubname - Name $routeMapName - RouteMapRule @ ($routeMapRule )
118
+ $routeMap = Get-AzRouteMap - ResourceGroupName $rgName - VirtualHubName $hubname - Name $routeMapName
119
+ Assert-AreEqual $routeMap.Rules.Count 1
120
+
121
+ $routingconfig = New-AzRoutingConfiguration - AssociatedRouteTable $rt.Id - Label @ (" none" ) - Id @ ($rt.Id ) - InboundRouteMap $routeMap.Id
122
+
123
+ Update-AzNetworkVirtualApplianceConnection - ResourceGroupName $rgname - VirtualApplianceName $nvaname - Name defaultConnection - RoutingConfiguration $routingconfig
124
+
125
+ $updatedNvaConnection = Get-AzNetworkVirtualApplianceConnection - VirtualAppliance $getnva
126
+
127
+ Assert-AreNotEqual $updatedNvaConnection.RoutingConfiguration $oldRoutingConfig
128
+ Assert-AreEqual $updatedNvaConnection.RoutingConfiguration.AssociatedRouteTable.Id $rt.Id
129
+ Assert-AreEqual $updatedNvaConnection.RoutingConfiguration.PropagatedRouteTables.Ids [0 ].Id $rt.Id
130
+ Assert-AreEqual $updatedNvaConnection.RoutingConfiguration.PropagatedRouteTables.Labels [0 ] " none"
131
+ Assert-AreEqual $updatedNvaConnection.RoutingConfiguration.InboundRouteMap.Id $routeMap.Id
132
+
133
+ }
134
+ finally {
135
+ # Clean up.
136
+ Clean - ResourceGroup $rgname
137
+ }
138
+ }
0 commit comments