Exemple #1
0
 def setUp(self):
     # manually register CUSTOM_MGMT_AKS_PREVIEW
     self.cli_ctx = MockCLI()
     self.cmd = MockCmd(self.cli_ctx)
     # store all the models used by nat gateway
     self.nat_gateway_models = AKSModels(
         self.cmd, ResourceType.MGMT_CONTAINERSERVICE).nat_gateway_models
Exemple #2
0
 def setUp(self):
     # manually register CUSTOM_MGMT_AKS_PREVIEW
     register_aks_preview_resource_type()
     self.cli_ctx = MockCLI()
     self.cmd = MockCmd(self.cli_ctx)
     self.resource_type = CUSTOM_MGMT_AKS_PREVIEW
     self.agentpool_decorator_mode = AgentPoolDecoratorMode.MANAGED_CLUSTER
     self.models = AKSPreviewAgentPoolModels(self.cmd, self.resource_type, self.agentpool_decorator_mode)
Exemple #3
0
    def test_configure_load_balancer_profile(self):
        cmd = MockCmd(MockCLI())
        managed_outbound_ip_count = 5
        outbound_ips = None
        outbound_ip_prefixes = None
        outbound_ports = 80
        idle_timeout = 3600

        from azure.cli.command_modules.acs.decorator import AKSModels
        # store all the models used by load balancer
        lb_models = AKSModels(cmd, ResourceType.MGMT_CONTAINERSERVICE).lb_models
        ManagedClusterLoadBalancerProfile = lb_models.get(
            "ManagedClusterLoadBalancerProfile"
        )
        ManagedClusterLoadBalancerProfileManagedOutboundIPs = lb_models.get(
            "ManagedClusterLoadBalancerProfileManagedOutboundIPs"
        )
        ManagedClusterLoadBalancerProfileOutboundIPs = lb_models.get(
            "ManagedClusterLoadBalancerProfileOutboundIPs"
        )
        ManagedClusterLoadBalancerProfileOutboundIPPrefixes = lb_models.get(
            "ManagedClusterLoadBalancerProfileOutboundIPPrefixes"
        )

        profile = ManagedClusterLoadBalancerProfile()
        profile.managed_outbound_i_ps = ManagedClusterLoadBalancerProfileManagedOutboundIPs(
            count=2
        )
        profile.outbound_i_ps = ManagedClusterLoadBalancerProfileOutboundIPs(
            public_i_ps="public_i_ps"
        )
        profile.outbound_ip_prefixes = ManagedClusterLoadBalancerProfileOutboundIPPrefixes(
            public_ip_prefixes="public_ip_prefixes"
        )

        p = loadbalancer.configure_load_balancer_profile(
            managed_outbound_ip_count,
            outbound_ips,
            outbound_ip_prefixes,
            outbound_ports,
            idle_timeout,
            profile,
            lb_models,
        )

        self.assertEqual(p.managed_outbound_i_ps.count, 5)
        self.assertEqual(p.outbound_i_ps, None)
        self.assertEqual(p.outbound_ip_prefixes, None)
        self.assertEqual(p.allocated_outbound_ports, 80)
        self.assertEqual(p.idle_timeout_in_minutes, 3600)
Exemple #4
0
 def setUp(self):
     self.cli_ctx = MockCLI()
     self.cmd = MockCmd(self.cli_ctx)
     self.models = BaseAKSModels(self.cmd, ResourceType.MGMT_CONTAINERSERVICE)
Exemple #5
0
 def setUp(self):
     self.cli_ctx = MockCLI()
     self.cmd = MockCmd(self.cli_ctx)
Exemple #6
0
 def setUp(self):
     self.cli_ctx = MockCLI()
     self.cmd = MockCmd(self.cli_ctx)
     self.models = AKSAgentPoolModels(self.cmd,
                                      ResourceType.MGMT_CONTAINERSERVICE)
     self.client = MockClient()