def takeSnapshot(self, viewName='Flow Statistics', windowsPath=None, isLinux=False, localLinuxPath=None, renameDestinationFile=None, includeTimestamp=False, mode='overwrite'): """ Description Take a snapshot of the vieweName statistics. This is a two step process. 1> Take a snapshot of the statistics that you want and store it in the C: drive for Windows. For Linux, the snapshot goes to /home/ixia_logs. 2> Copy the statistics from the snapshot locations to the local Linux where you ran the script.. Parameters viewName: The name of the statistics to get. windowsPath: For Windows|WindowsConnectionMgr only. The C: drive + path to store the snapshot: Example: c:\\Results. isLinux: : Defaults to False. Set to True if you're getting the snapshot from Linux chassis. localLinuxPath: None|path. Provide the local Linux path to put the snapshot file. If None, this API won't copy the stat file to local Linux. The stat file will remain on Windows c: drive. renameDestinationFile: None or a name of the file other than the viewName. includeTimestamp: True|False: To include a timestamp at the end of the file. mode: append|overwrite: append=To append stats to an existing stat file. overwrite=Don't append stats. Create a new stat file. Example: For Windows: statObj.takeSnapshot(viewName='Flow Statistics', windowsPath='C:\\Results', localLinuxPath='/home/hgee', renameDestinationFile='my_renamed_stat_file.csv', includeTimestamp=True) For Linux: statObj.takeSnapshot(viewName='Flow Statistics', isLinux=True, localLinuxPath='/home/hgee') """ if mode == 'append': mode = 'kAppendCSVFile' if mode == 'overwrite': mode = 'kOverwriteCSVFile' if windowsPath: location = windowsPath if isLinux: location = '/home/ixia_logs' data = {'arg1': [viewName], 'arg2': [ "Snapshot.View.Contents: \"allPages\"", "Snapshot.View.Csv.Location: \"{0}\"".format(location), "Snapshot.View.Csv.GeneratingMode: \"%s\"" % mode, "Snapshot.View.Csv.StringQuotes: \"True\"", "Snapshot.View.Csv.SupportsCSVSorting: \"False\"", "Snapshot.View.Csv.FormatTimestamp: \"True\"", "Snapshot.View.Csv.DumpTxPortLabelMap: \"False\"", "Snapshot.View.Csv.DecimalPrecision: \"3\"" ] } url = self.ixnObj.sessionUrl+'/operations/takeviewcsvsnapshot' response = self.ixnObj.post(url, data=data) self.ixnObj.waitForComplete(response, self.ixnObj.httpHeader + response.json()['url']) if isLinux: snapshotFile = location + '/' + viewName + '.csv' self.fileMgmtObj.copyFileLinuxToLocalLinux(linuxApiServerPathAndFileName=snapshotFile, localPath=localLinuxPath, renameDestinationFile=renameDestinationFile, includeTimestamp=includeTimestamp) if windowsPath and localLinuxPath: # Get the snapshot. Use the csvFilename that was specified and the location self.fileMgmtObj.copyFileWindowsToLocalLinux('{0}\\{1}.csv'.format(windowsPath, viewName), localLinuxPath, renameDestinationFile=renameDestinationFile, includeTimestamp=includeTimestamp)