-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pcrf json dbi #1
base: main
Are you sure you want to change the base?
Conversation
To allow the include to work even when build without mongo installed. No data types require mongoc.h to be in ogs_mongoc.h.
The only user of ogs-mongoc.h are the tests. Add comment to remove the comment as soon they aren't depend on the ogs-mongoc.h
…ends The current dbi only supports a single database backend. Add an abstraction layer to allow multiple database backends. Introduce a dbi backend struct containing all database functions.
…nal() Nobody is calling ogs_mongoc_final() directly. In preparation of making ogs_dbi_final() more generic
Allow database driver to only implement parts of the database driver. In preprataion of the json interface which will only implement session_data as might only be used by the PCRF.
Add json based database backend. TODO: add example json interface
Add the charging characteristics to the dbi function to allow the backend to decide the profile based on it. The charging characteristics can be filled by the HSS and will be passed by the PCEF towards the PCRF. This is an API dbi breakage.
To make use of the new json database backend, allow the pcrf to parse json backend configuration.
Also pass the 3GPP-Charging-Characteristics to the dbi session_data call
The tests won't be build as they depend on mongodb. To build without mongodb do meson configure -Dmongodb=false
@@ -24,8 +24,6 @@ | |||
#ifndef OGS_MONGOC_H | |||
#define OGS_MONGOC_H | |||
|
|||
#include <mongoc.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will be hapilly accepted upstream. A "mongoc" specific header which doesn't include mongoc.h? This looks weird. Looks like you'd want to generalize the API to remove all the "mongo" references, or import this ogs-mongoc.h file based on whether mongo support is enabled.
@@ -24,7 +24,9 @@ | |||
|
|||
#define OGS_DBI_INSIDE | |||
|
|||
/* TODO: remove ogs-mongoc.h as soon the test cases don't depend on it */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit in itself does nothing, so I'm sure you want to merge this into some other commit
@@ -25,7 +25,7 @@ | |||
#define OGS_DBI_INSIDE | |||
|
|||
/* TODO: remove ogs-mongoc.h as soon the test cases don't depend on it */ | |||
#include "dbi/ogs-mongoc.h" | |||
#include "dbi/mongo/ogs-mongoc.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the meson file seems to indicate you make the mongo files optional, but you are including it here non-conditionally?
lib/dbi/meson.build
Outdated
'''.split()) | ||
|
||
libmongoc_dep = dependency('libmongoc-1.0') | ||
libmongoc_dep = dependency('libmongoc-1.0', required: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this marked as "required:true" then check if found? Sounds like marking required would make everything fail if not found?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please merge this commit with all the previous one, otherwise it's a big set of incomplete steps and it's difficult to figure out what are you doing other than guessing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch can probably the first since it can be already sent as a separate PR and merge straight away.
|
||
int __ogs_dbi_domain; | ||
|
||
static ogs_dbi_t *dbi_interfaces[] = { | ||
#ifdef WITH_MONGOC | ||
&ogs_dbi_mongo_interface, | ||
#endif | ||
&ogs_dbi_json_interface, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so how is one or the other selected for use? I don't recall seeing any explanation anywhere.
@@ -34,7 +34,7 @@ struct ogs_dbi_s { | |||
void (*final)(void); | |||
/* session */ | |||
int (*session_data)(char *supi, ogs_s_nssai_t *s_nssai, char *dnn, | |||
ogs_session_data_t *data); | |||
int32_t charging_char, ogs_session_data_t *data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since it's more like a bitmask, maybe makes more sense to use uint32_t?
@@ -28,8 +28,10 @@ | |||
extern "C" { | |||
#endif | |||
|
|||
#define OGS_DBI_NO_CHARGING_CHAR -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the peer cannot send an all 0xff value meaning something different?
Or it's because ChargingChracteristics is 16bit?
@@ -0,0 +1,17 @@ | |||
[ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH it looks a bit weird that being all the config files yaml this is done in JSON. I forsee this will be NACKed upon review. If I were you I'd move this to yaml, drop cJSON and even incorporate this as a node in pcrf.cfg
@@ -267,7 +267,7 @@ int pcrf_context_parse_config(void) | |||
} | |||
|
|||
int pcrf_db_qos_data( | |||
char *imsi_bcd, char *apn, ogs_session_data_t *session_data) | |||
char *imsi_bcd, char *apn, int32_t charging_char, ogs_session_data_t *session_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If ChargingChar is 16bit, did you think about passing a "uint16_t *" ptr and pass it NULL if none is to be used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think having a int32 is simpler than passing a pointer.
/* This file will be used when build without mongodb support to support the old api */ | ||
#include "ogs-dbi.h" | ||
|
||
int ogs_dbi_init(const char *db_uri) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this needed? This commint looks like needs to be meregd with some of the previous commits doing stuff with the API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know if open5gs cares about so library versions and compatibility?
The dummy functions are needed when building without mongdb. dbi is still a shared library.
As there has been no recent activity on this PR, it has been marked as stale. It will be automatically closed if no further action is taken. |
No description provided.