# Abstract: Builds a container to compile Subscription Manager's code
# Date: 28 May 2019
#
-FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:2-u18.04-nng as submgrbuild
+FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:3-u18.04-nng as submgrbuild
RUN apt update && apt install -y iputils-ping net-tools curl tcpdump gdb
var e2asnpacker e2ap.E2APPackerIf = e2ap_wrapper.NewAsn1E2Packer()
+//
+//
+//
func createSubsReq() *e2ap.E2APSubscriptionRequest {
req := &e2ap.E2APSubscriptionRequest{}
req.RequestId.Id = 1
- req.RequestId.Seq = 22
+ req.RequestId.Seq = 0
req.FunctionId = 1
req.EventTriggerDefinition.InterfaceId.GlobalEnbId.Present = true
return req
}
+//
+//
+//
func createSubsResp(req *e2ap.E2APSubscriptionRequest) *e2ap.E2APSubscriptionResponse {
resp := &e2ap.E2APSubscriptionResponse{}
return resp
}
+//
+//
+//
+func createSubsDelReq(e2SubsId uint32) *e2ap.E2APSubscriptionDeleteRequest {
+ req := &e2ap.E2APSubscriptionDeleteRequest{}
+ req.RequestId.Id = 1
+ req.RequestId.Seq = e2SubsId
+ req.FunctionId = 1
+ return req
+}
+
+//
+//
+//
+func createSubsDelResp(req *e2ap.E2APSubscriptionDeleteRequest) *e2ap.E2APSubscriptionDeleteResponse {
+ resp := &e2ap.E2APSubscriptionDeleteResponse{}
+ resp.RequestId.Id = req.RequestId.Id
+ resp.RequestId.Seq = req.RequestId.Seq
+ resp.FunctionId = req.FunctionId
+ return resp
+}
+
//-----------------------------------------------------------------------------
// TestSubRequestSubResponseOk
//
+// stub stub
// +-------+ +---------+ +---------+
// | xapp | | submgr | | e2term |
// +-------+ +---------+ +---------+
// | SubResp | |
// |<-------------| |
// | | |
+// | | |
+// | SubDelReq | |
+// |------------->| |
+// | | |
+// | | SubDelReq |
+// | |------------->|
+// | | |
+// | | SubDelResp |
+// | |<-------------|
+// | | |
+// | SubDelResp | |
+// |<-------------| |
//
//-----------------------------------------------------------------------------
-func TestSubRequestSubResponseOk(t *testing.T) {
+func TestSubReqAndSubDelOk(t *testing.T) {
- xapp.Logger.Info("TestSimple start")
+ xapp.Logger.Info("TestSubReqAndSubDelOk start")
e2SubsReq := e2asnpacker.NewPackerSubscriptionRequest()
e2SubsResp := e2asnpacker.NewPackerSubscriptionResponse()
+ e2SubsDelReq := e2asnpacker.NewPackerSubscriptionDeleteRequest()
+ e2SubsDelResp := e2asnpacker.NewPackerSubscriptionDeleteResponse()
+ var e2SubsId int
//---------------------------------
- // xapp activity
+ // xapp activity: Send Subs Req
//---------------------------------
select {
case <-time.After(5 * time.Second):
+ xapp.Logger.Info("(xappConn) Send Subs Req")
req := createSubsReq()
e2SubsReq.Set(req)
xapp.Logger.Debug("%s", e2SubsReq.String())
err, packedMsg := e2SubsReq.Pack(nil)
if err != nil {
testError(t, "(xappConn) pack NOK %s", err.Error())
- } else {
- xapp.Logger.Info("(xappConn) pack OK")
}
params := &xapp.RMRParams{}
}
//---------------------------------
- // e2term activity
+ // e2term activity: Recv Subs Req & Send Subs Resp
//---------------------------------
select {
case msg := <-e2termConn.rmrConChan:
if msg.Mtype != xapp.RICMessageTypes["RIC_SUB_REQ"] {
testError(t, "(e2termConn) Received non RIC_SUB_REQ message")
} else {
-
+ xapp.Logger.Info("(e2termConn) Recv Subs Req & Send Subs Resp")
packedData := &packer.PackedData{}
packedData.Buf = msg.Payload
unpackerr := e2SubsReq.UnPack(packedData)
packerr, packedMsg := e2SubsResp.Pack(nil)
if packerr != nil {
testError(t, "(e2termConn) pack NOK %s", packerr.Error())
- } else {
- xapp.Logger.Info("(e2termConn) pack OK")
}
params := &xapp.RMRParams{}
}
//---------------------------------
- // xapp activity
+ // xapp activity: Recv Subs Resp
//---------------------------------
select {
case msg := <-xappConn.rmrConChan:
if msg.Mtype != xapp.RICMessageTypes["RIC_SUB_RESP"] {
testError(t, "(xappConn) Received non RIC_SUB_RESP message")
} else {
+ xapp.Logger.Info("(xappConn) Recv Subs Resp")
packedData := &packer.PackedData{}
packedData.Buf = msg.Payload
+ e2SubsId = msg.SubId
unpackerr := e2SubsResp.UnPack(packedData)
+
if unpackerr != nil {
testError(t, "(xappConn) RIC_SUB_RESP unpack failed err: %s", unpackerr.Error())
}
testError(t, "(xappConn) Not Received RIC_SUB_RESP within 15 secs")
}
+ //---------------------------------
+ // xapp activity: Send Subs Del Req
+ //---------------------------------
+ select {
+ case <-time.After(2 * time.Second):
+ xapp.Logger.Info("(xappConn) Send Subs Del Req")
+ req := createSubsDelReq(uint32(e2SubsId))
+ e2SubsDelReq.Set(req)
+ xapp.Logger.Debug("%s", e2SubsDelReq.String())
+ err, packedMsg := e2SubsDelReq.Pack(nil)
+ if err != nil {
+ testError(t, "(xappConn) pack NOK %s", err.Error())
+ }
+
+ params := &xapp.RMRParams{}
+ params.Mtype = xapp.RIC_SUB_DEL_REQ
+ params.SubId = e2SubsId
+ params.Payload = packedMsg.Buf
+ params.Meid = &xapp.RMRMeid{RanName: "RAN_NAME_1"}
+ params.Xid = "XID_1"
+ params.Mbuf = nil
+
+ snderr := xappConn.RmrSend(params)
+ if snderr != nil {
+ testError(t, "(xappConn) RMR SEND FAILED: %s", snderr.Error())
+ }
+ }
+
+ //---------------------------------
+ // e2term activity: Recv Subs Del Req & Send Subs Del Resp
+ //---------------------------------
+ select {
+ case msg := <-e2termConn.rmrConChan:
+ if msg.Mtype != xapp.RICMessageTypes["RIC_SUB_DEL_REQ"] {
+ testError(t, "(e2termConn) Received non RIC_SUB_DEL_REQ message")
+ } else {
+ xapp.Logger.Info("(e2termConn) Recv Subs Del Req & Send Subs Del Resp")
+
+ packedData := &packer.PackedData{}
+ packedData.Buf = msg.Payload
+ unpackerr := e2SubsDelReq.UnPack(packedData)
+ if unpackerr != nil {
+ testError(t, "(e2termConn) RIC_SUB_DEL_REQ unpack failed err: %s", unpackerr.Error())
+ }
+ geterr, req := e2SubsDelReq.Get()
+ if geterr != nil {
+ testError(t, "(e2termConn) RIC_SUB_DEL_REQ get failed err: %s", geterr.Error())
+ }
+
+ resp := createSubsDelResp(req)
+ e2SubsDelResp.Set(resp)
+ xapp.Logger.Debug("%s", e2SubsDelResp.String())
+ packerr, packedMsg := e2SubsDelResp.Pack(nil)
+ if packerr != nil {
+ testError(t, "(e2termConn) pack NOK %s", packerr.Error())
+ }
+
+ params := &xapp.RMRParams{}
+ params.Mtype = xapp.RIC_SUB_DEL_RESP
+ params.SubId = msg.SubId
+ params.Payload = packedMsg.Buf
+ params.Meid = msg.Meid
+ params.Xid = msg.Xid
+ params.Mbuf = nil
+
+ snderr := e2termConn.RmrSend(params)
+ if snderr != nil {
+ testError(t, "(e2termConn) RMR SEND FAILED: %s", snderr.Error())
+ }
+
+ }
+ case <-time.After(15 * time.Second):
+ testError(t, "(e2termConn) Not Received RIC_SUB_DEL_REQ within 15 secs")
+ }
+
+ //---------------------------------
+ // xapp activity: Recv Subs Del Resp
+ //---------------------------------
+ select {
+ case msg := <-xappConn.rmrConChan:
+ if msg.Mtype != xapp.RICMessageTypes["RIC_SUB_DEL_RESP"] {
+ testError(t, "(xappConn) Received non RIC_SUB_DEL_RESP message")
+ } else {
+ xapp.Logger.Info("(xappConn) Recv Subs Del Resp")
+
+ packedData := &packer.PackedData{}
+ packedData.Buf = msg.Payload
+ unpackerr := e2SubsDelResp.UnPack(packedData)
+ if unpackerr != nil {
+ testError(t, "(xappConn) RIC_SUB_DEL_RESP unpack failed err: %s", unpackerr.Error())
+ }
+ geterr, _ := e2SubsDelResp.Get()
+ if geterr != nil {
+ testError(t, "(xappConn) RIC_SUB_DEL_RESP get failed err: %s", geterr.Error())
+ }
+
+ }
+ case <-time.After(15 * time.Second):
+ testError(t, "(xappConn) Not Received RIC_SUB_DEL_RESP within 15 secs")
+ }
+
}
+++ /dev/null
-# DBaaS Stub Platform Component\r
-## General Description\r
-__DBaaS__ is a Stub provides SDL backend Stub for xApp-Frame based components\r
-* vanilla Redis instace from DockerHub\r
-\r
+++ /dev/null
-#
-#==================================================================================
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#==================================================================================
-#
-#
-# Abstract: DBaaS Stub Platform Component Kubernetes manifest
-# Date: 28 May 2019
-#
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: dbaas
- namespace: ricplt
-spec:
- replicas: 1
- selector:
- matchLabels:
- app: dbaas
- template:
- metadata:
- labels:
- app: dbaas
- spec:
- containers:
- - name: dbaas
- image: redis
- ports:
- - containerPort: 6379
+++ /dev/null
-#
-#==================================================================================
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#==================================================================================
-#
-#
-# Abstract: DBaaS Stub Platform Component service manifest
-# Date: 28 May 2019
-#
-kind: Service
-apiVersion: v1
-metadata:
- name: dbaas
- namespace: ricplt
-spec:
- selector:
- app: dbaas
- clusterIP: None
- ports:
- - name: redis
- port: 6379
- protocol: TCP
-
+++ /dev/null
-# E2T Test platform component\r
-Base project: https://gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp\r
-## General Description\r
-__E2T__ is a platform component stub which has following behaviors\r
-* Receives, decodes and prints out the content of RMR messages\r
-* Sends Subscription Response message (12011) to each RMR message using it's sub_id\r
-* Sends Subscription Response with invalid subscription ID in every 14 second\r
-* Sends Subscription Response with malformed payload in every 14 second\r
-* Set `E2T_RAWDATA` to override default encoded payload (use hex dump format)\r
-\r
-\r
+++ /dev/null
-#!/bin/sh -e
-#
-#==================================================================================
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#==================================================================================
-#
-#
-# Mnemonic: test/e2t/build.sh
-# Abstract: Creates E2T Stub Platform Component docker container
-# Date: 28 May 2019
-#
-
-echo 'Creating E2T container'
-docker build --no-cache --tag=e2t:builder -f container/Dockerfile ../..
+++ /dev/null
-#
-#==================================================================================
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#==================================================================================
-#
-#
-# Abstract: Builds E2T stub container
-# Date: 28 May 2019
-#
-
-FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:1-u18.04-nng1.1.1 as submgrbuild
-
-# Install RMr shared library
-RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr_1.9.0_amd64.deb/download.deb && dpkg -i rmr_1.9.0_amd64.deb && rm -rf rmr_1.9.0_amd64.deb
-# Install RMr development header files
-RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr-dev_1.9.0_amd64.deb/download.deb && dpkg -i rmr-dev_1.9.0_amd64.deb && rm -rf rmr-dev_1.9.0_amd64.deb
-
-# "PULLING LOG and COMPILING LOG"
-RUN git clone "https://gerrit.o-ran-sc.org/r/com/log" /opt/log && cd /opt/log && \
- ./autogen.sh && ./configure && make install && ldconfig
-
-WORKDIR /opt/submgr
-
-# "COMPILING E2AP Wrapper"
-COPY e2ap e2ap
-RUN cd /opt/submgr/e2ap && \
- gcc -c -fPIC -Iheaders/ lib/*.c wrapper.c && \
- gcc *.o -shared -o libwrapper.so && \
- cp libwrapper.so /usr/local/lib/ && \
- cp wrapper.h headers/*.h /usr/local/include/ && \
- ldconfig
-
-# "Installing Swagger"
-RUN cd /usr/local/go/bin \
- && wget --quiet https://github.com/go-swagger/go-swagger/releases/download/v0.19.0/swagger_linux_amd64 \
- && mv swagger_linux_amd64 swagger \
- && chmod +x swagger
-
-# "Getting and generating routing managers api client"
-COPY api api
-RUN git clone "https://gerrit.o-ran-sc.org/r/ric-plt/rtmgr" \
- && cp rtmgr/api/routing_manager.yaml api/ \
- && rm -rf rtmgr
-
-RUN mkdir pkg
-
-COPY go.mod go.mod
-
-RUN mkdir -p /root/go && \
- /usr/local/go/bin/swagger generate client -f api/routing_manager.yaml -t pkg/ -m rtmgr_models -c rtmgr_client
-
-COPY go.mod go.mod
-
-RUN /usr/local/go/bin/go mod tidy
-
-#Compiling E2T
-COPY pkg pkg
-COPY cmd cmd
-COPY test test
-
-RUN mkdir -p /opt/bin && \
- /usr/local/go/bin/go build -o /opt/test/e2t/e2t ./test/e2t/e2t.go && \
- mkdir -p /opt/test/e2t/container/usr/local
-
-FROM ubuntu:18.04
-
-COPY --from=submgrbuild /opt/test/e2t/e2t /
-COPY test/e2t/e2t.yaml test/e2t/container/run_e2t.sh /
-COPY --from=submgrbuild /usr/local/include /usr/local/include
-COPY --from=submgrbuild /usr/local/lib /usr/local/lib
-
-RUN ldconfig
-
-RUN chmod 755 /run_e2t.sh
+++ /dev/null
-#!/bin/sh -e
-#
-#==================================================================================
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#==================================================================================
-#
-#
-# Mnemonic: run_e2t.sh
-# Abstract: Starts the E2T stub platform service
-# Date: 28 May 2019
-#
-exec ./e2t -f /e2t.yaml
+++ /dev/null
-/*
-==================================================================================
- Copyright (c) 2019 AT&T Intellectual Property.
- Copyright (c) 2019 Nokia
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================================
-*/
-
-package main
-
-/*
-#include <rmr/RIC_message_types.h>
-#include <rmr/rmr.h>
-
-#cgo CFLAGS: -I../
-#cgo LDFLAGS: -lrmr_nng -lnng
-*/
-import "C"
-
-import (
- "encoding/hex"
- "errors"
- submgr "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/control"
- "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
- "github.com/spf13/viper"
- "strconv"
-)
-
-type E2t struct {
- submgr.E2ap
-}
-
-var c chan xapp.RMRParams = make(chan xapp.RMRParams, 1)
-
-var requestRawData string
-var deleteRawData string
-
-func init() {
- viper.AutomaticEnv()
- viper.SetEnvPrefix("e2t")
- viper.AllowEmptyEnv(true)
- requestRawData = viper.GetString("rawdata")
- if requestRawData == "" {
- requestRawData = "20c9001d000003ea7e00050000010002ea6300020003ea6c000700ea6d40020004"
- }
- xapp.Logger.Info("Initial RAW Data: %v", requestRawData)
- deleteRawData = viper.GetString("rawdata")
- if deleteRawData == "" {
- deleteRawData = "20ca0012000002ea7e00050000010002ea6300020003"
- }
- xapp.Logger.Info("Initial RAW Data: %v", deleteRawData)
-}
-
-func (e *E2t) GenerateRequestPayload(subId uint16) (payload []byte, err error) {
- skeleton, err := hex.DecodeString(requestRawData)
- if err != nil {
- return make([]byte, 0), errors.New("unable to decode data provided in \"RCO_RAWDATA\" environment variable")
- }
- payload, err = e.SetSubscriptionResponseSequenceNumber(skeleton, subId)
- return
-}
-
-func (e *E2t) GenerateDeletePayload(subId uint16) (payload []byte, err error) {
- skeleton, err := hex.DecodeString(deleteRawData)
- if err != nil {
- return make([]byte, 0), errors.New("unable to decode data provided in \"RCO_RAWDATA\" environment variable")
- }
- payload, err = e.SetSubscriptionDeleteResponseSequenceNumber(skeleton, subId)
- return
-}
-
-func (e E2t) Consume(rp *xapp.RMRParams) (err error) {
- switch rp.Mtype {
- case C.RIC_SUB_REQ:
- err = e.handleSubscriptionRequest(rp)
- case C.RIC_SUB_DEL_REQ:
- err = e.handleSubscriptionDeleteRequest(rp)
- default:
- err = errors.New("Message Type " + strconv.Itoa(rp.Mtype) + " is discarded")
- xapp.Logger.Error("Unknown message type: %v", err)
- }
- return
-}
-
-func (e E2t) handleSubscriptionRequest(request *xapp.RMRParams) (err error) {
- payloadSeqNum, err := e.GetSubscriptionRequestSequenceNumber(request.Payload)
- if err != nil {
- xapp.Logger.Error("Unable to get Subscription Sequence Number from Payload due to: " + err.Error())
- }
- xapp.Logger.Info("Subscription Request Received: RMR SUBSCRIPTION_ID: %v | PAYLOAD SEQUENCE_NUMBER: %v", payloadSeqNum, payloadSeqNum)
- payload, err := e.GenerateRequestPayload(payloadSeqNum)
- if err != nil {
- xapp.Logger.Debug(err.Error())
- return
- }
- request.Payload = payload
- request.Mtype = 12011
- c <- *request
- return
-}
-
-func (e E2t) handleSubscriptionDeleteRequest(request *xapp.RMRParams) (err error) {
- payloadSeqNum, err := e.GetSubscriptionDeleteRequestSequenceNumber(request.Payload)
- if err != nil {
- xapp.Logger.Error("Unable to get Subscription Sequence Number from Payload due to: " + err.Error())
- }
- xapp.Logger.Info("Subscription Delete Request Received: RMR SUBSCRIPTION_ID: %v | PAYLOAD SEQUENCE_NUMBER: %v", payloadSeqNum, payloadSeqNum)
- payload, err := e.GenerateDeletePayload(payloadSeqNum)
- if err != nil {
- xapp.Logger.Debug(err.Error())
- return
- }
- request.Payload = payload
- request.Mtype = 12021
- c <- *request
- return
-}
-
-func (e *E2t) Run() {
- for {
- message := <-c
- var payloadSeqNum uint16
- var err error
- if message.Mtype == 12011 {
- payloadSeqNum, err = e.GetSubscriptionResponseSequenceNumber(message.Payload)
- } else if message.Mtype == 12021 {
- payloadSeqNum, err = e.GetSubscriptionDeleteResponseSequenceNumber(message.Payload)
- } else {
- err = errors.New("OH MY GOD")
- }
- if err != nil {
- xapp.Logger.Debug("Unable to get Subscription Sequence Number from Payload due to: " + err.Error())
- }
- xapp.Logger.Info("Sending Message: TYPE: %v | RMR SUBSCRIPTION_ID: %v | PAYLOAD SEQUENCE_NUMBER: %v)", message.Mtype, message.SubId, payloadSeqNum)
- xapp.Rmr.Send(&message, true)
- }
-}
-
-func main() {
- e2t := E2t{}
- go e2t.Run()
- xapp.Run(e2t)
-}
+++ /dev/null
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"local":
- "host": ":8080"
-"logger":
- "level": 3
-"rmr":
- "protPort": "tcp:4560"
- "maxSize": 2072
- "numWorkers": 1
+++ /dev/null
-#
-#==================================================================================
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#==================================================================================
-#
-#
-# Abstract: E2T Stub Plaform component Kubernetes manifest
-# Date: 28 May 2019
-#
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: e2t
- namespace: ricplt
-spec:
- replicas: 1
- selector:
- matchLabels:
- app: e2t
- template:
- metadata:
- labels:
- app: e2t
- spec:
- containers:
- - name: e2t
- image: jenkins:5000/e2t:test
- command: ["/run_e2t.sh"]
- env:
- - name: DBAAS_SERVICE_HOST
- value: dbaas
- - name: E2T_RAWDATA
- value: 000001ea7e000500aaaabbbb
- ports:
- - containerPort: 8080
- - containerPort: 4560
- - containerPort: 4561
+++ /dev/null
-#
-#==================================================================================
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#==================================================================================
-#
-#
-# Abstract: E2T Stub Platform service manifest
-# Date: 28 May 2019
-#
-kind: Service
-apiVersion: v1
-metadata:
- name: e2t
- namespace: ricplt
-spec:
- selector:
- app: e2t
- clusterIP: None
- ports:
- - name: nbi
- port: 8080
- protocol: TCP
- - name: sbi-data
- port: 4560
- protocol: TCP
- - name: sbi-control
- port: 4561
- protocol: TCP
-
+++ /dev/null
-# RCO Test xApp Instance\r
-Base project: https://gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp\r
-## General Description\r
-__RCO__ is an xApp instance which has following behaviors\r
-* sends valid SUB_REQ RMR message periodically in every 2 second. \r
-* sends invalid message (10000) message in every 14 second\r
-* sends subscription requsts (12010) with malformed payload in every 14 seconds\r
-* receives RMR messages and emmits log on it's standard output\r
-* default initial sequence number is `12345`. Set `RCO_SEED_SN` environment variable to override\r
-* Set `RCO_RAWDATA` to override default encoded payload (use hex dump format)\r
-\r
-\r
-\r
-\r
+++ /dev/null
-#!/bin/sh -e
-#
-#==================================================================================
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#==================================================================================
-#
-#
-# Mnemonic: test/rco/build.sh
-# Abstract: Creates RCO Stub xApp docker container
-# Date: 28 May 2019
-#
-
-echo 'Creating RCO container'
-docker build --no-cache --tag=rco:builder -f container/Dockerfile ../..
+++ /dev/null
-#
-#==================================================================================
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#==================================================================================
-#
-#
-# Abstract: Builds RCO stub container
-# Date: 28 May 2019
-#
-
-FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:1-u18.04-nng1.1.1 as submgrbuild
-
-ENV HTTP_PROXY=http://10.144.1.10:8080
-ENV HTTPS_PROXY=http://10.144.1.10:8080
-RUN echo 'use_proxy=yes \n http_proxy=http://10.144.1.10:8080 \n https_proxy=http://10.144.1.10:8080' > /etc/wgetrc
-RUN echo 'Acquire::http::Proxy "http://87.254.212.121:8080/";' > /etc/apt/apt.conf
-
-# Install RMr shared library
-RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr_1.6.0_amd64.deb/download.deb && dpkg -i rmr_1.6.0_amd64.deb
-# Install RMr development header files
-RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr-dev_1.6.0_amd64.deb/download.deb && dpkg -i rmr-dev_1.6.0_amd64.deb
-
-# "PULLING LOG and COMPILING LOG"
-RUN git clone "https://gerrit.o-ran-sc.org/r/com/log" /opt/log && cd /opt/log && \
- ./autogen.sh && ./configure && make install && ldconfig
-
-WORKDIR /opt/submgr
-
-# "COMPILING E2AP Wrapper"
-COPY e2ap e2ap
-RUN cd e2ap && \
- gcc -c -fPIC -Iheaders/ lib/*.c wrapper.c && \
- gcc *.o -shared -o libwrapper.so && \
- cp libwrapper.so /usr/local/lib/ && \
- cp wrapper.h headers/*.h /usr/local/include/ && \
- ldconfig
-
-# "Installing Swagger"
-RUN cd /usr/local/go/bin \
- && wget --quiet https://github.com/go-swagger/go-swagger/releases/download/v0.19.0/swagger_linux_amd64 \
- && mv swagger_linux_amd64 swagger \
- && chmod +x swagger
-
-# "Getting and generating routing managers api client"
-COPY api api
-RUN git clone "https://gerrit.o-ran-sc.org/r/ric-plt/rtmgr" \
- && cp rtmgr/api/routing_manager.yaml api/ \
- && rm -rf rtmgr
-
-RUN mkdir pkg
-
-COPY go.mod go.mod
-
-RUN mkdir -p /root/go && \
- /usr/local/go/bin/swagger generate client -f api/routing_manager.yaml -t pkg/ -m rtmgr_models -c rtmgr_client
-
-COPY go.mod go.mod
-
-RUN /usr/local/go/bin/go mod tidy
-
-#Compiling RCO
-COPY pkg pkg
-COPY cmd cmd
-COPY test test
-
-RUN mkdir -p /opt/bin && \
- /usr/local/go/bin/go build -o /opt/test/rco/rco ./test/rco/rco.go && \
- mkdir -p /opt/test/rco/container/usr/local
-
-FROM ubuntu:18.04
-
-COPY --from=submgrbuild /opt/test/rco/rco /
-COPY test/rco/rco.yaml test/rco/container/run_rco.sh test/uta_rtg.rt /
-COPY --from=submgrbuild /usr/local/include /usr/local/include
-COPY --from=submgrbuild /usr/local/lib /usr/local/lib
-
-RUN ldconfig
-RUN chmod 755 /run_rco.sh
-RUN chmod 755 /rco
+++ /dev/null
-#!/bin/sh -e
-#
-#==================================================================================
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#==================================================================================
-#
-#
-# Mnemonic: run_rco.sh
-# Abstract: Starts the rco xApp stub
-# Date: 28 May 2019
-#
-exec ./rco -f /rco.yaml
+++ /dev/null
-#
-#==================================================================================
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#==================================================================================
-#
-#
-# Abstract: RCO Stub xApp Kubernetes manifest
-# Date: 28 May 2019
-#
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- name: rco
- namespace: ricplt
-spec:
- replicas: 1
- selector:
- matchLabels:
- app: rco
- template:
- metadata:
- labels:
- app: rco
- spec:
- containers:
- - name: rco
- image: jenkins:5000/rco:test
- command: ["/run_rco.sh"]
- env:
- - name: DBAAS_SERVICE_HOST
- value: dbaas
- - name: RCO_RAWDATA
- value: 000003ea7e000500aaaaccccea6300020000ea81000e00045465737400ea6b0003000100
- - name: RCO_SEED_SN
- value: "9999"
- - name: RMR_SEED_RT
- value: uta_rtg.rt
-
- ports:
- - containerPort: 8080
- - containerPort: 4560
- - containerPort: 4561
- imagePullPolicy: Always
+++ /dev/null
-#
-#==================================================================================
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#==================================================================================
-#
-#
-# Abstract: RCO Stub xApp service manifest
-# Date: 28 May 2019
-#
-kind: Service
-apiVersion: v1
-metadata:
- name: rco
- namespace: ricplt
-spec:
- selector:
- app: rco
- clusterIP: None
- ports:
- - name: nbi
- port: 8080
- protocol: TCP
- - name: sbi-data
- port: 4560
- protocol: TCP
- - name: sbi-control
- port: 4561
- protocol: TCP
-
+++ /dev/null
-/*
-==================================================================================
- Copyright (c) 2019 AT&T Intellectual Property.
- Copyright (c) 2019 Nokia
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-==================================================================================
-*/
-
-package main
-
-import (
- "encoding/hex"
- "errors"
- submgr "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/control"
- "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
- "github.com/spf13/viper"
- "os"
- "strconv"
- "time"
-)
-
-type Rco struct {
- submgr.E2ap
-}
-
-var c = make(chan submgr.RmrDatagram, 1)
-var params xapp.RMRParams
-
-var requestRawData string
-var deleteRawData string
-var seedSN uint16
-var deleteSeedSN uint16
-
-func init() {
- viper.AutomaticEnv()
- viper.SetEnvPrefix("rco")
- viper.AllowEmptyEnv(true)
- requestRawData = viper.GetString("rawdata")
- if requestRawData == "" {
- requestRawData = "00c90020000003ea7e00050000010002ea6300020003ea81000a000000ea6b4003000440"
- }
- deleteRawData = viper.GetString("deleterawdata")
- if deleteRawData == "" {
- deleteRawData = "00ca0012000002ea7e00050000010002ea6300020003"
- }
- xapp.Logger.Info("Initial RAW DATA: %v", requestRawData)
- xapp.Logger.Info("Initial DELETE RAW DATA: %v", deleteRawData)
- seedSN = uint16(viper.GetInt("seed_sn"))
- if seedSN == 0 || seedSN > 65535 {
- seedSN = 12345
- }
- deleteSeedSN = uint16(viper.GetInt("delete_seed_sn"))
- if deleteSeedSN == 0 || deleteSeedSN > 65535 {
- deleteSeedSN = seedSN
- }
-
- xapp.Logger.Info("Initial SEQUENCE NUMBER: %v", seedSN)
-}
-
-func (r *Rco) GeneratePayload(subId uint16) (payload []byte, err error) {
- skeleton, err := hex.DecodeString(requestRawData)
- if err != nil {
- return make([]byte, 0), errors.New("nable to decode data provided in \"RCO_RAWDATA\" environment variable")
- }
- payload, err = r.SetSubscriptionRequestSequenceNumber(skeleton, subId)
- return
-}
-
-func (r *Rco) GenerateDeletePayload(subId uint16) (payload []byte, err error) {
- skeleton, err := hex.DecodeString(deleteRawData)
- if err != nil {
- return make([]byte, 0), errors.New("unable to decode data provided in \"RCO_DELETERAWDATA\" environment variable")
- }
- payload, err = r.SetSubscriptionDeleteRequestSequenceNumber(skeleton, subId)
- return
-}
-
-func (r Rco) Consume(params *xapp.RMRParams) (err error) {
- switch params.Mtype {
- case xapp.RICMessageTypes["RIC_SUB_RESP"]:
- payloadSeqNum, err := r.GetSubscriptionResponseSequenceNumber(params.Payload)
- if err != nil {
- xapp.Logger.Error("SUBRESP: Unable to get Subscription Sequence Number from Payload due to: " + err.Error())
- }
- xapp.Logger.Info("Subscription Response Message Received: RMR SUBSCRIPTION_ID: %v | PAYLOAD SEQUENCE_NUMBER: %v", params.SubId, payloadSeqNum)
- return err
- case xapp.RICMessageTypes["RIC_SUB_DEL_RESP"]:
- payloadSeqNum, err := r.GetSubscriptionDeleteResponseSequenceNumber(params.Payload)
- if err != nil {
- xapp.Logger.Error("DELRESP: Unable to get Subscription Sequence Number from Payload due to: " + err.Error())
- }
- xapp.Logger.Info("Subscription Delete Response Message Received: RMR SUBSCRIPTION_ID: %v | PAYLOAD SEQUENCE_NUMBER: %v", params.SubId, payloadSeqNum)
- return err
- default:
- err = errors.New("Message Type " + strconv.Itoa(params.Mtype) + " is discarded")
- xapp.Logger.Error("Unknown message type: %v", err)
- return
- }
-}
-
-func (r *Rco) SendRequests() (err error) {
- message, err := r.GeneratePayload(seedSN)
- if err != nil {
- xapp.Logger.Debug(err.Error())
- return
- }
- deletemessage, err := r.GenerateDeletePayload(deleteSeedSN)
- if err != nil {
- xapp.Logger.Debug(err.Error())
- return
- }
- for {
- time.Sleep(5 * time.Second)
- c <- submgr.RmrDatagram{MessageType: 12010, SubscriptionId: seedSN, Payload: message}
- seedSN++
- time.Sleep(5 * time.Second)
- c <- submgr.RmrDatagram{MessageType: 12020, SubscriptionId: deleteSeedSN, Payload: deletemessage}
- deleteSeedSN++
- }
-}
-
-func (r *Rco) Run() {
- for {
- message := <-c
- payloadSeqNum, err := r.GetSubscriptionRequestSequenceNumber(message.Payload)
- if err != nil {
- xapp.Logger.Debug("Unable to get Subscription Sequence Number from Payload due to: " + err.Error())
- }
- params.SubId = int(message.SubscriptionId)
- params.Mtype = message.MessageType
- params.PayloadLen = len(message.Payload)
- params.Payload = message.Payload
- xapp.Logger.Info("Sending Message: TYPE: %v | RMR SUBSCRIPTION_ID: %v | PAYLOAD SEQUENCE_NUMBER: %v)", message.MessageType, message.SubscriptionId, payloadSeqNum)
- xapp.Rmr.Send(¶ms, false)
- }
-}
-
-func (r *Rco) sendInvalidTestMessages() {
- for {
- time.Sleep(7 * time.Second)
- c <- submgr.RmrDatagram{MessageType: 10000, SubscriptionId: 0, Payload: make([]byte, 1)}
- time.Sleep(7 * time.Second)
- c <- submgr.RmrDatagram{MessageType: 12010, SubscriptionId: 0, Payload: make([]byte, 1)}
- }
-}
-
-func main() {
- rco := Rco{}
- go xapp.Rmr.Start(rco)
- go rco.Run()
- go rco.sendInvalidTestMessages()
- err := rco.SendRequests()
- if err != nil {
- xapp.Logger.Info("Error: %v", err)
- os.Exit(1)
- }
-}
+++ /dev/null
-# Copyright (c) 2019 AT&T Intellectual Property.
-# Copyright (c) 2019 Nokia.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"local":
- "host": ":8080"
-"logger":
- "level": 3
-"rmr":
- "protPort": "tcp:4560"
- "maxSize": 2072
- "numWorkers": 1
+++ /dev/null
-newrt|start
-rte|12010,172.17.0.3:4560|172.17.0.4:4560
-rte|12010,172.17.0.4:4560|172.17.0.6:4560
-rte|12011,172.17.0.6:4560|172.17.0.4:4560
-rte|10000,172.17.0.3:4560|172.17.0.4:4560
-newrt|end