当前位置: 首页>>代码示例>>Python>>正文


Python Genie.init方法代码示例

本文整理汇总了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 
开发者ID:CiscoTestAutomation,项目名称:genielibs,代码行数:21,代码来源:topology_mapper.py

示例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) 
开发者ID:CiscoTestAutomation,项目名称:solutions_examples,代码行数:22,代码来源:local_user_check.py

示例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                           #
################################################################### 
开发者ID:CiscoTestAutomation,项目名称:solutions_examples,代码行数:24,代码来源:BGP_Neighbors_Established.py

示例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                           #
################################################################### 
开发者ID:DevNetSandbox,项目名称:sbx_iosxe,代码行数:22,代码来源:device_api_test.py

示例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 
开发者ID:CiscoTestAutomation,项目名称:CL-DevNet-2595,代码行数:39,代码来源:GenieRobot.py

示例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                           #
################################################################### 
开发者ID:hpreston,项目名称:netdevops_demos,代码行数:29,代码来源:OSPF_Working.py

示例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 
开发者ID:hpreston,项目名称:netdevops_demos,代码行数:5,代码来源:genie_utils.py


注:本文中的genie.conf.Genie.init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。