def reserve(self, soap_data, request_info):

        t_start = time.time()

        header, reservation = helper.parseRequest(soap_data)

        # do some checking here

#        print header.protocolVersion
#        print header.correlationId
#        print header.requesterNSA
#        print header.providerNSA
#        print header.replyTo

        criteria = reservation.criteria

        #version      = criteria.version # not used at the moment
        service_type = criteria.serviceType # right now we just ignore this, either we know the service type or not
        p2ps         = criteria.serviceDefinition

#        if len(service_defs) == 0:
#            err = failure.Failure ( error.PayloadError('No service definition element in message') )
#            return self._createSOAPFault(err, header.provider_nsa, service_type=service_type)

#        if len(service_defs) != 1:
#            err = failure.Failure ( error.PayloadError('Only one service definition allowed') )
#            return self._createSOAPFault(err, header.provider_nsa, service_type=service_type)

        if type(p2ps) is not p2pservices.P2PServiceBaseType:
            err = failure.Failure ( error.PayloadError('Only supports Point2PointService service for now.') )
            return self._createSOAPFault(err, header.provider_nsa, service_type=service_type)

        if (None, '') in p2ps.directionality:
            err = failure.Failure ( error.MissingParameterError('Directionality parameter not defined'))
            return self._createSOAPFault(err, header.provider_nsa)

        # create DTOs (EROs not supported yet)

        start_time = xmlhelper.parseXMLTimestamp(criteria.schedule.startTime) if criteria.schedule.startTime is not None else None
        end_time = xmlhelper.parseXMLTimestamp(criteria.schedule.endTime) if criteria.schedule.endTime is not None else None
        schedule = nsa.Schedule(start_time, end_time)

        src_stp = helper.createSTP(p2ps.sourceSTP)
        dst_stp = helper.createSTP(p2ps.destSTP)

        if p2ps.ero:
            err = failure.Failure ( error.PayloadError('ERO not supported, go away.') )
            return self._createSOAPFault(err, header.provider_nsa)

#        if p2ps.parameter:
#            p = p2ps.parameter[0]
#            err = failure.Failure ( error.UnsupportedParameter('Unsupported parameter: %s/%s' % (p.type_, p.value) ) )
#            return self._createSOAPFault(err, header.provider_nsa)
        params = [ (p.type_, p.value) for p in p2ps.parameter ] if p2ps.parameter else None
        symmetric = p2ps.symmetricPath or False # the p2p service specifies default behaviour as false, but doesn't specify default
        sd = nsa.Point2PointService(src_stp, dst_stp, p2ps.capacity, p2ps.directionality, symmetric, None, params)

        crt = nsa.Criteria(criteria.version, schedule, sd)

        t_delta = time.time() - t_start
        log.msg('Profile: Reserve request parse time: %s' % round(t_delta, 3), profile=True, system=LOG_SYSTEM)

        d = self.provider.reserve(header, reservation.connectionId, reservation.globalReservationId, reservation.description, crt, request_info)

        def createReserveAcknowledgement(connection_id):
            # no reply to / security attrs / trace
            soap_header_element = helper.createProviderHeader(header.requester_nsa, header.provider_nsa, None, header.correlation_id)

            reserve_response = nsiconnection.ReserveResponseType(connection_id)
            reserve_response_element = reserve_response.xml(nsiconnection.reserveResponse)

            payload = minisoap.createSoapPayload(reserve_response_element, soap_header_element)
            return payload


        d.addCallbacks(createReserveAcknowledgement, self._createSOAPFault, errbackArgs=(header.provider_nsa,))
        return d
dataset/ETHPy150Open NORDUnet/opennsa/opennsa/protocols/nsi2/providerservice.py/ProviderService.reserve/swapped operands of `in`