Example #1
0
 def generateInputJson(self):
     try:
         #Generate Index configuration file
         csvgen = CSVgenerator(self.file, _start_word_, keyField, fieldList)
         csvFile = _input_directory_ + "SMSCsi.csv"
         indexInfoList = csvgen.generateIndexDict(self.file, _start_word_,
                                                  keyField)
         indexInfoList2 = csvgen.generateIndexDict(self.file, _start_word_,
                                                   _object_start_)
         indexInfoList = indexInfoList2 + indexInfoList
         csvgen.writeDictToCSV(csvFile, indexInfoList)
         self.logger1.info("csv updated---" + csvFile)
         indexdict = indexInfoList
         # End Dynamic Index Generation code
         inputJson = self.parseAndGenerateInputMap(indexdict)
         filename = _input_directory_ + "ericsson_" + _obj_name_ + ".json"
         with open(filename, 'w') as f1:
             json.dump(inputJson, f1, indent=4)
         self.logger1.info("Json generated after parsing Input file ---" +
                           str(inputJson))
     except (FileNotFoundError):
         self.logger1.error("Input file missing:-" + self.file)
         raise ApplicationError("Input file missing for object:- " +
                                config.nokiaObjectName +
                                " Add input files & retry")
     except (Exception):
         self.logger1.error(
             "Error while parsing input dump, check for the correct format")
         raise
     return filename
Example #2
0
 def generateInputJson(self):
     try:
         #Generate Index Configuration File 
         csvgen= CSVgenerator(self.file,_start_word_1_,keyField_1,fieldList)
         csvFile=_input_directory_+"RoamingArea.csv"
         indexInfoList_1=csvgen.generateIndexDict(self.file, _start_word_1_, keyField_1)
         indexInfoList_2_a=csvgen.generateIndexDict(self.file, _start_word_2_, keyField_2_a_)
         indexInfoList_2_b=csvgen.generateIndexDict(self.file, _start_word_2_, keyField_2_b_)
         indexInfoList_2=indexInfoList_2_a+indexInfoList_2_b
         csvgen.addPrefixTokey(indexInfoList_2,'RAP') 
         indexInfoList_3=csvgen.generateIndexDict(self.file, _start_word_3_, keyField_3)
         csvgen.addPrefixTokey(indexInfoList_3 , 'HGNSP')
         indexInfoList = indexInfoList_1+indexInfoList_2+indexInfoList_3            
         csvgen.writeDictToCSV(csvFile, indexInfoList)
         self.logger.info("csv updated---"+csvFile)
         indexdict=indexInfoList
         # End Dynamic Generation Code
         inputJson=self.parseAndGenerateInputMap(indexdict);
         filename =_input_directory_+"ericsson_"+_obj_name_+".json"
         with open(filename, 'w') as f1:
             json.dump(inputJson, f1, indent=4)
         self.logger.info("Json generated after parsing Input file ---"+str(inputJson))
     except(FileNotFoundError):
         self.logger.error("Input file missing:-")
         logging.exception(FileNotFoundError)
         raise ApplicationError("Input file missing for object:- "+config.nokiaObjectName+" Add input files & retry")
     except(Exception):
         self.logger.error("Error while parsing input dump, check for the correct format")
         raise
     return filename 
 def generateInputJson(self):
     try:
         #Generate CSV File
         csvgen= CSVgenerator(self.file,_start_word_,keyField,fieldList)
         csvFile=_input_directory_+"qos.csv"
         indexInfoList=csvgen.generateIndexDict(self.file, _start_word_, keyField)
         csvgen.writeDictToCSV(csvFile, indexInfoList)
         self.logger1.info("csv updated---"+csvFile)
         indexdict=indexInfoList
         
         inputJson=self.parseAndGenerateInputMap(indexdict);
         filename =_input_directory_+"ericsson_"+_obj_name_+".json"
         with open(filename, 'w') as f1:
             json.dump(inputJson, f1, indent=4)
         self.logger1.info("Json generated after parsing Input file ---"+str(inputJson))
     except(FileNotFoundError):
         self.logger1.error("Input file missing:-"+self.file)
         raise
     except(Exception):
         self.logger1.error("Error while parsing input dump, check for the correct format")
         raise
     return filename