本文整理汇总了Python中NaServer.set_client_cert_and_key方法的典型用法代码示例。如果您正苦于以下问题:Python NaServer.set_client_cert_and_key方法的具体用法?Python NaServer.set_client_cert_and_key怎么用?Python NaServer.set_client_cert_and_key使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NaServer
的用法示例。
在下文中一共展示了NaServer.set_client_cert_and_key方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: import NaServer [as 别名]
# 或者: from NaServer import set_client_cert_and_key [as 别名]
else :
print ("Invalid value for connection timeout." + " Connection timeout value should be greater than 0.\n")
sys.exit (2)
#Set the style of the server
if(host_equiv == 1) :
s.set_style("HOSTS")
if (use_cba == 1) :
response = s.set_style("CERTIFICATE")
if (response):
print("Unable to set style: " + response.results_reason() + "\n")
sys.exit(2)
response = s.set_client_cert_and_key(cert_file, client_key)
if (response):
print(response.results_reason() + "\n")
sys.exit(2)
if (dossl or need_server_cert_verification):
response = s.set_server_cert_verification(need_server_cert_verification)
if (response):
print(response.results_reason() + "\n")
sys.exit(2)
if (need_server_cert_verification):
response = s.set_hostname_verification(need_hostname_verification)
if (response):
print(response.results_reason() + "\n")
sys.exit(2)
示例2: NaServer
# 需要导入模块: import NaServer [as 别名]
# 或者: from NaServer import set_client_cert_and_key [as 别名]
#!/usr/bin/env python
import sys
sys.path.append("NMSDKpy")
from NaServer import *
cluster = "svlngen4-c01-trad-gen001"
transport = "HTTPS"
port = 443
style = "CERTIFICATE"
cert = "devops_cert.pem"
key = "devops_cert.key"
s = NaServer(cluster, 1, 30)
s.set_transport_type(transport)
s.set_port(port)
s.set_style(style)
s.set_server_cert_verification(0)
s.set_client_cert_and_key(cert, key)
api = NaElement("system-get-version")
output = s.invoke_elem(api)
if (output.results_status() == "failed"):
r = output.results_reason()
print("Failed: " + str(r))
sys.exit(2)
ontap_version = output.child_get_string("version")
print ("V: " + ontap_version)