本文整理汇总了Python中genie.conf.Genie.init方法的典型用法代码示例。如果您正苦于以下问题:Python Genie.init方法的具体用法?Python Genie.init怎么用?Python Genie.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类genie.conf.Genie
的用法示例。
在下文中一共展示了Genie.init方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: forget
# 需要导入模块: from genie.conf import Genie [as 别名]
# 或者: from genie.conf.Genie import init [as 别名]
def forget(self):
self.assignments = None
self.resolved_subset = None
if pyats.easypy.runtime.testbed:
# Reset testbed from scratch
Genie.init(testbed=pyats.easypy.runtime.testbed)
elif Genie.testbed:
# Reset object states
for xos_device in Genie.testbed.devices:
xos_device.obj_state = 'active'
for xos_link in xos_device.interfaces:
xos_link.obj_state = 'active'
for link in Genie.testbed.links:
link.obj_state = 'active'
# TODO remove features?
# vim: ft=python ts=8 sw=4 et
示例2: connect
# 需要导入模块: from genie.conf import Genie [as 别名]
# 或者: from genie.conf.Genie import init [as 别名]
def connect(self, testbed):
genie_testbed = Genie.init(testbed)
self.parent.parameters['testbed'] = genie_testbed
device_list = []
for d in genie_testbed.devices.keys():
# Mark testcase with looping information
device = genie_testbed.devices[d]
log.info(banner(
"Connect to device '{d}'".format(d=device.name)))
try:
device.connect()
device_list.append(d)
except Exception as e:
msg = "Failed to connect to {} will not be checked!"
log.info(msg.format(device.name))
# run local_user_check against each device in the list
aetest.loop.mark(local_user_check, dev_name=device_list)
示例3: connect
# 需要导入模块: from genie.conf import Genie [as 别名]
# 或者: from genie.conf.Genie import init [as 别名]
def connect(self, testbed):
genie_testbed = Genie.init(testbed)
self.parent.parameters['testbed'] = genie_testbed
device_list = []
for device in genie_testbed.devices.values():
log.info(banner(
"Connect to device '{d}'".format(d=device.name)))
try:
device.connect()
except Exception as e:
self.failed("Failed to establish connection to '{}'".format(
device.name))
device_list.append(device)
# Pass list of devices the to testcases
self.parent.parameters.update(dev=device_list)
###################################################################
# TESTCASES SECTION #
###################################################################
示例4: get_devices
# 需要导入模块: from genie.conf import Genie [as 别名]
# 或者: from genie.conf.Genie import init [as 别名]
def get_devices(self, testbed):
genie_testbed = Genie.init(testbed)
self.parent.parameters["testbed"] = genie_testbed
device_list = []
# Attempt to establish connection with each device
for device in genie_testbed.devices.values():
if device.os in ["iosxe", "nxos", "iosxr"]:
log.info(banner("Connect to device '{d}'".format(d=device.name)))
device_list.append(device)
# Pass list of devices the to testcases
self.parent.parameters.update(dev=device_list)
###################################################################
# TESTCASES SECTION #
###################################################################
示例5: genie_testbed
# 需要导入模块: from genie.conf import Genie [as 别名]
# 或者: from genie.conf.Genie import init [as 别名]
def genie_testbed(self, testbed):
'''Create the genie testbed'''
try:
self.builtin.get_library_instance('pyats.robot.pyATSRobot')
ats_pyats = 'pyats.robot.pyATSRobot'
except RuntimeError:
self.builtin.get_library_instance('ats.robot.pyATSRobot')
ats_pyats = 'ats.robot.pyATSRobot'
except RuntimeError:
# No pyATS
pass
try:
# If pyATS, then call their use_testbed api, then convert
self.builtin.get_library_instance(ats_pyats).use_testbed(testbed)
testbed = self.builtin.get_library_instance(ats_pyats).testbed
except RuntimeError as e:
# No pyATS
self.testbed = loader.load(testbed)
else:
# Has pyATS, so converted and then save locally and also for pyATS
self.testbed = Genie.init(testbed)
self.builtin.get_library_instance(ats_pyats).testbed = self.testbed
self.testscript.parameters['testbed'] = self.testbed
# Load Genie Datafiles (Trigger, Verification and PTS)
# This make UUT mandatory. When learning, aka no trigger
# the UUT are not mandatory
self.loaded_yamls = True
self._load_genie_datafile()
if not self.trigger_datafile:
self.loaded_yamls = False
log.warning("Could not load the Datafile correctly")
# Metaparser
示例6: connect
# 需要导入模块: from genie.conf import Genie [as 别名]
# 或者: from genie.conf.Genie import init [as 别名]
def connect(self, testbed):
genie_testbed = Genie.init(testbed)
self.parent.parameters["testbed"] = genie_testbed
device_list = []
# Attempt to establish connection with each device
for device in genie_testbed.devices.values():
log.info(banner("Connect to device '{d}'".format(d=device.name)))
try:
device.connect()
# If unable to connect, fail test
except Exception as e:
self.failed(
"Failed to establish connection to '{}'".format(
device.name
)
)
device_list.append(device)
# Pass list of devices the to testcases
self.parent.parameters.update(dev=device_list)
###################################################################
# TESTCASES SECTION #
###################################################################
示例7: load_testbed
# 需要导入模块: from genie.conf import Genie [as 别名]
# 或者: from genie.conf.Genie import init [as 别名]
def load_testbed(testbed):
genie_testbed = Genie.init(testbed)
return genie_testbed