From 3b99c5cca6b7beb1b9b2cd8dc520bc2d56f387b4 Mon Sep 17 00:00:00 2001 From: gab-arrobo Date: Fri, 3 May 2024 11:06:50 -0700 Subject: [PATCH] Fix issues highglighted by HigHub Actions (#8) --- .github/workflows/main.yml | 2 +- .golangci.yml | 329 ++++++++++++++++++ AMF/TestAmf/conn.go | 1 + AMF/TestAmf/gen_nas_security_data.go | 4 +- AMF/TestAmf/smfProfile.go | 4 +- AMF/TestComm/N1N2MessageTransfer.go | 2 +- AMF/TestComm/UEContext.go | 2 - AUSF/TestUEAuth/UEAuthentication.go | 6 +- PCF/TestAMPolicy/AMPolicy.go | 17 +- PCF/TestBDTPolicy/BDTPolicyCreate.go | 3 +- .../PolicyAuthorizationCreate.go | 5 +- PCF/TestSMPolicy/SMPolicyTestData.go | 1 + SMF/TestPDUSession/SMContextCreate.go | 11 +- UDM/TestGenAuthData/GenerateAuthData.go | 6 +- .../RegistrationProcedure.go | 18 +- go.mod | 39 ++- go.sum | 118 ++++--- logger/logger.go | 23 +- 18 files changed, 472 insertions(+), 119 deletions(-) create mode 100644 .golangci.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8d10169..bdf81c5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,7 @@ jobs: go-version-file: 'go.mod' - name: Build - run: go build + run: go build ./... lint: runs-on: ubuntu-latest diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..2daab4d --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,329 @@ +# Copyright 2019 Communication Service/Software Laboratory, National Chiao Tung University (free5gc.org) +# +# SPDX-License-Identifier: Apache-2.0 + +# This file contains all available configuration options +# with their default values. +# options for analysis running +run: + # default concurrency is a available CPU number + concurrency: 4 + # timeout for analysis, e.g. 30s, 5m, default is 1m + timeout: 1m + # exit code when at least one issue was found, default is 1 + issues-exit-code: 1 + # include test files or not, default is true + tests: true + # list of build tags, all linters use it. Default is empty list. + build-tags: + # which dirs to skip: issues from them won't be reported; + # can use regexp here: generated.*, regexp is applied on full path; + # default value is empty list, but default dirs are skipped independently + # from this option's value (see skip-dirs-use-default). + # "/" will be replaced by current OS file path separator to properly work + # on Windows. + skip-dirs: + # default is true. Enables skipping of directories: + # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ + skip-dirs-use-default: true + # which files to skip: they will be analyzed, but issues from them + # won't be reported. Default value is empty list, but there is + # no need to include all autogenerated files, we confidently recognize + # autogenerated files. If it's not please let us know. + # "/" will be replaced by current OS file path separator to properly work + # on Windows. + skip-files: + - "api_.*\\.go$" + - "model_.*\\.go$" + - "routers.go" + - "client.go" + - "configuration.go" + - "nas.go" + # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules": + # If invoked with -mod=readonly, the go command is disallowed from the implicit + # automatic updating of go.mod described above. Instead, it fails when any changes + # to go.mod are needed. This setting is most useful to check that go.mod does + # not need updates, such as in a continuous integration and testing system. + # If invoked with -mod=vendor, the go command assumes that the vendor + # directory holds the correct copies of dependencies and ignores + # the dependency descriptions in go.mod. + #modules-download-mode: readonly|release|vendor + # Allow multiple parallel golangci-lint instances running. + # If false (default) - golangci-lint acquires file lock on start. + allow-parallel-runners: true +# output configuration options +output: + # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" + format: colored-line-number + # print lines of code with issue, default is true + print-issued-lines: true + # print linter name in the end of issue text, default is true + print-linter-name: true + # make issues output unique by line, default is true + uniq-by-line: true +# all available settings of specific linters +linters-settings: + errcheck: + # report about not checking of errors in type assertions: `a := b.(MyStruct)`; + # default is false: such cases aren't reported by default. + check-type-assertions: false + # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; + # default is false: such cases aren't reported by default. + check-blank: true + # [deprecated] comma-separated list of pairs of the form pkg:regex + # the regex is used to ignore names within pkg. (default "fmt:.*"). + # see https://github.com/kisielk/errcheck#the-deprecated-method for details + #ignore: fmt:.*,io/ioutil:^Read.* + # path to a file containing a list of functions to exclude from checking + # see https://github.com/kisielk/errcheck#excluding-functions for details + #exclude: /path/to/file.txt + funlen: + lines: 60 + statements: 40 + gocognit: + # minimal code complexity to report, 30 by default (but we recommend 10-20) + min-complexity: 10 + nestif: + # minimal complexity of if statements to report, 5 by default + min-complexity: 4 + goconst: + # minimal length of string constant, 3 by default + min-len: 3 + # minimal occurrences count to trigger, 3 by default + min-occurrences: 3 + gocritic: + # Which checks should be enabled; can't be combined with 'disabled-checks'; + # See https://go-critic.github.io/overview#checks-overview + # To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run` + # By default list of stable checks is used. + enabled-checks: + #- rangeValCopy + # Which checks should be disabled; can't be combined with 'enabled-checks'; default is empty + disabled-checks: + - regexpMust + # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint run` to see all tags and checks. + # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". + enabled-tags: + - performance + disabled-tags: + - experimental + settings: # settings passed to gocritic + captLocal: # must be valid enabled check name + paramsOnly: true + rangeValCopy: + sizeThreshold: 32 + gocyclo: + # minimal code complexity to report, 30 by default (but we recommend 10-20) + min-complexity: 10 + godox: + # report any comments starting with keywords, this is useful for TODO or FIXME comments that + # might be left in the code accidentally and should be resolved before merging + keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting + #- TODO + - FIXME + - BUG + #- NOTE + #- OPTIMIZE # marks code that should be optimized before merging + #- HACK # marks hack-arounds that should be removed before merging + - XXX # Fatal! Important problem + gofmt: + # simplify code: gofmt with `-s` option, true by default + simplify: true + goimports: + # put imports beginning with prefix after 3rd-party packages; + # it's a comma-separated list of prefixes + local-prefixes: github.com/org/project + golint: + # minimal confidence for issues, default is 0.8 + min-confidence: 0.8 + gomnd: + settings: + mnd: + # the list of enabled checks, see https://github.com/tommy-muehle/go-mnd/#checks for description. + checks: argument,case,condition,operation,return,assign + gomodguard: + allowed: + modules: # List of allowed modules + # - gopkg.in/yaml.v2 + domains: # List of allowed module domains + # - golang.org + blocked: + modules: # List of blocked modules + # - github.com/uudashr/go-module: # Blocked module + # recommendations: # Recommended modules that should be used instead (Optional) + # - golang.org/x/mod + # reason: "`mod` is the official go.mod parser library." # Reason why the recommended module should be used (Optional) + versions: # List of blocked module version constraints + # - github.com/mitchellh/go-homedir: # Blocked module with version constraint + # version: "< 1.1.0" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons + # reason: "testing if blocked version constraint works." # Reason why the version constraint exists. (Optional) + govet: + # report about shadowed variables + check-shadowing: true + # settings per analyzer + settings: + printf: # analyzer name, run `go tool vet help` to see all analyzers + funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf + # enable or disable analyzers by name + enable: + - atomicalign + enable-all: false + disable: + - shadow + disable-all: false + depguard: + list-type: blacklist + include-go-root: false + packages: + - github.com/sirupsen/logrus + packages-with-error-message: + # specify an error message to output when a blacklisted package is used + - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log" + lll: + # max line length, lines longer will be reported. Default is 120. + # '\t' is counted as 1 character by default, and can be changed with the tab-width option + line-length: 120 + # tab width in spaces. Default to 1. + tab-width: 1 + maligned: + # print struct with more effective memory layout or not, false by default + suggest-new: true + nakedret: + # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 + max-func-lines: 30 + testpackage: + # regexp pattern to skip files + skip-regexp: (export|internal)_test\.go + unused: + # treat code as a program (not a library) and report unused exported identifiers; default is false. + # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: + # if it's called for subdir of a project it can't find funcs usages. All text editor integrations + # with golangci-lint call it on a directory with the changed file. + check-exported: false + whitespace: + multi-if: false # Enforces newlines (or comments) after every multi-line if statement + multi-func: false # Enforces newlines (or comments) after every multi-line function signature + gci: + local-prefixes: "github.com/free5gc" + misspell: + #locale: US + ignore-words: + wsl: + # If true append is only allowed to be cuddled if appending value is + # matching variables, fields or types on line above. Default is true. + strict-append: true + # Allow calls and assignments to be cuddled as long as the lines have any + # matching variables, fields or types. Default is true. + allow-assign-and-call: true + # Allow multiline assignments to be cuddled. Default is true. + allow-multiline-assign: true + # Allow declarations (var) to be cuddled. + allow-cuddle-declarations: false + # Allow trailing comments in ending of blocks + allow-trailing-comment: true + # Force newlines in end of case at this limit (0 = never). + force-case-trailing-whitespace: 0 + # Force cuddling of err checks with err var assignment + force-err-cuddling: false + # Allow leading comments to be separated with empty liens + allow-separated-leading-comment: false + custom: + # Each custom linter should have a unique name. + +linters: + enable: + - gofmt + - govet + # - errcheck + - staticcheck + - unused + - gosimple + - ineffassign + - typecheck + # Additional + # - lll + - godox + #- gomnd + #- goconst + # - gocognit + # - maligned + # - nestif + # - gomodguard + # - nakedret + - gci + - misspell + - gofumpt + - whitespace + - unconvert + - predeclared + - noctx + - dogsled + - bodyclose + - asciicheck + #- stylecheck + # - unparam + # - wsl + + #disable-all: false + fast: true +issues: + # List of regexps of issue texts to exclude, empty list by default. + # But independently from this option we use default exclude patterns, + # it can be disabled by `exclude-use-default: false`. To list all + # excluded by default patterns execute `golangci-lint run --help` + exclude: + # Excluding configuration per-path, per-linter, per-text and per-source + exclude-rules: + # Exclude some linters from running on tests files. + # Independently from option `exclude` we use default exclude patterns, + # it can be disabled by this option. To list all + # excluded by default patterns execute `golangci-lint run --help`. + # Default value for this option is true. + exclude-use-default: false + # The default value is false. If set to true exclude and exclude-rules + # regular expressions become case sensitive. + exclude-case-sensitive: false + # The list of ids of default excludes to include or disable. By default it's empty. + include: + #- EXC0002 # disable excluding of issues about comments from golint + # Maximum issues count per one linter. Set to 0 to disable. Default is 50. + #max-issues-per-linter: 0 + # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. + #max-same-issues: 0 + # Show only new issues: if there are unstaged changes or untracked files, + # only those changes are analyzed, else only changes in HEAD~ are analyzed. + # It's a super-useful option for integration of golangci-lint into existing + # large codebase. It's not practical to fix all existing issues at the moment + # of integration: much better don't allow issues in new code. + # Default is false. + new: false + # Show only new issues created after git revision `REV` + new-from-rev: "" + # Show only new issues created in git patch with set file path. + #new-from-patch: path/to/patch/file +severity: + # Default value is empty string. + # Set the default severity for issues. If severity rules are defined and the issues + # do not match or no severity is provided to the rule this will be the default + # severity applied. Severities should match the supported severity names of the + # selected out format. + # - Code climate: https://docs.codeclimate.com/docs/issues#issue-severity + # - Checkstyle: https://checkstyle.sourceforge.io/property_types.html#severity + # - Github: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-error-message + default-severity: error + # The default value is false. + # If set to true severity-rules regular expressions become case sensitive. + case-sensitive: false + # Default value is empty list. + # When a list of severity rules are provided, severity information will be added to lint + # issues. Severity rules have the same filtering capability as exclude rules except you + # are allowed to specify one matcher per severity rule. + # Only affects out formats that support setting severity information. + rules: + - linters: + - gomnd + severity: ignore diff --git a/AMF/TestAmf/conn.go b/AMF/TestAmf/conn.go index af9235f..8650de9 100644 --- a/AMF/TestAmf/conn.go +++ b/AMF/TestAmf/conn.go @@ -18,6 +18,7 @@ type TestAddr struct { func (addr *TestAddr) Network() string { return addr.Net } + func (addr *TestAddr) String() string { return addr.Value } diff --git a/AMF/TestAmf/gen_nas_security_data.go b/AMF/TestAmf/gen_nas_security_data.go index 822edbf..a4c9a90 100644 --- a/AMF/TestAmf/gen_nas_security_data.go +++ b/AMF/TestAmf/gen_nas_security_data.go @@ -41,11 +41,10 @@ const ( var TestNIA2Table = make(map[string]*NIA2TestSet) -//https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/AES_CMAC.pdf +// https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/AES_CMAC.pdf var TestCMACAES128Table = make(map[string]*CMACAES128) func init() { - TestNIA2Table[NIA2Test1] = &NIA2TestSet{ // TS 33.401 test set 1 CountI: "38a6f056", @@ -163,5 +162,4 @@ func init() { PlainText: "007e005d02010280", Expected: "95c3ae0d", } - } diff --git a/AMF/TestAmf/smfProfile.go b/AMF/TestAmf/smfProfile.go index 9065de1..6450790 100644 --- a/AMF/TestAmf/smfProfile.go +++ b/AMF/TestAmf/smfProfile.go @@ -5,8 +5,8 @@ package TestAmf import ( - "github.com/omec-project/openapi/models" "github.com/google/uuid" + "github.com/omec-project/openapi/models" ) func BuildSmfNfProfile() (uuId string, profile models.NfProfile) { @@ -29,7 +29,6 @@ func BuildSmfNfProfile() (uuId string, profile models.NfProfile) { }, NfServices: &[]models.NfService{ { - ServiceInstanceId: "1", ServiceName: models.ServiceName_NSMF_PDUSESSION, Scheme: models.UriScheme_HTTPS, @@ -66,5 +65,4 @@ func BuildSmfNfProfile() (uuId string, profile models.NfProfile) { }, } return - } diff --git a/AMF/TestComm/N1N2MessageTransfer.go b/AMF/TestComm/N1N2MessageTransfer.go index cf1d388..bd425b9 100644 --- a/AMF/TestComm/N1N2MessageTransfer.go +++ b/AMF/TestComm/N1N2MessageTransfer.go @@ -124,7 +124,6 @@ func init() { // var data ngapType.PDUSessionResourceReleaseCommandTransfer // aper.UnmarshalWithParams(*transfer, &data, "valueExt") // spew.Dump(data) - } func buildPDUSessionResourceReleaseCommandTransfer() (data ngapType.PDUSessionResourceReleaseCommandTransfer) { @@ -135,6 +134,7 @@ func buildPDUSessionResourceReleaseCommandTransfer() (data ngapType.PDUSessionRe misc.Value = ngapType.CauseMiscPresentHardwareFailure return } + func GetPDUSessionResourceReleaseCommandTransfer() []byte { encodeData, _ := aper.MarshalWithParams(N2InfoTable[models.NgapIeType_PDU_RES_REL_CMD], "valueExt") return encodeData diff --git a/AMF/TestComm/UEContext.go b/AMF/TestComm/UEContext.go index 3a52422..5ea825b 100644 --- a/AMF/TestComm/UEContext.go +++ b/AMF/TestComm/UEContext.go @@ -113,7 +113,6 @@ func init() { Value: 0, }, } - } var ConsumerAMFUEContextTransferRequestTable = make(map[string]models.UeContextTransferRequest) @@ -176,5 +175,4 @@ func init() { ToReleaseSessionList: nil, PcfReselectedInd: false, } - } diff --git a/AUSF/TestUEAuth/UEAuthentication.go b/AUSF/TestUEAuth/UEAuthentication.go index 16d2eed..adf48e4 100644 --- a/AUSF/TestUEAuth/UEAuthentication.go +++ b/AUSF/TestUEAuth/UEAuthentication.go @@ -41,8 +41,10 @@ const ( TEST_SUPI_ANS = "imsi-27401200012080f6" ) -var TestUe5gAuthTable = make(map[string]*ResStarConfirmData) -var TestUeEapAuthTable = make(map[string]*ResConfirmData) +var ( + TestUe5gAuthTable = make(map[string]*ResStarConfirmData) + TestUeEapAuthTable = make(map[string]*ResConfirmData) +) func init() { // for 5G AKA diff --git a/PCF/TestAMPolicy/AMPolicy.go b/PCF/TestAMPolicy/AMPolicy.go index 1820e7b..532dcdc 100644 --- a/PCF/TestAMPolicy/AMPolicy.go +++ b/PCF/TestAMPolicy/AMPolicy.go @@ -5,8 +5,9 @@ package TestAMPolicy import ( - "github.com/omec-project/openapi/models" "time" + + "github.com/omec-project/openapi/models" ) //Data type definition TS 29.571// @@ -53,7 +54,7 @@ UserLoc : //Success Test func GetAMreqdata() models.PolicyAssociationRequest { timeNow := time.Now() - //d := time.Date(2019, 7, 5, 12, 30, 0, 0, time.UTC) + // d := time.Date(2019, 7, 5, 12, 30, 0, 0, time.UTC) amCreateReqData := models.PolicyAssociationRequest{ NotificationUri: "http://127.0.0.1:29518/namf-callback/v1/am-policy/imsi-2089300007487-1", Supi: "imsi-2089300007487", @@ -91,7 +92,7 @@ func GetAMreqdata() models.PolicyAssociationRequest { NrCellId: "000000001", }, AgeOfLocationInformation: 123, - //UeLocationTimestamp: "2019-04-15T09:47:35.505Z", + // UeLocationTimestamp: "2019-04-15T09:47:35.505Z", UeLocationTimestamp: &timeNow, GlobalGnbId: &models.GlobalRanNodeId{ PlmnId: &models.PlmnId{ @@ -132,6 +133,7 @@ func GetAMreqdata() models.PolicyAssociationRequest { } return amCreateReqData } + func GetAMUpdateReqData() models.PolicyAssociationUpdateRequest { amUpdateReqData := models.PolicyAssociationUpdateRequest{ Triggers: []models.RequestTrigger{ @@ -168,16 +170,17 @@ func GetAMUpdateReqData() models.PolicyAssociationUpdateRequest { //------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -//Fail Test (Create part) +// ------------------------------------------------------------------------------------------------- +// Fail Test (Create part) func GetamCreatefailnotifyURIData() models.PolicyAssociationRequest { - //d := time.Date(2019, 7, 5, 12, 30, 0, 0, time.UTC) + // d := time.Date(2019, 7, 5, 12, 30, 0, 0, time.UTC) amCreatefailnotifyURIData := GetAMreqdata() amCreatefailnotifyURIData.NotificationUri = "" return amCreatefailnotifyURIData } + func GetamCreatefailsupiData() models.PolicyAssociationRequest { - //d := time.Date(2019, 7, 5, 12, 30, 0, 0, time.UTC) + // d := time.Date(2019, 7, 5, 12, 30, 0, 0, time.UTC) amCreatefailnotifysupiData := GetAMreqdata() amCreatefailnotifysupiData.Supi = "dadfasdfasd" return amCreatefailnotifysupiData diff --git a/PCF/TestBDTPolicy/BDTPolicyCreate.go b/PCF/TestBDTPolicy/BDTPolicyCreate.go index 4026a03..d9fb5e1 100644 --- a/PCF/TestBDTPolicy/BDTPolicyCreate.go +++ b/PCF/TestBDTPolicy/BDTPolicyCreate.go @@ -5,8 +5,9 @@ package TestBDTPolicy import ( - "github.com/omec-project/openapi/models" "time" + + "github.com/omec-project/openapi/models" ) func GetCreateTestData() models.BdtReqData { diff --git a/PCF/TestPolicyAuthorization/PolicyAuthorizationCreate.go b/PCF/TestPolicyAuthorization/PolicyAuthorizationCreate.go index 4e7983e..478efbe 100644 --- a/PCF/TestPolicyAuthorization/PolicyAuthorizationCreate.go +++ b/PCF/TestPolicyAuthorization/PolicyAuthorizationCreate.go @@ -64,7 +64,7 @@ func GetPostAppSessionsData_Normal() models.AppSessionContext { }, }, NotifUri: "https://127.0.0.1:12345", - SuppFeat: "5", //b'0111' + SuppFeat: "5", // b'0111' Supi: "imsi-2089300007487", UeIpv4: "45.45.0.2", }, @@ -210,7 +210,8 @@ func GetUpdateEventsSubsc400Data() models.EventsSubscReqData { Duration: 0, TotalVolume: 0, DownlinkVolume: 0, - UplinkVolume: 0}, + UplinkVolume: 0, + }, } return UpdateEventsSubsc400Data } diff --git a/PCF/TestSMPolicy/SMPolicyTestData.go b/PCF/TestSMPolicy/SMPolicyTestData.go index 7f0689f..b11b5ba 100644 --- a/PCF/TestSMPolicy/SMPolicyTestData.go +++ b/PCF/TestSMPolicy/SMPolicyTestData.go @@ -217,6 +217,7 @@ func UpdateTestData(trigger []models.PolicyControlRequestTrigger, op *models.Rul } return data } + func DeldateTestData() models.SmPolicyDeleteData { smDelData := models.SmPolicyDeleteData{ UserLocationInfo: &models.UserLocation{ diff --git a/SMF/TestPDUSession/SMContextCreate.go b/SMF/TestPDUSession/SMContextCreate.go index 1e5f53b..0932b32 100644 --- a/SMF/TestPDUSession/SMContextCreate.go +++ b/SMF/TestPDUSession/SMContextCreate.go @@ -6,11 +6,12 @@ package TestPDUSession import ( "bytes" + + "github.com/google/uuid" "github.com/omec-project/nas" "github.com/omec-project/nas/nasMessage" "github.com/omec-project/nas/nasType" "github.com/omec-project/openapi/models" - "github.com/google/uuid" ) const ( @@ -151,10 +152,10 @@ type nasMessageULNASTransportData struct { inSpareHalfOctetAndPayloadContainerType uint8 inPayloadContainer nasType.PayloadContainer inPduSessionID2Value nasType.PduSessionID2Value - //inOldPDUSessionID nasType.OldPDUSessionID + // inOldPDUSessionID nasType.OldPDUSessionID inRequestType nasType.RequestType inSNSSAI nasType.SNSSAI - //inAdditionalInformation nasType.AdditionalInformation + // inAdditionalInformation nasType.AdditionalInformation } var NasMessageNasMessageULNASTransportDataTable = make(map[string]nasMessageULNASTransportData) @@ -175,7 +176,7 @@ func init() { Octet: 10, }, - //inOldPDUSessionID + // inOldPDUSessionID inRequestType: nasType.RequestType{ Octet: nasMessage.ULNASTransportRequestTypeType<<4 | nasMessage.ULNASTransportRequestTypeType, @@ -185,7 +186,7 @@ func init() { Len: 4, Octet: [8]uint8{0x01, 0x02, 0x03, 0x01}, }, - //inAdditionalInformation + // inAdditionalInformation } } diff --git a/UDM/TestGenAuthData/GenerateAuthData.go b/UDM/TestGenAuthData/GenerateAuthData.go index 383df36..98a1063 100644 --- a/UDM/TestGenAuthData/GenerateAuthData.go +++ b/UDM/TestGenAuthData/GenerateAuthData.go @@ -31,8 +31,10 @@ const ( TESTSET_SERVING_NETWORK_NAME = "WLAN" ) -var TestGenAuthDataTable = make(map[string]*models.AuthenticationInfoRequest) -var MilenageTestSet19 milenageTestSet +var ( + TestGenAuthDataTable = make(map[string]*models.AuthenticationInfoRequest) + MilenageTestSet19 milenageTestSet +) func init() { TestGenAuthDataTable[SUCCESS_CASE] = &models.AuthenticationInfoRequest{ diff --git a/UDR/TestRegistrationProcedure/RegistrationProcedure.go b/UDR/TestRegistrationProcedure/RegistrationProcedure.go index 4990f92..aa19943 100644 --- a/UDR/TestRegistrationProcedure/RegistrationProcedure.go +++ b/UDR/TestRegistrationProcedure/RegistrationProcedure.go @@ -12,11 +12,13 @@ const ( FREE5GC_CASE = "free5gc" ) -var TestAmDataTable = make(map[string]models.AccessAndMobilitySubscriptionData) -var TestSmfSelDataTable = make(map[string]models.SmfSelectionSubscriptionData) -var TestSmSelDataTable = make(map[string][]models.SessionManagementSubscriptionData) -var TestAmPolicyDataTable = make(map[string]models.AmPolicyData) -var TestSmPolicyDataTable = make(map[string]models.SmPolicyData) +var ( + TestAmDataTable = make(map[string]models.AccessAndMobilitySubscriptionData) + TestSmfSelDataTable = make(map[string]models.SmfSelectionSubscriptionData) + TestSmSelDataTable = make(map[string][]models.SessionManagementSubscriptionData) + TestAmPolicyDataTable = make(map[string]models.AmPolicyData) + TestSmPolicyDataTable = make(map[string]models.SmPolicyData) +) func init() { TestAmDataTable[FREE5GC_CASE] = models.AccessAndMobilitySubscriptionData{ @@ -115,7 +117,8 @@ func init() { DefaultSscMode: models.SscMode__1, AllowedSscModes: []models.SscMode{models.SscMode__1, models.SscMode__2, models.SscMode__3}, }, - PduSessionTypes: &models.PduSessionTypes{DefaultSessionType: models.PduSessionType_IPV4, + PduSessionTypes: &models.PduSessionTypes{ + DefaultSessionType: models.PduSessionType_IPV4, AllowedSessionTypes: []models.PduSessionType{models.PduSessionType_IPV4}, }, SessionAmbr: &models.Ambr{ @@ -143,7 +146,8 @@ func init() { DefaultSscMode: models.SscMode__1, AllowedSscModes: []models.SscMode{models.SscMode__1, models.SscMode__2, models.SscMode__3}, }, - PduSessionTypes: &models.PduSessionTypes{DefaultSessionType: models.PduSessionType_IPV4, + PduSessionTypes: &models.PduSessionTypes{ + DefaultSessionType: models.PduSessionType_IPV4, AllowedSessionTypes: []models.PduSessionType{models.PduSessionType_IPV4}, }, SessionAmbr: &models.Ambr{ diff --git a/go.mod b/go.mod index d2ad265..b092f80 100644 --- a/go.mod +++ b/go.mod @@ -6,10 +6,10 @@ require ( github.com/antihax/optional v1.0.0 github.com/antonfisher/nested-logrus-formatter v1.3.1 github.com/google/uuid v1.3.0 - github.com/omec-project/aper v1.1.1 + github.com/omec-project/aper v1.1.2 github.com/omec-project/logger_conf v1.1.1 github.com/omec-project/logger_util v1.2.0 - github.com/omec-project/nas v1.2.0 + github.com/omec-project/nas v1.2.2 github.com/omec-project/ngap v1.2.0 github.com/omec-project/openapi v1.2.0 github.com/sirupsen/logrus v1.9.3 @@ -17,24 +17,33 @@ require ( require ( 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/gabriel-vasile/mimetype v1.4.2 // indirect github.com/gin-contrib/sse v0.1.0 // indirect - github.com/gin-gonic/gin v1.7.3 // indirect - github.com/go-playground/locales v0.13.0 // indirect - github.com/go-playground/universal-translator v0.17.0 // indirect - github.com/go-playground/validator/v10 v10.4.1 // indirect + github.com/gin-gonic/gin v1.9.1 // 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.14.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.2 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/leodido/go-urn v1.2.0 // indirect - github.com/mattn/go-isatty v0.0.12 // 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/omec-project/util v1.0.13 // indirect - github.com/omec-project/util_3gpp v1.2.0 // indirect + github.com/omec-project/util_3gpp v1.2.1 // indirect + github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/rogpeppe/go-internal v1.9.0 // indirect - github.com/ugorji/go/codec v1.2.1 // indirect - golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect - golang.org/x/sys v0.6.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.2.11 // 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/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 541a655..eddcc17 100644 --- a/go.sum +++ b/go.sum @@ -4,112 +4,116 @@ github.com/antonfisher/nested-logrus-formatter v1.3.1 h1:NFJIr+pzwv5QLHTPyKz9UME github.com/antonfisher/nested-logrus-formatter v1.3.1/go.mod h1:6WTfyWFkBc9+zyBaKIqRrg/KwMqBbodBjgbHjDz7zjA= 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= +github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= +github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= +github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= +github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.7.3 h1:aMBzLJ/GMEYmv1UWs2FFTcPISLrQH2mRgL9Glz8xows= -github.com/gin-gonic/gin v1.7.3/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= -github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= -github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= +github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= +github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= +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= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +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/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/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/json-iterator/go v1.1.9/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/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/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +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/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= 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/omec-project/aper v1.1.1 h1:5Kr7QBheYWb/0723Xqi2/4kTiQS3WiqrxjWlOHOv5/Q= -github.com/omec-project/aper v1.1.1/go.mod h1:oOkKRI2BIo8SHpCsEzNbo9qiowEtEy3q+wmO7TuDrx4= +github.com/omec-project/aper v1.1.2 h1:oRtfloQJQV5HXhOkPpOXbRW9Ay8TAe5kTcbMMkInmOQ= +github.com/omec-project/aper v1.1.2/go.mod h1:jDWasZ2XLFL2uSEWhgGlT/ELyrpwCJd/2kE/VEGG8Ew= github.com/omec-project/logger_conf v1.1.1 h1:qo0cF5gnPfth8wy+I/QjiOx+F5jB6h4GLSOdyS+ted8= github.com/omec-project/logger_conf v1.1.1/go.mod h1:2EwoAXjOcRTweseN+ogWifJvjocEKjz3kxRaIC4I88g= github.com/omec-project/logger_util v1.2.0 h1:Wtx6skInAPqSic0b97QtJcs+xHDh5798MY2WRrnUz3s= github.com/omec-project/logger_util v1.2.0/go.mod h1:LRHlDJdCqVjOxYvYslRryj0DFUNtxQkgxEiQ7fSCoPk= -github.com/omec-project/nas v1.2.0 h1:fSMhieEKv7cJljkullFDh4TGee9Dc3+aYzpQpUN4w1s= -github.com/omec-project/nas v1.2.0/go.mod h1:o9JEUliCawXiPx7f5J9MaAfB3xptBNrfYI9QSu3W0oU= +github.com/omec-project/nas v1.2.2 h1:5qvKH6Eew0IwivRMC6eWueRPgXwYSLfRUPcH5sbsv44= +github.com/omec-project/nas v1.2.2/go.mod h1:QdRwa7KjgzWpuDnIdezNZgtCwhHH7RcFDdQTSCB5afM= github.com/omec-project/ngap v1.2.0 h1:BeH8xiQQUnBog0eQiipjgcV7Ua02MEnpS4O5hwVMpDo= github.com/omec-project/ngap v1.2.0/go.mod h1:fbX1GqunoSS2B7GDTEccIutmgNdUIxSy5BKVnvX7SM0= github.com/omec-project/openapi v1.2.0 h1:7Wvi0HLvhvxMyQtqGcqtMCPC/0QCGAFP5htrXCfWxRc= github.com/omec-project/openapi v1.2.0/go.mod h1:hjU13MB1m9MHTko87JfsUNCdeD6/m6VkNZDD8Vq5U9M= github.com/omec-project/util v1.0.13 h1:50ghFbWo7aqhqIknC6KDPWmkht0tP1v2wjpIdcWVXKg= github.com/omec-project/util v1.0.13/go.mod h1:Cn9P57qYFiEu0ZXti8imODsJIXVGqnqhP40MwbVbo3g= -github.com/omec-project/util_3gpp v1.2.0 h1:u2c1QeBGMnH6Ps5HSbPloTeeGjsAAMFuyl8Nsw+HqsM= -github.com/omec-project/util_3gpp v1.2.0/go.mod h1:53qng9MRMW1tgc2Cg0w+LaBNbskdQQqGZt/fcjPQSy4= +github.com/omec-project/util_3gpp v1.2.1 h1:OE8dckynwEqCpqLkRdMVuKPTQ8Afdq/I3nlROa4fQVo= +github.com/omec-project/util_3gpp v1.2.1/go.mod h1:q2fd2dniyDlCDO/2WwEnU9+fTAO7OYrzRnPqaBxZFyc= +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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +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.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go v1.2.1/go.mod h1:cSVypSfTLm2o9fKxXvQgn3rMmkPXovcWor6Qn5tbFmI= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.2.1 h1:/TRfW3XKkvWvmAYyCUaQlhoCDGjcvNR8xVVA/l5p/jQ= -github.com/ugorji/go/codec v1.2.1/go.mod h1:s/WxCRi46t8rA+fowL40EnmD7ec0XhR7ZypxeBNdzsM= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa h1:zuSxTR4o9y82ebqCUJYNGJbGPo6sKVl54f/TVDObg1c= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= +github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= +github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +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.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +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 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 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/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/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= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/logger/logger.go b/logger/logger.go index 24ad1ca..1965613 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -9,16 +9,17 @@ import ( "time" formatter "github.com/antonfisher/nested-logrus-formatter" - "github.com/sirupsen/logrus" - "github.com/omec-project/logger_conf" "github.com/omec-project/logger_util" + "github.com/sirupsen/logrus" ) -var log *logrus.Logger -var CommTestCommLog *logrus.Entry -var CommTestAmfLog *logrus.Entry -var CommTestSmfLog *logrus.Entry +var ( + log *logrus.Logger + CommTestCommLog *logrus.Entry + CommTestAmfLog *logrus.Entry + CommTestSmfLog *logrus.Entry +) func init() { log = logrus.New() @@ -32,12 +33,12 @@ func init() { FieldsOrder: []string{"component", "category"}, } - free5gcLogHook, err := logger_util.NewFileHook(logger_conf.Free5gcLogFile, os.O_CREATE|os.O_APPEND|os.O_RDWR, 0666) + free5gcLogHook, err := logger_util.NewFileHook(logger_conf.Free5gcLogFile, os.O_CREATE|os.O_APPEND|os.O_RDWR, 0o666) if err == nil { log.Hooks.Add(free5gcLogHook) } - selfLogHook, err := logger_util.NewFileHook(logger_conf.LibLogDir+"common_consumer_test_data.log", os.O_CREATE|os.O_APPEND|os.O_RDWR, 0666) + selfLogHook, err := logger_util.NewFileHook(logger_conf.LibLogDir+"common_consumer_test_data.log", os.O_CREATE|os.O_APPEND|os.O_RDWR, 0o666) if err == nil { log.Hooks.Add(selfLogHook) } @@ -52,7 +53,7 @@ func SetLogLevel(level logrus.Level) { log.SetLevel(level) } -func SetReportCaller(bool bool) { - CommTestCommLog.Infoln("set report call :", bool) - log.SetReportCaller(bool) +func SetReportCaller(reportCaller bool) { + CommTestCommLog.Infoln("set report call :", reportCaller) + log.SetReportCaller(reportCaller) }