From da0e74af90f9ed5f4de51dd6eb9607e87303c240 Mon Sep 17 00:00:00 2001 From: gatici Date: Tue, 30 Jan 2024 14:29:24 +0300 Subject: [PATCH] Replace MongoDBLibrary with util/mongoapi Signed-off-by: gatici --- datarepository/routers.go | 2 +- go.mod | 20 +- go.sum | 97 ++------ producer/data_repository.go | 477 ++++++++++++++++++++++++++++-------- service/init.go | 11 +- 5 files changed, 418 insertions(+), 189 deletions(-) diff --git a/datarepository/routers.go b/datarepository/routers.go index 8c7d88e..e2faec1 100644 --- a/datarepository/routers.go +++ b/datarepository/routers.go @@ -28,7 +28,7 @@ import ( type Route struct { // Name is the name of this Route. Name string - // Method is the string for the HTTP method. ex) GET, POST etc.. + // Method is the string for the HTTP method. ex GET, POST etc. Method string // Pattern is the pattern of the URI. Pattern string diff --git a/go.mod b/go.mod index 28d4a5f..e75d52c 100644 --- a/go.mod +++ b/go.mod @@ -8,22 +8,22 @@ require ( github.com/gin-gonic/gin v1.9.1 github.com/google/uuid v1.6.0 github.com/mitchellh/mapstructure v1.5.0 - github.com/omec-project/MongoDBLibrary v1.1.3 github.com/omec-project/config5g v1.2.0 github.com/omec-project/http2_util v1.1.0 github.com/omec-project/http_wrapper v1.1.0 github.com/omec-project/logger_util v1.1.0 github.com/omec-project/openapi v1.1.0 github.com/omec-project/path_util v1.1.0 + github.com/omec-project/util v1.0.12 github.com/sirupsen/logrus v1.9.3 github.com/urfave/cli v1.22.14 - go.mongodb.org/mongo-driver v1.7.3 + go.mongodb.org/mongo-driver v1.10.1 gopkg.in/yaml.v2 v2.4.0 ) require ( github.com/antihax/optional v1.0.0 // indirect - github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef // indirect + github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect github.com/bytedance/sonic v1.9.1 // indirect github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect @@ -32,19 +32,19 @@ require ( github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.14.0 // indirect - github.com/go-stack/stack v1.8.0 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/golang-jwt/jwt v3.2.1+incompatible // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/golang/snappy v0.0.1 // indirect + github.com/golang/snappy v0.0.4 // indirect github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.13.6 // indirect + github.com/klauspost/compress v1.15.9 // indirect github.com/klauspost/cpuid/v2 v2.2.4 // indirect github.com/leodido/go-urn v1.2.4 // indirect github.com/mattn/go-isatty v0.0.19 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/montanaflynn/stats v0.6.6 // indirect github.com/omec-project/logger_conf v1.1.0 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/pkg/errors v0.9.1 // indirect @@ -52,14 +52,14 @@ require ( github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.11 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect - github.com/xdg-go/scram v1.0.2 // indirect - github.com/xdg-go/stringprep v1.0.2 // indirect - github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect + github.com/xdg-go/scram v1.1.1 // indirect + github.com/xdg-go/stringprep v1.0.3 // indirect + github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect golang.org/x/arch v0.3.0 // indirect golang.org/x/crypto v0.17.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.7.0 // indirect - golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 // indirect + golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/go.sum b/go.sum index a9b883c..f1e2ff8 100644 --- a/go.sum +++ b/go.sum @@ -39,8 +39,9 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd github.com/antonfisher/nested-logrus-formatter v1.3.0/go.mod h1:6WTfyWFkBc9+zyBaKIqRrg/KwMqBbodBjgbHjDz7zjA= github.com/antonfisher/nested-logrus-formatter v1.3.1 h1:NFJIr+pzwv5QLHTPyKz9UMEoHck02Q9L0FP13b/xSbQ= github.com/antonfisher/nested-logrus-formatter v1.3.1/go.mod h1:6WTfyWFkBc9+zyBaKIqRrg/KwMqBbodBjgbHjDz7zjA= -github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef h1:46PFijGLmAjMPwCCCo7Jf0W6f9slllCkkv7vyc1yOSg= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= +github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s= github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= @@ -66,7 +67,6 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls= github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= @@ -92,32 +92,6 @@ github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91 github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js= github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= -github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= -github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= -github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= -github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= -github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs= -github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= -github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= -github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk= -github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28= -github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo= -github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk= -github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw= -github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360= -github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg= -github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE= -github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8= -github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= -github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= -github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= -github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= -github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= -github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= -github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= @@ -150,8 +124,9 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -187,24 +162,19 @@ github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplb github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= -github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY= +github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -213,8 +183,6 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= -github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= -github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= @@ -229,10 +197,10 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/montanaflynn/stats v0.6.6 h1:Duep6KMIDpY4Yo11iFsvyqJDyfzLF9+sndUKT+v64GQ= +github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4= github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= -github.com/omec-project/MongoDBLibrary v1.1.3 h1:3/2Luxl4YBe9cP2cRNtPruroBGonmiQbnCviYby1fo4= -github.com/omec-project/MongoDBLibrary v1.1.3/go.mod h1:bchS8sexPvTzgcA+fGzGeMyQk2Ji2xyAYgXDg6wOg1I= github.com/omec-project/config5g v1.2.0 h1:fyIg+1LZ9jn8DTkVUbD4jyxA4FgMICdIBwZVnzCyMd4= github.com/omec-project/config5g v1.2.0/go.mod h1:AWFzCbbgCBx/iJwt+zWbpDGLHRpFzg24OYHqIkdcMVA= github.com/omec-project/http2_util v1.1.0 h1:8H2NME/V8iONth8TlyK/3w4pguAzaeUnEv9pmeAocwQ= @@ -247,33 +215,24 @@ github.com/omec-project/openapi v1.1.0 h1:N3v59+FM2V/eCv2Au10kbyeTf1DsScJkEdkDEc github.com/omec-project/openapi v1.1.0/go.mod h1:Fv9ajWROYypcNER+ZwWXPhLCdV4pBz75KqFp/R/2gCw= github.com/omec-project/path_util v1.1.0 h1:vzzLsay8+uexyYEqS06th8lMcwp+N+CXcaHhaypZn1Q= github.com/omec-project/path_util v1.1.0/go.mod h1:O1ch35al6+FXKmg6+5vOpKusl4fiB0u36oYjxwI4QK4= -github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= +github.com/omec-project/util v1.0.12 h1:fmeeUxexHdi4nipAJumaq4lcx9l83FPaNfGH2fRmTTw= +github.com/omec-project/util v1.0.12/go.mod h1:Cn9P57qYFiEu0ZXti8imODsJIXVGqnqhP40MwbVbo3g= github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -303,17 +262,18 @@ github.com/urfave/cli v1.22.14 h1:ebbhrRiGK2i4naQJr+1Xj92HXZCrK7MsyTS/ob3HnAk= github.com/urfave/cli v1.22.14/go.mod h1:X0eDS6pD6Exaclxm99NJ3FiCDRED7vIHpx2mDOHLvkA= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.0.2 h1:akYIkZ28e6A96dkWNJQu3nmCzH3YfwMPQExUYDaRv7w= -github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= -github.com/xdg-go/stringprep v1.0.2 h1:6iq84/ryjjeRmMJwxutI51F2GIPlP5BfTvXHeYjyhBc= -github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= -github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA= +github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E= +github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= +github.com/xdg-go/stringprep v1.0.3 h1:kdwGpVNwPFtjs98xCGkHjQtGKh86rDcRZN17QEMCOIs= +github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a h1:fZHgsYlfvtyqToslyjUt3VOPF4J7aK/3MPcK7xp3PDk= +github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a/go.mod h1:ul22v+Nro/R083muKhosV54bj5niojjWZvU8xrevuH4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.mongodb.org/mongo-driver v1.7.3 h1:G4l/eYY9VrQAK/AUgkV0koQKzQnyddnWxrd/Etf0jIs= -go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= +go.mongodb.org/mongo-driver v1.10.1 h1:NujsPveKwHaWuKUer/ceo9DzEe7HIj1SlJ6uvXZG0S4= +go.mongodb.org/mongo-driver v1.10.1/go.mod h1:z4XpeoU6w+9Vht+jAFyLgVrD+jGSQQe0+CBWFHNiHt8= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -323,15 +283,14 @@ go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqe golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k= golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -392,6 +351,7 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -406,23 +366,19 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190412183630-56d357773e84/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde h1:ejfdSekXMDxDLbRrJMwUk6KnSLZ2McaUCVcIKM+N6jc= +golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190419153524-e8e3143a4f4a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190531175056-4c3a928424d2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -447,6 +403,7 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201211090839-8ad439b19e0f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -460,8 +417,8 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -473,13 +430,9 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190531172133-b3315ee88b7d/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= diff --git a/producer/data_repository.go b/producer/data_repository.go index 2d53564..c2cad25 100644 --- a/producer/data_repository.go +++ b/producer/data_repository.go @@ -9,17 +9,18 @@ package producer import ( "encoding/json" "fmt" + "github.com/omec-project/util/mongoapi" "net/http" "reflect" "strconv" "strings" + "time" jsonpatch "github.com/evanphx/json-patch" "github.com/mitchellh/mapstructure" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" - "github.com/omec-project/MongoDBLibrary" protos "github.com/omec-project/config5g/proto/sdcoreConfig" "github.com/omec-project/http_wrapper" "github.com/omec-project/openapi/models" @@ -35,9 +36,43 @@ const ( ) var CurrentResourceUri string +var commonDBClient mongoapi.MongoClient + +func getMongoClient(url string, dbname string) error { + var mClient, errConnect = mongoapi.NewMongoClient(url, dbname) + if mClient.Client != nil { + commonDBClient.Client = mClient.Client + } + return errConnect +} + +func ConnectMongo(url string, dbname string) { + // Connect to MongoDB + ticker := time.NewTicker(2 * time.Second) + defer func() { ticker.Stop() }() + timer := time.After(180 * time.Second) +ConnectMongo: + for { + if err := getMongoClient(url, dbname); err == nil { + break ConnectMongo + } + select { + case <-ticker.C: + continue + case <-timer: + logger.DataRepoLog.Errorln("Timed out while connecting to MongoDB in 3 minutes.") + return + } + } + + logger.DataRepoLog.Infoln("Connected to MongoDB.") +} func getDataFromDB(collName string, filter bson.M) (map[string]interface{}, *models.ProblemDetails) { - data := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + data, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if data == nil { return nil, util.ProblemDetailsNotFound("DATA_NOT_FOUND") } @@ -48,7 +83,10 @@ func getDataFromDB(collName string, filter bson.M) (map[string]interface{}, *mod } func deleteDataFromDB(collName string, filter bson.M) { - MongoDBLibrary.RestfulAPIDeleteOne(collName, filter) + errDelOne := commonDBClient.RestfulAPIDeleteOne(collName, filter) + if errDelOne != nil { + logger.DataRepoLog.Errorln(errDelOne) + } } func HandleCreateAccessAndMobilityData(request *http_wrapper.Request) *http_wrapper.Response { @@ -87,7 +125,10 @@ func AddEntrySmPolicyTable(imsi string, dnn string, snssai *protos.NSSAI) error Sd: snssai.Sd, Sst: int32(sval), } - smPolicyData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + smPolicyData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } var smPolicyDataWrite models.SmPolicyData if smPolicyData != nil { err := json.Unmarshal(util.MapToByte(smPolicyData), &smPolicyDataWrite) @@ -118,7 +159,10 @@ func AddEntrySmPolicyTable(imsi string, dnn string, snssai *protos.NSSAI) error if addUeId { smPolicyDataBsonM["ueId"] = ueID } - MongoDBLibrary.RestfulAPIPost(collName, filter, smPolicyDataBsonM) + _, errPost := commonDBClient.RestfulAPIPost(collName, filter, smPolicyDataBsonM) + if errPost != nil { + logger.DataRepoLog.Errorln(errPost) + } return nil } @@ -148,7 +192,10 @@ func HandleQueryAmData(request *http_wrapper.Request) *http_wrapper.Response { func QueryAmDataProcedure(collName string, ueId string, servingPlmnId string) (*map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId, "servingPlmnId": servingPlmnId} - accessAndMobilitySubscriptionData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + accessAndMobilitySubscriptionData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if accessAndMobilitySubscriptionData != nil { return &accessAndMobilitySubscriptionData, nil } else { @@ -172,16 +219,22 @@ func HandleAmfContext3gpp(request *http_wrapper.Request) *http_wrapper.Response func AmfContext3gppProcedure(collName string, ueId string, patchItem []models.PatchItem) *models.ProblemDetails { filter := bson.M{"ueId": ueId} - origValue := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + origValue, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } patchJSON, err := json.Marshal(patchItem) if err != nil { logger.DataRepoLog.Error(err) } - success := MongoDBLibrary.RestfulAPIJSONPatch(collName, filter, patchJSON) + failure := commonDBClient.RestfulAPIJSONPatch(collName, filter, patchJSON) - if success { - newValue := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + if failure == nil { + newValue, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } PreHandleOnDataChangeNotify(ueId, CurrentResourceUri, patchItem, origValue, newValue) return nil } else { @@ -207,7 +260,10 @@ func CreateAmfContext3gppProcedure(collName string, ueId string, putData := util.ToBsonM(Amf3GppAccessRegistration) putData["ueId"] = ueId - MongoDBLibrary.RestfulAPIPutOne(collName, filter, putData) + _, errPutOne := commonDBClient.RestfulAPIPutOne(collName, filter, putData) + if errPutOne != nil { + logger.DataRepoLog.Errorln(errPutOne) + } } func HandleQueryAmfContext3gpp(request *http_wrapper.Request) *http_wrapper.Response { @@ -230,7 +286,10 @@ func HandleQueryAmfContext3gpp(request *http_wrapper.Request) *http_wrapper.Resp func QueryAmfContext3gppProcedure(collName string, ueId string) (*map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId} - amf3GppAccessRegistration := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + amf3GppAccessRegistration, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if amf3GppAccessRegistration != nil { return &amf3GppAccessRegistration, nil @@ -258,15 +317,21 @@ func HandleAmfContextNon3gpp(request *http_wrapper.Request) *http_wrapper.Respon func AmfContextNon3gppProcedure(ueId string, collName string, patchItem []models.PatchItem, filter bson.M) *models.ProblemDetails { - origValue := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + origValue, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } patchJSON, err := json.Marshal(patchItem) if err != nil { logger.DataRepoLog.Error(err) } - success := MongoDBLibrary.RestfulAPIJSONPatch(collName, filter, patchJSON) - if success { - newValue := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + failure := commonDBClient.RestfulAPIJSONPatch(collName, filter, patchJSON) + if failure == nil { + newValue, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } PreHandleOnDataChangeNotify(ueId, CurrentResourceUri, patchItem, origValue, newValue) return nil } else { @@ -292,7 +357,10 @@ func CreateAmfContextNon3gppProcedure(AmfNon3GppAccessRegistration models.AmfNon putData["ueId"] = ueId filter := bson.M{"ueId": ueId} - MongoDBLibrary.RestfulAPIPutOne(collName, filter, putData) + _, errPutOne := commonDBClient.RestfulAPIPutOne(collName, filter, putData) + if errPutOne != nil { + logger.DataRepoLog.Errorln(errPutOne) + } } func HandleQueryAmfContextNon3gpp(request *http_wrapper.Request) *http_wrapper.Response { @@ -315,7 +383,10 @@ func HandleQueryAmfContextNon3gpp(request *http_wrapper.Request) *http_wrapper.R func QueryAmfContextNon3gppProcedure(collName string, ueId string) (*map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId} - response := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + response, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if response != nil { return &response, nil @@ -342,16 +413,22 @@ func HandleModifyAuthentication(request *http_wrapper.Request) *http_wrapper.Res func ModifyAuthenticationProcedure(collName string, ueId string, patchItem []models.PatchItem) *models.ProblemDetails { filter := bson.M{"ueId": ueId} - origValue := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + origValue, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } patchJSON, err := json.Marshal(patchItem) if err != nil { logger.DataRepoLog.Error(err) } - success := MongoDBLibrary.RestfulAPIJSONPatch(collName, filter, patchJSON) + failure := commonDBClient.RestfulAPIJSONPatch(collName, filter, patchJSON) - if success { - newValue := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + if failure == nil { + newValue, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } PreHandleOnDataChangeNotify(ueId, CurrentResourceUri, patchItem, origValue, newValue) return nil } else { @@ -380,7 +457,10 @@ func HandleQueryAuthSubsData(request *http_wrapper.Request) *http_wrapper.Respon func QueryAuthSubsDataProcedure(collName string, ueId string) (map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId} - authenticationSubscription := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + authenticationSubscription, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if authenticationSubscription != nil { return authenticationSubscription, nil @@ -404,7 +484,10 @@ func CreateAuthenticationSoRProcedure(collName string, ueId string, putData bson filter := bson.M{"ueId": ueId} putData["ueId"] = ueId - MongoDBLibrary.RestfulAPIPutOne(collName, filter, putData) + _, errPutOne := commonDBClient.RestfulAPIPutOne(collName, filter, putData) + if errPutOne != nil { + logger.DataRepoLog.Errorln(errPutOne) + } } func HandleQueryAuthSoR(request *http_wrapper.Request) *http_wrapper.Response { @@ -428,7 +511,10 @@ func HandleQueryAuthSoR(request *http_wrapper.Request) *http_wrapper.Response { func QueryAuthSoRProcedure(collName string, ueId string) (map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId} - sorData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + sorData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if sorData != nil { return sorData, nil @@ -453,7 +539,10 @@ func CreateAuthenticationStatusProcedure(collName string, ueId string, putData b filter := bson.M{"ueId": ueId} putData["ueId"] = ueId - MongoDBLibrary.RestfulAPIPutOne(collName, filter, putData) + _, errPutOne := commonDBClient.RestfulAPIPutOne(collName, filter, putData) + if errPutOne != nil { + logger.DataRepoLog.Errorln(errPutOne) + } } func HandleQueryAuthenticationStatus(request *http_wrapper.Request) *http_wrapper.Response { @@ -478,7 +567,10 @@ func QueryAuthenticationStatusProcedure(collName string, ueId string) (*map[stri *models.ProblemDetails) { filter := bson.M{"ueId": ueId} - authEvent := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + authEvent, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if authEvent != nil { return &authEvent, nil @@ -508,7 +600,10 @@ func HandleApplicationDataInfluenceDataGet(queryParams map[string][]string) *htt func getApplicationDataInfluenceDatafromDB(influIDs, dnns, snssais, intGroupIDs, supis []string) []map[string]interface{} { filter := bson.M{} - allInfluDatas := MongoDBLibrary.RestfulAPIGetMany(APPDATA_INFLUDATA_DB_COLLECTION_NAME, filter) + allInfluDatas, errGetMany := commonDBClient.RestfulAPIGetMany(APPDATA_INFLUDATA_DB_COLLECTION_NAME, filter) + if errGetMany != nil { + logger.DataRepoLog.Errorln(errGetMany) + } var matchedInfluDatas []map[string]interface{} matchedInfluDatas = filterDataByString("influenceId", influIDs, allInfluDatas) matchedInfluDatas = filterDataByString("dnn", dnns, matchedInfluDatas) @@ -597,7 +692,10 @@ func patchApplicationDataIndividualInfluenceDataToDB(influID string, trInfluDataPatch *models.TrafficInfluDataPatch) (bson.M, int) { filter := bson.M{"influenceId": influID} - oldData := MongoDBLibrary.RestfulAPIGetOne(APPDATA_INFLUDATA_DB_COLLECTION_NAME, filter) + oldData, errGetOne := commonDBClient.RestfulAPIGetOne(APPDATA_INFLUDATA_DB_COLLECTION_NAME, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if oldData == nil { return nil, http.StatusNotFound } @@ -622,7 +720,10 @@ func patchApplicationDataIndividualInfluenceDataToDB(influID string, // Add "influenceId" entry to DB newData["influenceId"] = influID - MongoDBLibrary.RestfulAPIPutOne(APPDATA_INFLUDATA_DB_COLLECTION_NAME, filter, newData) + _, errPutOne := commonDBClient.RestfulAPIPutOne(APPDATA_INFLUDATA_DB_COLLECTION_NAME, filter, newData) + if errPutOne != nil { + logger.DataRepoLog.Errorln(errPutOne) + } // Roll back to origin data before return delete(newData, "influenceId") @@ -645,7 +746,10 @@ func putApplicationDataIndividualInfluenceDataToDB(influID string, // Add "influenceId" entry to DB data["influenceId"] = influID - isExisted := MongoDBLibrary.RestfulAPIPutOne(APPDATA_INFLUDATA_DB_COLLECTION_NAME, filter, data) + isExisted, errPutOne := commonDBClient.RestfulAPIPutOne(APPDATA_INFLUDATA_DB_COLLECTION_NAME, filter, data) + if errPutOne != nil { + logger.DataRepoLog.Errorln(errPutOne) + } // Roll back to origin data before return delete(data, "influenceId") @@ -700,7 +804,10 @@ func getApplicationDataInfluenceDataSubsToNotifyfromDB(dnn, snssai, intGroupID, if len(supi) != 0 { filter["supis"] = supi[0] } - matchedSubs := MongoDBLibrary.RestfulAPIGetMany(APPDATA_INFLUDATA_SUBSC_DB_COLLECTION_NAME, filter) + matchedSubs, errGetMany := commonDBClient.RestfulAPIGetMany(APPDATA_INFLUDATA_SUBSC_DB_COLLECTION_NAME, filter) + if errGetMany != nil { + logger.DataRepoLog.Errorln(errGetMany) + } if len(snssai) != 0 { matchedSubs = filterDataBySnssais(snssai[0], matchedSubs) } @@ -763,7 +870,10 @@ func postApplicationDataInfluenceDataSubsToNotifyToDB(subscID string, // Add "subscriptionId" entry to DB data["subscriptionId"] = subscID - MongoDBLibrary.RestfulAPIPutOne(APPDATA_INFLUDATA_SUBSC_DB_COLLECTION_NAME, filter, data) + _, errPutOne := commonDBClient.RestfulAPIPutOne(APPDATA_INFLUDATA_SUBSC_DB_COLLECTION_NAME, filter, data) + if errPutOne != nil { + logger.DataRepoLog.Errorln(errPutOne) + } // Revert back to origin data before return delete(data, "subscriptionId") return data, http.StatusCreated @@ -820,14 +930,20 @@ func putApplicationDataIndividualInfluenceDataSubsToNotifyToDB(subscID string, filter := bson.M{"subscriptionId": subscID} newData := util.ToBsonM(*trInfluSub) - oldData := MongoDBLibrary.RestfulAPIGetOne(APPDATA_INFLUDATA_SUBSC_DB_COLLECTION_NAME, filter) + oldData, errGetOne := commonDBClient.RestfulAPIGetOne(APPDATA_INFLUDATA_SUBSC_DB_COLLECTION_NAME, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if oldData == nil { return nil, http.StatusNotFound } // Add "subscriptionId" entry to DB newData["subscriptionId"] = subscID // Modify with new data - MongoDBLibrary.RestfulAPIPutOne(APPDATA_INFLUDATA_SUBSC_DB_COLLECTION_NAME, filter, newData) + _, errPutOne := commonDBClient.RestfulAPIPutOne(APPDATA_INFLUDATA_SUBSC_DB_COLLECTION_NAME, filter, newData) + if errPutOne != nil { + logger.DataRepoLog.Errorln(errPutOne) + } // Roll back to origin data before return delete(newData, "subscriptionId") return newData, http.StatusOK @@ -874,7 +990,10 @@ func putApplicationDataIndividualPfdToDB(appID string, pfdDataForApp *models.Pfd filter := bson.M{"applicationId": appID} data := util.ToBsonM(*pfdDataForApp) - isExisted := MongoDBLibrary.RestfulAPIPutOne(APPDATA_PFD_DB_COLLECTION_NAME, filter, data) + isExisted, errPutOne := commonDBClient.RestfulAPIPutOne(APPDATA_PFD_DB_COLLECTION_NAME, filter, data) + if errPutOne != nil { + logger.DataRepoLog.Errorln(errPutOne) + } if isExisted { return data, http.StatusOK @@ -896,15 +1015,22 @@ func getApplicationDataPfdsFromDB(pfdsAppIDs []string) (response []map[string]in filter := bson.M{} var matchedPfds []map[string]interface{} + var errGetMany error if len(pfdsAppIDs) == 0 { - matchedPfds = MongoDBLibrary.RestfulAPIGetMany(APPDATA_PFD_DB_COLLECTION_NAME, filter) + matchedPfds, errGetMany = commonDBClient.RestfulAPIGetMany(APPDATA_PFD_DB_COLLECTION_NAME, filter) + if errGetMany != nil { + logger.DataRepoLog.Errorln(errGetMany) + } for i := 0; i < len(matchedPfds); i++ { delete(matchedPfds[i], "_id") } } else { for _, v := range pfdsAppIDs { filter := bson.M{"applicationId": v} - data := MongoDBLibrary.RestfulAPIGetOne(APPDATA_PFD_DB_COLLECTION_NAME, filter) + data, errGetOne := commonDBClient.RestfulAPIGetOne(APPDATA_PFD_DB_COLLECTION_NAME, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if data != nil { // Delete "_id" entry which is auto-inserted by MongoDB delete(data, "_id") @@ -939,7 +1065,10 @@ func HandlePolicyDataBdtDataBdtReferenceIdDelete(request *http_wrapper.Request) func PolicyDataBdtDataBdtReferenceIdDeleteProcedure(collName string, bdtReferenceId string) { filter := bson.M{"bdtReferenceId": bdtReferenceId} - MongoDBLibrary.RestfulAPIDeleteOne(collName, filter) + errDelOne := commonDBClient.RestfulAPIDeleteOne(collName, filter) + if errDelOne != nil { + logger.DataRepoLog.Errorln(errDelOne) + } } func HandlePolicyDataBdtDataBdtReferenceIdGet(request *http_wrapper.Request) *http_wrapper.Response { @@ -963,7 +1092,10 @@ func PolicyDataBdtDataBdtReferenceIdGetProcedure(collName string, bdtReferenceId *models.ProblemDetails) { filter := bson.M{"bdtReferenceId": bdtReferenceId} - bdtData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + bdtData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if bdtData != nil { return &bdtData, nil @@ -994,7 +1126,10 @@ func PolicyDataBdtDataBdtReferenceIdPutProcedure(collName string, bdtReferenceId putData["bdtReferenceId"] = bdtReferenceId filter := bson.M{"bdtReferenceId": bdtReferenceId} - isExisted := MongoDBLibrary.RestfulAPIPutOne(collName, filter, putData) + isExisted, errPutOne := commonDBClient.RestfulAPIPutOne(collName, filter, putData) + if errPutOne != nil { + logger.DataRepoLog.Errorln(errPutOne) + } if isExisted { PreHandlePolicyDataChangeNotification("", bdtReferenceId, bdtData) @@ -1015,7 +1150,10 @@ func HandlePolicyDataBdtDataGet(request *http_wrapper.Request) *http_wrapper.Res func PolicyDataBdtDataGetProcedure(collName string) (response *[]map[string]interface{}) { filter := bson.M{} - bdtDataArray := MongoDBLibrary.RestfulAPIGetMany(collName, filter) + bdtDataArray, errGetMany := commonDBClient.RestfulAPIGetMany(collName, filter) + if errGetMany != nil { + logger.DataRepoLog.Errorln(errGetMany) + } return &bdtDataArray } @@ -1040,7 +1178,10 @@ func HandlePolicyDataPlmnsPlmnIdUePolicySetGet(request *http_wrapper.Request) *h func PolicyDataPlmnsPlmnIdUePolicySetGetProcedure(collName string, plmnId string) (*map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"plmnId": plmnId} - uePolicySet := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + uePolicySet, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if uePolicySet != nil { return &uePolicySet, nil @@ -1071,7 +1212,10 @@ func PolicyDataSponsorConnectivityDataSponsorIdGetProcedure(collName string, sponsorId string) (*map[string]interface{}, int) { filter := bson.M{"sponsorId": sponsorId} - sponsorConnectivityData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + sponsorConnectivityData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if sponsorConnectivityData != nil { return &sponsorConnectivityData, http.StatusOK @@ -1182,7 +1326,10 @@ func PolicyDataUesUeIdAmDataGetProcedure(collName string, ueId string) (*map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId} - amPolicyData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + amPolicyData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if amPolicyData != nil { return &amPolicyData, nil @@ -1213,7 +1360,10 @@ func PolicyDataUesUeIdOperatorSpecificDataGetProcedure(collName string, ueId string) (*interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId} - operatorSpecificDataContainerMapCover := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + operatorSpecificDataContainerMapCover, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if operatorSpecificDataContainerMapCover != nil { operatorSpecificDataContainerMap := operatorSpecificDataContainerMapCover["operatorSpecificDataContainerMap"] @@ -1248,10 +1398,10 @@ func PolicyDataUesUeIdOperatorSpecificDataPatchProcedure(collName string, ueId s logger.DataRepoLog.Warnln(err) } - success := MongoDBLibrary.RestfulAPIJSONPatchExtend(collName, filter, patchJSON, + failure := commonDBClient.RestfulAPIJSONPatchExtend(collName, filter, patchJSON, "operatorSpecificDataContainerMap") - if success { + if failure == nil { return nil } else { return util.ProblemDetailsModifyNotAllowed("") @@ -1279,7 +1429,10 @@ func PolicyDataUesUeIdOperatorSpecificDataPutProcedure(collName string, ueId str putData := map[string]interface{}{"operatorSpecificDataContainerMap": OperatorSpecificDataContainer} putData["ueId"] = ueId - MongoDBLibrary.RestfulAPIPutOne(collName, filter, putData) + _, errPutOne := commonDBClient.RestfulAPIPutOne(collName, filter, putData) + if errPutOne != nil { + logger.DataRepoLog.Errorln(errPutOne) + } } func HandlePolicyDataUesUeIdSmDataGet(request *http_wrapper.Request) *http_wrapper.Response { @@ -1317,7 +1470,10 @@ func PolicyDataUesUeIdSmDataGetProcedure(collName string, ueId string, snssai mo filter["smPolicySnssaiData."+util.SnssaiModelsToHex(snssai)+".smPolicyDnnData."+dnn] = bson.M{"$exists": true} } - smPolicyData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + smPolicyData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if smPolicyData != nil { var smPolicyDataResp models.SmPolicyData err := json.Unmarshal(util.MapToByte(smPolicyData), &smPolicyDataResp) @@ -1327,7 +1483,10 @@ func PolicyDataUesUeIdSmDataGetProcedure(collName string, ueId string, snssai mo { collName := "policyData.ues.smData.usageMonData" filter := bson.M{"ueId": ueId} - usageMonDataMapArray := MongoDBLibrary.RestfulAPIGetMany(collName, filter) + usageMonDataMapArray, errGetMany := commonDBClient.RestfulAPIGetMany(collName, filter) + if errGetMany != nil { + logger.DataRepoLog.Errorln(errGetMany) + } if !reflect.DeepEqual(usageMonDataMapArray, []map[string]interface{}{}) { var usageMonDataArray []models.UsageMonData @@ -1370,12 +1529,15 @@ func PolicyDataUesUeIdSmDataPatchProcedure(collName string, ueId string, for k, usageMonData := range UsageMonData { limitId := k filterTmp := bson.M{"ueId": ueId, "limitId": limitId} - success := MongoDBLibrary.RestfulAPIMergePatch(collName, filterTmp, util.ToBsonM(usageMonData)) - if !success { + failure := commonDBClient.RestfulAPIMergePatch(collName, filterTmp, util.ToBsonM(usageMonData)) + if failure != nil { successAll = false } else { var usageMonData models.UsageMonData - usageMonDataBsonM := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + usageMonDataBsonM, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } err := json.Unmarshal(util.MapToByte(usageMonDataBsonM), &usageMonData) if err != nil { logger.DataRepoLog.Warnln(err) @@ -1385,7 +1547,10 @@ func PolicyDataUesUeIdSmDataPatchProcedure(collName string, ueId string, } if successAll { - smPolicyDataBsonM := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + smPolicyDataBsonM, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } var smPolicyData models.SmPolicyData err := json.Unmarshal(util.MapToByte(smPolicyDataBsonM), &smPolicyData) if err != nil { @@ -1394,7 +1559,10 @@ func PolicyDataUesUeIdSmDataPatchProcedure(collName string, ueId string, { collName := "policyData.ues.smData.usageMonData" filter := bson.M{"ueId": ueId} - usageMonDataMapArray := MongoDBLibrary.RestfulAPIGetMany(collName, filter) + usageMonDataMapArray, errGetMany := commonDBClient.RestfulAPIGetMany(collName, filter) + if errGetMany != nil { + logger.DataRepoLog.Errorln(errGetMany) + } if !reflect.DeepEqual(usageMonDataMapArray, []map[string]interface{}{}) { var usageMonDataArray []models.UsageMonData @@ -1428,7 +1596,10 @@ func HandlePolicyDataUesUeIdSmDataUsageMonIdDelete(request *http_wrapper.Request func PolicyDataUesUeIdSmDataUsageMonIdDeleteProcedure(collName string, ueId string, usageMonId string) { filter := bson.M{"ueId": ueId, "usageMonId": usageMonId} - MongoDBLibrary.RestfulAPIDeleteOne(collName, filter) + errDelOne := commonDBClient.RestfulAPIDeleteOne(collName, filter) + if errDelOne != nil { + logger.DataRepoLog.Errorln(errDelOne) + } } func HandlePolicyDataUesUeIdSmDataUsageMonIdGet(request *http_wrapper.Request) *http_wrapper.Response { @@ -1451,7 +1622,10 @@ func PolicyDataUesUeIdSmDataUsageMonIdGetProcedure(collName string, usageMonId s ueId string) *map[string]interface{} { filter := bson.M{"ueId": ueId, "usageMonId": usageMonId} - usageMonData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + usageMonData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } return &usageMonData } @@ -1476,7 +1650,10 @@ func PolicyDataUesUeIdSmDataUsageMonIdPutProcedure(collName string, ueId string, putData["usageMonId"] = usageMonId filter := bson.M{"ueId": ueId, "usageMonId": usageMonId} - MongoDBLibrary.RestfulAPIPutOne(collName, filter, putData) + _, errPutOne := commonDBClient.RestfulAPIPutOne(collName, filter, putData) + if errPutOne != nil { + logger.DataRepoLog.Errorln(errPutOne) + } return &putData } @@ -1502,7 +1679,10 @@ func PolicyDataUesUeIdUePolicySetGetProcedure(collName string, ueId string) (*ma *models.ProblemDetails) { filter := bson.M{"ueId": ueId} - uePolicySet := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + uePolicySet, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if uePolicySet != nil { return &uePolicySet, nil @@ -1533,11 +1713,14 @@ func PolicyDataUesUeIdUePolicySetPatchProcedure(collName string, ueId string, patchData["ueId"] = ueId filter := bson.M{"ueId": ueId} - success := MongoDBLibrary.RestfulAPIMergePatch(collName, filter, patchData) + failure := commonDBClient.RestfulAPIMergePatch(collName, filter, patchData) - if success { + if failure == nil { var uePolicySet models.UePolicySet - uePolicySetBsonM := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + uePolicySetBsonM, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } err := json.Unmarshal(util.MapToByte(uePolicySetBsonM), &uePolicySet) if err != nil { logger.DataRepoLog.Warnln(err) @@ -1574,7 +1757,10 @@ func PolicyDataUesUeIdUePolicySetPutProcedure(collName string, ueId string, putData["ueId"] = ueId filter := bson.M{"ueId": ueId} - isExisted := MongoDBLibrary.RestfulAPIPutOne(collName, filter, putData) + isExisted, errPutOne := commonDBClient.RestfulAPIPutOne(collName, filter, putData) + if errPutOne != nil { + logger.DataRepoLog.Errorln(errPutOne) + } if !isExisted { return putData, http.StatusCreated } else { @@ -1779,7 +1965,10 @@ func HandleQueryEEData(request *http_wrapper.Request) *http_wrapper.Response { func QueryEEDataProcedure(collName string, ueId string) (*map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId} - eeProfileData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + eeProfileData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if eeProfileData != nil { return &eeProfileData, nil @@ -2087,17 +2276,23 @@ func HandlePatchOperSpecData(request *http_wrapper.Request) *http_wrapper.Respon func PatchOperSpecDataProcedure(collName string, ueId string, patchItem []models.PatchItem) *models.ProblemDetails { filter := bson.M{"ueId": ueId} - origValue := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + origValue, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } patchJSON, err := json.Marshal(patchItem) if err != nil { logger.DataRepoLog.Errorln(err) } - success := MongoDBLibrary.RestfulAPIJSONPatch(collName, filter, patchJSON) + failure := commonDBClient.RestfulAPIJSONPatch(collName, filter, patchJSON) - if success { - newValue := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + if failure == nil { + newValue, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } PreHandleOnDataChangeNotify(ueId, CurrentResourceUri, patchItem, origValue, newValue) return nil } else { @@ -2126,7 +2321,10 @@ func HandleQueryOperSpecData(request *http_wrapper.Request) *http_wrapper.Respon func QueryOperSpecDataProcedure(collName string, ueId string) (*map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId} - operatorSpecificDataContainer := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + operatorSpecificDataContainer, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } // The key of the map is operator specific data element name and the value is the operator specific data of the UE. @@ -2158,7 +2356,10 @@ func HandleGetppData(request *http_wrapper.Request) *http_wrapper.Response { func GetppDataProcedure(collName string, ueId string) (*map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId} - ppData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + ppData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if ppData != nil { return &ppData, nil @@ -2203,7 +2404,10 @@ func QueryProvisionedDataProcedure(ueId string, servingPlmnId string, { collName := "subscriptionData.provisionedData.amData" filter := bson.M{"ueId": ueId, "servingPlmnId": servingPlmnId} - accessAndMobilitySubscriptionData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + accessAndMobilitySubscriptionData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if accessAndMobilitySubscriptionData != nil { var tmp models.AccessAndMobilitySubscriptionData err := mapstructure.Decode(accessAndMobilitySubscriptionData, &tmp) @@ -2217,7 +2421,10 @@ func QueryProvisionedDataProcedure(ueId string, servingPlmnId string, { collName := "subscriptionData.provisionedData.smfSelectionSubscriptionData" filter := bson.M{"ueId": ueId, "servingPlmnId": servingPlmnId} - smfSelectionSubscriptionData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + smfSelectionSubscriptionData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if smfSelectionSubscriptionData != nil { var tmp models.SmfSelectionSubscriptionData err := mapstructure.Decode(smfSelectionSubscriptionData, &tmp) @@ -2231,7 +2438,10 @@ func QueryProvisionedDataProcedure(ueId string, servingPlmnId string, { collName := "subscriptionData.provisionedData.smsData" filter := bson.M{"ueId": ueId, "servingPlmnId": servingPlmnId} - smsSubscriptionData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + smsSubscriptionData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if smsSubscriptionData != nil { var tmp models.SmsSubscriptionData err := mapstructure.Decode(smsSubscriptionData, &tmp) @@ -2245,7 +2455,10 @@ func QueryProvisionedDataProcedure(ueId string, servingPlmnId string, { collName := "subscriptionData.provisionedData.smData" filter := bson.M{"ueId": ueId, "servingPlmnId": servingPlmnId} - sessionManagementSubscriptionDatas := MongoDBLibrary.RestfulAPIGetMany(collName, filter) + sessionManagementSubscriptionDatas, errGetMany := commonDBClient.RestfulAPIGetMany(collName, filter) + if errGetMany != nil { + logger.DataRepoLog.Errorln(errGetMany) + } if sessionManagementSubscriptionDatas != nil { var tmp []models.SessionManagementSubscriptionData err := mapstructure.Decode(sessionManagementSubscriptionDatas, &tmp) @@ -2259,7 +2472,10 @@ func QueryProvisionedDataProcedure(ueId string, servingPlmnId string, { collName := "subscriptionData.provisionedData.traceData" filter := bson.M{"ueId": ueId, "servingPlmnId": servingPlmnId} - traceData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + traceData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if traceData != nil { var tmp models.TraceData err := mapstructure.Decode(traceData, &tmp) @@ -2273,7 +2489,10 @@ func QueryProvisionedDataProcedure(ueId string, servingPlmnId string, { collName := "subscriptionData.provisionedData.smsMngData" filter := bson.M{"ueId": ueId, "servingPlmnId": servingPlmnId} - smsManagementSubscriptionData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + smsManagementSubscriptionData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if smsManagementSubscriptionData != nil { var tmp models.SmsManagementSubscriptionData err := mapstructure.Decode(smsManagementSubscriptionData, &tmp) @@ -2309,17 +2528,23 @@ func HandleModifyPpData(request *http_wrapper.Request) *http_wrapper.Response { func ModifyPpDataProcedure(collName string, ueId string, patchItem []models.PatchItem) *models.ProblemDetails { filter := bson.M{"ueId": ueId} - origValue := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + origValue, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } patchJSON, err := json.Marshal(patchItem) if err != nil { logger.DataRepoLog.Errorln(err) } - success := MongoDBLibrary.RestfulAPIJSONPatch(collName, filter, patchJSON) + failure := commonDBClient.RestfulAPIJSONPatch(collName, filter, patchJSON) - if success { - newValue := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + if failure == nil { + newValue, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } PreHandleOnDataChangeNotify(ueId, CurrentResourceUri, patchItem, origValue, newValue) return nil } else { @@ -2348,7 +2573,10 @@ func HandleGetIdentityData(request *http_wrapper.Request) *http_wrapper.Response func GetIdentityDataProcedure(collName string, ueId string) (*map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId} - identityData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + identityData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if identityData != nil { return &identityData, nil @@ -2378,7 +2606,10 @@ func HandleGetOdbData(request *http_wrapper.Request) *http_wrapper.Response { func GetOdbDataProcedure(collName string, ueId string) (*map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId} - operatorDeterminedBarringData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + operatorDeterminedBarringData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if operatorDeterminedBarringData != nil { return &operatorDeterminedBarringData, nil @@ -2416,7 +2647,10 @@ func GetSharedDataProcedure(collName string, sharedDataIds []string) (*[]map[str var sharedDataArray []map[string]interface{} for _, sharedDataId := range sharedDataIds { filter := bson.M{"sharedDataId": sharedDataId} - sharedData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + sharedData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if sharedData != nil { sharedDataArray = append(sharedDataArray, sharedData) } @@ -2609,7 +2843,10 @@ func QuerySmDataProcedure(collName string, ueId string, servingPlmnId string, filter["dnnConfigurations."+dnn] = bson.M{"$exists": true} } - sessionManagementSubscriptionDatas := MongoDBLibrary.RestfulAPIGetMany(collName, filter) + sessionManagementSubscriptionDatas, errGetMany := commonDBClient.RestfulAPIGetMany(collName, filter) + if errGetMany != nil { + logger.DataRepoLog.Errorln(errGetMany) + } return &sessionManagementSubscriptionDatas } @@ -2644,7 +2881,10 @@ func CreateSmfContextNon3gppProcedure(SmfRegistration models.SmfRegistration, putData["pduSessionId"] = int32(pduSessionIdInt) filter := bson.M{"ueId": ueId, "pduSessionId": pduSessionIdInt} - isExisted := MongoDBLibrary.RestfulAPIPutOne(collName, filter, putData) + isExisted, errPutOne := commonDBClient.RestfulAPIPutOne(collName, filter, putData) + if errPutOne != nil { + logger.DataRepoLog.Errorln(errPutOne) + } if !isExisted { return putData, http.StatusCreated @@ -2671,7 +2911,10 @@ func DeleteSmfContextProcedure(collName string, ueId string, pduSessionId string } filter := bson.M{"ueId": ueId, "pduSessionId": pduSessionIdInt} - MongoDBLibrary.RestfulAPIDeleteOne(collName, filter) + errDelOne := commonDBClient.RestfulAPIDeleteOne(collName, filter) + if errDelOne != nil { + logger.DataRepoLog.Errorln(errDelOne) + } } func HandleQuerySmfRegistration(request *http_wrapper.Request) *http_wrapper.Response { @@ -2701,7 +2944,10 @@ func QuerySmfRegistrationProcedure(collName string, ueId string, filter := bson.M{"ueId": ueId, "pduSessionId": pduSessionIdInt} - smfRegistration := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + smfRegistration, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if smfRegistration != nil { return &smfRegistration, nil @@ -2726,7 +2972,10 @@ func HandleQuerySmfRegList(request *http_wrapper.Request) *http_wrapper.Response func QuerySmfRegListProcedure(collName string, ueId string) *[]map[string]interface{} { filter := bson.M{"ueId": ueId} - smfRegList := MongoDBLibrary.RestfulAPIGetMany(collName, filter) + smfRegList, errGetMany := commonDBClient.RestfulAPIGetMany(collName, filter) + if errGetMany != nil { + logger.DataRepoLog.Errorln(errGetMany) + } if smfRegList != nil { return &smfRegList @@ -2754,7 +3003,10 @@ func HandleQuerySmfSelectData(request *http_wrapper.Request) *http_wrapper.Respo func QuerySmfSelectDataProcedure(collName string, ueId string, servingPlmnId string) (*map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId, "servingPlmnId": servingPlmnId} - smfSelectionSubscriptionData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + smfSelectionSubscriptionData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if smfSelectionSubscriptionData != nil { return &smfSelectionSubscriptionData, nil @@ -2780,7 +3032,10 @@ func CreateSmsfContext3gppProcedure(collName string, ueId string, SmsfRegistrati putData["ueId"] = ueId filter := bson.M{"ueId": ueId} - MongoDBLibrary.RestfulAPIPutOne(collName, filter, putData) + _, errPutOne := commonDBClient.RestfulAPIPutOne(collName, filter, putData) + if errPutOne != nil { + logger.DataRepoLog.Errorln(errPutOne) + } } func HandleDeleteSmsfContext3gpp(request *http_wrapper.Request) *http_wrapper.Response { @@ -2795,7 +3050,10 @@ func HandleDeleteSmsfContext3gpp(request *http_wrapper.Request) *http_wrapper.Re func DeleteSmsfContext3gppProcedure(collName string, ueId string) { filter := bson.M{"ueId": ueId} - MongoDBLibrary.RestfulAPIDeleteOne(collName, filter) + errDelOne := commonDBClient.RestfulAPIDeleteOne(collName, filter) + if errDelOne != nil { + logger.DataRepoLog.Errorln(errDelOne) + } } func HandleQuerySmsfContext3gpp(request *http_wrapper.Request) *http_wrapper.Response { @@ -2818,7 +3076,10 @@ func HandleQuerySmsfContext3gpp(request *http_wrapper.Request) *http_wrapper.Res func QuerySmsfContext3gppProcedure(collName string, ueId string) (*map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId} - smsfRegistration := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + smsfRegistration, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if smsfRegistration != nil { return &smsfRegistration, nil @@ -2844,7 +3105,10 @@ func CreateSmsfContextNon3gppProcedure(SmsfRegistration models.SmsfRegistration, putData["ueId"] = ueId filter := bson.M{"ueId": ueId} - MongoDBLibrary.RestfulAPIPutOne(collName, filter, putData) + _, errPutOne := commonDBClient.RestfulAPIPutOne(collName, filter, putData) + if errPutOne != nil { + logger.DataRepoLog.Errorln(errPutOne) + } } func HandleDeleteSmsfContextNon3gpp(request *http_wrapper.Request) *http_wrapper.Response { @@ -2859,7 +3123,10 @@ func HandleDeleteSmsfContextNon3gpp(request *http_wrapper.Request) *http_wrapper func DeleteSmsfContextNon3gppProcedure(collName string, ueId string) { filter := bson.M{"ueId": ueId} - MongoDBLibrary.RestfulAPIDeleteOne(collName, filter) + errDelOne := commonDBClient.RestfulAPIDeleteOne(collName, filter) + if errDelOne != nil { + logger.DataRepoLog.Errorln(errDelOne) + } } func HandleQuerySmsfContextNon3gpp(request *http_wrapper.Request) *http_wrapper.Response { @@ -2882,7 +3149,10 @@ func HandleQuerySmsfContextNon3gpp(request *http_wrapper.Request) *http_wrapper. func QuerySmsfContextNon3gppProcedure(collName string, ueId string) (*map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId} - smsfRegistration := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + smsfRegistration, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if smsfRegistration != nil { return &smsfRegistration, nil @@ -2912,7 +3182,10 @@ func HandleQuerySmsMngData(request *http_wrapper.Request) *http_wrapper.Response func QuerySmsMngDataProcedure(collName string, ueId string, servingPlmnId string) (*map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId, "servingPlmnId": servingPlmnId} - smsManagementSubscriptionData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + smsManagementSubscriptionData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if smsManagementSubscriptionData != nil { return &smsManagementSubscriptionData, nil @@ -2944,7 +3217,10 @@ func QuerySmsDataProcedure(collName string, ueId string, servingPlmnId string) (*map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId, "servingPlmnId": servingPlmnId} - smsSubscriptionData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + smsSubscriptionData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if smsSubscriptionData != nil { return &smsSubscriptionData, nil @@ -3028,7 +3304,10 @@ func QueryTraceDataProcedure(collName string, ueId string, servingPlmnId string) (*map[string]interface{}, *models.ProblemDetails) { filter := bson.M{"ueId": ueId, "servingPlmnId": servingPlmnId} - traceData := MongoDBLibrary.RestfulAPIGetOne(collName, filter) + traceData, errGetOne := commonDBClient.RestfulAPIGetOne(collName, filter) + if errGetOne != nil { + logger.DataRepoLog.Errorln(errGetOne) + } if traceData != nil { return &traceData, nil diff --git a/service/init.go b/service/init.go index fb3d3dd..d0cda4c 100644 --- a/service/init.go +++ b/service/init.go @@ -21,8 +21,6 @@ import ( "github.com/sirupsen/logrus" "github.com/urfave/cli" - "github.com/omec-project/MongoDBLibrary" - mongoDBLibLogger "github.com/omec-project/MongoDBLibrary/logger" "github.com/omec-project/http2_util" "github.com/omec-project/logger_util" "github.com/omec-project/path_util" @@ -35,6 +33,7 @@ import ( "github.com/omec-project/udr/logger" "github.com/omec-project/udr/producer" "github.com/omec-project/udr/util" + mongoDBLibLogger "github.com/omec-project/util/logger" ) type UDR struct{} @@ -141,14 +140,14 @@ func (udr *UDR) setLogLevel() { if factory.UdrConfig.Logger.MongoDBLibrary != nil { if factory.UdrConfig.Logger.MongoDBLibrary.DebugLevel != "" { if level, err := logrus.ParseLevel(factory.UdrConfig.Logger.MongoDBLibrary.DebugLevel); err != nil { - mongoDBLibLogger.MongoDBLog.Warnf("MongoDBLibrary Log level [%s] is invalid, set to [info] level", + mongoDBLibLogger.AppLog.Warnf("MongoDBLibrary Log level [%s] is invalid, set to [info] level", factory.UdrConfig.Logger.MongoDBLibrary.DebugLevel) mongoDBLibLogger.SetLogLevel(logrus.InfoLevel) } else { mongoDBLibLogger.SetLogLevel(level) } } else { - mongoDBLibLogger.MongoDBLog.Warnln("MongoDBLibrary Log level not set. Default set to [info] level") + mongoDBLibLogger.AppLog.Warnln("MongoDBLibrary Log level not set. Default set to [info] level") mongoDBLibLogger.SetLogLevel(logrus.InfoLevel) } mongoDBLibLogger.SetReportCaller(factory.UdrConfig.Logger.MongoDBLibrary.ReportCaller) @@ -172,12 +171,10 @@ func (udr *UDR) Start() { // get config file info config := factory.UdrConfig mongodb := config.Configuration.Mongodb - initLog.Infof("UDR Config Info: Version[%s] Description[%s]", config.Info.Version, config.Info.Description) // Connect to MongoDB - MongoDBLibrary.SetMongoDB(mongodb.Name, mongodb.Url) - + producer.ConnectMongo(mongodb.Url, mongodb.Name) initLog.Infoln("Server started") router := logger_util.NewGinWithLogrus(logger.GinLog)