Fujitsu IRMC S2/S3 Universal Remote User Manual


 
iRMC S2/S3 423
Configuring the iRMC S2/S3 via SCCI and scripted configuration
12.2.2.4 Scripting with Python
#!/usr/bin/python3
import sys
import httplib2
from urllib.parse import urlencode
# ==============================================================
# iRMC
USER = 'admin'
PWD = 'admin'
IP_ADDR = '192.168.1.100'
# ==============================================================
h = httplib2.Http()
# Basic/Digest authentication
h.add_credentials(USER, PWD)
def doit(data,ausgabe=sys.stdout):
try:
resp, content = h.request("http://%s/config" % IP_ADDR,
"POST", data)
if resp['status'] == '200'
data = content.decode('utf-8')
print(data,file=ausgabe)
else:
print('STATUS:',resp['status'],file=ausgabe)
print(str(resp),file=ausgabe)
except Exception as err:
print('ERROR:',str(err),file=ausgabe)
print()
# Example 1 - send a configuration file to the iRMC S2/S3
try:
data = open('ConfigFile.pre').read()
doit(data)
except Exception as err:
print('ERROR:',str(err),file=ausgabe)
# Example 2 - Set Config Space Values
# 0x200 (ConfCabinetLocation) and
# 0x204 (ConfSystemContact) direct from the script
#
LocationContact = '''<?xml version="1.0" encoding="UTF-8"
standalone="yes" ?>