Пример #1
0
    def querySummarySync(self,
                         header,
                         connection_ids=None,
                         global_reservation_ids=None):
        def gotReply(soap_data):
            header, query_confirmed = helper.parseRequest(soap_data)
            return [
                queryhelper.buildQueryResult(resv, header.provider_nsa)
                for resv in query_confirmed.reservations
            ]

        # don't need to check header here
        header_element = helper.createProviderHeader(
            header.requester_nsa,
            header.provider_nsa,
            reply_to=self.reply_to,
            correlation_id=header.correlation_id,
            security_attributes=header.security_attributes,
            connection_trace=header.connection_trace)

        query_type = nsiconnection.QueryType(connection_ids,
                                             global_reservation_ids)
        body_element = query_type.xml(nsiconnection.querySummarySync)

        payload = minisoap.createSoapPayload(body_element, header_element)

        d = httpclient.soapRequest(self.service_url,
                                   actions.QUERY_SUMMARY_SYNC,
                                   payload,
                                   ctx_factory=self.ctx_factory,
                                   headers=self.http_headers)
        d.addCallbacks(gotReply,
                       self._handleErrorReply,
                       errbackArgs=(header, ))
        return d
Пример #2
0
    def queryRecursive(self,
                       header,
                       connection_ids,
                       global_reservation_ids=None):

        self._checkHeader(header)

        header_element = helper.createProviderHeader(
            header.requester_nsa,
            header.provider_nsa,
            reply_to=self.reply_to,
            correlation_id=header.correlation_id,
            security_attributes=header.security_attributes,
            connection_trace=header.connection_trace)

        query_type = nsiconnection.QueryType(connection_ids,
                                             global_reservation_ids)
        body_element = query_type.xml(nsiconnection.queryRecursive)

        payload = minisoap.createSoapPayload(body_element, header_element)

        d = httpclient.soapRequest(self.service_url,
                                   actions.QUERY_RECURSIVE,
                                   payload,
                                   ctx_factory=self.ctx_factory,
                                   headers=self.http_headers)
        d.addCallbacks(lambda sd: None,
                       self._handleErrorReply,
                       errbackArgs=(header, ))
        return d
Пример #3
0
    def querySummary(self,
                     header,
                     connection_ids=None,
                     global_reservation_ids=None,
                     request_info=None):

        self._checkHeader(header)

        header_element = helper.convertProviderHeader(header, self.reply_to)

        query_type = nsiconnection.QueryType(connection_ids,
                                             global_reservation_ids)
        body_element = query_type.xml(nsiconnection.querySummary)

        payload = minisoap.createSoapPayload(body_element, header_element)

        d = httpclient.soapRequest(self.service_url,
                                   actions.QUERY_SUMMARY,
                                   payload,
                                   ctx_factory=self.ctx_factory,
                                   headers=self.http_headers)
        d.addCallbacks(lambda sd: None,
                       self._handleErrorReply,
                       errbackArgs=(header, ))
        return d