3gpp_29.510.h 8.5 KB
Newer Older
1
2
3
4
5
/*
 * 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
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
6
7
8
 * 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
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 *
 *      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
 */

#ifndef FILE_3GPP_29_510_NRF_SEEN
#define FILE_3GPP_29_510_NRF_SEEN

25
#include <vector>
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
26
#include "3gpp_23.003.h"
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
27
28
29
30
31
32

enum class nf_status_e { REGISTERED = 0, SUSPENDED = 1, UNDISCOVERABLE = 2 };

static const std::vector<std::string> nf_status_e2str = {
    "REGISTERED", "SUSPENDED", "UNDISCOVERABLE"};

33
34
35
36
37
38
39
40
41
42
43
typedef enum nf_up_interface_type_s {
  N3              = 0,
  N6              = 1,
  N9              = 2,
  DATA_FORWARDING = 3,
  TYPE_UNKNOWN    = 4
} nf_up_interface_type_t;

static const std::vector<std::string> up_interface_type_e2str = {
    "N3", "N6", "N9", "DATA_FORWARDING", "UNKNOWN"};

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
typedef struct amf_info_s {
  std::string amf_set_id;
  std::string amf_region_id;
  std::vector<guami_t> guami_list;
} amf_info_t;

typedef struct dnn_smf_info_item_s {
  std::string dnn;
} dnn_smf_info_item_t;

typedef struct snssai_smf_info_item_s {
  snssai_t snssai;
  std::vector<dnn_smf_info_item_t> dnn_smf_info_list;

} snssai_smf_info_item_t;

typedef struct smf_info_s {
  std::vector<snssai_smf_info_item_t> snssai_smf_info_list;
} smf_info_t;

Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
64
65
66
67
68
69
70
71
72
73
74
typedef struct dnn_upf_info_item_s {
  std::string dnn;
  // std::vector<std::string> dnai_list
  // std::vector<std::string> pdu_session_types
} dnn_upf_info_item_t;

typedef struct snssai_upf_info_item_s {
  snssai_t snssai;
  std::vector<dnn_upf_info_item_t> dnn_upf_info_list;
} snssai_upf_info_item_t;

75
76
77
78
79
80
81
82
typedef struct interface_upf_info_item_s {
  std::string interface_type;
  std::vector<struct in_addr> ipv4_addresses;
  std::vector<struct in6_addr> ipv6_addresses;
  std::string endpoint_fqdn;
  std::string network_instance;
} interface_upf_info_item_t;

Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
83
84
typedef struct upf_info_s {
  std::vector<snssai_upf_info_item_t> snssai_upf_info_list;
85
  std::vector<interface_upf_info_item_t> interface_upf_info_list;
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
86
87
} upf_info_t;

Rohan's avatar
Rohan committed
88
typedef struct supi_range_ausf_info_item_s {
Rohan's avatar
Rohan committed
89
  supi_range_t supi_range;
Rohan's avatar
Rohan committed
90
91
92
93
94
} supi_range_ausf_info_item_t;

typedef struct ausf_info_s {
  std::string groupid;
  std::vector<supi_range_ausf_info_item_t> supi_ranges;
Rohan's avatar
Rohan committed
95
  std::vector<std::string> routing_indicator;
Rohan's avatar
Rohan committed
96
97
} ausf_info_t;

98
enum subscr_condition_type_e {  // TODO: use enum class
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
99
  UNKNOWN_CONDITION   = 0,
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
100
  NF_INSTANCE_ID_COND = 1,
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
101
102
103
104
105
106
  NF_TYPE_COND        = 2,
  SERVICE_NAME_COND   = 3,
  AMF_COND            = 4,
  GUAMI_LIST_COND     = 5,
  NETWOTK_SLICE_COND  = 6,
  NF_GROUP_COND       = 7
107
108
};

109
110
111
112
113
114
static const std::vector<std::string> subscription_condition_type_e2str = {
    "UNKNOWN_CONDITION",  "NF_INSTANCE_ID_COND",
    "NF_TYPE_COND",       "SERVICE_NAME_COND",
    "AMF_COND",           "GUAMI_LIST_COND",
    "NETWOTK_SLICE_COND", "NF_GROUP_COND"};

Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
typedef struct amf_cond_s {
  std::string amf_set_id;
  std::string amf_region_id;
} amf_cond_t;

typedef struct network_slice_cond_s {
  std::vector<snssai_t> snssai_list;
  std::vector<std::string> nsi_list;
} network_slice_cond_t;

typedef struct nf_group_cond_s {
  std::string nf_type;

  std::string nf_group_id;
} nf_group_cond_t;

typedef struct subscription_condition_s {
  uint8_t type;
  union {
    std::string nf_instance_id;
    std::string nf_type;
    std::string service_name;
    amf_cond_t amf_info;
    std::vector<guami_t> guami_list;
    network_slice_cond_t network_slice;
    nf_group_cond_t nf_group;
  };

143
  subscription_condition_s() : type(0), nf_instance_id() {}
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
144
145
146

  subscription_condition_s(uint8_t t) : type(t) {}

Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
147
  subscription_condition_s(const subscription_condition_s& s)
148
      : subscription_condition_s() {
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
149
150
151
152
153
154
155
156
157
158
159
160
161
    type = s.type;
    switch (s.type) {
      case NF_INSTANCE_ID_COND: {
        nf_instance_id = s.nf_instance_id;
      } break;
      case NF_TYPE_COND: {
        nf_type = s.nf_type;
      } break;

      case SERVICE_NAME_COND: {
        service_name = s.service_name;
      } break;
      case AMF_COND: {
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
162
        amf_info.amf_set_id    = s.amf_info.amf_set_id;
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
        amf_info.amf_region_id = s.amf_info.amf_region_id;
      } break;

      case GUAMI_LIST_COND: {
        // TODO:
      } break;

      case NETWOTK_SLICE_COND: {
        // TODO:
      } break;

      case NF_GROUP_COND: {
        // TODO:
      } break;

      default: {
        // TODO:
      }
    }
    // TODO:
  }
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
184
  bool operator==(const struct subscription_condition_s& s) const {
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
185
186
187
    return (s.type == type);
  }

Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
188
  bool operator==(const uint8_t& t) const { return (t == type); }
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
189

Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
190
  subscription_condition_s& operator=(const subscription_condition_s& s) {
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
191
192
193
194
195
196
197
198
199
200
201
202
203
    type = s.type;
    switch (s.type) {
      case NF_INSTANCE_ID_COND: {
        nf_instance_id = s.nf_instance_id;
      } break;
      case NF_TYPE_COND: {
        nf_type = s.nf_type;
      } break;

      case SERVICE_NAME_COND: {
        service_name = s.service_name;
      } break;
      case AMF_COND: {
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
204
        amf_info.amf_set_id    = s.amf_info.amf_set_id;
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
        amf_info.amf_region_id = s.amf_info.amf_region_id;
      } break;

      case GUAMI_LIST_COND: {
        // TODO:
      } break;

      case NETWOTK_SLICE_COND: {
        // TODO:
      } break;

      case NF_GROUP_COND: {
        // TODO:
      } break;

      default: {
        // TODO:
      }
    }
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
224
    return *this;
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
225
226
227
    // TODO:
  }

Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
228
229
  virtual ~subscription_condition_s(){};

230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
  std::string to_string() const {
    std::string s = {};
    s.append("Type: ");
    s.append(subscription_condition_type_e2str[type]);
    s.append(", condition: ");
    switch (type) {
      case NF_INSTANCE_ID_COND: {
        s.append(nf_instance_id);
      } break;
      case NF_TYPE_COND: {
        s.append(nf_type);
      } break;
      case SERVICE_NAME_COND: {
        s.append(service_name);
      } break;
      case AMF_COND: {
        s.append(", AMF_Set_ID: ");
        s.append(amf_info.amf_set_id);
        s.append(", AMF_Region_ID: ");
        s.append(amf_info.amf_region_id);
      } break;

      case GUAMI_LIST_COND: {
        // TODO:
      } break;

      case NETWOTK_SLICE_COND: {
        // TODO:
      } break;

      case NF_GROUP_COND: {
        // TODO:
      } break;

      default: {
        // TODO:
      }
    }
    // TODO:

    return s;
  }

Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
273
274
} subscription_condition_t;

275
enum notification_event_type_t {
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
276
277
278
  NOTIFICATION_TYPE_UNKNOWN_EVENT      = 0,
  NOTIFICATION_TYPE_NF_REGISTERED      = 1,
  NOTIFICATION_TYPE_NF_DEREGISTERED    = 2,
279
  NOTIFICATION_TYPE_NF_PROFILE_CHANGED = 3
280
281
};

282
283
284
static const std::vector<std::string> notification_event_type_e2str = {
    "UNKNOWN EVENT", "NF_REGISTERED", "NF_DEREGISTERED", "NF_PROFILE_CHANGED"};

Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
285
286
287
288
typedef struct nf_service_version_s {
  std::string api_version_in_uri;  // apiVersionInUri
  std::string api_full_version;    // apiFullVersion

Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
289
  nf_service_version_s& operator=(const nf_service_version_s& s) {
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
290
    api_version_in_uri = s.api_version_in_uri;
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
291
    api_full_version   = s.api_full_version;
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
292
    return *this;
Tien-Thinh Nguyen's avatar
Tien-Thinh Nguyen committed
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
  }

  std::string to_string() const {
    std::string s = {};
    s.append(", Version (");
    s.append("apiVersionInUri: ");
    s.append(api_version_in_uri);
    s.append(", apiFullVersion: ");
    s.append(api_full_version);
    s.append(" )");
    return s;
  }
} nf_service_version_t;

typedef struct nf_service_s {
  std::string service_instance_id;
  std::string service_name;
  std::vector<nf_service_version_t> versions;
  std::string scheme;
  std::string nf_service_status;

  std::string to_string() const {
    std::string s = {};
    s.append("Service Instance ID: ");
    s.append(service_instance_id);
    s.append(", Service name: ");
    s.append(service_name);
    for (auto v : versions) {
      s.append(v.to_string());
    }
    s.append(", Scheme: ");
    s.append(scheme);
    s.append(", Service status: ");
    s.append(nf_service_status);
    return s;
  }
} nf_service_t;

331
#endif