本文整理汇总了Python中marvin.integration.lib.base.LoadBalancerRule.list方法的典型用法代码示例。如果您正苦于以下问题:Python LoadBalancerRule.list方法的具体用法?Python LoadBalancerRule.list怎么用?Python LoadBalancerRule.list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marvin.integration.lib.base.LoadBalancerRule
的用法示例。
在下文中一共展示了LoadBalancerRule.list方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_04_delete_lb_rule
# 需要导入模块: from marvin.integration.lib.base import LoadBalancerRule [as 别名]
# 或者: from marvin.integration.lib.base.LoadBalancerRule import list [as 别名]
def test_04_delete_lb_rule(self):
"""Test LB rule before/after stickiness policy creation"""
# Validate the following
# 1. Create a LB rule with roundrobin, leastconn and source.
# listLoadBalancerRules should show newly created load balancer rule
# 2. Delete the loadbalancer rule. Delete loadbalancer rule should be
# successful
# 3. Configure the Source based, app cookie and lb cookie based policy
# with custom parameters listLBStickinessPolicies should show newly
# created stickiness
# 4. Delete load balancer rule. Delete should be successful
lb_methods = ["roundrobin", "leastconn", "source"]
configs = {"SourceBased": {"tablesize": '100k'},
"AppCookie": {"request-learn": "true"},
"LBCookie": {"nocache": "true"}}
for lb_method in lb_methods:
for method, params in configs.items():
self.debug("Creating load balancing rule on IP %s & algo %s" %
(self.public_ip.ipaddress.ipaddress, lb_method))
services = self.services["lbrule"]
services["alg"] = lb_method
lb_rule = self.create_LB_Rule(self.public_ip,
network=self.get_Network(self.account),
vmarray=[self.virtual_machine, self.virtual_machine_2],
services=services)
self.debug(
"Deleting the LB rule before stickiness policy creation")
lb_rule.delete(self.apiclient)
with self.assertRaises(Exception):
LoadBalancerRule.list(self.apiclient,
id=lb_rule.id,
listall=True)
lb_rule = self.create_LB_Rule(self.public_ip,
network=self.get_Network(self.account),
vmarray=[self.virtual_machine, self.virtual_machine_2],
services=services)
self.debug("Creating stickiness policy for the LB rule: %s" %
lb_rule.id)
policies = self.configure_Stickiness_Policy(lb_rule,
method=method,
paramDict=params)
policy = policies.stickinesspolicy[0]
self.debug("Policy: %s" % str(policy))
self.debug("Validating the stickiness policy")
self.validate_Stickiness_Policy(lb_rule, method, self.public_ip.ipaddress.ipaddress)
self.debug("Deleting the LB rule: %s" % lb_rule.name)
lb_rule.delete(self.apiclient)
with self.assertRaises(Exception):
LoadBalancerRule.list(self.apiclient, id=lb_rule.id)
return
示例2: test_05_error_alerts_after_create
# 需要导入模块: from marvin.integration.lib.base import LoadBalancerRule [as 别名]
# 或者: from marvin.integration.lib.base.LoadBalancerRule import list [as 别名]
def test_05_error_alerts_after_create(self):
"""Test error/alerts after creating stickiness policy"""
# Validate the following
# 1. Create a LB rule with round Robin/Least connections/Source
# listLoadBalancerRules should show newly created load balancer rule
# 2. Configure the Stickiness policy to above created LB rule.
# listLBStickinessPolicies Api should show newly created stickiness
# 3. update & delete stickiness policy see error related to stickiness
# 4. No errors should be shown in the logs and alerts
lb_methods = ["roundrobin", "leastconn", "source"]
configs = {"SourceBased": {"tablesize": '100k'},
"AppCookie": {"request-learn": "true"},
"LBCookie": {"nocache": "true"}}
for lb_method in lb_methods:
for method, params in configs.items():
self.debug("Creating load balancing rule on IP %s & algo %s" %
(self.public_ip.ipaddress.ipaddress, lb_method))
services = self.services["lbrule"]
services["alg"] = lb_method
lb_rule = self.create_LB_Rule(self.public_ip,
network=self.get_Network(self.account),
vmarray=[self.virtual_machine, self.virtual_machine_2],
services=services)
self.debug("Creating stickiness policy for the LB rule: %s" %
lb_rule.id)
policies = self.configure_Stickiness_Policy(lb_rule,
method=method,
paramDict=params)
policy = policies.stickinesspolicy[0]
self.debug("Policy: %s" % str(policy))
self.debug("Validating the stickiness policy")
self.validate_Stickiness_Policy(lb_rule, method, self.public_ip.ipaddress.ipaddress)
self.debug("Deleting the LB rule: %s" % lb_rule.name)
lb_rule.delete(self.apiclient)
with self.assertRaises(Exception):
LoadBalancerRule.list(self.apiclient,
id=lb_rule.id,
listall=True)
alerts = Alert.list(self.apiclient, keyword="stickiness",
listall=True)
self.debug(
"Create/update/delete should not produce any alert/error")
self.assertEqual(alerts, None,
"Create/update/delete should not produce any alert/error")
return
示例3: test_15_VPC_ReleaseIPForLBRuleCreated
# 需要导入模块: from marvin.integration.lib.base import LoadBalancerRule [as 别名]
# 或者: from marvin.integration.lib.base.LoadBalancerRule import list [as 别名]
def test_15_VPC_ReleaseIPForLBRuleCreated(self):
""" Test release Ip address that has a LB rule assigned to it.
"""
# Validate the following
# 1. Create a VPC1 with cidr - 10.1.1.1/16
# 2. Create a Network offering - NO1 with all supported services
# 3. Add network1(10.1.1.1/24) using N01 to this VPC1.
# 2. Create a Network offering - NO1 with all supported services
# 5. Deploy vm1 and vm2 in network1 and network 2 primary host.
# 6. aquire public ip address
# 6. Create a StaticNat Rule rule for vm1
# 7. Use the Create LB rule for vm1 and vm2 in network1.
# 8. LB rule creation should fail
network_1 = self.create_Network(self.services["network_offering"])
vm_1 = self.create_VM_in_Network(network_1)
vm_2 = self.create_VM_in_Network(network_1)
public_ip_1 = self.acquire_Public_IP(network_1)
lb_rule = self.create_LB_Rule(public_ip_1, network_1, [vm_2, vm_1])
public_ip_1.delete(self.apiclient)
with self.assertRaises(Exception):
lb_rules = LoadBalancerRule.list(self.apiclient,
id=lb_rule.id,
listall=True
)
return