From 1559096b8a57a9dd7d36a349fabde22730504cd8 Mon Sep 17 00:00:00 2001 From: Woojoong Kim Date: Sun, 30 Jun 2024 00:34:17 -0700 Subject: [PATCH] migrate CI to github action Signed-off-by: Woojoong Kim --- .github/workflows/build-test.yml | 31 ++++++ .github/workflows/code-scan.yml | 43 ++++++++ .github/workflows/master.yml | 84 ---------------- .github/workflows/release.yml | 98 +++++++++++++++++++ .gitignore | 1 + Makefile | 43 +++++--- build/bin/version_check.sh | 93 ++++++++++++++++++ build/docker/quicktype/Dockerfile | 3 +- .../qoe_and_tsp/v2/qoe_and_tsp.go | 31 +++--- go/policy_schemas/qoe_target/v2/qoe_target.go | 20 ++-- .../qos_and_tsp/v2/qos_and_tsp.go | 31 +++--- go/policy_schemas/qos_target/v2/qos_target.go | 22 ++--- .../slice_sla_target/v1/slice_sla_target.go | 28 +++--- .../v2/traffic_steering_preference.go | 23 ++--- .../ue_level_target/v1/ue_level_target.go | 30 +++--- .../v2/policy_scope_identifier.go | 14 +-- go/policy_status/v2/policy_status.go | 10 +- 17 files changed, 403 insertions(+), 202 deletions(-) create mode 100644 .github/workflows/build-test.yml create mode 100644 .github/workflows/code-scan.yml delete mode 100644 .github/workflows/master.yml create mode 100644 .github/workflows/release.yml create mode 100755 build/bin/version_check.sh diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 0000000..bb2fec5 --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2024 Intel Corporation + +name: Build and test 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-file: 'go.mod' + - name: build + run: make build + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + - name: Unit tests + run: make test diff --git a/.github/workflows/code-scan.yml b/.github/workflows/code-scan.yml new file mode 100644 index 0000000..4ae9ae7 --- /dev/null +++ b/.github/workflows/code-scan.yml @@ -0,0 +1,43 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2024 Intel Corporation + +name: Code scan workflow + +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + version-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: check version + run: make check-version + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + - name: golang-lint + run: make lint + license: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: check license + run: make license + fossa-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: FOSSA scan + uses: fossa-contrib/fossa-action@v3 + with: + fossa-api-key: 6d304c09a3ec097ba4517724e4a4d17d diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml deleted file mode 100644 index 7b74288..0000000 --- a/.github/workflows/master.yml +++ /dev/null @@ -1,84 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Copyright 2024 Intel Corporation - -name: Master workflow -on: - push: - branches: - - master - pull_request: - -jobs: - build: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./go - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version-file: './go/go.mod' - - name: Build - run: go build ./... - - lint: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./go - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version-file: './go/go.mod' - - uses: golangci/golangci-lint-action@v6 - with: - version: latest - args: -v --config ./.golangci.yml --timeout=15m - - unit-tests: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./go - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version-file: './go/go.mod' - - name: Unit tests - run: go test -race github.com/onosproject/onos-a1-dm/... - - docker-build: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./go - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version-file: './go/go.mod' - - name: Build Docker image - run: | - git clone https://github.com/onosproject/build-tools.git build/build-tools - go mod vendor - docker build . -f ../build/docker/quicktype/Dockerfile -t onosproject/onos-a1-dm:latest - rm -rf vendor - - license-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: reuse lint - uses: fsfe/reuse-action@v3 - - fossa-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: FOSSA scan - uses: fossa-contrib/fossa-action@v3 - with: - fossa-api-key: 6d304c09a3ec097ba4517724e4a4d17d diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..dde94d7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,98 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2024 Intel Corporation +# Copyright 2024 Kyunghee University +name: Publish image and tag/release code + +on: + push: + branches: + - master + +jobs: + version-check: + if: (github.repository_owner == 'onosproject') + runs-on: ubuntu-latest + outputs: + valid_version: ${{ steps.version-check-step.outputs.valid_version }} + dev_version: ${{ steps.dev-version-check-step.outputs.dev_version }} + target_version: ${{ steps.get-target-version-step.outputs.target_version }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: check version + id: version-check-step + run: | + make check-version; if [[ $? == 0 ]]; then echo "valid_version=true" >> $GITHUB_OUTPUT; else echo "valid_version=false" >> $GITHUB_OUTPUT; fi + cat $GITHUB_OUTPUT + + - name: check dev version + id: dev-version-check-step + run: | + f_dev=$(./build/bin/version_check.sh is_dev) + if [[ $f_dev == "true" ]]; then echo "dev_version=true" >> $GITHUB_OUTPUT; else echo "dev_version=false" >> $GITHUB_OUTPUT; fi + cat $GITHUB_OUTPUT + + - name: get target version + id: get-target-version-step + run: | + echo "target_version=$(cat VERSION)" >> $GITHUB_OUTPUT + cat $GITHUB_OUTPUT + + tag_versions: + runs-on: ubuntu-latest + needs: version-check + if: (github.repository_owner == 'onosproject') && (needs.version-check.outputs.valid_version == 'true') && (needs.version-check.outputs.dev_version == 'false') + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: create release using REST API + run: | + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GH_ONOS_PAT }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/${{ github.repository }}/releases \ + -d '{ + "tag_name": "v${{ needs.version-check.outputs.target_version }}", + "target_commitish": "${{ github.event.repository.default_branch }}", + "name": "v${{ needs.version-check.outputs.target_version }}", + "draft": false, + "prerelease": false, + "generate_release_notes": true + }' + + bump-up-version: + runs-on: ubuntu-latest + needs: version-check + if: (github.repository_owner == 'onosproject') && (needs.version-check.outputs.valid_version == 'true') && (needs.version-check.outputs.dev_version == 'false') + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: increment version + run: | + IFS='.' read -r major minor patch <<< ${{ needs.version-check.outputs.target_version }} + patch_update=$((patch+1)) + NEW_VERSION="$major.$minor.$patch_update-dev" + echo $NEW_VERSION > VERSION + echo "Updated version: $NEW_VERSION" + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GH_ONOS_PAT }} + commit-message: Update version + committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> + author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> + signoff: true + branch: version-update + delete-branch: true + title: Update version + body: | + Update VERSION file + add-paths: | + VERSION \ No newline at end of file diff --git a/.gitignore b/.gitignore index f1dbc8a..0178fc0 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ .idea build/build-tools +venv \ No newline at end of file diff --git a/Makefile b/Makefile index 9408b8d..836fbf7 100644 --- a/Makefile +++ b/Makefile @@ -2,31 +2,44 @@ # # SPDX-License-Identifier: Apache-2.0 -.PHONY: build +.PHONY: build license -all: schemas golang +all: build -build-tools:=$(shell if [ ! -d "./build/build-tools" ]; then cd build && git clone https://github.com/onosproject/build-tools.git; fi) -include ./build/build-tools/make/onf-common.mk +build: # @HELP build the Go library +build: schemas go-build test: # @HELP run the unit tests and source code validation -test: golang schemas +test: build lint license -jenkins-test: # @HELP run the unit tests and source code validation producing a junit style report for Jenkins -jenkins-test: jenkins-tools - -golang: +go-build: cd go && go build ./... schemas: cd ./build/bin/ && ./compile-a1-schemas.sh -publish: # @HELP publish version on github - ./build/build-tools/publish-version ${VERSION} - ./build/build-tools/publish-version go/${VERSION} +lint: # @HELP examines Go source code and reports coding problems + golangci-lint --version | grep $(GOLANG_CI_VERSION) || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b `go env GOPATH`/bin $(GOLANG_CI_VERSION) + golangci-lint run --timeout 15m + +license: # @HELP run license checks + rm -rf venv + python3 -m venv venv + . ./venv/bin/activate;\ + python3 -m pip install --upgrade pip;\ + python3 -m pip install reuse;\ + reuse lint -jenkins-publish: jenkins-tools # @HELP Jenkins calls this to publish artifacts - ./build/build-tools/release-merge-commit +check-version: # @HELP check version is duplicated + ./build/bin/version_check.sh all -clean:: # @HELP remove all the build artifacts +clean: # @HELP remove all the build artifacts rm -rf ./build/_output ./vendor + +help: + @grep -E '^.*: *# *@HELP' $(MAKEFILE_LIST) \ + | sort \ + | awk ' \ + BEGIN {FS = ": *# *@HELP"}; \ + {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}; \ + ' diff --git a/build/bin/version_check.sh b/build/bin/version_check.sh new file mode 100755 index 0000000..feabddb --- /dev/null +++ b/build/bin/version_check.sh @@ -0,0 +1,93 @@ +#!/bin/bash +# SPDX-License-Identifier: Apache-2.0 +# Copyright 2024 Intel Corporation + +set +x + +# input should be all, is_valid_format, is_dev, and is_unique +INPUT=$1 + +function is_valid_format() { + # check if version format is matched to SemVer + VER_REGEX='^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$' + if [[ ! $(cat VERSION | tr -d '\n' | sed s/-dev//) =~ $VER_REGEX ]] + then + return 1 + fi + return 0 +} + +function is_dev_version() { + # check if version has '-dev' + # if there is, no need to check version + if [[ $(cat VERSION | tr -d '\n' | tail -c 4) =~ "-dev" ]] + then + return 0 + fi + return 1 +} + +function is_unique_version() { + # check if the version is already tagged in GitHub repository + for t in $(git tag | cat) + do + if [[ $t == $(echo v$(cat VERSION | tr -d '\n')) ]] + then + return 1 + fi + done + return 0 +} + +case $INPUT in + all) + is_valid_format + f_valid=$? + if [[ $f_valid == 1 ]] + then + echo "ERROR: Version $(cat VERSION) is not in SemVer format" + exit 2 + fi + + is_dev_version + f_dev=$? + if [[ $f_dev == 0 ]] + then + echo "This is dev version" + exit 0 + fi + + is_unique_version + f_unique=$? + if [[ $f_unique == 1 ]] + then + echo "ERROR: duplicated tag $(cat VERSION)" + exit 2 + fi + ;; + + is_valid_format) + is_valid_format + ;; + + is_dev) + is_dev_version + f_dev=$? + if [[ $f_dev == 0 ]] + then + echo "true" + exit 0 + fi + echo "false" + ;; + + is_unique) + is_unique_version + ;; + + *) + echo -n "unknown input" + exit 2 + ;; + +esac diff --git a/build/docker/quicktype/Dockerfile b/build/docker/quicktype/Dockerfile index d51fdda..40e9e6e 100644 --- a/build/docker/quicktype/Dockerfile +++ b/build/docker/quicktype/Dockerfile @@ -2,8 +2,9 @@ # # SPDX-License-Identifier: Apache-2.0 -FROM node:12.22.9-buster-slim +FROM node:16.17.0-slim +RUN npm update -g RUN npm install -g quicktype ENTRYPOINT ["/usr/local/bin/quicktype"] \ No newline at end of file diff --git a/go/policy_schemas/qoe_and_tsp/v2/qoe_and_tsp.go b/go/policy_schemas/qoe_and_tsp/v2/qoe_and_tsp.go index ed22946..9458dc0 100644 --- a/go/policy_schemas/qoe_and_tsp/v2/qoe_and_tsp.go +++ b/go/policy_schemas/qoe_and_tsp/v2/qoe_and_tsp.go @@ -25,26 +25,26 @@ func (r *API) Marshal() ([]byte, error) { // O-RAN standard QoE Target and Traffic Steering Preference policy type API struct { QoeObjectives QoeObjectives `json:"qoeObjectives"` - Scope Scope `json:"scope"` - TSPResources []TSPResource `json:"tspResources"` + Scope Scope `json:"scope"` + TSPResources []TSPResource `json:"tspResources"` } type QoeObjectives struct { InitialBuffering *float64 `json:"initialBuffering,omitempty"` - QoeScore *float64 `json:"qoeScore,omitempty"` - ReBuffFreq *float64 `json:"reBuffFreq,omitempty"` - StallRatio *float64 `json:"stallRatio,omitempty"` + QoeScore *float64 `json:"qoeScore,omitempty"` + ReBuffFreq *float64 `json:"reBuffFreq,omitempty"` + StallRatio *float64 `json:"stallRatio,omitempty"` } type Scope struct { - CellID *CellID `json:"cellId,omitempty"` - QosID *QosID `json:"qosId,omitempty"` + CellID *CellID `json:"cellId,omitempty"` + QosID *QosID `json:"qosId,omitempty"` SliceID *SliceID `json:"sliceId,omitempty"` - UeID *string `json:"ueId,omitempty"` + UeID *string `json:"ueId,omitempty"` } type CellID struct { - CID CID `json:"cId"` + CID CID `json:"cId"` PlmnID PlmnID `json:"plmnId"` } @@ -64,23 +64,24 @@ type QosID struct { } type SliceID struct { - PlmnID PlmnID `json:"plmnId"` + PlmnID PlmnID `json:"plmnId"` SD *string `json:"sd,omitempty"` - Sst int64 `json:"sst"` + Sst int64 `json:"sst"` } type TSPResource struct { - CellIDList []CellID `json:"cellIdList"` - Preference PreferenceType `json:"preference"` + CellIDList []CellID `json:"cellIdList"` + Preference PreferenceType `json:"preference"` Primary *bool `json:"primary,omitempty"` } type PreferenceType string + const ( - Avoid PreferenceType = "AVOID" + Avoid PreferenceType = "AVOID" Forbid PreferenceType = "FORBID" Prefer PreferenceType = "PREFER" - Shall PreferenceType = "SHALL" + Shall PreferenceType = "SHALL" ) var RawSchema = `{ "$schema": "http://json-schema.org/draft-07/schema#", "description": "O-RAN standard QoE Target and Traffic Steering Preference policy", "type": "object", "properties": { "scope": { "anyOf": [ { "type": "object", "properties": { "ueId": {"$ref": "#/definitions/UeId"}, "sliceId": {"$ref": "#/definitions/SliceId"}, "qosId": {"$ref": "#/definitions/QosId"}, "cellId": {"$ref": "#/definitions/CellId"} }, "additionalProperties": false, "required": ["ueId", "sliceId"] }, { "type": "object", "properties": { "ueId": {"$ref": "#/definitions/UeId"}, "qosId": {"$ref": "#/definitions/QosId"}, "cellId": {"$ref": "#/definitions/CellId"} }, "additionalProperties": false, "required": ["ueId", "qosId"] }, { "type": "object", "properties": { "sliceId": {"$ref": "#/definitions/SliceId"}, "qosId": {"$ref": "#/definitions/QosId"}, "cellId": {"$ref": "#/definitions/CellId"} }, "additionalProperties": false, "required": ["sliceId"] } ] }, "qoeObjectives": { "type": "object", "properties": { "qoeScore": {"type": "number"}, "initialBuffering": {"type": "number"}, "reBuffFreq": {"type": "number"}, "stallRatio": {"type": "number"} }, "minProperties": 1, "additionalProperties": false }, "tspResources": { "type": "array", "items": { "$ref": "#/definitions/TspResource" }, "minItems": 1 } }, "additionalProperties": false, "required": ["scope", "qoeObjectives", "tspResources"], "definitions": { "UeId": { "type": "string", "pattern": "^[A-Fa-f0-9]{16}$" }, "SliceId": { "type": "object", "properties": { "sst": { "type": "integer", "minimum": 0, "maximum": 255 }, "sd": { "type": "string", "pattern": "^[A-Fa-f0-9]{6}$" }, "plmnId": {"$ref": "#/definitions/PlmnId"} }, "additionalProperties": false, "required": ["sst","plmnId"] }, "QosId": { "oneOf": [ { "type":"object", "properties": { "5qI": { "type": "integer", "minimum": 1, "maximum": 256 } }, "additionalProperties": false, "required": ["5qI"] }, { "type": "object", "properties": { "qcI": { "type": "integer", "minimum": 1, "maximum": 256 } }, "additionalProperties": false, "required": ["qcI"] } ] }, "CellId": { "type": "object", "properties": { "plmnId": {"$ref": "#/definitions/PlmnId"}, "cId": {"$ref": "#/definitions/CId"} }, "additionalProperties": false, "required": ["plmnId", "cId"] }, "CId": { "oneOf": [ { "type":"object", "properties": { "ncI": {"$ref": "#/definitions/NcI"} }, "additionalProperties": false, "required": ["ncI"] }, { "type": "object", "properties": { "ecI": {"$ref": "#/definitions/EcI"} }, "additionalProperties": false, "required": ["ecI"] } ] }, "NcI": { "type": "integer", "minimum": 0, "maximum": 68719476735 }, "EcI": { "type": "integer", "minimum": 0, "maximum": 268435455 }, "PlmnId": { "type": "object", "properties": { "mcc": { "type": "string", "pattern": "^[0-9]{3}$" }, "mnc": { "type": "string", "pattern": "^[0-9]{2,3}$" } }, "additionalProperties": false, "required": ["mcc", "mnc"] }, "PreferenceType": { "type": "string", "enum": [ "SHALL", "PREFER", "AVOID", "FORBID" ] }, "CellIdList": { "type":"array", "items": { "$ref": "#/definitions/CellId" } }, "TspResource": { "type": "object", "properties": { "cellIdList": {"$ref": "#/definitions/CellIdList"}, "preference": {"$ref": "#/definitions/PreferenceType"}, "primary": {"type": "boolean"} }, "required": ["cellIdList", "preference"], "additionalProperties": false } } }` diff --git a/go/policy_schemas/qoe_target/v2/qoe_target.go b/go/policy_schemas/qoe_target/v2/qoe_target.go index 291a72e..b724991 100644 --- a/go/policy_schemas/qoe_target/v2/qoe_target.go +++ b/go/policy_schemas/qoe_target/v2/qoe_target.go @@ -25,25 +25,25 @@ func (r *API) Marshal() ([]byte, error) { // O-RAN standard QoE Target policy type API struct { QoeObjectives QoeObjectives `json:"qoeObjectives"` - Scope Scope `json:"scope"` + Scope Scope `json:"scope"` } type QoeObjectives struct { InitialBuffering *float64 `json:"initialBuffering,omitempty"` - QoeScore *float64 `json:"qoeScore,omitempty"` - ReBuffFreq *float64 `json:"reBuffFreq,omitempty"` - StallRatio *float64 `json:"stallRatio,omitempty"` + QoeScore *float64 `json:"qoeScore,omitempty"` + ReBuffFreq *float64 `json:"reBuffFreq,omitempty"` + StallRatio *float64 `json:"stallRatio,omitempty"` } type Scope struct { - CellID *CellID `json:"cellId,omitempty"` - QosID *QosID `json:"qosId,omitempty"` + CellID *CellID `json:"cellId,omitempty"` + QosID *QosID `json:"qosId,omitempty"` SliceID *SliceID `json:"sliceId,omitempty"` - UeID *string `json:"ueId,omitempty"` + UeID *string `json:"ueId,omitempty"` } type CellID struct { - CID CID `json:"cId"` + CID CID `json:"cId"` PlmnID PlmnID `json:"plmnId"` } @@ -63,9 +63,9 @@ type QosID struct { } type SliceID struct { - PlmnID PlmnID `json:"plmnId"` + PlmnID PlmnID `json:"plmnId"` SD *string `json:"sd,omitempty"` - Sst int64 `json:"sst"` + Sst int64 `json:"sst"` } var RawSchema = `{ "$schema": "http://json-schema.org/draft-07/schema#", "description": "O-RAN standard QoE Target policy", "type": "object", "properties": { "scope": { "anyOf": [ { "type": "object", "properties": { "ueId": {"$ref": "#/definitions/UeId"}, "sliceId": {"$ref": "#/definitions/SliceId"}, "qosId": {"$ref": "#/definitions/QosId"}, "cellId": {"$ref": "#/definitions/CellId"} }, "additionalProperties": false, "required": ["ueId", "sliceId"] }, { "type": "object", "properties": { "ueId": {"$ref": "#/definitions/UeId"}, "qosId": {"$ref": "#/definitions/QosId"}, "cellId": {"$ref": "#/definitions/CellId"} }, "additionalProperties": false, "required": ["ueId", "qosId"] }, { "type": "object", "properties": { "sliceId": {"$ref": "#/definitions/SliceId"}, "qosId": {"$ref": "#/definitions/QosId"}, "cellId": {"$ref": "#/definitions/CellId"} }, "additionalProperties": false, "required": ["sliceId"] }, { "type": "object", "properties": { "qosId": {"$ref": "#/definitions/QosId"}, "cellId": {"$ref": "#/definitions/CellId"} }, "additionalProperties": false, "required": ["qosId"] } ] }, "qoeObjectives": { "type": "object", "properties": { "qoeScore": {"type": "number"}, "initialBuffering": {"type": "number"}, "reBuffFreq": {"type": "number"}, "stallRatio": {"type": "number"} }, "minProperties": 1, "additionalProperties": false } }, "additionalProperties": false, "required": ["scope", "qoeObjectives"], "definitions": { "UeId": { "type": "string", "pattern": "^[A-Fa-f0-9]{16}$" }, "SliceId": { "type": "object", "properties": { "sst": { "type": "integer", "minimum": 0, "maximum": 255 }, "sd": { "type": "string", "pattern": "^[A-Fa-f0-9]{6}$" }, "plmnId": {"$ref": "#/definitions/PlmnId"} }, "additionalProperties": false, "required": ["sst","plmnId"] }, "QosId": { "oneOf": [ { "type":"object", "properties": { "5qI": { "type": "integer", "minimum": 1, "maximum": 256 } }, "additionalProperties": false, "required": ["5qI"] }, { "type": "object", "properties": { "qcI": { "type": "integer", "minimum": 1, "maximum": 256 } }, "additionalProperties": false, "required": ["qcI"] } ] }, "CellId": { "type": "object", "properties": { "plmnId": {"$ref": "#/definitions/PlmnId"}, "cId": {"$ref": "#/definitions/CId"} }, "additionalProperties": false, "required": ["plmnId", "cId"] }, "CId": { "oneOf": [ { "type":"object", "properties": { "ncI": {"$ref": "#/definitions/NcI"} }, "additionalProperties": false, "required": ["ncI"] }, { "type": "object", "properties": { "ecI": {"$ref": "#/definitions/EcI"} }, "additionalProperties": false, "required": ["ecI"] } ] }, "NcI": { "type": "integer", "minimum": 0, "maximum": 68719476735 }, "EcI": { "type": "integer", "minimum": 0, "maximum": 268435455 }, "PlmnId": { "type": "object", "properties": { "mcc": { "type": "string", "pattern": "^[0-9]{3}$" }, "mnc": { "type": "string", "pattern": "^[0-9]{2,3}$" } }, "additionalProperties": false, "required": ["mcc", "mnc"] } } }` diff --git a/go/policy_schemas/qos_and_tsp/v2/qos_and_tsp.go b/go/policy_schemas/qos_and_tsp/v2/qos_and_tsp.go index 6a90ab5..6cde872 100644 --- a/go/policy_schemas/qos_and_tsp/v2/qos_and_tsp.go +++ b/go/policy_schemas/qos_and_tsp/v2/qos_and_tsp.go @@ -25,26 +25,26 @@ func (r *API) Marshal() ([]byte, error) { // O-RAN standard QoS Target and Traffic Steering Preference policy type API struct { QosObjectives QosObjectives `json:"qosObjectives"` - Scope Scope `json:"scope"` - TSPResources []TSPResource `json:"tspResources"` + Scope Scope `json:"scope"` + TSPResources []TSPResource `json:"tspResources"` } type QosObjectives struct { - Gfbr *float64 `json:"gfbr,omitempty"` - Mfbr *float64 `json:"mfbr,omitempty"` - Pdb *float64 `json:"pdb,omitempty"` + Gfbr *float64 `json:"gfbr,omitempty"` + Mfbr *float64 `json:"mfbr,omitempty"` + Pdb *float64 `json:"pdb,omitempty"` PriorityLevel *float64 `json:"priorityLevel,omitempty"` } type Scope struct { - CellID *CellID `json:"cellId,omitempty"` - QosID QosID `json:"qosId"` + CellID *CellID `json:"cellId,omitempty"` + QosID QosID `json:"qosId"` SliceID *SliceID `json:"sliceId,omitempty"` - UeID *string `json:"ueId,omitempty"` + UeID *string `json:"ueId,omitempty"` } type CellID struct { - CID CID `json:"cId"` + CID CID `json:"cId"` PlmnID PlmnID `json:"plmnId"` } @@ -64,23 +64,24 @@ type QosID struct { } type SliceID struct { - PlmnID PlmnID `json:"plmnId"` + PlmnID PlmnID `json:"plmnId"` SD *string `json:"sd,omitempty"` - Sst int64 `json:"sst"` + Sst int64 `json:"sst"` } type TSPResource struct { - CellIDList []CellID `json:"cellIdList"` - Preference PreferenceType `json:"preference"` + CellIDList []CellID `json:"cellIdList"` + Preference PreferenceType `json:"preference"` Primary *bool `json:"primary,omitempty"` } type PreferenceType string + const ( - Avoid PreferenceType = "AVOID" + Avoid PreferenceType = "AVOID" Forbid PreferenceType = "FORBID" Prefer PreferenceType = "PREFER" - Shall PreferenceType = "SHALL" + Shall PreferenceType = "SHALL" ) var RawSchema = `{ "$schema": "http://json-schema.org/draft-07/schema#", "description": "O-RAN standard QoS Target and Traffic Steering Preference policy", "type": "object", "properties": { "scope": { "anyOf": [ { "type": "object", "properties": { "ueId": {"$ref": "#/definitions/UeId"}, "sliceId": {"$ref": "#/definitions/SliceId"}, "qosId": {"$ref": "#/definitions/QosId"}, "cellId": {"$ref": "#/definitions/CellId"} }, "additionalProperties": false, "required": ["ueId", "qosId"] }, { "type": "object", "properties": { "sliceId": {"$ref": "#/definitions/SliceId"}, "qosId": {"$ref": "#/definitions/QosId"}, "cellId": {"$ref": "#/definitions/CellId"} }, "additionalProperties": false, "required": ["sliceId", "qosId"] } ] }, "qosObjectives": { "type": "object", "properties": { "gfbr": {"type": "number"}, "mfbr": {"type": "number"}, "priorityLevel": {"type": "number"}, "pdb": {"type": "number"} }, "minProperties": 1, "additionalProperties": false }, "tspResources": { "type": "array", "items": { "$ref": "#/definitions/TspResource" }, "minItems": 1 } }, "additionalProperties": false, "required": ["scope", "qosObjectives", "tspResources"], "definitions": { "UeId": { "type": "string", "pattern": "^[A-Fa-f0-9]{16}$" }, "SliceId": { "type": "object", "properties": { "sst": { "type": "integer", "minimum": 0, "maximum": 255 }, "sd": { "type": "string", "pattern": "^[A-Fa-f0-9]{6}$" }, "plmnId": {"$ref": "#/definitions/PlmnId"} }, "additionalProperties": false, "required": ["sst","plmnId"] }, "QosId": { "oneOf": [ { "type":"object", "properties": { "5qI": { "type": "integer", "minimum": 1, "maximum": 256 } }, "additionalProperties": false, "required": ["5qI"] }, { "type": "object", "properties": { "qcI": { "type": "integer", "minimum": 1, "maximum": 256 } }, "additionalProperties": false, "required": ["qcI"] } ] }, "CellId": { "type": "object", "properties": { "plmnId": {"$ref": "#/definitions/PlmnId"}, "cId": {"$ref": "#/definitions/CId"} }, "additionalProperties": false, "required": ["plmnId", "cId"] }, "CId": { "oneOf": [ { "type":"object", "properties": { "ncI": {"$ref": "#/definitions/NcI"} }, "additionalProperties": false, "required": ["ncI"] }, { "type": "object", "properties": { "ecI": {"$ref": "#/definitions/EcI"} }, "additionalProperties": false, "required": ["ecI"] } ] }, "NcI": { "type": "integer", "minimum": 0, "maximum": 68719476735 }, "EcI": { "type": "integer", "minimum": 0, "maximum": 268435455 }, "PlmnId": { "type": "object", "properties": { "mcc": { "type": "string", "pattern": "^[0-9]{3}$" }, "mnc": { "type": "string", "pattern": "^[0-9]{2,3}$" } }, "additionalProperties": false, "required": ["mcc", "mnc"] }, "PreferenceType": { "type": "string", "enum": [ "SHALL", "PREFER", "AVOID", "FORBID" ] }, "CellIdList": { "type":"array", "items": { "$ref": "#/definitions/CellId" } }, "TspResource": { "type": "object", "properties": { "cellIdList": {"$ref": "#/definitions/CellIdList"}, "preference": {"$ref": "#/definitions/PreferenceType"}, "primary": {"type": "boolean"} }, "required": ["cellIdList", "preference"], "additionalProperties": false } } }` diff --git a/go/policy_schemas/qos_target/v2/qos_target.go b/go/policy_schemas/qos_target/v2/qos_target.go index 7c8a6c9..6c287f4 100644 --- a/go/policy_schemas/qos_target/v2/qos_target.go +++ b/go/policy_schemas/qos_target/v2/qos_target.go @@ -25,26 +25,26 @@ func (r *API) Marshal() ([]byte, error) { // O-RAN standard QoS Target policy type API struct { QosObjectives QosObjectives `json:"qosObjectives"` - Scope Scope `json:"scope"` + Scope Scope `json:"scope"` } type QosObjectives struct { - Gfbr *float64 `json:"gfbr,omitempty"` - Mfbr *float64 `json:"mfbr,omitempty"` - Pdb *float64 `json:"pdb,omitempty"` + Gfbr *float64 `json:"gfbr,omitempty"` + Mfbr *float64 `json:"mfbr,omitempty"` + Pdb *float64 `json:"pdb,omitempty"` PriorityLevel *float64 `json:"priorityLevel,omitempty"` } type Scope struct { - CellID *CellID `json:"cellId,omitempty"` + CellID *CellID `json:"cellId,omitempty"` GroupID *GroupID `json:"groupId,omitempty"` - QosID QosID `json:"qosId"` - UeID *string `json:"ueId,omitempty"` + QosID QosID `json:"qosId"` + UeID *string `json:"ueId,omitempty"` SliceID *SliceID `json:"sliceId,omitempty"` } type CellID struct { - CID CID `json:"cId"` + CID CID `json:"cId"` PlmnID PlmnID `json:"plmnId"` } @@ -59,7 +59,7 @@ type PlmnID struct { } type GroupID struct { - SPID *int64 `json:"spId,omitempty"` + SPID *int64 `json:"spId,omitempty"` RfspIndex *int64 `json:"rfspIndex,omitempty"` } @@ -69,9 +69,9 @@ type QosID struct { } type SliceID struct { - PlmnID PlmnID `json:"plmnId"` + PlmnID PlmnID `json:"plmnId"` SD *string `json:"sd,omitempty"` - Sst int64 `json:"sst"` + Sst int64 `json:"sst"` } var RawSchema = `{ "$schema": "http://json-schema.org/draft-07/schema#", "description": "O-RAN standard QoS Target policy", "type": "object", "properties": { "scope": { "anyOf": [ { "type": "object", "properties": { "ueId": {"$ref": "#/definitions/UeId"}, "groupId": {"$ref": "#/definitions/GroupId"}, "qosId": {"$ref": "#/definitions/QosId"}, "cellId": {"$ref": "#/definitions/CellId"} }, "additionalProperties": false, "required": ["ueId", "qosId"] }, { "type": "object", "properties": { "ueId": {"$ref": "#/definitions/UeId"}, "sliceId": {"$ref": "#/definitions/SliceId"}, "qosId": {"$ref": "#/definitions/QosId"}, "cellId": {"$ref": "#/definitions/CellId"} }, "additionalProperties": false, "required": ["ueId", "qosId"] }, { "type": "object", "properties": { "groupId": {"$ref": "#/definitions/GroupId"}, "qosId": {"$ref": "#/definitions/QosId"}, "cellId": {"$ref": "#/definitions/CellId"} }, "additionalProperties": false, "required": ["groupId", "qosId"] }, { "type": "object", "properties": { "sliceId": {"$ref": "#/definitions/SliceId"}, "qosId": {"$ref": "#/definitions/QosId"}, "cellId": {"$ref": "#/definitions/CellId"} }, "additionalProperties": false, "required": ["sliceId", "qosId"] }, { "type": "object", "properties": { "qosId": {"$ref": "#/definitions/QosId"}, "cellId": {"$ref": "#/definitions/CellId"} }, "additionalProperties": false, "required": ["qosId"] } ] }, "qosObjectives": { "type": "object", "properties": { "gfbr": {"type": "number"}, "mfbr": {"type": "number"}, "priorityLevel": {"type": "number"}, "pdb": {"type": "number"} }, "minProperties": 1, "additionalProperties": false } }, "additionalProperties": false, "required": ["scope", "qosObjectives"], "definitions": { "UeId": { "type": "string", "pattern": "^[A-Fa-f0-9]{16}$" }, "GroupId": { "oneOf": [ { "type":"object", "properties": { "spId": { "type": "integer", "minimum": 1, "maximum": 256 } }, "additionalProperties": false, "required": ["spId"] }, { "type": "object", "properties": { "rfspIndex": { "type": "integer", "minimum": 1, "maximum": 256 } }, "additionalProperties": false, "required": ["rfspIndex"] } ] }, "SliceId": { "type": "object", "properties": { "sst": { "type": "integer", "minimum": 0, "maximum": 255 }, "sd": { "type": "string", "pattern": "^[A-Fa-f0-9]{6}$" }, "plmnId": {"$ref": "#/definitions/PlmnId"} }, "additionalProperties": false, "required": ["sst","plmnId"] }, "QosId": { "oneOf": [ { "type":"object", "properties": { "5qI": { "type": "integer", "minimum": 1, "maximum": 256 } }, "additionalProperties": false, "required": ["5qI"] }, { "type": "object", "properties": { "qcI": { "type": "integer", "minimum": 1, "maximum": 256 } }, "additionalProperties": false, "required": ["qcI"] } ] }, "CellId": { "type": "object", "properties": { "plmnId": {"$ref": "#/definitions/PlmnId"}, "cId": {"$ref": "#/definitions/CId"} }, "additionalProperties": false, "required": ["plmnId", "cId"] }, "CId": { "oneOf": [ { "type":"object", "properties": { "ncI": {"$ref": "#/definitions/NcI"} }, "additionalProperties": false, "required": ["ncI"] }, { "type": "object", "properties": { "ecI": {"$ref": "#/definitions/EcI"} }, "additionalProperties": false, "required": ["ecI"] } ] }, "NcI": { "type": "integer", "minimum": 0, "maximum": 68719476735 }, "EcI": { "type": "integer", "minimum": 0, "maximum": 268435455 }, "PlmnId": { "type": "object", "properties": { "mcc": { "type": "string", "pattern": "^[0-9]{3}$" }, "mnc": { "type": "string", "pattern": "^[0-9]{2,3}$" } }, "additionalProperties": false, "required": ["mcc", "mnc"] } } }` diff --git a/go/policy_schemas/slice_sla_target/v1/slice_sla_target.go b/go/policy_schemas/slice_sla_target/v1/slice_sla_target.go index 8790313..78f42bf 100644 --- a/go/policy_schemas/slice_sla_target/v1/slice_sla_target.go +++ b/go/policy_schemas/slice_sla_target/v1/slice_sla_target.go @@ -24,8 +24,8 @@ func (r *API) Marshal() ([]byte, error) { // O-RAN standard slice SLA policy type API struct { - Scope Scope `json:"scope"` - SliceSlaObjectives SliceSlaObjectives `json:"sliceSlaObjectives"` + Scope Scope `json:"scope"` + SliceSlaObjectives SliceSlaObjectives `json:"sliceSlaObjectives"` SliceSlaResources *SliceSlaResources `json:"sliceSlaResources,omitempty"` } @@ -34,9 +34,9 @@ type Scope struct { } type SliceID struct { - PlmnID PlmnID `json:"plmnId"` + PlmnID PlmnID `json:"plmnId"` SD *string `json:"sd,omitempty"` - Sst int64 `json:"sst"` + Sst int64 `json:"sst"` } type PlmnID struct { @@ -45,23 +45,23 @@ type PlmnID struct { } type SliceSlaObjectives struct { - GuaDLThptPerSlice *float64 `json:"guaDlThptPerSlice,omitempty"` - GuaULThptPerSlice *float64 `json:"guaUlThptPerSlice,omitempty"` - MaxDLThptPerSlice *float64 `json:"maxDlThptPerSlice,omitempty"` - MaxDLThptPerUe *float64 `json:"maxDlThptPerUe,omitempty"` + GuaDLThptPerSlice *float64 `json:"guaDlThptPerSlice,omitempty"` + GuaULThptPerSlice *float64 `json:"guaUlThptPerSlice,omitempty"` + MaxDLThptPerSlice *float64 `json:"maxDlThptPerSlice,omitempty"` + MaxDLThptPerUe *float64 `json:"maxDlThptPerUe,omitempty"` MaxNumberOfPduSessions *float64 `json:"maxNumberOfPduSessions,omitempty"` - MaxNumberOfUes *float64 `json:"maxNumberOfUes,omitempty"` - MaxULThptPerSlice *float64 `json:"maxUlThptPerSlice,omitempty"` - MaxULThptPerUe *float64 `json:"maxUlThptPerUe,omitempty"` + MaxNumberOfUes *float64 `json:"maxNumberOfUes,omitempty"` + MaxULThptPerSlice *float64 `json:"maxUlThptPerSlice,omitempty"` + MaxULThptPerUe *float64 `json:"maxUlThptPerUe,omitempty"` } type SliceSlaResources struct { CellIDList []CellID `json:"cellIdList,omitempty"` - TaIList []TaI `json:"taIList,omitempty"` + TaIList []TaI `json:"taIList,omitempty"` } type CellID struct { - CID CID `json:"cId"` + CID CID `json:"cId"` PlmnID PlmnID `json:"plmnId"` } @@ -72,7 +72,7 @@ type CID struct { type TaI struct { PlmnID PlmnID `json:"plmnId"` - Tac string `json:"tac"` + Tac string `json:"tac"` } var RawSchema = `{ "$schema": "http://json-schema.org/draft-07/schema#", "description": "O-RAN standard slice SLA policy", "type": "object", "properties": { "scope": { "type": "object", "properties": { "sliceId": {"$ref": "#/definitions/SliceId"} }, "additionalProperties": false, "required": ["sliceId"] }, "sliceSlaObjectives": { "type": "object", "properties": { "maxNumberOfUes": {"type": "number"}, "maxNumberOfPduSessions": {"type": "number"}, "guaDlThptPerSlice": {"type": "number"}, "maxDlThptPerSlice": {"type": "number"}, "maxDlThptPerUe": {"type": "number"}, "guaUlThptPerSlice": {"type": "number"}, "maxUlThptPerSlice": {"type": "number"}, "maxUlThptPerUe": {"type": "number"} }, "minProperties": 1, "additionalProperties": false }, "sliceSlaResources": { "type": "object", "properties": { "cellIdList": {"$ref": "#/definitions/CellIdList"}, "taIList": {"$ref": "#/definitions/TaIList"} }, "additionalProperties": false, "oneOf": [ {"required": ["cellIdList"]}, {"required": ["taIList"]} ] } }, "additionalProperties": false, "required": ["scope", "sliceSlaObjectives"], "definitions": { "SliceId": { "type": "object", "properties": { "sst": { "type": "integer", "minimum": 0, "maximum": 255 }, "sd": { "type": "string", "pattern": "^[A-Fa-f0-9]{6}$" }, "plmnId": {"$ref": "#/definitions/PlmnId"} }, "additionalProperties": false, "required": ["sst","plmnId"] }, "CellId": { "type": "object", "properties": { "plmnId": {"$ref": "#/definitions/PlmnId"}, "cId": {"$ref": "#/definitions/CId"} }, "additionalProperties": false, "required": ["plmnId", "cId"] }, "CId": { "oneOf": [ { "type":"object", "properties": { "ncI": {"$ref": "#/definitions/NcI"} }, "additionalProperties": false, "required": ["ncI"] }, { "type": "object", "properties": { "ecI": {"$ref": "#/definitions/EcI"} }, "additionalProperties": false, "required": ["ecI"] } ] }, "NcI": { "type": "integer", "minimum": 0, "maximum": 68719476735 }, "EcI": { "type": "integer", "minimum": 0, "maximum": 268435455 }, "PlmnId": { "type": "object", "properties": { "mcc": { "type": "string", "pattern": "^[0-9]{3}$" }, "mnc": { "type": "string", "pattern": "^[0-9]{2,3}$" } }, "additionalProperties": false, "required": ["mcc", "mnc"] }, "TaI": { "type": "object", "properties": { "plmnId": {"$ref": "#/definitions/PlmnId"}, "tac": { "type": "string", "pattern": "^[A-Fa-f0-9]{6}$" } }, "additionalProperties": false, "required": ["plmnId","tac"] }, "CellIdList": { "type":"array", "items": { "$ref": "#/definitions/CellId" } }, "TaIList": { "type":"array", "items": { "$ref": "#/definitions/TaI" } } } }` diff --git a/go/policy_schemas/traffic_steering_preference/v2/traffic_steering_preference.go b/go/policy_schemas/traffic_steering_preference/v2/traffic_steering_preference.go index fb95b2f..cc83110 100644 --- a/go/policy_schemas/traffic_steering_preference/v2/traffic_steering_preference.go +++ b/go/policy_schemas/traffic_steering_preference/v2/traffic_steering_preference.go @@ -24,19 +24,19 @@ func (r *API) Marshal() ([]byte, error) { // O-RAN standard Traffic Steering Preference policy type API struct { - Scope Scope `json:"scope"` + Scope Scope `json:"scope"` TSPResources []TSPResource `json:"tspResources"` } type Scope struct { - CellID *CellID `json:"cellId,omitempty"` - QosID *QosID `json:"qosId,omitempty"` + CellID *CellID `json:"cellId,omitempty"` + QosID *QosID `json:"qosId,omitempty"` SliceID *SliceID `json:"sliceId,omitempty"` - UeID *string `json:"ueId,omitempty"` + UeID *string `json:"ueId,omitempty"` } type CellID struct { - CID CID `json:"cId"` + CID CID `json:"cId"` PlmnID PlmnID `json:"plmnId"` } @@ -56,23 +56,24 @@ type QosID struct { } type SliceID struct { - PlmnID PlmnID `json:"plmnId"` + PlmnID PlmnID `json:"plmnId"` SD *string `json:"sd,omitempty"` - Sst int64 `json:"sst"` + Sst int64 `json:"sst"` } type TSPResource struct { - CellIDList []CellID `json:"cellIdList"` - Preference PreferenceType `json:"preference"` + CellIDList []CellID `json:"cellIdList"` + Preference PreferenceType `json:"preference"` Primary *bool `json:"primary,omitempty"` } type PreferenceType string + const ( - Avoid PreferenceType = "AVOID" + Avoid PreferenceType = "AVOID" Forbid PreferenceType = "FORBID" Prefer PreferenceType = "PREFER" - Shall PreferenceType = "SHALL" + Shall PreferenceType = "SHALL" ) var RawSchema = `{ "$schema": "http://json-schema.org/draft-07/schema#", "description": "O-RAN standard Traffic Steering Preference policy", "type": "object", "properties": { "scope": { "anyOf": [ { "type": "object", "properties": { "ueId": {"$ref": "#/definitions/UeId"}, "sliceId": {"$ref": "#/definitions/SliceId"}, "qosId": {"$ref": "#/definitions/QosId"}, "cellId": {"$ref": "#/definitions/CellId"} }, "additionalProperties": false, "required": ["ueId"] }, { "type": "object", "properties": { "sliceId": {"$ref": "#/definitions/SliceId"}, "qosId": {"$ref": "#/definitions/QosId"}, "cellId": {"$ref": "#/definitions/CellId"} }, "additionalProperties": false, "required": ["sliceId"] } ] }, "tspResources": { "type": "array", "items": { "$ref": "#/definitions/TspResource" }, "minItems": 1 } }, "additionalProperties": false, "required": ["scope", "tspResources"], "definitions": { "UeId": { "type": "string", "pattern": "^[A-Fa-f0-9]{16}$" }, "SliceId": { "type": "object", "properties": { "sst": { "type": "integer", "minimum": 0, "maximum": 255 }, "sd": { "type": "string", "pattern": "^[A-Fa-f0-9]{6}$" }, "plmnId": {"$ref": "#/definitions/PlmnId"} }, "additionalProperties": false, "required": ["sst","plmnId"] }, "QosId": { "oneOf": [ { "type":"object", "properties": { "5qI": { "type": "integer", "minimum": 1, "maximum": 256 } }, "additionalProperties": false, "required": ["5qI"] }, { "type": "object", "properties": { "qcI": { "type": "integer", "minimum": 1, "maximum": 256 } }, "additionalProperties": false, "required": ["qcI"] } ] }, "CellId": { "type": "object", "properties": { "plmnId": {"$ref": "#/definitions/PlmnId"}, "cId": {"$ref": "#/definitions/CId"} }, "additionalProperties": false, "required": ["plmnId", "cId"] }, "CId": { "oneOf": [ { "type":"object", "properties": { "ncI": {"$ref": "#/definitions/NcI"} }, "additionalProperties": false, "required": ["ncI"] }, { "type": "object", "properties": { "ecI": {"$ref": "#/definitions/EcI"} }, "additionalProperties": false, "required": ["ecI"] } ] }, "NcI": { "type": "integer", "minimum": 0, "maximum": 68719476735 }, "EcI": { "type": "integer", "minimum": 0, "maximum": 268435455 }, "PlmnId": { "type": "object", "properties": { "mcc": { "type": "string", "pattern": "^[0-9]{3}$" }, "mnc": { "type": "string", "pattern": "^[0-9]{2,3}$" } }, "additionalProperties": false, "required": ["mcc", "mnc"] }, "PreferenceType": { "type": "string", "enum": [ "SHALL", "PREFER", "AVOID", "FORBID" ] }, "CellIdList": { "type":"array", "items": { "$ref": "#/definitions/CellId" } }, "TspResource": { "type": "object", "properties": { "cellIdList": {"$ref": "#/definitions/CellIdList"}, "preference": {"$ref": "#/definitions/PreferenceType"}, "primary": {"type": "boolean"} }, "required": ["cellIdList", "preference"], "additionalProperties": false } } }` diff --git a/go/policy_schemas/ue_level_target/v1/ue_level_target.go b/go/policy_schemas/ue_level_target/v1/ue_level_target.go index 003ea02..fb424af 100644 --- a/go/policy_schemas/ue_level_target/v1/ue_level_target.go +++ b/go/policy_schemas/ue_level_target/v1/ue_level_target.go @@ -24,20 +24,20 @@ func (r *API) Marshal() ([]byte, error) { // O-RAN standard UE Level Target policy type API struct { - Scope Scope `json:"scope"` + Scope Scope `json:"scope"` UeLevelObjectives UeLevelObjectives `json:"ueLevelObjectives"` } type Scope struct { - CellID *CellID `json:"cellId,omitempty"` + CellID *CellID `json:"cellId,omitempty"` GroupID *GroupID `json:"groupId,omitempty"` SliceID *SliceID `json:"sliceId,omitempty"` - UeID string `json:"ueId"` - QosID *QosID `json:"qosId,omitempty"` + UeID string `json:"ueId"` + QosID *QosID `json:"qosId,omitempty"` } type CellID struct { - CID CID `json:"cId"` + CID CID `json:"cId"` PlmnID PlmnID `json:"plmnId"` } @@ -52,7 +52,7 @@ type PlmnID struct { } type GroupID struct { - SPID *int64 `json:"spId,omitempty"` + SPID *int64 `json:"spId,omitempty"` RfspIndex *int64 `json:"rfspIndex,omitempty"` } @@ -62,24 +62,24 @@ type QosID struct { } type SliceID struct { - PlmnID PlmnID `json:"plmnId"` + PlmnID PlmnID `json:"plmnId"` SD *string `json:"sd,omitempty"` - Sst int64 `json:"sst"` + Sst int64 `json:"sst"` } type UeLevelObjectives struct { - DLPacketDelay *float64 `json:"dlPacketDelay,omitempty"` - DLReliability *ReliabilityType `json:"dlReliability,omitempty"` + DLPacketDelay *float64 `json:"dlPacketDelay,omitempty"` + DLReliability *ReliabilityType `json:"dlReliability,omitempty"` DLRlcSduPacketLossRate *float64 `json:"dlRlcSduPacketLossRate ,omitempty"` - DLThroughput *float64 `json:"dlThroughput,omitempty"` - ULPacketDelay *float64 `json:"ulPacketDelay,omitempty"` + DLThroughput *float64 `json:"dlThroughput,omitempty"` + ULPacketDelay *float64 `json:"ulPacketDelay,omitempty"` ULPdcpSduPacketLossRate *float64 `json:"ulPdcpSduPacketLossRate,omitempty"` - ULReliability *ReliabilityType `json:"ulReliability,omitempty"` - ULThroughput *float64 `json:"ulThroughput,omitempty"` + ULReliability *ReliabilityType `json:"ulReliability,omitempty"` + ULThroughput *float64 `json:"ulThroughput,omitempty"` } type ReliabilityType struct { - PacketSize float64 `json:"packetSize"` + PacketSize float64 `json:"packetSize"` SuccessProbility float64 `json:"successProbility"` UserPlaneLatency float64 `json:"userPlaneLatency"` } diff --git a/go/policy_scope_id/v2/policy_scope_identifier.go b/go/policy_scope_id/v2/policy_scope_identifier.go index d065e5a..8a42a42 100644 --- a/go/policy_scope_id/v2/policy_scope_identifier.go +++ b/go/policy_scope_id/v2/policy_scope_identifier.go @@ -28,15 +28,15 @@ type API struct { } type Scope struct { - UeID *string `json:"ueId,omitempty"` + UeID *string `json:"ueId,omitempty"` GroupID *GroupID `json:"groupId,omitempty"` SliceID *SliceID `json:"sliceId,omitempty"` - QosID *QosID `json:"qosId,omitempty"` - CellID *CellID `json:"cellId,omitempty"` + QosID *QosID `json:"qosId,omitempty"` + CellID *CellID `json:"cellId,omitempty"` } type CellID struct { - CID CID `json:"cId"` + CID CID `json:"cId"` PlmnID PlmnID `json:"plmnId"` } @@ -51,7 +51,7 @@ type PlmnID struct { } type GroupID struct { - SPID *int64 `json:"spId,omitempty"` + SPID *int64 `json:"spId,omitempty"` RfspIndex *int64 `json:"rfspIndex,omitempty"` } @@ -61,9 +61,9 @@ type QosID struct { } type SliceID struct { - PlmnID PlmnID `json:"plmnId"` + PlmnID PlmnID `json:"plmnId"` SD *string `json:"sd,omitempty"` - Sst int64 `json:"sst"` + Sst int64 `json:"sst"` } var RawSchema = `{ "$schema": "http://json-schema.org/draft-07/schema#", "description": "scope identifier definitions", "type": "object", "properties": { "scope": { "anyOf": [ { "type": "object", "properties": { "ueId": {"$ref": "#/definitions/UeId"} }, "required": ["ueId"] }, { "type": "object", "properties": { "groupId": {"$ref": "#/definitions/GroupId"} }, "required": ["groupId"] }, { "type": "object", "properties": { "sliceId": {"$ref": "#/definitions/SliceId"} }, "required": ["sliceId"] }, { "type": "object", "properties": { "qosId": {"$ref": "#/definitions/QosId"} }, "required": ["qosId"] }, { "type": "object", "properties": { "cellId": {"$ref": "#/definitions/CellId"} }, "required": ["cellId"] } ] } }, "additionalProperties": false, "required": ["scope"], "definitions": { "UeId": { "type": "string", "pattern": "^[A-Fa-f0-9]{16}$" }, "GroupId": { "oneOf": [ { "type":"object", "properties": { "spId": { "type": "integer", "minimum": 1, "maximum": 256 } }, "additionalProperties": false, "required": ["spId"] }, { "type": "object", "properties": { "rfspIndex": { "type": "integer", "minimum": 1, "maximum": 256 } }, "additionalProperties": false, "required": ["rfspIndex"] } ] }, "SliceId": { "type": "object", "properties": { "sst": { "type": "integer", "minimum": 0, "maximum": 255 }, "sd": { "type": "string", "pattern": "^[A-Fa-f0-9]{6}$" }, "plmnId": {"$ref": "#/definitions/PlmnId"} }, "additionalProperties": false, "required": ["sst","plmnId"] }, "QosId": { "oneOf": [ { "type":"object", "properties": { "5qI": { "type": "integer", "minimum": 1, "maximum": 256 } }, "additionalProperties": false, "required": ["5qI"] }, { "type": "object", "properties": { "qcI": { "type": "integer", "minimum": 1, "maximum": 256 } }, "additionalProperties": false, "required": ["qcI"] } ] }, "CellId": { "type": "object", "properties": { "plmnId": {"$ref": "#/definitions/PlmnId"}, "cId": {"$ref": "#/definitions/CId"} }, "additionalProperties": false, "required": ["plmnId", "cId"] }, "CId": { "oneOf": [ { "type":"object", "properties": { "ncI": {"$ref": "#/definitions/NcI"} }, "additionalProperties": false, "required": ["ncI"] }, { "type": "object", "properties": { "ecI": {"$ref": "#/definitions/EcI"} }, "additionalProperties": false, "required": ["ecI"] } ] }, "NcI": { "type": "integer", "minimum": 0, "maximum": 68719476735 }, "EcI": { "type": "integer", "minimum": 0, "maximum": 268435455 }, "PlmnId": { "type": "object", "properties": { "mcc": { "type": "string", "pattern": "^[0-9]{3}$" }, "mnc": { "type": "string", "pattern": "^[0-9]{2,3}$" } }, "additionalProperties": false, "required": ["mcc", "mnc"] } } }` diff --git a/go/policy_status/v2/policy_status.go b/go/policy_status/v2/policy_status.go index bbf391b..47c5826 100644 --- a/go/policy_status/v2/policy_status.go +++ b/go/policy_status/v2/policy_status.go @@ -25,19 +25,21 @@ func (r *API) Marshal() ([]byte, error) { // O-RAN standard policy status type API struct { EnforceReason *EnforceReason `json:"enforceReason,omitempty"` - EnforceStatus EnforceStatus `json:"enforceStatus"` + EnforceStatus EnforceStatus `json:"enforceStatus"` } type EnforceReason string + const ( - OtherReason EnforceReason = "OTHER_REASON" - ScopeNotApplicable EnforceReason = "SCOPE_NOT_APPLICABLE" + OtherReason EnforceReason = "OTHER_REASON" + ScopeNotApplicable EnforceReason = "SCOPE_NOT_APPLICABLE" StatementNotApplicable EnforceReason = "STATEMENT_NOT_APPLICABLE" ) type EnforceStatus string + const ( - Enforced EnforceStatus = "ENFORCED" + Enforced EnforceStatus = "ENFORCED" NotEnforced EnforceStatus = "NOT_ENFORCED" )