本文整理汇总了Python中opserver_introspect_utils.VerificationOpsSrv.get_ops_vm方法的典型用法代码示例。如果您正苦于以下问题:Python VerificationOpsSrv.get_ops_vm方法的具体用法?Python VerificationOpsSrv.get_ops_vm怎么用?Python VerificationOpsSrv.get_ops_vm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opserver_introspect_utils.VerificationOpsSrv
的用法示例。
在下文中一共展示了VerificationOpsSrv.get_ops_vm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: verify_vm_uve
# 需要导入模块: from opserver_introspect_utils import VerificationOpsSrv [as 别名]
# 或者: from opserver_introspect_utils.VerificationOpsSrv import get_ops_vm [as 别名]
def verify_vm_uve(self, vm_id, num_vm_ifs, msg_count, opserver_port=None):
if opserver_port is not None:
vns = VerificationOpsSrv('127.0.0.1', opserver_port)
else:
vns = VerificationOpsSrv('127.0.0.1', self._opserver_port)
res = vns.get_ops_vm(vm_id)
if res == {}:
return False
else:
assert(len(res) > 0)
self._logger.info(str(res))
anum_vm_ifs = len(res.get_attr('Agent', 'interface_list'))
assert anum_vm_ifs == num_vm_ifs
anum_vm_if_stats = len(res.get_attr('Agent', 'if_stats_list'))
assert anum_vm_if_stats == num_vm_ifs
for i in range(num_vm_ifs):
vm_if_dict = res.get_attr('Agent', 'interface_list')[i]
vm_if_stats_dict = res.get_attr('Agent', 'if_stats_list')[i]
evm_if_name = self._VM_IF_PREFIX + str(i)
avm_if_name = vm_if_dict['name']
assert avm_if_name == evm_if_name
avm_if_stats_name = vm_if_stats_dict['name']
assert avm_if_stats_name == evm_if_name
epkt_count = self._INITIAL_PKT_COUNT + \
(msg_count - 1) * self._PKTS_PER_SEC
apkt_count = vm_if_stats_dict['in_pkts']
assert int(apkt_count) == epkt_count
ebyte_count = epkt_count * self._BYTES_PER_PACKET
abyte_count = vm_if_stats_dict['in_bytes']
assert int(abyte_count) == ebyte_count
return True
示例2: verify_vm_uve
# 需要导入模块: from opserver_introspect_utils import VerificationOpsSrv [as 别名]
# 或者: from opserver_introspect_utils.VerificationOpsSrv import get_ops_vm [as 别名]
def verify_vm_uve(self, vm_id, num_vm_ifs, msg_count):
vns = VerificationOpsSrv("127.0.0.1", self._opserver_port)
res = vns.get_ops_vm(vm_id)
if res == {}:
return False
else:
assert len(res) > 0
self._logger.info(str(res))
anum_vm_ifs = len(res.get_attr("Agent", "interface_list"))
assert anum_vm_ifs == num_vm_ifs
anum_vm_if_stats = len(res.get_attr("Agent", "if_stats_list"))
assert anum_vm_if_stats == num_vm_ifs
for i in range(num_vm_ifs):
vm_if_dict = res.get_attr("Agent", "interface_list")[i]
vm_if_stats_dict = res.get_attr("Agent", "if_stats_list")[i]
evm_if_name = self._VM_IF_PREFIX + str(i)
avm_if_name = vm_if_dict["name"]
assert avm_if_name == evm_if_name
avm_if_stats_name = vm_if_stats_dict["name"]
assert avm_if_stats_name == evm_if_name
epkt_count = self._INITIAL_PKT_COUNT + (msg_count - 1) * self._PKTS_PER_SEC
apkt_count = vm_if_stats_dict["in_pkts"]
assert int(apkt_count) == epkt_count
ebyte_count = epkt_count * self._BYTES_PER_PACKET
abyte_count = vm_if_stats_dict["in_bytes"]
assert int(abyte_count) == ebyte_count
return True
示例3: verify_vm_uve
# 需要导入模块: from opserver_introspect_utils import VerificationOpsSrv [as 别名]
# 或者: from opserver_introspect_utils.VerificationOpsSrv import get_ops_vm [as 别名]
def verify_vm_uve(self, vm_id, num_vm_ifs, msg_count, opserver_port=None):
if opserver_port is not None:
vns = VerificationOpsSrv('127.0.0.1', opserver_port)
else:
vns = VerificationOpsSrv('127.0.0.1', self._opserver_port)
res = vns.get_ops_vm(vm_id)
if res == {}:
return False
else:
assert(len(res) > 0)
self._logger.info(str(res))
anum_vm_ifs = len(res.get_attr('Agent', 'interface_list'))
assert anum_vm_ifs == num_vm_ifs
for i in range(num_vm_ifs):
vm_if_dict = res.get_attr('Agent', 'interface_list')[i]
evm_if_name = self._VM_IF_PREFIX + str(i)
avm_if_name = vm_if_dict['name']
assert avm_if_name == evm_if_name
return True