Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add O-RAN CCC service model #392

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/esm_ccc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2024 Intel Corporation

name: e2sm_ccc
on:
push:
branches:
- master
pull_request:

env:
E2T_MOD: github.com/onosproject/onos-e2t@master
ONOS_E2_SM_VERSION: latest

jobs:
e2sm_ccc:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./servicemodels/e2sm_ccc
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Build
run: go build -o build/_output/e2sm_ccc.so.1.0.0 -buildmode=plugin .

- name: Unit tests
run: go test -race ./...

- name: docker-build
run: |
cd ../..
./build/bin/build-deps e2sm_ccc $E2T_MOD onosproject/service-model-docker-e2sm_ccc-1.0.0:$ONOS_E2_SM_VERSION
docker build . -f build/plugins/Dockerfile \
--build-arg PLUGIN_MAKE_TARGET="e2sm_ccc" \
--build-arg PLUGIN_MAKE_VERSION="1.0.0" \
-t onosproject/service-model-docker-e2sm_ccc-1.0.0:$ONOS_E2_SM_VERSION
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include ./build/build-tools/make/onf-common.mk

PHONY:build
build: # @HELP build all libraries
build: build/_output/e2sm_kpm.so.1.0.0 build/_output/e2sm_kpm_v2.so.1.0.0 build/_output/e2sm_kpm_v2_go.so.1.0.0 build/_output/e2sm_ni.so.1.0.0 build/_output/e2sm_rc_pre.so.1.0.0 build/_output/e2sm_mho.so.1.0.0 build/_output/e2sm_rsm.so.1.0.0 build/_output/e2sm_rc_pre_go.so.1.0.0 build/_output/e2sm_mho_go.so.1.0.0 build/_output/e2sm_rc.so.1.0.0
build: build/_output/e2sm_kpm.so.1.0.0 build/_output/e2sm_kpm_v2.so.1.0.0 build/_output/e2sm_kpm_v2_go.so.1.0.0 build/_output/e2sm_ni.so.1.0.0 build/_output/e2sm_rc_pre.so.1.0.0 build/_output/e2sm_mho.so.1.0.0 build/_output/e2sm_rsm.so.1.0.0 build/_output/e2sm_rc_pre_go.so.1.0.0 build/_output/e2sm_mho_go.so.1.0.0 build/_output/e2sm_rc.so.1.0.0 build/_output/e2sm_ccc.so.1.0.0

build/_output/e2sm_kpm.so.1.0.0: # @HELP build the e2sm_kpm.so.1.0.0
cd servicemodels/e2sm_kpm && CGO_ENABLED=1 go build -o build/_output/e2sm_kpm.so.1.0.0 -buildmode=plugin .
Expand Down Expand Up @@ -50,6 +50,9 @@ build/_output/e2sm_mho.so.1.0.0: # @HELP build the e2sm_mho.so.1.0.1
build/_output/e2sm_rc.so.1.0.0: # @HELP build the e2sm_rc.so.1.0.1
cd servicemodels/e2sm_rc && CGO_ENABLED=1 go build -o build/_output/e2sm_rc.so.1.0.0 -buildmode=plugin .

build/_output/e2sm_ccc.so.1.0.0: # @HELP build the e2sm_ccc.so.1.0.1
cd servicemodels/e2sm_ccc && CGO_ENABLED=1 go build -o build/_output/e2sm_ccc.so.1.0.0 -buildmode=plugin .

build_protoc_gen_cgo:
cd protoc-gen-cgo/ && go build -v -o ./protoc-gen-cgo && cd ..

Expand Down Expand Up @@ -155,6 +158,14 @@ service-model-docker-e2sm_rsm-1.0.0: # @HELP build e2sm_kpm_v2 1.0.0 plugin Dock
--build-arg PLUGIN_MAKE_VERSION="1.0.0" \
-t onosproject/service-model-docker-e2sm_rsm-1.0.0:${ONOS_E2_SM_VERSION}

PHONY: service-model-docker-e2sm_ccc-1.0.0
service-model-docker-e2sm_ccc-1.0.0: # @HELP build e2sm_kpm_v2 1.0.0 plugin Docker image
./build/bin/build-deps e2sm_ccc ${E2T_MOD} onosproject/service-model-docker-e2sm_ccc-1.0.0:${ONOS_E2_SM_VERSION}
docker build . -f build/plugins/Dockerfile \
--build-arg PLUGIN_MAKE_TARGET="e2sm_ccc" \
--build-arg PLUGIN_MAKE_VERSION="1.0.0" \
-t onosproject/service-model-docker-e2sm_ccc-1.0.0:${ONOS_E2_SM_VERSION}

PHONY: service-model-docker-e2sm_ni-1.0.0
service-model-docker-e2sm_ni-1.0.0: # @HELP build e2sm_ni 1.0.0 plugin Docker image
./build/bin/build-deps e2sm_ni ${E2T_MOD}
Expand Down Expand Up @@ -209,7 +220,8 @@ images: build service-model-docker-e2sm_kpm_v2_go-1.0.0 \
service-model-docker-e2sm_rsm-1.0.0 \
service-model-docker-e2sm_rc_pre_go-1.0.0 \
service-model-docker-e2sm_mho_go-1.0.0 \
service-model-docker-e2sm_rc-1.0.0
service-model-docker-e2sm_rc-1.0.0 \
service-model-docker-e2sm_ccc-1.0.0


kind: # @HELP build Docker images and add them to the currently configured kind cluster
Expand Down
24 changes: 23 additions & 1 deletion build/bin/compile-protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,28 @@ protoc -I=$proto_imports:${GOPATH}/src/github.com/onosproject/onos-lib-go/api \
--go_out=. \
e2sm_rc/v1/e2sm_common_ies.proto

protoc -I=$proto_imports:${GOPATH}/src/github.com/onosproject/onos-lib-go/api:${GOPATH}/src/github.com/onosproject/onos-e2-sm/servicemodels \
--proto_path=servicemodels \
--go_out=./servicemodels/ \
e2sm_ccc/v1/e2sm_ccc.proto e2sm_ccc/v1/e2sm_common_ies.proto
protoc-go-inject-tag -input=servicemodels/github.com/onosproject/onos-e2-sm/servicemodels/e2sm_ccc/v1/e2sm-ccc-ies/e2sm_ccc.pb.go

protoc -I=$proto_imports:${GOPATH}/src/github.com/onosproject/onos-lib-go/api \
--validate_out=lang=go:. --proto_path=servicemodels \
--go_out=. \
e2sm_ccc/v1/e2sm_ccc.proto

protoc -I=$proto_imports:${GOPATH}/src/github.com/onosproject/onos-lib-go/api:${GOPATH}/src/github.com/onosproject/onos-e2-sm/servicemodels \
--proto_path=servicemodels \
--go_out=./servicemodels/ \
e2sm_ccc/v1/e2sm_common_ies.proto
protoc-go-inject-tag -input=servicemodels/github.com/onosproject/onos-e2-sm/servicemodels/e2sm_ccc/v1/e2sm-common-ies/e2sm_common_ies.pb.go

protoc -I=$proto_imports:${GOPATH}/src/github.com/onosproject/onos-lib-go/api \
--validate_out=lang=go:. --proto_path=servicemodels \
--go_out=. \
e2sm_ccc/v1/e2sm_common_ies.proto

#protoc -I=$proto_imports:${GOPATH}/src/github.com/onosproject/onos-lib-go/api:${GOPATH}/src/github.com/onosproject/onos-e2-sm/servicemodels \
# --proto_path=servicemodels \
# --go_out=. \
Expand Down Expand Up @@ -141,4 +163,4 @@ cp -r servicemodels/github.com/onosproject/onos-e2-sm/* .
rm -rf servicemodels/github.com

#cp -r e2sm_ni/* ./servicemodels/
#rm -rf e2sm_ni
#rm -rf e2sm_ni
47 changes: 47 additions & 0 deletions servicemodels/e2sm_ccc/encoder/E2SM-CCcRAnfunctionDefinition.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// SPDX-FileCopyrightText: 2023-present Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0

package encoder

import (
"encoding/hex"
e2smcccv1 "github.com/onosproject/onos-e2-sm/servicemodels/e2sm_ccc/v1/e2sm-ccc-ies"
"github.com/onosproject/onos-e2-sm/servicemodels/e2sm_ccc/v1/choiceOptions"
"github.com/onosproject/onos-lib-go/pkg/asn1/aper"
"github.com/onosproject/onos-lib-go/pkg/errors"
)

func PerEncodeE2SmCCcRAnfunctionDefinition(msg *e2smcccv1.E2SmCCcRAnfunctionDefinition) ([]byte, error) {

log.Debugf("Obtained E2SM-CCcRAnfunctionDefinition message is\n%v", msg)
if err := msg.Validate(); err != nil {
return nil, errors.NewInvalid("error validating E2SM-CCcRAnfunctionDefinition PDU %s", err.Error())
}

per, err := aper.MarshalWithParams(msg, "", choiceOptions.E2smCccChoicemap, nil)
if err != nil {
return nil, err
}
log.Debugf("Encoded E2SM-CCcRAnfunctionDefinition PER bytes are\n%v", hex.Dump(per))

return per, nil
}

func PerDecodeE2SmCCcRAnfunctionDefinition(per []byte) (*e2smcccv1.E2SmCCcRAnfunctionDefinition, error) {

log.Debugf("Obtained E2SM-CCcRAnfunctionDefinition PER bytes are\n%v", hex.Dump(per))

result := e2smcccv1.E2SmCCcRAnfunctionDefinition{}
err := aper.UnmarshalWithParams(per, &result, "", choiceOptions.E2smCccChoicemap, nil)
if err != nil {
return nil, err
}

log.Debugf("Decoded E2SM-CCcRAnfunctionDefinition from PER is\n%v", &result)
if err = result.Validate(); err != nil {
return nil, errors.NewInvalid("error validating E2SM-CCcRAnfunctionDefinition PDU %s", err.Error())
}

return &result, nil
}
47 changes: 47 additions & 0 deletions servicemodels/e2sm_ccc/encoder/E2SM-CCcRIcControlHeader.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// SPDX-FileCopyrightText: 2023-present Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0

package encoder

import (
"encoding/hex"
e2smcccv1 "github.com/onosproject/onos-e2-sm/servicemodels/e2sm_ccc/v1/e2sm-ccc-ies"
"github.com/onosproject/onos-e2-sm/servicemodels/e2sm_ccc/v1/choiceOptions"
"github.com/onosproject/onos-lib-go/pkg/asn1/aper"
"github.com/onosproject/onos-lib-go/pkg/errors"
)

func PerEncodeE2SmCCcRIcControlHeader(msg *e2smcccv1.E2SmCCcRIcControlHeader) ([]byte, error) {

log.Debugf("Obtained E2SM-CCcRIcControlHeader message is\n%v", msg)
if err := msg.Validate(); err != nil {
return nil, errors.NewInvalid("error validating E2SM-CCcRIcControlHeader PDU %s", err.Error())
}

per, err := aper.MarshalWithParams(msg, "", choiceOptions.E2smCccChoicemap, nil)
if err != nil {
return nil, err
}
log.Debugf("Encoded E2SM-CCcRIcControlHeader PER bytes are\n%v", hex.Dump(per))

return per, nil
}

func PerDecodeE2SmCCcRIcControlHeader(per []byte) (*e2smcccv1.E2SmCCcRIcControlHeader, error) {

log.Debugf("Obtained E2SM-CCcRIcControlHeader PER bytes are\n%v", hex.Dump(per))

result := e2smcccv1.E2SmCCcRIcControlHeader{}
err := aper.UnmarshalWithParams(per, &result, "", choiceOptions.E2smCccChoicemap, nil)
if err != nil {
return nil, err
}

log.Debugf("Decoded E2SM-CCcRIcControlHeader from PER is\n%v", &result)
if err = result.Validate(); err != nil {
return nil, errors.NewInvalid("error validating E2SM-CCcRIcControlHeader PDU %s", err.Error())
}

return &result, nil
}
47 changes: 47 additions & 0 deletions servicemodels/e2sm_ccc/encoder/E2SM-CCcRIcControlMessage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// SPDX-FileCopyrightText: 2023-present Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0

package encoder

import (
"encoding/hex"
e2smcccv1 "github.com/onosproject/onos-e2-sm/servicemodels/e2sm_ccc/v1/e2sm-ccc-ies"
"github.com/onosproject/onos-e2-sm/servicemodels/e2sm_ccc/v1/choiceOptions"
"github.com/onosproject/onos-lib-go/pkg/asn1/aper"
"github.com/onosproject/onos-lib-go/pkg/errors"
)

func PerEncodeE2SmCCcRIcControlMessage(msg *e2smcccv1.E2SmCCcRIcControlMessage) ([]byte, error) {

log.Debugf("Obtained E2SM-CCcRIcControlMessage message is\n%v", msg)
if err := msg.Validate(); err != nil {
return nil, errors.NewInvalid("error validating E2SM-CCcRIcControlMessage PDU %s", err.Error())
}

per, err := aper.MarshalWithParams(msg, "", choiceOptions.E2smCccChoicemap, nil)
if err != nil {
return nil, err
}
log.Debugf("Encoded E2SM-CCcRIcControlMessage PER bytes are\n%v", hex.Dump(per))

return per, nil
}

func PerDecodeE2SmCCcRIcControlMessage(per []byte) (*e2smcccv1.E2SmCCcRIcControlMessage, error) {

log.Debugf("Obtained E2SM-CCcRIcControlMessage PER bytes are\n%v", hex.Dump(per))

result := e2smcccv1.E2SmCCcRIcControlMessage{}
err := aper.UnmarshalWithParams(per, &result, "", choiceOptions.E2smCccChoicemap, nil)
if err != nil {
return nil, err
}

log.Debugf("Decoded E2SM-CCcRIcControlMessage from PER is\n%v", &result)
if err = result.Validate(); err != nil {
return nil, errors.NewInvalid("error validating E2SM-CCcRIcControlMessage PDU %s", err.Error())
}

return &result, nil
}
47 changes: 47 additions & 0 deletions servicemodels/e2sm_ccc/encoder/E2SM-CCcRIcControlOutcome.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// SPDX-FileCopyrightText: 2023-present Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0

package encoder

import (
"encoding/hex"
e2smcccv1 "github.com/onosproject/onos-e2-sm/servicemodels/e2sm_ccc/v1/e2sm-ccc-ies"
"github.com/onosproject/onos-e2-sm/servicemodels/e2sm_ccc/v1/choiceOptions"
"github.com/onosproject/onos-lib-go/pkg/asn1/aper"
"github.com/onosproject/onos-lib-go/pkg/errors"
)

func PerEncodeE2SmCCcRIcControlOutcome(msg *e2smcccv1.E2SmCCcRIcControlOutcome) ([]byte, error) {

log.Debugf("Obtained E2SM-CCcRIcControlOutcome message is\n%v", msg)
if err := msg.Validate(); err != nil {
return nil, errors.NewInvalid("error validating E2SM-CCcRIcControlOutcome PDU %s", err.Error())
}

per, err := aper.MarshalWithParams(msg, "", choiceOptions.E2smCccChoicemap, nil)
if err != nil {
return nil, err
}
log.Debugf("Encoded E2SM-CCcRIcControlOutcome PER bytes are\n%v", hex.Dump(per))

return per, nil
}

func PerDecodeE2SmCCcRIcControlOutcome(per []byte) (*e2smcccv1.E2SmCCcRIcControlOutcome, error) {

log.Debugf("Obtained E2SM-CCcRIcControlOutcome PER bytes are\n%v", hex.Dump(per))

result := e2smcccv1.E2SmCCcRIcControlOutcome{}
err := aper.UnmarshalWithParams(per, &result, "", choiceOptions.E2smCccChoicemap, nil)
if err != nil {
return nil, err
}

log.Debugf("Decoded E2SM-CCcRIcControlOutcome from PER is\n%v", &result)
if err = result.Validate(); err != nil {
return nil, errors.NewInvalid("error validating E2SM-CCcRIcControlOutcome PDU %s", err.Error())
}

return &result, nil
}
47 changes: 47 additions & 0 deletions servicemodels/e2sm_ccc/encoder/E2SM-CCcRIcIndicationHeader.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// SPDX-FileCopyrightText: 2023-present Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0

package encoder

import (
"encoding/hex"
e2smcccv1 "github.com/onosproject/onos-e2-sm/servicemodels/e2sm_ccc/v1/e2sm-ccc-ies"
"github.com/onosproject/onos-e2-sm/servicemodels/e2sm_ccc/v1/choiceOptions"
"github.com/onosproject/onos-lib-go/pkg/asn1/aper"
"github.com/onosproject/onos-lib-go/pkg/errors"
)

func PerEncodeE2SmCCcRIcIndicationHeader(msg *e2smcccv1.E2SmCCcRIcIndicationHeader) ([]byte, error) {

log.Debugf("Obtained E2SM-CCcRIcIndicationHeader message is\n%v", msg)
if err := msg.Validate(); err != nil {
return nil, errors.NewInvalid("error validating E2SM-CCcRIcIndicationHeader PDU %s", err.Error())
}

per, err := aper.MarshalWithParams(msg, "", choiceOptions.E2smCccChoicemap, nil)
if err != nil {
return nil, err
}
log.Debugf("Encoded E2SM-CCcRIcIndicationHeader PER bytes are\n%v", hex.Dump(per))

return per, nil
}

func PerDecodeE2SmCCcRIcIndicationHeader(per []byte) (*e2smcccv1.E2SmCCcRIcIndicationHeader, error) {

log.Debugf("Obtained E2SM-CCcRIcIndicationHeader PER bytes are\n%v", hex.Dump(per))

result := e2smcccv1.E2SmCCcRIcIndicationHeader{}
err := aper.UnmarshalWithParams(per, &result, "", choiceOptions.E2smCccChoicemap, nil)
if err != nil {
return nil, err
}

log.Debugf("Decoded E2SM-CCcRIcIndicationHeader from PER is\n%v", &result)
if err = result.Validate(); err != nil {
return nil, errors.NewInvalid("error validating E2SM-CCcRIcIndicationHeader PDU %s", err.Error())
}

return &result, nil
}
Loading
Loading