#!/usr/bin/python import logging import suds from suds.wsse import * import sys import readline logging.getLogger("suds.client").setLevel(logging.CRITICAL) url = "http://firescopetest:8048/services/FireScopeConfigurationWebService/v1?wsdl" token = UsernameToken("webservices", "password") security = Security() security.tokens.append(token) client = suds.client.Client(url) client.set_options(wsse = security) def ci(): ci = raw_input("Enter your CI name: ") ip = raw_input("Enter the IP address of your CI: ") ci = ci.strip() ip = ip.strip() response = client.service.createConfigurationItems(ci, "MONITOR", True, ip) print "Done!" def template(): template = raw_input("Enter your template name: ") ci = raw_input("Enter your CI name: ") template = template.strip() ci = ci.strip() response = client.service.linkTemplate(template, ci, "CREATE_OR_UPDATE") print "Done!" print "What would you like to do 1. Create a new CI? 2. Link a CI to Template?" answer = raw_input() if answer == "1": ci() elif answer == "2": template() else: print "Wrong answer try again"
I am creating a short script to automate creation in our monitoring platform Firescope.
In this script i want to be able to create some variables with user input and use them in the suds client service. Does anybody have experience with python and suds. The variables appear not be passing through correctly even after being converted to strings with strip. Its only the first function ci that is not working the template function is working fine. So the variables are being passed through there. But the IP variable in the first function is number this could be causing problems…? Im no web services expert this is my first time using them.
PDF version of Firescope webservices - Linky
Any help with this would be great.