def OptionsFile_Extraction(self): if self.Error == False: result = self.Modem.SendCommandWithReturn(ExpectBegin=">", Command="options show", ExpectEnd=">") temp = {} temp1 = lib_Parsing.String_Parse(result, ["modem_sn"], ["Serial_Number"], Section="OPTIONS_FILE") if temp1 != None: temp.update(temp1) temp1 = lib_Parsing.String_Parse( result, ["up_translation", "down_translation"], ["Up_Translation", "Down_Translation"], Section="FREQ_TRANS") if temp1 != None: temp.update(temp1) temp1 = lib_Parsing.String_Parse(result, ["vid"], ["VLAN"], Section="VLAN") if temp1 != None: temp.update(temp1) temp1 = lib_Parsing.String_Parse(result, ["hunt_frequency"], ["Hunt_Frequency"], Section="SATELLITE") if temp1 != None: temp.update(temp1) return temp else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def LinkStatus_Extraction(self): if self.Error == False: result = self.FBB.SendCommandWithReturn2("showLinkStatus") result = lib_Parsing.String_Parse(result, ["Link status"], ["Link_Status"]) List = result["Link_Status"].split() result = "" for data in List: result += data + "\n" result = lib_Parsing.String_Parse( result, ["Port1", "Port2", "Port3", "Port4"], ["Port1", "Port2", "Port3", "Port4"]) return result else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def GPS_Extraction(self): if self.Error == False: result = self.Modem.SendCommandWithReturn(ExpectBegin=">", Command="latlong", ExpectEnd=">", Timeout=10) result = lib_Parsing.String_Parse(result, ["latlong"], ["GPS"]) b = parse( "{Latitude} {LatitudeDirection} {Longitude} {LongitudeDirection}", result["GPS"]) result = {} if b == None: return result else: longitude = float(b["Longitude"]) if b["LongitudeDirection"].upper() == 'W': longitude = longitude * -1 result["Longitude"] = format(longitude, '.5f') latitude = float(b["Latitude"]) if b["LatitudeDirection"].upper() == 'S': latitude = latitude * -1 result["Latitude"] = format(latitude, '.5f') # import pprint # pprint.pprint(result) return result else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def Get_iARM(self): if self.Error == False: result = self.SSH.SendCommandWithReturn(Command="show iARM version",Method=1) result = lib_Parsing.String_Parse(result,["Active File System Version"],["iARM"]) return result else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def Get_Management(self): if self.Error == False: result = self.SSH.SendCommandWithReturn(Command="show config mgmt",Method=1) result = lib_Parsing.String_Parse(result,["MGMT IP Address","MGMT Net Mask","MGMT DHCP Start","MGMT DHCP End","MGMT DHCP Lease Time","MAC Address"],["MGMT_IPAddress","MGMT_NetMask","MGMT_DHCPStart","MGMT_DHCPEnd","MGMT_DHCPLeaseTime","MACAddress"]) return result else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def Get_AntInfo(self): if self.Error == False: result = self.SSH.SendCommandWithReturn(Command="show mediator ant_info",Method=1) regex = r"(Antenna)([0-9])(\s*:)" subst = "[\g<1>\g<2>]" result = re.sub(regex, subst, result, 0) temp = {} temp1 = lib_Parsing.String_Parse(result,["Antenna Status","Signal","RX Lock","TX Enable"],["Antenna1_Status","Antenna1_Signal","Antenna1_RXLock","Antenna1_TXEnable"],Section = "Antenna1") if temp1 != None: temp.update(temp1) temp1 = lib_Parsing.String_Parse(result,["Antenna Status","Signal","RX Lock","TX Enable"],["Antenna2_Status","Antenna2_Signal","Antenna2_RXLock","Antenna2_TXEnable"],Section = "Antenna2") if temp1 != None: temp.update(temp1) return temp else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def RadioAppVariables(self): if self.Error == False: result = self.FBB.SendCommandWithReturn2("radioapp variables") result = lib_Parsing.String_Parse(result, [ "radioAppContext.currentRadioMode", "currentChannelType", "current_ChID", "lastDSC_ChID" ], [ "currentRadioMode", "currentChannelType", "currentChID", "lastDSCChID" ]) # result["currentCh"] = None # result["currentChDesc"] = None try: if (int(result["currentChID"]) > 399) and (int( result["currentChID"]) < 501): result["currentCh"] = "P" + str( int(result["currentChID"]) - 400) else: for item in self.channelList: if int(item[0]) == int(result["currentChID"]): result["currentCh"] = item[1] result["currentChDesc"] = item[2] result["transmitMode"] = item[3] break except Exception as e: self.log.printError("ERROR in VHF calculation currenchannel") self.log.printError(str(e)) pass return result else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def Version_Extraction(self): if self.Error == False: result = self.FBB.SendCommandWithReturn2("version f") result = lib_Parsing.String_Parse(result, ["version"], ["Version"]) return result else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def Network_Extraction(self): if self.Error == False: result = self.FBB.SendCommandWithReturn2("ifconfig") result = lib_Parsing.String_Parse(result, ["ip", "netmask", "mac"], ["IP", "Netmask", "MAC"]) return result else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def GPS_Extraction(self): if self.Error == False: result = self.FBB.SendCommandWithReturn2("nmea pos") result = lib_Parsing.String_Parse(result, ["Lat", "Lon"], ["latitude", "longitude"]) return result else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def getSysconf(self): if self.Error == False: result = {} temp = self.AlarmPanel.SendCommandWithReturn2("sysconf") result = lib_Parsing.String_Parse(temp,["Model number","MAC","Serial number"],["type","MAC","serial"]) final = {} final["General"] = result return final else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def Rx_SNR_Extraction(self): if self.Error == False: result = self.Modem.SendCommandWithReturn(ExpectBegin=">", Command="rx snr", ExpectEnd=">") result = lib_Parsing.String_Parse(result, ["rx snr"], ["Rx_SNR"]) return result else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def Get_SatTarget(self): if self.Error == False: result = self.SSH.SendCommandWithReturn( Command="show acs position target", Method=1) result = lib_Parsing.String_Parse( result, ["Azimuth", "Elevation", "POL"], ["TargetAzimuth", "TargetElevation", "TargetPOL"]) return result else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def Version_Extraction(self): if self.Error == False: result = self.FBB.SendCommandWithReturn2("ver") result = lib_Parsing.String_Parse(result, ["Software"], ["Software"]) data = result["Software"].split()[0] result["Software"] = data[:len(data) - 1] return result else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def Get_Mediator(self): if self.Error == False: temp = {} result = self.SSH.SendCommandWithReturn(Command="show mediator",Method=1) temp1 = lib_Parsing.String_Parse(result,["Type","Product Name","S/W Version","Serial Number"],["Type","DeviceName","Version","SerialNumber"],Section = "Mediator Information") if temp1 != None: temp.update(temp1) temp1 = lib_Parsing.String_Parse(result,["ACU1 Connection","ACU2 Connection","RF Path","Switch Selection"],["ACU1_Connection","ACU2_Connection","RFPath","SwitchSelection"],Section = "Mediator Status") if temp1 != None: temp.update(temp1) temp1 = lib_Parsing.String_Parse(result,["Touch Key Lock"],["TouchKeyLock"],Section = "Mediator Touch Lock Status") if temp1 != None: temp.update(temp1) temp1 = lib_Parsing.String_Parse(result,["Modem Type","Modem PORT","Modem Protocol","GPS Out Sentence","Use TX Mute","Use Modem Lock","TX Mute","Modem Lock","IP Address","Subnet Mask","Gateway","DNS","TCP Modem Port","UDP Modem Port"],["ModemType","ModemPort","ModemProtocol","GPSOutSentence","UseTXMute","UseModemLock","TXMute","ModemLock","IPAddress","SubnetMask","Gateway","DNS","TCPModemPort","UDPModemPort"],Section = "Mediator Modem Information") if temp1 != None: temp.update(temp1) temp1 = lib_Parsing.String_Parse(result,["Switching Threshold"],["SwitchingThreshold"],Section = "Mediator Switching Threshold Information") if temp1 != None: temp.update(temp1) temp1 = lib_Parsing.String_Parse(result,["Heading Device","Boudrate"],["HeadingDevice","Baudrate"],Section = "Heading Information") if temp1 != None: temp.update(temp1) return temp else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def SysState_Extraction(self): if self.Error == False: result = self.FBB.SendCommandWithReturn2("sys_state") result = lib_Parsing.Cut_Multiline_String(result, Begin="---", End="---") result = lib_Parsing.String_Parse( result, ["BDU state", "ADU state", "MSG state"], ["BDU_State", "ADU_State", "MSG_State"]) return result else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def Remote_State_Extraction(self): if self.Error == False: result = self.Modem.SendCommandWithReturn(ExpectBegin=">", Command="remotestate", ExpectEnd=">", Timeout=100) result = result[result.find('\n') + 1:result.rfind('\n')] result = lib_Parsing.String_Parse( result, ["txer state", "rxer lock", "Modem state", "link layer state"], ["Tx_State", "Rx_Lock", "Modem_State", "Link_State"]) return result else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def GPS_Extraction(self): if self.Error == False: result = self.FBB.SendCommandWithReturn2("ALgetGpsData") result = lib_Parsing.Cut_Multiline_String(result, Begin="Copy of last", End="ECEF") result = lib_Parsing.String_Parse( result, ["Current Fix Status", "Satellites", "hmsl"], ["GPS_Fix", "GPS_Satellites", "SealevelHeight"]) result["SealevelHeight"] = result["SealevelHeight"].split()[0] result["GPS_Satellites"] = result["GPS_Satellites"].split()[0] return result else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def Uptime_Extraction(self): if self.Error == False: c = {} result = self.Modem.SendCommandWithReturn(ExpectBegin=">", Command="uptime", ExpectEnd=">", Timeout=10) a = lib_Parsing.String_Parse(result, ["application uptime"], ["Application_Uptime"]) if not "Application_Uptime" in a: return c result = lib_Parsing.TimeSting_To_Sec(a["Application_Uptime"]) c["Application_Uptime"] = result return c else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def LogoutCli(self): if self.Error == False: result = self.SSH.CloseSessionWithReturn(Command="exit") result = lib_Parsing.String_Parse(result, [ "AZ_REL", "HEADING", "AZ_ABS", "EL", "POL", "IF", "STATUS", "SIGNAL", "TX ENABLE", "ENABLE MODE", "BLOCK ZONE", "POINTING", "MODEM LOCK", "LNB ROTATE", "POL", "Detect Level", "Tracking Level", "Antenna", "ACU", "WEB", "GPS(m)", "Local", "Band", "TX Pol" ], [ "RelativeAz", "Heading", "AbsoluteAz", "Elevation", "POL", "TrackingFreq", "AntennaStatus", "AGC", "TxMode", "EnableMode", "BlockZone", "Pointing", "ModemLock", "LNBRotate", "POL", "DetectLevel", "TrackingLevel", "PCU", "ACU", "E2S", "GPS", "LNBFreq", "System_Band", "TX_Polarisation" ]) #Clean GPS gps = result["GPS"].split() length = len(gps[0]) direction = gps[0][length - 1:length] if direction == "N" or direction == "E" or direction == "S" or direction == "W": result["LatitudeDirection"] = gps[0][length - 1:length] result["Latitude"] = gps[0][:length - 1] length = len(gps[1]) direction = gps[1][length - 1:length] if direction == "N" or direction == "E" or direction == "S" or direction == "W": result["LongitudeDirection"] = gps[1][length - 1:length] result["Longitude"] = gps[1][:length - 1] result.pop("GPS", None) #clean ACU acu = result["ACU"].split() result["ACU"] = acu[0] #clean PCU pcu = result["PCU"].split() result["PCU"] = pcu[0] """ import pprint pprint.pprint(result) """ temp = {} temp["General"] = result return temp else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def Get_BucTemp(self): if self.Error == False: result = self.SSH.SendCommandWithReturn( Command="show buc temperature", Method=1) result = lib_Parsing.String_Parse(result, ["BUC TEMPERATURE"], ["BUCTemperature"]) if result == None: return None else: try: temp = parse("{temp} deg. C", result["BUCTemperature"]) result["BUCTemperature"] = temp["temp"] return result except: self.log.printWarning("Could not Parse %s" % result["BUCTxPower"]) return None else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def Get_Blockzones(self): if self.Error == False: temp = {} result = self.SSH.SendCommandWithReturn( Command="show acs blockzone", Method=1) for x in range(1, 6): result = result.replace("BLOCK ZONE " + str(x), "[BLOCK ZONE " + str(x) + "]") for x in range(1, 6): temp1 = lib_Parsing.String_Parse( result, ["STATUS", "AZ START", "AZ END", "EL END"], [ "bz" + str(x) + "Status", "bz" + str(x) + "AzStart", "bz" + str(x) + "AzEnd", "bz" + str(x) + "ElEnd" ], Section="BLOCK ZONE " + str(x)) if temp1 != None: temp.update(temp1) return temp else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def Get_LinkUptime(self): if self.Error == False: result = self.SSH.SendCommandWithReturn(Command="show link uptime", Method=1) a = lib_Parsing.String_Parse( result, ["Current Modem Lock", "Total Uptime"], ["CurrentModemLock", "TotalUptime"]) c = {} if "CurrentModemLock" in a: b = parse("{result} ({inseconds} seconds)", a["CurrentModemLock"]) if b != None: result = b["inseconds"] c["CurrentModemLock"] = result if "TotalUptime" in a: b = parse("{result} ({inseconds} seconds)", a["TotalUptime"]) if b != None: result = b["inseconds"] c["TotalUptime"] = result c["TotalUptime"] = result return c else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def SatInfo_Extraction(self): if self.Error == False: result = self.FBB.SendCommandWithReturn2("mmisatinfo stat") result = lib_Parsing.Cut_Multiline_String(result, Begin="Satellite status") result = lib_Parsing.String_Parse(result, [ "Connection status", "Satellite name", "Satellite ID", "Satellite longitude", "Spotbeam type", "Spotbeam ID", "Pointing elevation", "Pointing azimuth", "Signal Quality (C/N0)", "Vessel latitude", "Vessel longitude" ], [ "Status", "Sat_Name", "Sat_ID", "Sat_Longitude", "Spotbeam_Type", "Spotbeam_ID", "Elevation", "AbsoluteAz", "Signal", "Latitude", "Longitude" ]) result["Elevation"] = result["Elevation"].split()[0] result["AbsoluteAz"] = result["AbsoluteAz"].split()[0] result["Signal"] = result["Signal"].split()[0] data = parse("{none}({gps})", result["Latitude"]) dir = parse('{none}" {dir}', data["gps"]) result["LatitudeDir"] = dir["dir"] Latitude = data["gps"] data = parse("{none}({gps})", result["Longitude"]) dir = parse('{none}" {dir}', data["gps"]) result["LongitudeDir"] = dir["dir"] Longitude = data["gps"] temp = Latitude + " " + Longitude gps = lib_GPS.parse_dms(temp) result["Latitude"] = gps[0] result["Longitude"] = gps[1] return result else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)
def Get_ACS(self): if self.Error == False: temp = {} result = self.SSH.SendCommandWithReturn(Command="show acs", Method=1) temp1 = lib_Parsing.String_Parse( result, ["STAB", "PCU", "ACU"], ["STAB", "PCU", "ACU"], Section="Current Software Information") if temp1 != None: temp.update(temp1) temp1 = lib_Parsing.String_Parse( result, ["Antenna Status", "AGC/Signal", "TX Mode"], ["AntennaStatus", "AGC", "TxMode"], Section="Antenna Status") if temp1 != None: temp.update(temp1) temp1 = lib_Parsing.String_Parse( result, ["Relative AZ", "Absolute AZ", "Elevation", "POL"], ["RelativeAz", "AbsoluteAz", "Elevation", "POL"], Section="Current Antenna Position") if temp1 != None: temp.update(temp1) a = lib_Parsing.String_Parse(result, ["Latitude", "Longitude"], ["Latitude", "Longitude"], Section="GPS") if a != None: c = {} try: b = parse("{Latitude} {LatitudeDirection}", a["Latitude"]) c["Latitude"] = b["Latitude"] c["LatitudeDirection"] = b["LatitudeDirection"] b = parse("{Longitude} {LongitudeDirection}", a["Longitude"]) c["Longitude"] = b["Longitude"] c["LongitudeDirection"] = b["LongitudeDirection"] except: c = None if c != None: temp.update(c) temp1 = lib_Parsing.String_Parse(result, ["Heading Device", "Heading"], ["HeadingDevice", "Heading"], Section="Heading Device") if temp1 != None: temp.update(temp1) temp1 = lib_Parsing.String_Parse(result, ["Bow Offset"], ["BowOffset"], Section="BOW Offset") if temp1 != None: temp.update(temp1) temp1 = lib_Parsing.String_Parse(result, [ "Longitude", "Local Frequency", "Tracking Frequency(NBD)", "Skew Offset" ], ["SatelliteLongitude", "LNBFreq", "TrackingFreq", "SkewOffset"], Section="Satellite Information") if temp1 != None: temp.update(temp1) temp1 = lib_Parsing.String_Parse(result, [ "SIZE", "SYSTEM BAND", "SYSTEM POL.", "ANT NAME", "ANT SERIAL", "ACU NAME", "ACU SERIAL" ], [ "AntennaType", "System_Band", "System_Polarisation", "AntennaName", "AntennaSerial", "ACUName", "ACUSerial" ], Section="System Information") if temp1 != None: temp.update(temp1) return temp else: self.log.printWarning("%s skipped due to previous failure" % sys._getframe().f_code.co_name)