######################################################################## # # All Rights Reserved. # Copyright (C) 2024, Hitachi Vantara, Ltd. # ######################################################################## # # bcmapi_test - This sample script shows how to confirmation # BCM Web API server start-up and termination. # # This sample script assumes the following settings. # 1) The prefix is defined in the CLIDFLTS dataset. # ######################################################################## # To execute this script, need the following steps: # 1) Put bcmapi.py in the same directory as this script. # 2) Write bcmapi.ini and put it in the same directory as this script. # 3) Execute this script from python. import bcmapi import json import pprint def test(): # Check environments. operands = "" rc,appData = bcmapi.bcmreq("YKENV", operands) if rc != 0: return 8 print(appData) # Get list of BCM configuration file IDs. operands = "" rc,appData = bcmapi.bcmreq("YKLISTID", operands) if rc != 0: return 8 print(appData) return 0 tsoStart = False bcmStart = False # Before using the BCM Web API, you need to perform # z/OSMF authentication, start a TSO/E session, # and then start the BCM Web API server. respBody = bcmapi.start_tso() if respBody != "": tsoStart = True respBody = bcmapi.start_bcm() if respBody != "": bcmStart = True rc = test() # To exit the BCM Web API server, # you need to send a "submit":"exit" request. if bcmStart: respBody = bcmapi.end_bcm() # You must send DELETE /zosmf/tsoApp/tso/<servletKey> # to terminate TSO/E address space of BCM Web API server. if tsoStart: respBody = bcmapi.end_tso() exit()