當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。