本文整理汇总了Python中marvin.integration.lib.base.LoadBalancerRule类的典型用法代码示例。如果您正苦于以下问题:Python LoadBalancerRule类的具体用法?Python LoadBalancerRule怎么用?Python LoadBalancerRule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LoadBalancerRule类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_04_delete_lb_rule
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
开发者ID:Bhathiya90,项目名称:cloudstack,代码行数:60,代码来源:test_haproxy.py
示例2: test_05_error_alerts_after_create
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
开发者ID:Bhathiya90,项目名称:cloudstack,代码行数:54,代码来源:test_haproxy.py
示例3: test_15_VPC_ReleaseIPForLBRuleCreated
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
开发者ID:baishuo,项目名称:cloudstack,代码行数:28,代码来源:test_vpc_network_lbrules.py
示例4: create_LB_Rule
def create_LB_Rule(self, public_ip, network, vmarray, services=None):
self.debug("Creating LB rule for IP address: %s" %
public_ip.ipaddress.ipaddress)
objservices = None
if services:
objservices = services
else:
objservices = self.services["lbrule"]
lb_rule = LoadBalancerRule.create(
self.apiclient,
objservices,
ipaddressid=public_ip.ipaddress.id,
accountid=self.account.name,
networkid=network.id,
vpcid=self.vpc.id,
domainid=self.account.domainid
)
self.debug("Adding virtual machines %s and %s to LB rule" % (vmarray[0], vmarray[1]))
lb_rule.assign(self.apiclient, vmarray)
self.debug("Adding NetworkACl rules to make NAT rule accessible")
nwacl_nat = NetworkACL.create(self.apiclient,
objservices,
networkid=network.id,
traffictype='Ingress'
)
self.debug('nwacl_nat=%s' % nwacl_nat.__dict__)
return lb_rule
开发者ID:baishuo,项目名称:cloudstack,代码行数:29,代码来源:test_vpc_network_lbrules.py
示例5: create_LB_Rule
def create_LB_Rule(self, public_ip, network, vmarray, services=None):
self.debug("Creating LB rule for IP address: %s" % public_ip.ipaddress.ipaddress)
objservices = None
if services:
objservices = services
else:
objservices = self.services["lbrule"]
lb_rule = LoadBalancerRule.create(
self.apiclient,
objservices,
ipaddressid=public_ip.ipaddress.id,
accountid=self.account.name,
networkid=network.id,
vpcid=self.vpc.id,
domainid=self.account.domainid,
)
self.debug("Adding virtual machines %s and %s to LB rule" % (vmarray))
lb_rule.assign(self.apiclient, vmarray)
return lb_rule
开发者ID:vogxn,项目名称:cloudstack,代码行数:20,代码来源:test_vpc_network_pfrules.py
注:本文中的marvin.integration.lib.base.LoadBalancerRule类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论