예제 #1
0
    def calling(self):
        session = Session(self.hostName, self.userName, self.password, self.rootUser, self.rootPasswd, "telnet", "CoreCalling.log")
        session.logfile = sys.stdout
        print "***Calling***                                                    [3/5]"
        try:
            session.waitUntil(self.timeout, '>')
            session.sendLine(self.userName + " " + self.password)
            session.waitUntil(self.timeout, 'CDMG S3MTXV19DN MS2K Sanity')
            session.sendLine('mtxcrank cdr 10 10 10')
            session.waitUntil(self.timeout, 'second')
            print "\033[1;32;40m***Calling Success***                                            [OK]\033[0m"
            return 0

        except exception.TimeOutError, e:
            print "Timeout"
            return 1
예제 #2
0
    def lastFileNumber(self):
        session = Session(self.hostName, self.userName, self.password, self.rootUser, self.rootPasswd, "telnet",
                          "ServerCheckFileBeforeCalling.log")
        print "***Got the billing before call***"
        try:
            session.waitUntil(self.timeout, 'login:'******'Password:'******'cdma184%')
            session.sendLine("cd " + self.fileDirectory + ";" + "ls -l" + "\n\r", 1)
            session.waitUntil(self.timeout, 'cdma184%')

            logPath = session.getLog()
            lastFileNum = AnalyseText.getLastFileNumber(logPath)

            print "\033[1;32;40m***Get the number( %s ) success***                     [OK]\033[0m" % lastFileNum
            return lastFileNum


        except exception.TimeOutError, e:
            print "Timeout"
            return 1
    def checkRTBConfiguration(self):
        try:
            print "***Checking Configuration***                                     [1/5]"
            session = Session(self.hostName, self.userName, self.password, self.rootUser, self.rootPasswd, "telnet",
                              "checkRTBConfiguration.log")
            #session.logfile = sys.stdout
            session.waitUntil(self.timeout, 'login:'******'Password:'******'$')
            session.sendLine('su -')
            session.waitUntil(self.timeout, 'Password:'******'#')
            session.sendLine('billmtc')
            session.waitUntil(self.timeout, 'BILLMTC')
            session.waitUntil(self.timeout, '18 Refresh')
            session.send('schedule')
            session.waitUntil(self.timeout, 'schedule')
            session.waitUntil(self.timeout, '18 Refresh')
            session.send('RTB')
            session.waitUntil(self.timeout, 'RTB')
            session.waitUntil(self.timeout, '18 Refresh')
            session.send('Query AMA')
            session.waitUntil(self.timeout, '18 Refresh')

            session.waitUntil(self.timeout, '----------------------------------------------------')
            flag, logFilePath = session.traverse("KeyLog_RTB.log", self.traverseTimeout, "stream", "INSV", "SYSB",
                                                 "OFFL", "ISTB", "MANB", )

            status = analyse_text.analyseRTBInSv(logFilePath, self.fileFormat, self.destination)

            session.send('CONFRTB')
            session.waitUntil(self.timeout, '18 Refresh')
            session.send('Query AMA')
            session.waitUntil(self.timeout, '18 Refresh')

            session.waitUntil(self.timeout, '----------------------------------------------------')

            flag, logFilePath = session.traverse("KeyLog_CONFRTB.log", self.traverseTimeout, "CONFIGURED", "CONFIGURED",
                                                 "UNCONFIGURED")

            configuration = analyse_text.analyseConfRTBConfigurated(logFilePath, self.fileFormat, self.destination)

            session.send('')
            session.send('Quit')
            session.waitUntil(self.timeout, '18 Refresh')
            session.send('Quit')
            session.waitUntil(self.timeout, '18 Refresh')
            session.send('list')
            session.waitUntil(self.timeout, 'Stream')


            flag, logFilePath = session.traverse2("KeyLog_SCHEDULE.log", self.traverseTimeout, "Return to Continue...",
                                                  "('Abort' quits)...", "Return to Continue...")
            verify = analyse_text.analyseScheduleInfo(logFilePath, self.stream, self.fileFormat, self.destination,
                                                      self.fileDestination)

            if status != "INSV":
                raise exception.RTBInSvError(self.stream, self.fileFormat, self.destination,status)
            if configuration != "CONFIGURED":
                raise exception.RTBConfigurationError(self.stream, self.fileFormat, self.destination,configuration)
            if verify != "success":
                raise exception.ScheduleError(self.stream, self.fileFormat, self.destination, self.fileDestination)

            print "\033[1;32;40m***Checking configuration Success***                             [OK]\033[0m"
            return 0

        except exception.TimeOutError, e:
            print "Timeout"
            return 1
    def checkFile(self):
        session = Session(self.hostName, self.userName, self.password, self.rootUser, self.rootPasswd, "telnet",
                          "ServerCheckFileBeforeCalling.log")
        #session.logfile = sys.stdout
        print "***Got the billing before call***                                [2/5]"
        try:
            session.waitUntil(self.timeout, 'login:'******'Password:'******'cdma184%')
            session.sendLine("cd " + self.fileDirectory + ";" + "ls -l" + "\n\r", 1)
            session.waitUntil(self.timeout, 'cdma184%')

            logPath = session.getLog()
            lastestNum = analyse_text.analyseBillingList(logPath)

            print "\033[1;32;40m***Got the billing before call Success***                        [OK]\033[0m"
            return 0, lastestNum

        except exception.TimeOutError, e:
            print "Timeout"
            return 1
    def checkFile(self):
        session = Session(self.hostName, self.userName, self.password, self.rootUser, self.rootPasswd, "telnet", "ServerCheckFileAfterCalling.log")
        session.logfile = sys.stdout
        print "***Got the billing after call***                                [5/5]"
        try:
            session.waitUntil(self.timeout, 'login:'******'Password:'******'cdma184%');                session.sendLine("cd "+self.fileDirectory+";"+"ls -l"+"\n\r")
            session.waitUntil(self.timeout, 'cdma184%')
            print "\033[1;32;40m***Got the billing after call Success***                       [OK]\033[0m"
            return 0

        except exception.TimeOutError, e:
            print "Timeout"
            return 1
    def checkBilling(self):
        print "***Check file in query***                                        [4/5]"
        try:
            session = Session(self.hostName, self.userName, self.password, self.rootUser, self.rootPasswd, "telnet","checkBilling.log")
            #session.logfile = sys.stdout
            session.waitUntil(self.timeout, 'login:'******'Password:'******'$')
            session.sendLine('su -')
            session.waitUntil(self.timeout, 'Password:'******'#')
            session.sendLine('billmtc')
            session.waitUntil(self.timeout, 'BILLMTC')
            session.waitUntil(self.timeout, '18 Refresh')
            session.send('FILESYS')
            session.waitUntil(self.timeout, '18 Refresh')
            session.send('LISTFILE AMA')
            session.waitUntil(self.timeout, 'RUNNING')
            session.waitUntil(self.timeout, 'O')
            print "\033[1;32;40m***Check file in query Success***                                [OK]\033[0m"
            return 0

        except exception.TimeOutError, e:
                print "Timeout"
                return 1
    def checkBilling(self):
        print "***Check file in query***                                        [4/5]"
        try:
            session = Session(
                self.hostName,
                self.userName,
                self.password,
                self.rootUser,
                self.rootPasswd,
                "telnet",
                "checkBilling.log",
            )
            session.logfile = sys.stdout
            session.waitUntil(self.timeout, "login:"******"Password:"******"$")
            session.sendLine("su -")
            session.waitUntil(self.timeout, "Password:"******"#")
            session.sendLine("billmtc")
            session.waitUntil(self.timeout, "BILLMTC")
            session.waitUntil(self.timeout, "18 Refresh")
            session.send("FILESYS")
            session.waitUntil(self.timeout, "18 Refresh")
            session.send("LISTFILE AMA")
            session.waitUntil(self.timeout, "RUNNING")
            session.waitUntil(self.timeout, "O")
            # session.traverse2("KeyLog_Billing.log", self.traverseTimeout, "Size")
            print "\033[1;32;40m***Check file in query Success***                                [OK]\033[0m"
            return 0

        except exception.TimeOutError, e:
            print "Timeout"
            return 1
예제 #8
0
    def generateCall(self):
        session = Session(self.hostName, self.userName, self.password, self.rootUser, self.rootPasswd, "telnet",
                          "CoreCalling.log")
        print "***Calling***"
        try:
            session.waitUntil(self.timeout, '>')
            session.sendLine(self.userName + " " + self.password, 1)
            session.waitUntil(self.timeout, 'CDMG S3MTXV19DN MS2K Sanity')
            session.sendLine('mtxcrank cdr 10 10 10', 1)
            session.waitUntil(self.timeout, 'second')
            print "\033[1;32;40m***Calling Success***                                            [OK]\033[0m"
            self.flag = True
            return 0

        except exception.TimeOutError, e:
            print "Timeout"
            self.flag = False
            return 1
    def checkRTBConfiguration(self):
        try:
            print "***Checking Configuration***                                     [1/5]"
            session = Session(
                self.hostName,
                self.userName,
                self.password,
                self.rootUser,
                self.rootPasswd,
                "telnet",
                "checkRTBConfiguration.log",
            )
            session.logfile = sys.stdout
            session.waitUntil(self.timeout, "login:"******"Password:"******"$")
            session.sendLine("su -")
            session.waitUntil(self.timeout, "Password:"******"#")
            session.sendLine("billmtc")
            session.waitUntil(self.timeout, "BILLMTC")
            session.waitUntil(self.timeout, "18 Refresh")
            session.send("schedule")
            session.waitUntil(self.timeout, "schedule")
            session.waitUntil(self.timeout, "18 Refresh")
            session.send("RTB")
            session.waitUntil(self.timeout, "RTB")
            session.waitUntil(self.timeout, "18 Refresh")
            session.send("Query AMA")
            session.waitUntil(self.timeout, "18 Refresh")
            session.waitUntil(self.timeout, "----------------------------------------------------")
            session.traverse("KeyLog_RTB.log", self.traverseTimeout, "INSV", "SYSB", "OFFL", "ISTB")
            session.send("CONFRTB")
            session.waitUntil(self.timeout, "18 Refresh")
            session.send("Query AMA")
            session.waitUntil(self.timeout, "18 Refresh")
            session.waitUntil(self.timeout, "----------------------------------------------------")
            session.traverse("KeyLog_CONFRTB.log", self.traverseTimeout, "CONFIGURED", "UNCONFIGURED")
            session.send("")
            session.send("Quit")
            session.waitUntil(self.timeout, "18 Refresh")
            session.send("Quit")
            session.waitUntil(self.timeout, "18 Refresh")
            session.send("list")
            session.waitUntil(self.timeout, "Stream")

            flag = session.traverse2("KeyLog_SCHEDULE.log", self.traverseTimeout, "('Abort' quits)", "Continue")
            if flag == 0:
                print "\033[1;32;40m***Checking configuration Success***                             [OK]\033[0m"
                return 0
            else:
                raise Exception.Fault_Error

        except exception.TimeOutError, e:
            print "Timeout"
            return 1