White Paper

13 Scripting WSMAN Operating System Deployment Boot Network ISO
"""
Ping the IP Address of the Target to make sure the
network is up and responsive.
"""
import sys
import re
from sys import stdout
if(detect_host_os() == 1):
cmd = "ping -n 2 " + ipaddress
resp = "\(0%"
else:
cmd = "ping -c 2 " + ipaddress
resp = " 0%"
print 'Pinging %s. Waiting for response.' % (ipaddress),
stdout.flush()
stdout_value,stderr_value = wsman_command_launch(cmd)
if(re.search(resp,stdout_value)== None):
print "\nThe iDRAC is not responding. Check system and try again."
sys.exit()
print "Response received."
Extract SSL certificate
This API is used to check for presence of the SSL certificate in the file system. If the certificate is not
present, it will be retrieved from the server and a new certificate file will be created.
# Retrieve and Extract SSL certificate from the server
def wsman_get_cert(ipaddress, port = 443):
"""
Getting and building the SSL ceritificate.
"""
import os
import ssl
from sys import stdout
filename = "cer-"+ipaddress+".cer"
if os.path.isfile(filename):
# print "SSL Certificate exists!"
pass
else:
print 'Getting SSL Certificate. Waiting for response.',
stdout.flush()
cert = ssl.get_server_certificate((ipaddress,port))