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