本文整理匯總了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