本文整理汇总了Python中marvin.lib.base.Configurations.list方法的典型用法代码示例。如果您正苦于以下问题:Python Configurations.list方法的具体用法?Python Configurations.list怎么用?Python Configurations.list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marvin.lib.base.Configurations
的用法示例。
在下文中一共展示了Configurations.list方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_04_rvpc_network_garbage_collector_nics
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import list [as 别名]
def test_04_rvpc_network_garbage_collector_nics(self):
""" Create a redundant VPC with 1 Tier, 1 VM, 1 ACL, 1 PF and test Network GC Nics"""
self.logger.debug("Starting test_04_rvpc_network_garbage_collector_nics")
self.query_routers()
self.networks.append(self.create_network(self.services["network_offering"], "10.1.1.1", nr_vms=1))
self.check_routers_state()
self.add_nat_rules()
self.do_vpc_test(False)
self.stop_vm()
gc_wait = Configurations.list(self.apiclient, name="network.gc.wait")
gc_interval = Configurations.list(self.apiclient, name="network.gc.interval")
self.logger.debug("network.gc.wait is ==> %s" % gc_wait)
self.logger.debug("network.gc.interval is ==> %s" % gc_wait)
total_sleep = 120
if gc_wait and gc_interval:
total_sleep = int(gc_wait[0].value) + int(gc_interval[0].value)
else:
self.logger.debug("Could not retrieve the keys 'network.gc.interval' and 'network.gc.wait'. Sleeping for 2 minutes.")
time.sleep(total_sleep * 3)
self.check_routers_interface(interface_to_check="eth2", expected_exists=False)
self.start_vm()
self.check_routers_state(status_to_check="MASTER")
self.check_routers_interface(interface_to_check="eth2", expected_exists=True)
示例2: test_09_expunge_vm
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import list [as 别名]
def test_09_expunge_vm(self):
"""Test destroy(expunge) Virtual Machine
"""
# Validate the following
# 1. listVM command should NOT return this VM any more.
self.debug("Expunge VM-ID: %s" % self.small_virtual_machine.id)
cmd = destroyVirtualMachine.destroyVirtualMachineCmd()
cmd.id = self.small_virtual_machine.id
self.apiclient.destroyVirtualMachine(cmd)
config = Configurations.list(self.apiclient, name="expunge.delay")
expunge_delay = int(config[0].value)
time.sleep(expunge_delay * 2)
# VM should be destroyed unless expunge thread hasn't run
# Wait for two cycles of the expunge thread
config = Configurations.list(self.apiclient, name="expunge.interval")
expunge_cycle = int(config[0].value)
wait_time = expunge_cycle * 2
while wait_time >= 0:
list_vm_response = VirtualMachine.list(self.apiclient, id=self.small_virtual_machine.id)
if list_vm_response:
time.sleep(expunge_cycle)
wait_time = wait_time - expunge_cycle
else:
break
self.debug("listVirtualMachines response: %s" % list_vm_response)
self.assertEqual(list_vm_response, None, "Check Expunged virtual machine is in listVirtualMachines response")
return
示例3: setUpClass
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import list [as 别名]
def setUpClass(cls):
# We want to fail quicker if it's failure
socket.setdefaulttimeout(60)
cls.testClient = super(TestVPCRedundancy, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.template = get_test_template(cls.api_client, cls.zone.id, cls.hypervisor)
if cls.template == FAILED:
assert False, "get_test_template() failed to return template"
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"])
cls._cleanup = [cls.service_offering]
cls.logger = logging.getLogger('TestVPCRedundancy')
cls.stream_handler = logging.StreamHandler()
cls.logger.setLevel(logging.DEBUG)
cls.logger.addHandler(cls.stream_handler)
cls.advert_int = int(Configurations.list(cls.api_client, name="router.redundant.vrrp.interval")[0].value)
示例4: test_01_VPN_user_limit
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import list [as 别名]
def test_01_VPN_user_limit(self):
"""VPN remote access user limit tests"""
# Validate the following
# prerequisite: change management configuration setting of
# remote.access.vpn.user.limit
# 1. provision more users than is set in the limit
# Provisioning of users after the limit should failProvisioning of
# users after the limit should fail
self.debug("Fetching the limit for remote access VPN users")
configs = Configurations.list(
self.apiclient,
name='remote.access.vpn.user.limit',
listall=True)
self.assertEqual(isinstance(configs, list),
True,
"List configs should return a valid response")
limit = int(configs[0].value)
self.debug("Enabling the VPN access for IP: %s" %
self.public_ip.ipaddress)
self.create_VPN(self.public_ip)
self.debug("Creating %s VPN users" % limit)
for x in range(limit):
self.create_VPN_Users()
self.debug("Adding another user exceeding limit for remote VPN users")
with self.assertRaises(Exception):
self.create_VPN_Users()
self.debug("Limit exceeded exception raised!")
return
示例5: setUpClass
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import list [as 别名]
def setUpClass(cls):
testClient = super(TestVerifyEventsTable, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.testdata = testClient.getParsedTestDataConfig()
cls.hypervisor = cls.testClient.getHypervisorInfo()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.template = get_template(
cls.apiclient,
cls.zone.id,
cls.testdata["ostype"])
cls._cleanup = []
try:
cls.unsupportedHypervisor = False
if cls.hypervisor.lower() in ['hyperv', 'lxc', 'kvm']:
if cls.hypervisor.lower() == 'kvm':
configs = Configurations.list(
cls.apiclient,
name='kvm.snapshot.enabled'
)
if configs[0].value == "false":
cls.unsupportedHypervisor = True
else:
cls.unsupportedHypervisor = True
return
# Create an account
cls.account = Account.create(
cls.apiclient,
cls.testdata["account"],
domainid=cls.domain.id
)
# Create user api client of the account
cls.userapiclient = testClient.getUserApiClient(
UserName=cls.account.name,
DomainName=cls.account.domain
)
# Create Service offering
cls.service_offering = ServiceOffering.create(
cls.apiclient,
cls.testdata["service_offering"],
)
cls._cleanup = [
cls.account,
cls.service_offering,
]
except Exception as e:
cls.tearDownClass()
raise e
return
示例6: get_lb_stats_settings
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import list [as 别名]
def get_lb_stats_settings(self):
self.logger.debug("Retrieving haproxy stats settings")
settings = {}
try:
settings["stats_port"] = Configurations.list(
self.apiclient, name="network.loadbalancer.haproxy.stats.port")[0].value
settings["stats_uri"] = Configurations.list(
self.apiclient, name="network.loadbalancer.haproxy.stats.uri")[0].value
settings["username"], settings["password"] = Configurations.list(
self.apiclient, name="network.loadbalancer.haproxy.stats.auth")[0].value.split(":")
settings["visibility"] = Configurations.list(
self.apiclient, name="network.loadbalancer.haproxy.stats.visibility")[0].value
self.logger.debug(settings)
except Exception as e:
self.fail("Failed to retrieve stats settings " % e)
return settings
示例7: is_config_suitable
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import list [as 别名]
def is_config_suitable(apiclient, name, value):
"""
Ensure if the deployment has the expected `value` for the global setting `name'
@return: true if value is set, else false
"""
configs = Configurations.list(apiclient, name=name)
assert configs is not None and isinstance(configs, list) and len(configs) > 0
return configs[0].value == value
示例8: tearDown
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import list [as 别名]
def tearDown(self):
try:
self.debug("Cleaning up the resources")
cleanup_resources(self.apiclient, self.cleanup)
interval = Configurations.list(
self.apiclient,
name='network.gc.interval'
)
wait = Configurations.list(
self.apiclient,
name='network.gc.wait'
)
#time.sleep(int(interval[0].value) + int(wait[0].value))
self.debug("Cleanup complete!")
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
示例9: tearDown
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import list [as 别名]
def tearDown(self):
try:
self.debug("Cleaning up the resources")
#Clean up, terminate the created network offerings
#cleanup_resources(self.apiclient, self.cleanup)
interval = Configurations.list(
self.apiclient,
name='network.gc.interval'
)
wait = Configurations.list(
self.apiclient,
name='network.gc.wait'
)
# Sleep to ensure that all resources are deleted
time.sleep(int(interval[0].value) + int(wait[0].value))
self.debug("Cleanup complete!")
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
示例10: setUpClass
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import list [as 别名]
def setUpClass(cls):
testClient = super(Overcommit, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.testdata = testClient.getParsedTestDataConfig()
# Get Zone,Domain and templates
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient)
cls.testdata["mode"] = cls.zone.networktype
cls.testdata["configurableData"]["password"] = "xenroot"
cls.hypervisor = testClient.getHypervisorInfo()
cls.template = get_template(
cls.apiclient,
cls.zone.id,
cls.testdata["ostype"])
cls.testdata["template"]["ostypeid"] = cls.template.ostypeid
list_conf = Configurations.list(cls.apiclient,
name="capacity.check.period"
)
cls.wait_time = 5 + int(list_conf[0].value) / 1000
if cls.template == FAILED:
cls.fail(
"get_template() failed to return template with description \
%s" %
cls.testdata["ostype"])
cls._cleanup = []
try:
cls.account = Account.create(cls.apiclient,
cls.testdata["account"],
domainid=cls.domain.id
)
cls._cleanup.append(cls.account)
cls.service_offering = ServiceOffering.create(
cls.apiclient,
cls.testdata["service_offerings"]["small"])
cls._cleanup.append(cls.service_offering)
cls.deployVmResponse = VirtualMachine.create(
cls.apiclient,
services=cls.testdata["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id,
zoneid=cls.zone.id,
)
except Exception as e:
cls.tearDownClass()
raise e
return
示例11: test_vm_ha
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import list [as 别名]
def test_vm_ha(self):
"""Test VM HA
# Validate the following:
# VM started on other host in cluster
"""
#wait for VM to HA
ping_timeout = Configurations.list(self.apiclient, name="ping.timeout")
ping_interval = Configurations.list(self.apiclient, name="ping.interval")
total_duration = int(float(ping_timeout[0].value) * float(ping_interval[0].value))
time.sleep(total_duration)
duration = 0
vm = None
while duration < total_duration:
list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
self.assertTrue(isinstance(list_vms, list) and len(list_vms) == 1, msg = "List VM response was empty")
vm = list_vms[0]
if vm.hostid != self.virtual_machine.hostid and vm.state == "Running":
break
else:
time.sleep(10)
duration = duration + 10
self.assertEqual(
vm.id,
self.virtual_machine.id,
"VM ids do not match")
self.assertEqual(
vm.name,
self.virtual_machine.name,
"VM names do not match")
self.assertEqual(
vm.state,
"Running",
msg="VM is not in Running state")
self.assertNotEqual(
vm.hostid,
self.virtual_machine.hostid,
msg="VM is not started on another host as part of HA")
示例12: get_lb_stats_settings
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import list [as 别名]
def get_lb_stats_settings(self):
self.logger.debug("Retrieving haproxy stats settings")
settings = {}
try:
settings["stats_port"] = Configurations.list(
self.apiclient, name="network.loadbalancer.haproxy.stats.port")[0].value
settings["stats_uri"] = Configurations.list(
self.apiclient, name="network.loadbalancer.haproxy.stats.uri")[0].value
# Update global setting network.loadbalancer.haproxy.stats.auth to a known value
haproxy_auth = "admin:password"
Configurations.update(self.apiclient, "network.loadbalancer.haproxy.stats.auth", haproxy_auth)
self.logger.debug(
"Updated global setting stats network.loadbalancer.haproxy.stats.auth to %s" % (haproxy_auth))
settings["username"], settings["password"] = haproxy_auth.split(":")
settings["visibility"] = Configurations.list(
self.apiclient, name="network.loadbalancer.haproxy.stats.visibility")[0].value
self.logger.debug(settings)
except Exception as e:
self.fail("Failed to retrieve stats settings " % e)
return settings
示例13: test_05_rvpc_multi_tiers
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import list [as 别名]
def test_05_rvpc_multi_tiers(self):
""" Create a redundant VPC with 3 Tiers, 3 VMs, 3 PF rules"""
self.logger.debug("Starting test_05_rvpc_multi_tiers")
self.query_routers()
network_to_delete_1 = self.create_network(self.services["network_offering"], "10.1.1.1", nr_vms=1, mark_net_cleanup=False)
self.networks.append(network_to_delete_1)
self.networks.append(self.create_network(self.services["network_offering_no_lb"], "10.1.2.1", nr_vms=1))
network_to_delete_2 = self.create_network(self.services["network_offering_no_lb"], "10.1.3.1", nr_vms=1, mark_net_cleanup=False)
self.networks.append(network_to_delete_2)
self.check_routers_state()
self.add_nat_rules()
self.do_vpc_test(False)
self.destroy_vm(network_to_delete_1)
network_to_delete_1.get_net().delete(self.apiclient)
self.networks.remove(network_to_delete_1)
vrrp_interval = Configurations.list(self.apiclient, name="router.redundant.vrrp.interval")
self.logger.debug("router.redundant.vrrp.interval is ==> %s" % vrrp_interval)
total_sleep = 10
if vrrp_interval:
total_sleep = int(vrrp_interval[0].value) * 4
else:
self.logger.debug("Could not retrieve the key 'router.redundant.vrrp.interval'. Sleeping for 10 seconds.")
'''
Sleep (router.redundant.vrrp.interval * 4) seconds here because since we are removing the first tier (NIC) the VRRP will have to reconfigure the interface it uses.
Due to the configuration changes, it will start a new election and it might take up to 4 seconds, because each router has an
advertisement interval of 2 seconds.
'''
time.sleep(total_sleep)
self.check_routers_state(status_to_check="MASTER")
self.do_vpc_test(False)
self.destroy_vm(network_to_delete_2)
network_to_delete_2.get_net().delete(self.apiclient)
self.networks.remove(network_to_delete_2)
'''
Let's be sure and sleep for 'total_sleep' seconds because removing/adding an interface will restart keepalived.
It restarts it because the keepalived configuration file changes in order to have the virtual_ipaddress section updated.
'''
time.sleep(total_sleep)
self.check_routers_state(status_to_check="MASTER")
self.do_vpc_test(False)
示例14: test_vms_with_same_name
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import list [as 别名]
def test_vms_with_same_name(self):
""" Test vm deployment with same name
# 1. Deploy a VM on with perticular name from account_1
# 2. Try to deploy another vm with same name from account_2
# 3. Verify that second VM deployment fails
"""
# Step 1
# Create VM on cluster wide
configs = Configurations.list(
self.apiclient,
name="vm.instancename.flag")
orig_value = configs[0].value
if orig_value == "false":
Configurations.update(self.apiclient,
name="vm.instancename.flag",
value="true"
)
# Restart management server
self.RestartServer()
time.sleep(120)
self.testdata["small"]["displayname"]="TestName"
self.testdata["small"]["name"]="TestName"
VirtualMachine.create(
self.userapiclient_1,
self.testdata["small"],
templateid=self.template.id,
accountid=self.account_1.name,
domainid=self.account_1.domainid,
serviceofferingid=self.service_offering.id,
zoneid=self.zone.id,
)
with self.assertRaises(Exception):
VirtualMachine.create(
self.userapiclient_2,
self.testdata["small"],
templateid=self.template.id,
accountid=self.account_2.name,
domainid=self.account_2.domainid,
serviceofferingid=self.service_offering.id,
zoneid=self.zone.id,
)
return
示例15: test_maxAccountNetworks
# 需要导入模块: from marvin.lib.base import Configurations [as 别名]
# 或者: from marvin.lib.base.Configurations import list [as 别名]
def test_maxAccountNetworks(self):
"""Test Limit number of guest account specific networks
"""
# Steps for validation
# 1. Fetch max.account.networks from configurations
# 2. Create an account. Create account more that max.accout.network
# 3. Create network should fail
self.debug("Creating project with '%s' as admin" % self.account.name)
# Create project as a domain admin
project = Project.create(
self.apiclient, self.services["project"], account=self.account.name, domainid=self.account.domainid
)
# Cleanup created project at end of test
self.cleanup.append(project)
self.debug("Created project with domain admin with ID: %s" % project.id)
config = Configurations.list(self.apiclient, name="max.project.networks", listall=True)
self.assertEqual(isinstance(config, list), True, "List configurations hsould have max.project.networks")
config_value = int(config[0].value)
self.debug("max.project.networks: %s" % config_value)
for ctr in range(config_value):
# Creating network using the network offering created
self.debug("Creating network with network offering: %s" % self.network_offering.id)
network = Network.create(
self.apiclient,
self.services["network"],
projectid=project.id,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
)
self.debug("Created network with ID: %s" % network.id)
self.debug("Creating network in account already having networks : %s" % config_value)
with self.assertRaises(Exception):
Network.create(
self.apiclient,
self.services["network"],
projectid=project.id,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
)
self.debug("Create network failed (as expected)")
return