Skip to content

Commit

Permalink
Merge pull request #32 from HanHongChen/feat/r17
Browse files Browse the repository at this point in the history
Feat/r17
  • Loading branch information
ianchen0119 authored Dec 25, 2024
2 parents a904a1b + 3cbc618 commit 72740fd
Show file tree
Hide file tree
Showing 25 changed files with 1,002 additions and 730 deletions.
15 changes: 11 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ module github.com/free5gc/pcf
go 1.21

require (
github.com/antihax/optional v1.0.0
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/cydev/zero v0.0.0-20160322155811-4a4535dd56e7
github.com/free5gc/openapi v1.0.8
github.com/free5gc/openapi v1.0.9-0.20241112160830-092c679ef6cd
github.com/free5gc/util v1.0.6
github.com/gin-contrib/cors v1.6.0
github.com/gin-gonic/gin v1.9.1
Expand All @@ -26,16 +25,20 @@ require (
github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
github.com/evanphx/json-patch v0.5.2 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
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.19.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-jwt/jwt/v5 v5.2.1 // indirect
github.com/golang/protobuf v1.5.0 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/h2non/gock v1.2.0 // 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
Expand All @@ -55,6 +58,11 @@ require (
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
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.49.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
golang.org/x/arch v0.7.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/net v0.23.0 // indirect
Expand All @@ -64,6 +72,5 @@ require (
golang.org/x/text v0.14.0 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/h2non/gock.v1 v1.1.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
35 changes: 25 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
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=
Expand Down Expand Up @@ -67,8 +65,10 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/evanphx/json-patch v0.5.2 h1:xVCHIVMUu1wtM/VkR9jVZ45N3FhZfYMMYGorLCR8P3k=
github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ=
github.com/free5gc/openapi v1.0.8 h1:QjfQdB6VVA1GRnzOJ7nILzrI7gMiY0lH64JHVW7vF34=
github.com/free5gc/openapi v1.0.8/go.mod h1:w6y9P/uySczc1d9OJZAEuB2FImR/z60Wg2BekPAVt3M=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/free5gc/openapi v1.0.9-0.20241112160830-092c679ef6cd h1:VRxE3QzfL1uU8ZnR9Y1aXtslHPeMIVoHb3wU0yOz2AI=
github.com/free5gc/openapi v1.0.9-0.20241112160830-092c679ef6cd/go.mod h1:aKw6uGzEibGDrn9++w4/JpWxaaUBo7GaqsvuFKU9fl4=
github.com/free5gc/util v1.0.6 h1:dBt9drcXtYKE/cY5XuQcuffgsYclPIpIArhSeS6M+DQ=
github.com/free5gc/util v1.0.6/go.mod h1:eSGN7POUM8LNTvg/E591XR6447a6/w1jFWGKNZPHcXw=
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
Expand All @@ -82,6 +82,11 @@ github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SU
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
Expand All @@ -94,8 +99,8 @@ 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/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=
github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
Expand Down Expand Up @@ -134,8 +139,9 @@ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
Expand All @@ -151,6 +157,8 @@ github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/h2non/gock v1.2.0 h1:K6ol8rfrRkUOefooBC8elXoaNGYkpp7y2qcxGG6BzUE=
github.com/h2non/gock v1.2.0/go.mod h1:tNhoxHYW2W42cYkYb1WqzdbYIieALC99kpYr7rH/BQk=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
Expand Down Expand Up @@ -246,6 +254,16 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.49.0 h1:RtcvQ4iw3w9NBB5yRwgA4sSa82rfId7n4atVpvKx3bY=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.49.0/go.mod h1:f/PbKbRd4cdUICWell6DmzvVJ7QrmBgFrRHjXmAXbK4=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw=
go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo=
go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo=
go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI=
go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco=
go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI=
go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU=
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/arch v0.7.0 h1:pskyeJh/3AmoQ8CPE95vxHLqp1G1GfGNXTmcl9NEKTc=
golang.org/x/arch v0.7.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
Expand Down Expand Up @@ -419,7 +437,6 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
Expand Down Expand Up @@ -503,8 +520,6 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY=
gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
Expand Down
20 changes: 10 additions & 10 deletions internal/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type PCFContext struct {
SBIPort int
TimeFormat string
DefaultBdtRefId string
NfService map[models.ServiceName]models.NfService
NfService map[models.ServiceName]models.NrfNfManagementNfService
PcfServiceUris map[models.ServiceName]string
PcfSuppFeats map[models.ServiceName]openapi.SupportedFeature
NrfUri string
Expand Down Expand Up @@ -68,7 +68,7 @@ type AppSessionData struct {
RelatedPccRuleIds map[string]string
PccRuleIdMapToCompId map[string]string
// EventSubscription
Events map[models.AfEvent]models.AfNotifMethod
Events map[models.PcfPolicyAuthorizationAfEvent]models.AfNotifMethod
EventUri string
// related Session
SmPolicyData *UeSmPolicyData
Expand Down Expand Up @@ -138,7 +138,7 @@ func InitPcfContext(context *PCFContext) {
for _, service := range context.NfService {
var err error
context.PcfServiceUris[service.ServiceName] = service.ApiPrefix +
"/" + string(service.ServiceName) + "/" + (*service.Versions)[0].ApiVersionInUri
"/" + string(service.ServiceName) + "/" + (service.Versions)[0].ApiVersionInUri
context.PcfSuppFeats[service.ServiceName], err = openapi.NewSupportedFeature(service.SupportedFeatures)
if err != nil {
logger.UtilLog.Errorf("openapi NewSupportedFeature error: %+v", err)
Expand All @@ -152,7 +152,7 @@ func Init() {
pcfContext.UriScheme = models.UriScheme_HTTPS
pcfContext.TimeFormat = "2006-01-02 15:04:05"
pcfContext.DefaultBdtRefId = "BdtPolicyId-"
pcfContext.NfService = make(map[models.ServiceName]models.NfService)
pcfContext.NfService = make(map[models.ServiceName]models.NrfNfManagementNfService)
pcfContext.PcfServiceUris = make(map[models.ServiceName]string)
pcfContext.PcfSuppFeats = make(map[models.ServiceName]openapi.SupportedFeature)
pcfContext.BdtPolicyIDGenerator = idgenerator.NewGenerator(1, math.MaxInt64)
Expand Down Expand Up @@ -197,10 +197,10 @@ func (c *PCFContext) InitNFService(serviceList []factory.Service, version string
versionUri := "v" + tmpVersion[0]
for index, service := range serviceList {
name := models.ServiceName(service.ServiceName)
c.NfService[name] = models.NfService{
c.NfService[name] = models.NrfNfManagementNfService{
ServiceInstanceId: strconv.Itoa(index),
ServiceName: name,
Versions: &[]models.NfServiceVersion{
Versions: []models.NfServiceVersion{
{
ApiFullVersion: version,
ApiVersionInUri: versionUri,
Expand All @@ -209,10 +209,10 @@ func (c *PCFContext) InitNFService(serviceList []factory.Service, version string
Scheme: c.UriScheme,
NfServiceStatus: models.NfServiceStatus_REGISTERED,
ApiPrefix: c.GetIPv4Uri(),
IpEndPoints: &[]models.IpEndPoint{
IpEndPoints: []models.IpEndPoint{
{
Ipv4Address: c.RegisterIPv4,
Transport: models.TransportProtocol_TCP,
Transport: models.NrfNfManagementTransportProtocol_TCP,
Port: int32(c.SBIPort),
},
},
Expand Down Expand Up @@ -443,13 +443,13 @@ func (c *PCFContext) NewAmfStatusSubscription(subscriptionID string, subscriptio
c.AMFStatusSubsData.Store(subscriptionID, subscriptionData)
}

func (c *PCFContext) GetTokenCtx(serviceName models.ServiceName, targetNF models.NfType) (
func (c *PCFContext) GetTokenCtx(serviceName models.ServiceName, targetNF models.NrfNfManagementNfType) (
context.Context, *models.ProblemDetails, error,
) {
if !c.OAuth2Required {
return context.TODO(), nil, nil
}
return oauth.GetTokenCtx(models.NfType_PCF, targetNF,
return oauth.GetTokenCtx(models.NrfNfManagementNfType_PCF, targetNF,
c.NfId, c.NrfUri, string(serviceName))
}

Expand Down
29 changes: 16 additions & 13 deletions internal/context/ue.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ type UeAMPolicyData struct {
PolAssoId string
AccessType models.AccessType
NotificationUri string
ServingPlmn *models.NetworkId
ServingPlmn *models.PlmnIdNid
AltNotifIpv4Addrs []string
AltNotifIpv6Addrs []string
// TODO: AMF Status Change
AmfStatusUri string
Guami *models.Guami
ServiveName string
ServiceName models.ServiceName
// TraceReq *TraceData
// Policy Association
Triggers []models.RequestTrigger
Triggers []models.PcfAmPolicyControlRequestTrigger
ServAreaRes *models.ServiceAreaRestriction
Rfsp int32
UserLoc *models.UserLocation
Expand Down Expand Up @@ -103,7 +103,10 @@ type UeSmPolicyData struct {
}

// NewUeAMPolicyData returns created UeAMPolicyData data and insert this data to Ue.AMPolicyData with assolId as key
func (ue *UeContext) NewUeAMPolicyData(assolId string, req models.PolicyAssociationRequest) *UeAMPolicyData {
func (ue *UeContext) NewUeAMPolicyData(
assolId string,
req models.PcfAmPolicyControlPolicyAssociationRequest,
) *UeAMPolicyData {
ue.Gpsi = req.Gpsi
ue.Pei = req.Pei
ue.GroupIds = req.GroupIds
Expand All @@ -119,7 +122,7 @@ func (ue *UeContext) NewUeAMPolicyData(assolId string, req models.PolicyAssociat
Rfsp: req.Rfsp,
Guami: req.Guami,
UserLoc: req.UserLoc,
ServiveName: req.ServiveName,
ServiceName: req.ServiceName,
PcfUe: ue,
}
ue.AMPolicyData[assolId].Pras = make(map[string]models.PresenceInfo)
Expand Down Expand Up @@ -264,7 +267,7 @@ func (policy *UeSmPolicyData) RemovePccRule(pccRuleId string, deletedSmPolicyDec
}

// Check if the afEvent exists in smPolicy
func (policy *UeSmPolicyData) CheckRelatedAfEvent(event models.AfEvent) (found bool) {
func (policy *UeSmPolicyData) CheckRelatedAfEvent(event models.PcfPolicyAuthorizationAfEvent) (found bool) {
for appSessionId := range policy.AppSessions {
if val, ok := GetSelf().AppSessionPool.Load(appSessionId); ok {
appSession := val.(*AppSessionData)
Expand All @@ -282,20 +285,20 @@ func (policy *UeSmPolicyData) CheckRelatedAfEvent(event models.AfEvent) (found b
func (policy *UeSmPolicyData) ArrangeExistEventSubscription() (changed bool) {
triggers := []models.PolicyControlRequestTrigger{}
for _, trigger := range policy.PolicyDecision.PolicyCtrlReqTriggers {
var afEvent models.AfEvent
var afEvent models.PcfPolicyAuthorizationAfEvent
switch trigger {
case models.PolicyControlRequestTrigger_PLMN_CH: // PLMN Change
afEvent = models.AfEvent_PLMN_CHG
afEvent = models.PcfPolicyAuthorizationAfEvent_PLMN_CHG
case models.PolicyControlRequestTrigger_QOS_NOTIF:
// SMF notify PCF when receiving from RAN that QoS can/can't be guaranteed (subsclause 4.2.4.20 in TS29512) (always)
afEvent = models.AfEvent_QOS_NOTIF
afEvent = models.PcfPolicyAuthorizationAfEvent_QOS_NOTIF
case models.PolicyControlRequestTrigger_SUCC_RES_ALLO:
// Successful resource allocation (subsclause 4.2.6.5.5, 4.2.4.14 in TS29512)
afEvent = models.AfEvent_SUCCESSFUL_RESOURCES_ALLOCATION
afEvent = models.PcfPolicyAuthorizationAfEvent_SUCCESSFUL_RESOURCES_ALLOCATION
case models.PolicyControlRequestTrigger_AC_TY_CH: // Change of RatType
afEvent = models.AfEvent_ACCESS_TYPE_CHANGE
afEvent = models.PcfPolicyAuthorizationAfEvent_ACCESS_TYPE_CHANGE
case models.PolicyControlRequestTrigger_US_RE: // UMC
afEvent = models.AfEvent_USAGE_REPORT
afEvent = models.PcfPolicyAuthorizationAfEvent_USAGE_REPORT
}
if afEvent != "" && !policy.CheckRelatedAfEvent(afEvent) {
changed = true
Expand Down Expand Up @@ -384,7 +387,7 @@ func DecreaseRamainBitRateToZero(remainBitRate *float64) string {
}

// returns AM Policy which AccessType and plmnId match
func (ue *UeContext) FindAMPolicy(anType models.AccessType, plmnId *models.NetworkId) *UeAMPolicyData {
func (ue *UeContext) FindAMPolicy(anType models.AccessType, plmnId *models.PlmnIdNid) *UeAMPolicyData {
if ue == nil || plmnId == nil {
return nil
}
Expand Down
Loading

0 comments on commit 72740fd

Please sign in to comment.