@@ -8524,6 +8524,62 @@ def test_network_vnet_gateway_get_routes_and_resiliency_information(self, resour
85248524 self .check ('type(components)' , 'array' )
85258525 ])
85268526
8527+ class NetworkVirtualNetworKApplianceScenario (ScenarioTest ):
8528+ @ResourceGroupPreparer (name_prefix = 'test_vna' , location = 'eastus' )
8529+ def test_network_virtual_network_appliance (self , resource_group ):
8530+ self .kwargs .update ({
8531+ 'vnet1' : 'vnet1' ,
8532+ 'vnet2' : 'vnet2' ,
8533+ 'vnet_address' : '10.10.0.0/16' ,
8534+ 'subnet' : 'VirtualNetworkApplianceSubnet' ,
8535+ 'subnet_address' : '10.10.0.0/24' ,
8536+ 'vna1' : 'vna1' ,
8537+ 'vna2' : 'vna2' ,
8538+ 'tag1' : 'tag1' ,
8539+ 'tag2' : 'tag2' ,
8540+ })
8541+
8542+ # Create vnet, subnet for first vna
8543+ self .cmd ('network vnet create -g {rg} -n {vnet1} --address-prefixes {vnet_address}' )
8544+
8545+ self .kwargs ['subnet1_id' ] = self .cmd ('network vnet subnet create -g {rg} -n {subnet} --vnet-name {vnet1} --address-prefix {subnet_address} --default-outbound false --query id' ).get_output_in_json ()
8546+
8547+ # Create first vna
8548+ self .cmd ('network virtual-network-appliance create -g {rg} -n {vna1} --bandwidth-in-gbps 50 --subnet \" {{id:{subnet1_id}}}\" --tags \" {{name:{tag1}}}\" ' )
8549+
8550+ self .cmd ('network virtual-network-appliance show -g {rg} -n {vna1}' , checks = [
8551+ self .check ('tags.name' , '{tag1}' ),
8552+ self .check ('subnet.id' , '{subnet1_id}' ),
8553+ self .check ('bandwidthInGbps' , 50 ),
8554+ ])
8555+
8556+ self .cmd ('network virtual-network-appliance update -g {rg} -n {vna1} --tags \" {{name:{tag2}}}\" ' , checks = [
8557+ self .check ('tags.name' , '{tag2}' ),
8558+ ])
8559+
8560+ self .cmd ('network virtual-network-appliance list -g {rg}' , checks = [
8561+ self .check ('length(@)' , 1 )
8562+ ])
8563+
8564+ # Create vnet, subnet for second vna
8565+ self .cmd ('network vnet create -g {rg} -n {vnet2} --address-prefixes {vnet_address}' )
8566+
8567+ self .kwargs ['subnet2_id' ] = self .cmd ('network vnet subnet create -g {rg} -n {subnet} --vnet-name {vnet2} --address-prefix {subnet_address} --default-outbound false --query id' ).get_output_in_json ()
8568+
8569+ # Create second vna
8570+ vna2_id = self .cmd ('network virtual-network-appliance create -g {rg} -n {vna2} --bandwidth-in-gbps 50 --subnet \" {{id:{subnet2_id}}}\" --query id' ).get_output_in_json ()
8571+
8572+ self .cmd ('network virtual-network-appliance list -g {rg}' , checks = [
8573+ self .check ('length(@)' , 2 )
8574+ ])
8575+
8576+ self .cmd ('network virtual-network-appliance delete -g {rg} -n {vna1} -y' )
8577+
8578+ vna_list = self .cmd ('network virtual-network-appliance list -g {rg}' , checks = [
8579+ self .check ('length(@)' , 1 )
8580+ ]).get_output_in_json ()
8581+
8582+ self .assertTrue (vna_list [0 ].get ('id' ) == vna2_id )
85278583
85288584if __name__ == '__main__' :
85298585 unittest .main ()
0 commit comments