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


Python pyIOSXR.IOSXR类代码示例

本文整理汇总了Python中pyIOSXR.IOSXR的典型用法代码示例。如果您正苦于以下问题:Python IOSXR类的具体用法?Python IOSXR怎么用?Python IOSXR使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了IOSXR类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_open_no_lock

 def test_open_no_lock(self, mock_spawn):
     '''
     Test pyiosxr class open - without lock
     Should return None
     '''
     device = IOSXR(hostname='hostname', username='ejasinska', password='passwd', port=22, timeout=60, logfile=None, lock=False)
     self.assertIsNone(device.open())
开发者ID:mygoda,项目名称:pyiosxr,代码行数:7,代码来源:test.py

示例2: test_load_candidate_config

 def test_load_candidate_config(self, mock_rpc, mock_sendline, mock_expect, mock_spawn):
     '''
     Test pyiosxr class load_candidate_config
     Should return None
     '''
     device = IOSXR(hostname='hostname', username='ejasinska', password='passwd', port=22, timeout=60, logfile=None, lock=False)
     mock_spawn.return_value = None
     device.open()
     self.assertIsNone(device.load_candidate_config(config='config'))
开发者ID:runborg,项目名称:pyiosxr,代码行数:9,代码来源:test.py

示例3: test_close_locked

 def test_close_locked(self, mock_rpc, mock_lock, mock_close, mock_sendline, mock_expect, mock_spawn):
     '''
     Test pyiosxr class close with lock
     Should return None
     '''
     device = IOSXR(hostname='hostname', username='ejasinska', password='passwd', port=22, timeout=60, logfile=None, lock=True)
     mock_spawn.return_value = None
     device.open()
     self.assertIsNone(device.close())
开发者ID:runborg,项目名称:pyiosxr,代码行数:9,代码来源:test.py

示例4: test_getattr_AttributeError

 def test_getattr_AttributeError(self, mock_sendline, mock_expect, mock_spawn):
     '''
     Test pyiosxr class getattr
     Should return AttributeError
     '''
     device = IOSXR(hostname='hostname', username='ejasinska', password='passwd', port=22, timeout=60, logfile=None, lock=False)
     mock_spawn.return_value = None
     device.open()
     self.assertRaises(AttributeError, getattr, device, 'foo')
开发者ID:runborg,项目名称:pyiosxr,代码行数:9,代码来源:test.py

示例5: test_execute_config_show

 def test_execute_config_show(self, mock_rpc, mock_sendline, mock_expect, mock_spawn):
     '''
     Test pyiosxr helper __execute_config_show__
     Should return True
     '''
     device = IOSXR(hostname='hostname', username='ejasinska', password='passwd', port=22, timeout=60, logfile=None, lock=False)
     mock_spawn.return_value = None
     device.open()
     self.assertTrue(__execute_config_show__(device=device, show_command='show interfaces', timeout=10))
开发者ID:runborg,项目名称:pyiosxr,代码行数:9,代码来源:test.py

示例6: test_commit_config

 def test_commit_config(self, mock_rpc, mock_sendline, mock_expect, mock_spawn):
     '''
     Test pyiosxr class commit_config
     Should return None
     '''
     device = IOSXR(hostname='hostname', username='ejasinska', password='passwd', port=22, timeout=60, logfile=None, lock=False)
     mock_spawn.return_value = None
     device.open()
     self.assertIsNone(device.commit_config(label='label', comment='comment', confirmed=30))
开发者ID:runborg,项目名称:pyiosxr,代码行数:9,代码来源:test.py

示例7: test_commit_replace_config_InvalidInputError

 def test_commit_replace_config_InvalidInputError(self, mock_rpc, mock_sendline, mock_expect, mock_spawn):
     '''
     Test pyiosxr class commit_replace_config
     Should return InvalidInputError
     '''
     device = IOSXR(hostname='hostname', username='ejasinska', password='passwd', port=22, timeout=60, logfile=None, lock=False)
     mock_spawn.return_value = None
     device.open()
     self.assertRaises(InvalidInputError, device.commit_replace_config, label='label', comment='comment', confirmed=900)
开发者ID:runborg,项目名称:pyiosxr,代码行数:9,代码来源:test.py

示例8: test_rollback

 def test_rollback(self, mock_rpc, mock_sendline, mock_expect, mock_spawn):
     '''
     Test pyiosxr class rollback
     Should return None
     '''
     device = IOSXR(hostname='hostname', username='ejasinska', password='passwd', port=22, timeout=60, logfile=None, lock=False)
     mock_spawn.return_value = None
     device.open()
     self.assertIsNone(device.rollback())
开发者ID:mygoda,项目名称:pyiosxr,代码行数:9,代码来源:test.py

示例9: test_open_no_passwd

 def test_open_no_passwd(self, mock_sendline, mock_expect, mock_spawn):
     '''
     Test pyiosxr class open - pexpect.EOF
     Should return Nona
     '''
     device = IOSXR(hostname='hostname', username='ejasinska', password='passwd', port=22, timeout=60, logfile=None, lock=False)
     mock_spawn.return_value = None
     mock_expect.return_value = 3
     self.assertIsNone(device.open())
开发者ID:runborg,项目名称:pyiosxr,代码行数:9,代码来源:test.py

示例10: test_make_rpc_call

 def test_make_rpc_call(self, mock_rpc, mock_sendline, mock_expect, mock_spawn):
     '''
     Test pyiosxr class make_rpc_call
     Should return True
     '''
     device = IOSXR(hostname='hostname', username='ejasinska', password='passwd', port=22, timeout=60, logfile=None, lock=False)
     mock_spawn.return_value = None
     mock_rpc.return_value = ElementTree.fromstring('<xml></xml>')
     device.open()
     self.assertTrue(device.make_rpc_call("<Get><Operational><LLDP><NodeTable></NodeTable></LLDP></Operational></Get>"))
开发者ID:runborg,项目名称:pyiosxr,代码行数:10,代码来源:test.py

示例11: test_get_candidate_config

 def test_get_candidate_config(self, mock_show, mock_sendline, mock_expect, mock_spawn):
     '''
     Test pyiosxr class get_candidate_config
     Should return True
     '''
     device = IOSXR(hostname='hostname', username='ejasinska', password='passwd', port=22, timeout=60, logfile=None, lock=False)
     mock_spawn.return_value = None
     device.open()
     mock_show.return_value = '!! IOS XR Configuration'
     self.assertTrue(device.get_candidate_config(merge=True, formal=True))
开发者ID:runborg,项目名称:pyiosxr,代码行数:10,代码来源:test.py

示例12: test_getattr_show_config

 def test_getattr_show_config(self, mock_show, mock_sendline, mock_expect, mock_spawn):
     '''
     Test pyiosxr class getattr
     Should return True
     '''
     device = IOSXR(hostname='hostname', username='ejasinska', password='passwd', port=22, timeout=60, logfile=None, lock=False)
     mock_spawn.return_value = None
     device.open()
     mock_show.return_value = '!! IOS XR Configuration [email protected]#$ </Exec>'
     self.assertTrue(device.show_configuration_merge(config=True))
开发者ID:runborg,项目名称:pyiosxr,代码行数:10,代码来源:test.py

示例13: test_compare_replace_config

 def test_compare_replace_config(self, mock_show, mock_sendline, mock_expect, mock_spawn):
     '''
     Test pyiosxr class compare_replace_config
     Should return True
     '''
     device = IOSXR(hostname='hostname', username='ejasinska', password='passwd', port=22, timeout=60, logfile=None, lock=False)
     mock_spawn.return_value = None
     device.open()
     mock_show.return_value = ''
     self.assertEqual('', device.compare_replace_config())
开发者ID:runborg,项目名称:pyiosxr,代码行数:10,代码来源:test.py

示例14: test_load_candidate_config_InvalidInputError

 def test_load_candidate_config_InvalidInputError(self, mock_rpc, mock_discard, mock_sendline, mock_expect, mock_spawn):
     '''
     Test pyiosxr class load_candidate_config
     Should return InvalidInputError
     '''
     device = IOSXR(hostname='hostname', username='ejasinska', password='passwd', port=22, timeout=60, logfile=None, lock=False)
     mock_spawn.return_value = None
     mock_rpc.side_effect = InvalidInputError('error')
     device.open()
     self.assertRaises(InvalidInputError, device.load_candidate_config, config='config')
开发者ID:runborg,项目名称:pyiosxr,代码行数:10,代码来源:test.py

示例15: __init__

 def __init__(self, hostname, username, password):
     self.hostname = hostname
     self.username = username
     self.password = password
     self.device = IOSXR(hostname, username, password)
     self.pending_changes = False
     self.replace = False
开发者ID:coxley,项目名称:napalm,代码行数:7,代码来源:iosxr.py


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