Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
thakurajayL committed Dec 16, 2023
2 parents 1499a6c + 4935c69 commit 9435692
Show file tree
Hide file tree
Showing 19 changed files with 336 additions and 1,183 deletions.
45 changes: 0 additions & 45 deletions .github/workflows/docker.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/golangci-lint.yml

This file was deleted.

73 changes: 73 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2023 Canonical Ltd.

name: Master workflow

on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: 1.21

- name: Build
run: go build

docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: 1.21

- name: Build and push Docker image
run: make docker-build

lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: 1.21

- name: golangci-lint
uses: golangci/[email protected]
with:
version: latest
args: -v --config ./.golangci.yml

license-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: reuse lint
run: make check-reuse

unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: 1.21

- name: Unit tests
run: go test ./...
54 changes: 0 additions & 54 deletions .github/workflows/pull_request.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/reuse.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/run-smf-unit-test.yml

This file was deleted.

42 changes: 21 additions & 21 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,35 +220,35 @@ linters-settings:
linters:
enable:
- gofmt
- govet
- errcheck
- staticcheck
- unused
- gosimple
- structcheck
- varcheck
# - govet
# - errcheck
# - staticcheck
# - unused
# - gosimple
# - structcheck
# - varcheck
- ineffassign
- deadcode
- typecheck
# - deadcode
# - typecheck
# Additional
- lll
# - lll
- godox
#- gomnd
#- goconst
# - gomnd
# - goconst
# - gocognit
# - maligned
# - nestif
# - gomodguard
- nakedret
- gci
- misspell
- gofumpt
- whitespace
- unconvert
- predeclared
- noctx
# - nakedret
# - gci
# - misspell
# - gofumpt
# - whitespace
# - unconvert
# - predeclared
# - noctx
- dogsled
- bodyclose
# - bodyclose
- asciicheck
#- stylecheck
# - unparam
Expand Down
11 changes: 3 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@
# SPDX-License-Identifier: Apache-2.0
#

FROM golang:1.16.0-stretch AS builder
FROM golang:1.21.5-bookworm AS builder

LABEL maintainer="ONF <[email protected]>"

RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list
#RUN apt remove cmdtest yarn
RUN apt-get update && apt-get -y install apt-transport-https ca-certificates
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg > pubkey.gpg
RUN apt-key add pubkey.gpg
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update
RUN apt-get -y install gcc cmake autoconf libtool pkg-config libmnl-dev libyaml-dev nodejs yarn
RUN apt-get -y install gcc cmake autoconf libtool pkg-config libmnl-dev libyaml-dev
RUN apt-get clean


Expand All @@ -27,7 +22,7 @@ RUN cd $GOPATH/src/smf \
# compile upf-adapter binary
RUN cd $GOPATH/src/smf/upfadapter && CGO_ENABLED=0 go build

FROM alpine:3.16 as smf
FROM alpine:3.19 as smf

LABEL description="ONF open source 5G Core Network" \
version="Stage 3"
Expand Down
2 changes: 1 addition & 1 deletion callback/api_nf_subscribe_notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func HTTPNfSubscriptionStatusNotify(c *gin.Context) {

responseBody, err := openapi.Serialize(rsp.Body, "application/json")
if err != nil {
logger.PduSessLog.Errorln("Error fetching response for HTTPNfSubscriptionStatusNotify : %+v", err)
logger.PduSessLog.Errorf("Error fetching response for HTTPNfSubscriptionStatusNotify : %+v\n", err)
problemDetails := models.ProblemDetails{
Status: http.StatusInternalServerError,
Cause: "SYSTEM_FAILURE",
Expand Down
3 changes: 2 additions & 1 deletion context/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ func DeleteSmContextInDBBySEID(seidUint uint64) {
MongoDBLibrary.RestfulAPIDeleteOne(SeidSmContextCol, filter)
DeleteSmContextInDBByRef(ref)
} else {
logger.CtxLog.Infof("DB entry doesn't exist with seid: ", seid)
logger.CtxLog.Infof("DB entry doesn't exist with seid: %v\n", seid)
}

}
Expand All @@ -368,6 +368,7 @@ func DeleteSmContextInDBByRef(ref string) {
fmt.Println("db - delete SMContext In DB w ref")
filter := bson.M{"ref": ref}
logger.CtxLog.Infof("filter : %v", filter)

MongoDBLibrary.RestfulAPIDeleteOne(SmContextDataColl, filter)
}

Expand Down
2 changes: 1 addition & 1 deletion context/sm_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ func (smContext *SMContext) PublishSmCtxtInfo() {

//Populate kafka sm ctxt struct
kafkaSmCtxt.Imsi = smContext.Supi
if smContext.PDUAddress.Ip != nil {
if smContext.PDUAddress != nil && smContext.PDUAddress.Ip != nil {
kafkaSmCtxt.IPAddress = smContext.PDUAddress.Ip.String()
}
kafkaSmCtxt.SmfSubState, op = mapPduSessStateToMetricStateAndOp(smContext.SMContextState)
Expand Down
4 changes: 2 additions & 2 deletions fsm/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ type SmEventData struct {
}

// Define FSM Func Point Struct here
type fsmHandler [smf_context.SmStateMax][SmEventMax]func(event SmEvent, eventData *SmEventData) (smf_context.SMContextState, error)
type eventHandler func(event SmEvent, eventData *SmEventData) (smf_context.SMContextState, error)

var SmfFsmHandler fsmHandler
var SmfFsmHandler [smf_context.SmStateMax][SmEventMax]eventHandler

func init() {
//Initilise with default invalid handler
Expand Down
Loading

0 comments on commit 9435692

Please sign in to comment.