本文整理汇总了Python中client_test_lib.Bootstrap.eapi_node_information_collected方法的典型用法代码示例。如果您正苦于以下问题:Python Bootstrap.eapi_node_information_collected方法的具体用法?Python Bootstrap.eapi_node_information_collected怎么用?Python Bootstrap.eapi_node_information_collected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类client_test_lib.Bootstrap
的用法示例。
在下文中一共展示了Bootstrap.eapi_node_information_collected方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_duplicate_actions
# 需要导入模块: from client_test_lib import Bootstrap [as 别名]
# 或者: from client_test_lib.Bootstrap import eapi_node_information_collected [as 别名]
def test_duplicate_actions(self):
bootstrap = Bootstrap()
bootstrap.ztps.set_config_response()
bootstrap.ztps.set_node_check_response()
bootstrap.ztps.set_definition_response(
actions=[{'action' : 'startup_config_action'},
{'action' : 'print_action'},
{'action' : 'print_action'}])
bootstrap.ztps.set_action_response('startup_config_action',
startup_config_action())
text = random_string()
bootstrap.ztps.set_action_response('print_action',
print_action(text))
bootstrap.start_test()
try:
self.failUnless(bootstrap.eapi_node_information_collected())
self.failUnless(bootstrap.success())
self.failUnless(bootstrap.output.count('Downloading action '
'print_action') == 1)
self.failUnless(bootstrap.output.count('Executing action '
'print_action') == 2)
self.failUnless(bootstrap.output.count(text) == 2)
self.failIf(bootstrap.error)
except AssertionError as assertion:
print 'Output: %s' % bootstrap.output
print 'Error: %s' % bootstrap.error
raise assertion
finally:
bootstrap.end_test()
示例2: test_attribute
# 需要导入模块: from client_test_lib import Bootstrap [as 别名]
# 或者: from client_test_lib.Bootstrap import eapi_node_information_collected [as 别名]
def test_attribute(self):
bootstrap = Bootstrap()
bootstrap.ztps.set_config_response()
bootstrap.ztps.set_node_check_response()
text = random_string()
bootstrap.ztps.set_definition_response(
actions=[{'action' : 'startup_config_action'},
{'action' : 'print_action',
'attributes' : {'print_action-attr':text}}])
bootstrap.ztps.set_action_response('startup_config_action',
startup_config_action())
bootstrap.ztps.set_action_response('print_action',
print_action(use_attribute=True))
bootstrap.start_test()
try:
self.failUnless(bootstrap.eapi_node_information_collected())
self.failUnless(bootstrap.success())
self.failUnless(text in bootstrap.output)
self.failIf(bootstrap.error)
except AssertionError as assertion:
print 'Output: %s' % bootstrap.output
print 'Error: %s' % bootstrap.error
raise assertion
finally:
bootstrap.end_test()
示例3: test
# 需要导入模块: from client_test_lib import Bootstrap [as 别名]
# 或者: from client_test_lib.Bootstrap import eapi_node_information_collected [as 别名]
def test(self):
bootstrap = Bootstrap()
open(bootstrap.rc_eos, 'w').write(random_string())
open(bootstrap.boot_extensions, 'w').write(random_string())
os.makedirs(bootstrap.boot_extensions_folder)
open('%s/%s' % (bootstrap.boot_extensions_folder,
random_string()),
'w').write(random_string())
bootstrap.ztps.set_config_response()
bootstrap.ztps.set_node_check_response()
bootstrap.ztps.set_definition_response()
bootstrap.start_test()
try:
self.failUnless(bootstrap.eapi_node_information_collected())
self.failUnless(bootstrap.missing_startup_config_failure())
self.failIf(os.path.exists(bootstrap.rc_eos))
self.failIf(os.path.exists(bootstrap.boot_extensions))
self.failIf(os.path.exists(bootstrap.boot_extensions_folder))
self.failIf(bootstrap.error)
except AssertionError as assertion:
print 'Output: %s' % bootstrap.output
print 'Error: %s' % bootstrap.error
raise_exception(assertion)
finally:
bootstrap.end_test()
示例4: test_multiple_actions
# 需要导入模块: from client_test_lib import Bootstrap [as 别名]
# 或者: from client_test_lib.Bootstrap import eapi_node_information_collected [as 别名]
def test_multiple_actions(self):
bootstrap = Bootstrap()
bootstrap.ztps.set_config_response()
bootstrap.ztps.set_node_check_response()
bootstrap.ztps.set_definition_response(
actions=[{'action' : 'startup_config_action'},
{'action' : 'print_action_1'},
{'action' : 'print_action_2'}])
bootstrap.ztps.set_action_response('startup_config_action',
startup_config_action())
text_1 = random_string()
bootstrap.ztps.set_action_response('print_action_1',
print_action(text_1))
text_2 = random_string()
bootstrap.ztps.set_action_response('print_action_2',
print_action(text_2))
bootstrap.start_test()
try:
self.failUnless(bootstrap.eapi_node_information_collected())
self.failUnless(bootstrap.success())
self.failUnless(text_1 in bootstrap.output)
self.failUnless(text_2 in bootstrap.output)
self.failIf(bootstrap.error)
except AssertionError as assertion:
print 'Output: %s' % bootstrap.output
print 'Error: %s' % bootstrap.error
raise assertion
finally:
bootstrap.end_test()
示例5: test
# 需要导入模块: from client_test_lib import Bootstrap [as 别名]
# 或者: from client_test_lib.Bootstrap import eapi_node_information_collected [as 别名]
def test(self):
open(RC_EOS, 'w').write(random_string())
open(BOOT_EXTENSIONS, 'w').write(random_string())
os.makedirs(BOOT_EXTENSIONS_FOLDER)
open('%s/%s' % (BOOT_EXTENSIONS_FOLDER, random_string()),
'w').write(random_string())
bootstrap = Bootstrap()
bootstrap.ztps.set_config_response()
bootstrap.ztps.set_node_check_response()
bootstrap.ztps.set_definition_response()
bootstrap.start_test()
try:
self.failUnless(bootstrap.eapi_node_information_collected())
self.failUnless(bootstrap.missing_startup_config_failure())
self.failIf(os.path.exists(RC_EOS))
self.failIf(os.path.exists(BOOT_EXTENSIONS))
self.failIf(os.path.exists(BOOT_EXTENSIONS_FOLDER))
self.failIf(bootstrap.error)
except AssertionError as assertion:
print 'Output: %s' % bootstrap.output
print 'Error: %s' % bootstrap.error
raise assertion
finally:
bootstrap.end_test()
示例6: test_definition_missing
# 需要导入模块: from client_test_lib import Bootstrap [as 别名]
# 或者: from client_test_lib.Bootstrap import eapi_node_information_collected [as 别名]
def test_definition_missing(self):
bootstrap = Bootstrap()
bootstrap.ztps.set_config_response()
bootstrap.ztps.set_node_check_response()
bootstrap.start_test()
try:
self.failUnless(bootstrap.eapi_node_information_collected())
self.failUnless(bootstrap.server_connection_failure())
self.failIf(bootstrap.error)
except AssertionError as assertion:
print 'Output: %s' % bootstrap.output
print 'Error: %s' % bootstrap.error
raise assertion
finally:
bootstrap.end_test()
示例7: test_node_not_found
# 需要导入模块: from client_test_lib import Bootstrap [as 别名]
# 或者: from client_test_lib.Bootstrap import eapi_node_information_collected [as 别名]
def test_node_not_found(self):
bootstrap = Bootstrap()
bootstrap.ztps.set_config_response()
bootstrap.ztps.set_node_check_response(status=400)
bootstrap.start_test()
try:
self.failUnless(bootstrap.eapi_node_information_collected())
self.failUnless(bootstrap.node_not_found_failure())
self.failIf(bootstrap.error)
except AssertionError as assertion:
print 'Output: %s' % bootstrap.output
print 'Error: %s' % bootstrap.error
raise_exception(assertion)
finally:
bootstrap.end_test()
示例8: test_content_type
# 需要导入模块: from client_test_lib import Bootstrap [as 别名]
# 或者: from client_test_lib.Bootstrap import eapi_node_information_collected [as 别名]
def test_content_type(self):
bootstrap = Bootstrap()
bootstrap.ztps.set_config_response()
bootstrap.ztps.set_node_check_response(
content_type='text/plain')
bootstrap.start_test()
try:
self.failUnless(bootstrap.eapi_node_information_collected())
self.failUnless(bootstrap.unexpected_response_failure())
self.failIf(bootstrap.error)
except AssertionError as assertion:
print 'Output: %s' % bootstrap.output
print 'Error: %s' % bootstrap.error
raise assertion
finally:
bootstrap.end_test()
示例9: action_fail_test
# 需要导入模块: from client_test_lib import Bootstrap [as 别名]
# 或者: from client_test_lib.Bootstrap import eapi_node_information_collected [as 别名]
def action_fail_test(self, action):
bootstrap = Bootstrap()
bootstrap.ztps.set_config_response()
bootstrap.ztps.set_node_check_response()
bootstrap.ztps.set_definition_response(
actions=[{'action' : 'test_action'}])
bootstrap.ztps.set_action_response('test_action', action)
bootstrap.start_test()
try:
self.failUnless(bootstrap.eapi_node_information_collected())
self.failUnless(bootstrap.action_failure())
self.failIf(bootstrap.error)
except AssertionError as assertion:
print 'Output: %s' % bootstrap.output
print 'Error: %s' % bootstrap.error
raise assertion
finally:
bootstrap.end_test()
示例10: test_topology_check
# 需要导入模块: from client_test_lib import Bootstrap [as 别名]
# 或者: from client_test_lib.Bootstrap import eapi_node_information_collected [as 别名]
def test_topology_check(self):
bootstrap = Bootstrap()
bootstrap.ztps.set_config_response()
bootstrap.ztps.set_node_check_response()
bootstrap.ztps.set_definition_response(
status=400,
content_type='text/html')
bootstrap.start_test()
try:
self.failUnless(bootstrap.eapi_node_information_collected())
self.failUnless(bootstrap.toplogy_check_failure())
self.failIf(bootstrap.error)
except AssertionError as assertion:
print 'Output: %s' % bootstrap.output
print 'Error: %s' % bootstrap.error
raise assertion
finally:
bootstrap.end_test()
示例11: test_success
# 需要导入模块: from client_test_lib import Bootstrap [as 别名]
# 或者: from client_test_lib.Bootstrap import eapi_node_information_collected [as 别名]
def test_success(self):
bootstrap = Bootstrap()
bootstrap.ztps.set_config_response()
bootstrap.ztps.set_node_check_response()
bootstrap.ztps.set_definition_response(
actions=[{'action' : 'startup_config_action'}])
bootstrap.ztps.set_action_response('startup_config_action',
startup_config_action())
bootstrap.start_test()
try:
self.failUnless(bootstrap.eapi_node_information_collected())
self.failUnless(bootstrap.success())
self.failIf(bootstrap.error)
except AssertionError as assertion:
print 'Output: %s' % bootstrap.output
print 'Error: %s' % bootstrap.error
raise_exception(assertion)
finally:
bootstrap.end_test()
示例12: test_status_content_type
# 需要导入模块: from client_test_lib import Bootstrap [as 别名]
# 或者: from client_test_lib.Bootstrap import eapi_node_information_collected [as 别名]
def test_status_content_type(self):
bootstrap = Bootstrap()
bootstrap.ztps.set_config_response()
bootstrap.ztps.set_node_check_response()
bootstrap.ztps.set_definition_response(
actions=[{'action' : 'test_action'}])
bootstrap.ztps.set_action_response('test_action', print_action(),
status=201,
content_type='test/plain')
bootstrap.start_test()
try:
self.failUnless(bootstrap.eapi_node_information_collected())
self.failUnless(bootstrap.unexpected_response_failure())
self.failIf(bootstrap.error)
except AssertionError as assertion:
print 'Output: %s' % bootstrap.output
print 'Error: %s' % bootstrap.error
raise_exception(assertion)
finally:
bootstrap.end_test()
示例13: test_action_failure
# 需要导入模块: from client_test_lib import Bootstrap [as 别名]
# 或者: from client_test_lib.Bootstrap import eapi_node_information_collected [as 别名]
def test_action_failure(self):
bootstrap = Bootstrap()
bootstrap.ztps.set_config_response()
bootstrap.ztps.set_node_check_response()
bootstrap.ztps.set_definition_response(
actions=[{'action' : 'test_action'}])
flash_filename = random_string()
bootstrap.ztps.set_action_response(
'test_action',
fail_flash_file_action(bootstrap.flash,
flash_filename))
open(bootstrap.rc_eos, 'w').write(random_string())
open(bootstrap.startup_config, 'w').write(random_string())
open(bootstrap.boot_extensions, 'w').write(random_string())
os.mkdir(bootstrap.boot_extensions_folder)
open('%s/my_extension' %
bootstrap.boot_extensions_folder, 'w').write(random_string())
bootstrap.start_test()
try:
self.failUnless(bootstrap.eapi_node_information_collected())
self.failUnless(bootstrap.action_failure())
self.failIf(bootstrap.error)
self.failIf(os.path.isfile('%s/%s' %
(bootstrap.flash,
flash_filename)))
self.failIf(os.path.isfile(bootstrap.rc_eos))
self.failIf(os.path.isfile(bootstrap.startup_config))
self.failIf(os.path.isfile(bootstrap.boot_extensions))
self.failIf(os.path.isdir(bootstrap.boot_extensions_folder))
except AssertionError as assertion:
print 'Output: %s' % bootstrap.output
print 'Error: %s' % bootstrap.error
raise_exception(assertion)
finally:
bootstrap.end_test()
示例14: xmpp_sanity_test
# 需要导入模块: from client_test_lib import Bootstrap [as 别名]
# 或者: from client_test_lib.Bootstrap import eapi_node_information_collected [as 别名]
def xmpp_sanity_test(self, xmpp):
log = '/tmp/ztps-log-%s-debug' % os.getpid()
bootstrap = Bootstrap()
bootstrap.ztps.set_config_response(logging=[
{'destination' : 'file:%s' % log,
'level' : 'DEBUG'},],
xmpp=xmpp)
bootstrap.ztps.set_node_check_response()
bootstrap.ztps.set_definition_response()
bootstrap.start_test()
try:
self.failUnless(bootstrap.eapi_node_information_collected())
self.failUnless(bootstrap.missing_startup_config_failure())
self.failIf(bootstrap.error)
self.failIf('XmppClient' not in ''.join(file_log(log)))
except AssertionError as assertion:
print 'Output: %s' % bootstrap.output
print 'Error: %s' % bootstrap.error
raise assertion
finally:
bootstrap.end_test()
示例15: test_action_success_log
# 需要导入模块: from client_test_lib import Bootstrap [as 别名]
# 或者: from client_test_lib.Bootstrap import eapi_node_information_collected [as 别名]
def test_action_success_log(self):
log = '/tmp/ztps-log-%s-debug' % os.getpid()
bootstrap = Bootstrap()
bootstrap.ztps.set_config_response(logging=[
{'destination' : 'file:%s' % log,
'level' : 'DEBUG'},])
bootstrap.ztps.set_node_check_response()
text_onstart = random_string()
text_onsuccess = random_string()
text_onfailure = random_string()
bootstrap.ztps.set_definition_response(
actions=[{'action' : 'startup_config_action',
'onstart' : text_onstart,
'onsuccess' : text_onsuccess,
'onfailure' : text_onfailure,
}])
bootstrap.ztps.set_action_response('startup_config_action',
startup_config_action())
bootstrap.start_test()
try:
self.failUnless(bootstrap.eapi_node_information_collected())
self.failUnless(bootstrap.success())
self.failIf(bootstrap.error)
log = ''.join(file_log(log))
self.failUnless('startup_config_action:%s' % text_onstart in log)
self.failUnless('startup_config_action:%s' % text_onsuccess in log)
self.failUnless('startup_config_action:%s' %
text_onfailure not in log)
except AssertionError as assertion:
print 'Output: %s' % bootstrap.output
print 'Error: %s' % bootstrap.error
raise assertion
finally:
bootstrap.end_test()