SessionManagementSubscriptionDataApiImpl.cpp 3.07 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/*
 * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The OpenAirInterface Software Alliance licenses this file to You under
 * the OAI Public License, Version 1.1  (the "License"); you may not use this
 * file except in compliance with the License. You may obtain a copy of the
 * License at
 *
 *      http://www.openairinterface.org/?page_id=698
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *-------------------------------------------------------------------------------
 * For more information about the OpenAirInterface (OAI) Software Alliance:
 *      contact@openairinterface.org
 */
yangjian's avatar
yangjian committed
21
/**
yangjian's avatar
yangjian committed
22 23 24 25 26 27 28 29 30 31 32
 * Nudr_DataRepository API OpenAPI file
 * Unified Data Repository Service. © 2020, 3GPP Organizational Partners (ARIB,
 * ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
 *
 * The version of the OpenAPI document: 2.1.2
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator
 * (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
 * the class manually.
 */
yangjian's avatar
yangjian committed
33 34 35

#include "SessionManagementSubscriptionDataApiImpl.h"

36 37 38 39 40
#include "logger.hpp"
#include "udr_app.hpp"
#include "udr_config.hpp"
using namespace config;
extern config::udr_config udr_cfg;
41
namespace oai::udr::api {
yangjian's avatar
yangjian committed
42

43
using namespace oai::udr::model;
yangjian's avatar
yangjian committed
44

yangjian's avatar
yangjian committed
45 46
SessionManagementSubscriptionDataApiImpl::
    SessionManagementSubscriptionDataApiImpl(
47
        std::shared_ptr<Pistache::Rest::Router> rtr, udr_app *udr_app_inst,
48
        std::string address)
49 50
    : SessionManagementSubscriptionDataApi(rtr),
      m_udr_app(udr_app_inst),
51
      m_address(address) {}
yangjian's avatar
yangjian committed
52

yangjian's avatar
yangjian committed
53 54 55 56 57 58 59 60 61 62 63 64
void SessionManagementSubscriptionDataApiImpl::query_sm_data(
    const std::string &ueId, const std::string &servingPlmnId,
    const Pistache::Optional<Snssai> &singleNssai,
    const Pistache::Optional<std::string> &dnn,
    const Pistache::Optional<std::vector<std::string>> &fields,
    const Pistache::Optional<std::string> &supportedFeatures,
    const Pistache::Optional<Pistache::Http::Header::Raw> &ifNoneMatch,
    const Pistache::Optional<Pistache::Http::Header::Raw> &ifModifiedSince,
    Pistache::Http::ResponseWriter &response) {
  // response.send(Pistache::Http::Code::Ok, "query_sm_data\n");
  // servingPlmnId  pattern: "^[0-9]{5,6}$"

65 66 67
  Snssai snssai = {};
  if (!singleNssai.isEmpty()) {
    snssai = singleNssai.get();
yangjian's avatar
yangjian committed
68
  }
69 70 71
  std::string dnn_str = {};
  if (!dnn.isEmpty()) {
    dnn_str = dnn.get();
yangjian's avatar
yangjian committed
72
  }
73 74 75 76
  // TODO: DNN and SNSSAI
  nlohmann::json response_data = {};
  Pistache::Http::Code code = {};
  m_udr_app->handle_query_sm_data(ueId, servingPlmnId, response_data, code);
yangjian's avatar
yangjian committed
77

78 79
  Logger::udr_server().debug("HTTP reponse code %d.\n", code);
  response.send(code, response_data.dump());
yangjian's avatar
yangjian committed
80 81
}

82
}  // namespace oai::udr::api