@@ -1757,7 +1757,7 @@ def test_get_outbound_type(self):
1757
1757
DecoratorMode .UPDATE ,
1758
1758
)
1759
1759
self .assertEqual (ctx_1 ._get_outbound_type (read_only = True ), None )
1760
- self .assertEqual (ctx_1 .get_outbound_type (), "loadBalancer" )
1760
+ self .assertEqual (ctx_1 .get_outbound_type (), None )
1761
1761
network_profile_1 = self .models .ContainerServiceNetworkProfile (outbound_type = "test_outbound_type" )
1762
1762
mc = self .models .ManagedCluster (location = "test_location" , network_profile = network_profile_1 )
1763
1763
ctx_1 .attach_mc (mc )
@@ -1835,6 +1835,7 @@ def test_get_outbound_type(self):
1835
1835
{
1836
1836
"outbound_type" : CONST_OUTBOUND_TYPE_USER_DEFINED_ROUTING ,
1837
1837
"vnet_subnet_id" : "test_vnet_subnet_id" ,
1838
+ "nat_gateway_managed_outbound_ip_count" : 10
1838
1839
}
1839
1840
),
1840
1841
self .models ,
@@ -1848,17 +1849,10 @@ def test_get_outbound_type(self):
1848
1849
AgentPoolDecoratorMode .MANAGED_CLUSTER ,
1849
1850
)
1850
1851
ctx_5 .attach_agentpool_context (agentpool_ctx_5 )
1851
- load_balancer_profile = self .models .load_balancer_models .ManagedClusterLoadBalancerProfile (
1852
- outbound_ip_prefixes = self .models .load_balancer_models .ManagedClusterLoadBalancerProfileOutboundIPPrefixes (
1853
- public_ip_prefixes = [self .models .load_balancer_models .ResourceReference (id = "test_public_ip_prefix" )]
1854
- )
1855
- )
1856
1852
# fail on mutually exclusive outbound_type and managed_outbound_ip_count/outbound_ips/outbound_ip_prefixes of
1857
1853
# load balancer
1858
1854
with self .assertRaises (MutuallyExclusiveArgumentError ):
1859
- ctx_5 .get_outbound_type (
1860
- load_balancer_profile = load_balancer_profile ,
1861
- )
1855
+ ctx_5 .get_outbound_type ()
1862
1856
1863
1857
# invalid parameter
1864
1858
ctx_6 = AKSManagedClusterContext (
@@ -1885,6 +1879,46 @@ def test_get_outbound_type(self):
1885
1879
# load balancer
1886
1880
with self .assertRaises (MutuallyExclusiveArgumentError ):
1887
1881
ctx_6 .get_outbound_type ()
1882
+ ctx_7 = AKSManagedClusterContext (
1883
+ self .cmd ,
1884
+ AKSManagedClusterParamDict (
1885
+ {
1886
+ "outbound_type" : CONST_OUTBOUND_TYPE_USER_DEFINED_ROUTING ,
1887
+ "vnet_subnet_id" : "test_vnet_subnet_id" ,
1888
+ "nat_gateway_managed_outbound_ip_count" : 10 ,
1889
+ }
1890
+ ),
1891
+ self .models ,
1892
+ DecoratorMode .CREATE ,
1893
+ )
1894
+ agentpool_ctx_7 = AKSAgentPoolContext (
1895
+ self .cmd ,
1896
+ AKSAgentPoolParamDict ({"vnet_subnet_id" : "test_vnet_subnet_id" }),
1897
+ self .models ,
1898
+ DecoratorMode .CREATE ,
1899
+ AgentPoolDecoratorMode .MANAGED_CLUSTER ,
1900
+ )
1901
+ ctx_7 .attach_agentpool_context (agentpool_ctx_7 )
1902
+ # fail on mutually exclusive outbound_type and nat_gateway_managed_outbound_ip_count on
1903
+ # nat gateway
1904
+ with self .assertRaises (MutuallyExclusiveArgumentError ):
1905
+ ctx_7 .get_outbound_type ()
1906
+
1907
+ network_profile_1 = self .models .ContainerServiceNetworkProfile (outbound_type = "test_outbound_type" )
1908
+ mc = self .models .ManagedCluster (location = "test_location" , network_profile = network_profile_1 )
1909
+ # existing value should not be validated
1910
+ ctx_8 = AKSManagedClusterContext (
1911
+ self .cmd ,
1912
+ AKSManagedClusterParamDict (
1913
+ {
1914
+ }
1915
+ ),
1916
+ self .models ,
1917
+ DecoratorMode .UPDATE ,
1918
+ )
1919
+ ctx_8 .attach_mc (mc )
1920
+ existingOutboundType = ctx_8 .get_outbound_type ()
1921
+ self .assertEqual (existingOutboundType , "test_outbound_type" )
1888
1922
1889
1923
def test_get_network_plugin_mode (self ):
1890
1924
# default
0 commit comments