예제 #1
0
    def _handleErrorReply(self, err, header):

        if err.check(WebError) is None:
            if err.check(ConnectionRefusedError):
                # could not contact NSA
                msg = 'Could not contact NSA %s. Reason: %s' % (header.provider_nsa, err.getErrorMessage())
                ex = error.DownstreamNSAError(msg, nsa_id=header.provider_nsa)
                return failure.Failure(ex)
            else:
                # cannot handle it here
                return err

        if err.value.status != b'500':
            log.msg("Got error with non-500 status. Message: %s" % err.getErrorMessage(), system=LOG_SYSTEM)
            return err

        fault_code, fault_string, detail = minisoap.parseFault(err.value.response)

        service_exception = None
        if detail:
            service_exception = nsiconnection.parse(detail)

        if service_exception is None:
            # this is not entirely correct, but it isn't really wrong either
            ex = error.InternalServerError(fault_string)
        else:
            ex = helper.createException(service_exception, header.provider_nsa)

        err = failure.Failure(ex)

        return err
예제 #2
0
    def _handleErrorReply(self, err, header):

        if err.check(WebError) is None:
            if err.check(ConnectionRefusedError):
                # could not contact NSA
                msg = 'Could not contact NSA %s. Reason: %s' % (header.provider_nsa, err.getErrorMessage())
                ex = error.DownstreamNSAError(msg, nsa_id=header.provider_nsa)
                return failure.Failure(ex)
            else:
                # cannot handle it here
                return err

        if err.value.status != '500':
            log.msg("Got error with non-500 status. Message: %s" % err.getErrorMessage(), system=LOG_SYSTEM)
            return err

        fault_code, fault_string, detail = minisoap.parseFault(err.value.response)

        service_exception = None
        if detail:
            service_exception = nsiconnection.parse(detail)

        if service_exception is None:
            # this is not entirely correct, but it isn't really wrong either
            ex = error.InternalServerError(fault_string)
        else:
            ex = helper.createException(service_exception, header.provider_nsa)

        err = failure.Failure(ex)

        return err
예제 #3
0
    def _parseGenericFailure(self, soap_data):

        header, generic_failure = helper.parseRequest(soap_data)

        rc = generic_failure.connectionStates
        rd = rc.dataPlaneStatus

        dps = (rd.active, rd.version, rd.versionConsistent)
        cs = (rc.reservationState, rc.provisionState, rc.lifecycleState, dps)

        ex = helper.createException(generic_failure.serviceException, header.provider_nsa)
        return header, generic_failure.connectionId, cs, ex
예제 #4
0
    def _parseGenericFailure(self, soap_data):

        header, generic_failure = helper.parseRequest(soap_data)

        rc = generic_failure.connectionStates
        rd = rc.dataPlaneStatus

        dps = (rd.active, rd.version, rd.versionConsistent)
        cs = (rc.reservationState, rc.provisionState, rc.lifecycleState, dps)

        ex = helper.createException(generic_failure.serviceException, header.provider_nsa)
        return header, generic_failure.connectionId, cs, ex