Example #1
0
 def mysql2xml(self, request, context):
     if request.username == default_usr and \
         request.password == default_pwd:
         res = base64.b64encode(utils.read_mysql().encode('utf-8'))
         return AutoDataCollection_pb2.resultXML(result=res)
     else:
         return AutoDataCollection_pb2.resultXML(result='Auth Failed')
Example #2
0
 def healthCheck(self, request, context):
     if request.username == default_usr and \
         request.password == default_pwd:
         localtime = time.asctime(time.localtime(time.time()))
         print(localtime + ' Health checking status: online')
         return AutoDataCollection_pb2.healthCheckRes(status='online')
     else:
         return AutoDataCollection_pb2.healthCheckRes(status='Auth Failed')
Example #3
0
 def autoTxt2xml(self, request, context):
     if request.username == default_usr and \
         request.password == default_pwd:
         result = utils.auto_txt2xml(incremental_read=False,
                                     startid=request.startid,
                                     endid=request.endid,
                                     taskid=request.taskid,
                                     device_name=device_name)
         if result:
             return AutoDataCollection_pb2.autoTaskStatus(status="success")
         else:
             return AutoDataCollection_pb2.autoTaskStatus(status="error")
     else:
         return AutoDataCollection_pb2.autoTaskStatus(status='Auth Failed')
Example #4
0
def get_healthCheck(stub):
    auth = AutoDataCollection_pb2.auth(
        username=default_usr,
        password=default_pwd
    )
    status = stub.healthCheck(auth).status
    print('received health check result: ' + status)
Example #5
0
def get_mysql2xml_result(stub):
    auth = AutoDataCollection_pb2.auth(
        username=default_usr,
        password=default_pwd
    )
    resultXML = stub.mysql2xml(auth)
    print('[mysql] received {result}'.format(
        result=base64.b64decode(resultXML.result).decode(encoding='utf-8')
    ))
Example #6
0
def get_autoTaskStatus(stub):
    param = AutoDataCollection_pb2.autoTaskParam(
        taskid="cae0b2e4753792947640a7",
        username=default_usr,
        password=default_pwd,
        startid = 1,
        endid = 2
    )
    status = stub.autoTxt2xml(param).status
    print('received auto txt2xml result: ' + status)