+ self.producer_alarms.publish(key=msg_key, value=json.dumps(response_msg), topic=topic)
+
+
+ def update_access_credentials(self, access_info):
+ """Verify if all the required access config params are provided and
+ updates access config in default vrops config file
+ """
+ update_status = False
+ wr_status = False
+ #Check if all the required config params are passed in request
+ if not all (keys in access_info for keys in req_config_params):
+ self.logger.debug("All required Access Config Parameters not provided")
+ self.logger.debug("List of required Access Config Parameters: {}".format(req_config_params))
+ self.logger.debug("List of given Access Config Parameters: {}".format(access_info))
+ return update_status
+
+ wr_status = self.write_access_config(access_info)
+ return wr_status #True/False
+
+ def write_access_config(self, access_info):
+ """Write access configuration to vROPs config file.
+ """
+ wr_status = False
+ try:
+ tree = XmlElementTree.parse(CONFIG_FILE_PATH)
+ root = tree.getroot()
+ alarmParams = {}
+ for config in root:
+ if config.tag == 'Access_Config':
+ for param in config:
+ for key,val in access_info.iteritems():
+ if param.tag == key:
+ #print param.tag, val
+ param.text = val
+
+ tree.write(CONFIG_FILE_PATH)
+ wr_status = True
+ except Exception as exp:
+ self.logger.warn("Failed to update Access Config Parameters: {}".format(exp))