Initial integration version of the RIC Subscription Manager 74/374/1
authorkalnagy <kalman.nagy@nokia.com>
Tue, 18 Jun 2019 12:40:39 +0000 (14:40 +0200)
committerkalnagy <kalman.nagy@nokia.com>
Tue, 18 Jun 2019 12:40:39 +0000 (14:40 +0200)
Change-Id: I14763247a45f639931b734fe836b214dd54dcf38
Signed-off-by: kalnagy <kalman.nagy@nokia.com>
41 files changed:
.gitreview [new file with mode: 0644]
CONTRIBUTING.md [new file with mode: 0644]
README.md [new file with mode: 0644]
RELNOTES [new file with mode: 0644]
build.sh [new file with mode: 0644]
build/binary/Dockerfile [new file with mode: 0644]
build/binary/compile.sh [new file with mode: 0644]
build/container/Dockerfile [new file with mode: 0644]
build/container/run_submgr.sh [new file with mode: 0644]
cmd/submgr.go [new file with mode: 0644]
config/submgr.yaml [new file with mode: 0644]
go.mod [new file with mode: 0644]
manifests/namespace.yaml [new file with mode: 0644]
manifests/submgr/submgr-dep.yaml [new file with mode: 0644]
manifests/submgr/submgr-svc.yaml [new file with mode: 0644]
pkg/control/control.go [new file with mode: 0644]
pkg/control/e2ap.go [new file with mode: 0644]
pkg/control/libe2ap.a [new file with mode: 0644]
pkg/control/registry.go [new file with mode: 0644]
pkg/control/types.go [new file with mode: 0644]
test/dbaas/README.md [new file with mode: 0644]
test/dbaas/manifests/dbaas-dep.yaml [new file with mode: 0644]
test/dbaas/manifests/dbaas-svc.yaml [new file with mode: 0644]
test/e2t/README.md [new file with mode: 0644]
test/e2t/build.sh [new file with mode: 0644]
test/e2t/container/Dockerfile [new file with mode: 0644]
test/e2t/container/e2t.yaml [new file with mode: 0644]
test/e2t/container/run_e2t.sh [new file with mode: 0644]
test/e2t/e2t.go [new file with mode: 0644]
test/e2t/e2t.yaml [new file with mode: 0644]
test/e2t/manifests/e2t_dep.yaml [new file with mode: 0644]
test/e2t/manifests/e2t_svc.yaml [new file with mode: 0644]
test/rco/README.md [new file with mode: 0644]
test/rco/build.sh [new file with mode: 0644]
test/rco/container/Dockerfile [new file with mode: 0644]
test/rco/container/run_rco.sh [new file with mode: 0644]
test/rco/manifests/rco-dep.yaml [new file with mode: 0644]
test/rco/manifests/rco-svc.yaml [new file with mode: 0644]
test/rco/rco.go [new file with mode: 0644]
test/rco/rco.yaml [new file with mode: 0644]
test/uta_rtg.rt [new file with mode: 0644]

diff --git a/.gitreview b/.gitreview
new file mode 100644 (file)
index 0000000..c9650ed
--- /dev/null
@@ -0,0 +1,7 @@
+[gerrit]
+host=gerrit.oran-osc.org
+#port=29418
+project=ric-plt/submgr
+defaultbranch=master
+defaultremote=origin
+
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644 (file)
index 0000000..6b47299
--- /dev/null
@@ -0,0 +1,18 @@
+# Conntribution milestones
+
+_NOTE: recommendations for developing internally. should be updated accordingly after opensourcing_
+
+## RECOMMENDATIONS
+
+* **Try to keep workig code in master**
+* **Use gofmt**
+* **In case of upstream import, try to use exact release instead of master code**
+
+## WORKFLOW
+
+* Create branch from master for your feature/bugfix
+* Apply changes
+* Add tests
+* Update corresponding README.md
+* Open a merge request to master
+* Provide the RLEASE NOTES in the request
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..361baf2
--- /dev/null
+++ b/README.md
@@ -0,0 +1,86 @@
+# Subscription Manager
+
+## Table of contents
+* [Introduction](#introduction)
+* [Release notes](#release-notes)
+* [Prerequisites](#prerequisites)
+* [Project folders structure](#project-folders-structure)
+* [Installation guide](#installation-guide)
+  * [Compiling code](#compiling-code)
+  * [Building docker container](#building-docker-container)
+  * [Installing Routing Manager](#installing-routing-manager)
+  * [Testing and Troubleshoting](#testing-and-troubleshoting)
+* [Upcoming changes](#upcoming-changes)
+* [License](#license)
+
+## Introduction
+__Subscription Manager__ is a basic platform service of RIC. It is responsible to serve, coordinate and manage xApps' subscriptions.
+
+Submgr acts as an anchor point for subscription related internal messaging, i.e. every xApp sends its subscription related messages to Submgr. Submgr invokes Routing Manager (Rtmgr) to create or tear down the subscription related routes, and the appropriate E2 Termination to signal the subscription related event also towards the RAN.
+
+The solution base on the [xapp-frame](https://gerrit.o-ran-sc.org/r/admin/repos/ric-plt/xapp-frame) project which provides common HttpREST, RMR and SDL interfaces.
+
+Current implementation provides the following functionalities:
+* Handling RIC_SUB_REQ and RIC_SUB_RESP type RMR messages 
+* Generating New subscription ID and forwarding subscription request to E2 termination
+* Receiving Subscription response and sendig it back to the subscriber
+  
+## Release notes
+Check the separated `RELNOTES` file.
+
+## Prerequisites
+* Healthy kubernetes cluster
+* Access to the common docker registry
+
+## Project folder structure
+* /build: contains build tools (scripts, Dockerfiles, etc.)
+* /manifest: contains deployment files (Kubernetes manifests, Helm chart)
+* /cmd: contains go project's main file
+* /pkg: contains go project's internal packages
+* /config: contains default configuration file for the service
+* /test: contains CI/CD testing files (scripts, mocks, manifests)
+
+## Installation guide
+
+### Compiling code
+Enter the project root and execute `./build.sh` script.
+The build script has two main phases. First is the code compilation, where it creates a temporary container for downloading all dependencies then compiles the code. In the second phase it builds the production ready container and taggs it to `submgr:builder`
+
+**NOTE:** The script puts a copy of the binary into the `./bin` folder for further use cases
+
+### Installing Subscription Manager
+#### Preparing environment
+Tag the `submgr` container according to the project release and push it to a registry accessible from all minions of the Kubernetes cluster.
+Edit the container image section of `submgr-dep.yaml` file according to the `submgr` image tag.
+
+#### Deploying Subscription Manager 
+Issue the `kubectl create -f {manifest.yaml}` command in the following order
+  1. `manifests/namespace.yaml`: creates the `example` namespace for routing-manager resources
+  2. `manifests/submgr/submgr-dep.yaml`: instantiates the `submgr` deployment in the `example` namespace
+  3. `manifests/submgr/submgr-svc.yaml`: creates the `submgr` service in `example` namespace
+
+### Testing and Troubleshoting
+Subscription Manager's behaviour can be tested using the stub xApp (called RCO) and the stub E2 Termination (called E2T) on the following way.
+
+  1. [Compile](#compiling-code) and [Installing subscription manager](#installing-subscription-manager)
+  2  Enter `./test/dbaas` folder and issue `kubectl apply -f ./manifests`
+  3. Enter `./test/e2t/` folder and run `build.sh`. After docker image successfully built, issue `kubectl apply -f ./manifests`
+  4. Enter `./test/rco/` folder and run `build.sh`. After docker image successfully built, issue `kubectl apply -f ./manifests`
+  5. Configure RMR routes accordingly
+
+Test scenario:
+  1. RCO alternately sends Subscription Request (12010) and other (10000) type of messages towards SUBMGR. (non ASN1 code/decode)
+  2. SUBMGR receives RCO's subscription request and generates a new ID for the given request and puts it in the header of RMR messages to be forwareded to E2T
+  3. E2T receives the Subscription Request message and sends a Subscription Response to SUBMGR
+  4. SUBMGR accepts the Subscirption Response and forwards it to RCO
+
+
+## Configuration and Troubleshooting
+Basic configuration file provided in `./config/` folder. Consult xapp-frame project documentation for custom configuration settings.
+
+## Upcoming changes
+[] ASN1 support
+
+## License
+This project is licensed under the Apache License, Version 2.0 - see the [LICENSE](LICENSE)
+
diff --git a/RELNOTES b/RELNOTES
new file mode 100644 (file)
index 0000000..4e64950
--- /dev/null
+++ b/RELNOTES
@@ -0,0 +1,4 @@
+### v0.1.0
+* Receives and Forwards RMR Subscription Requests
+* Introduces RCO (Stub xApp) and E2T (Stub Platform Component) for testing purposes
+* Builder and Deployer scripts and manifests 
diff --git a/build.sh b/build.sh
new file mode 100644 (file)
index 0000000..5252b7d
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,39 @@
+#!/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:       build.sh
+#      Abstract:       Compiles the Subscription Manager's source and builds the docker container
+#      Date:           28 May 2019
+#
+
+echo 'Creating compiler container'
+docker build --no-cache --tag=submgr_compiler:0.1 $PWD/build/binary/
+
+echo 'Running submgr compiler'
+docker run --rm -v ${PWD}:/opt submgr_compiler:0.1
+
+echo 'Cleaning up compiler container'
+docker rmi -f submgr_compiler:0.1
+
+echo 'submgr binary successfully built!'
+
+echo 'Creating submgr container'
+docker build --no-cache --tag=submgr:builder ${PWD}/build/container/
+
diff --git a/build/binary/Dockerfile b/build/binary/Dockerfile
new file mode 100644 (file)
index 0000000..6a5f2a1
--- /dev/null
@@ -0,0 +1,29 @@
+#
+#==================================================================================
+#   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 a container to compile Subscription Manager's code
+#      Date:           28 May 2019
+#
+FROM golang:1.12
+
+COPY compile.sh /
+RUN apt-get update \
+    && apt-get install -y git vim build-essential cmake ksh autotools-dev dh-autoreconf gawk autoconf-archive
+
+ENTRYPOINT /compile.sh
diff --git a/build/binary/compile.sh b/build/binary/compile.sh
new file mode 100644 (file)
index 0000000..592f806
--- /dev/null
@@ -0,0 +1,67 @@
+#!/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:       compile.sh
+#      Abstract:       Compiles the source of Subscription Manager service and the two platform component stubs
+#      Date:           28 May 2019
+#
+echo "PULLING RMR"
+cd /opt
+git clone "https://gerrit.o-ran-sc.org/r/ric-plt/lib/rmr"
+echo "START COMPILING RMR"
+cd /opt/rmr
+git checkout v1.0.31
+mkdir -p build
+cd build
+cmake ..
+make install
+
+echo "PULLING LOG"
+cd /opt
+git clone "https://gerrit.o-ran-sc.org/r/com/log"
+echo "START COMPILING LOG"
+cd /opt/log
+./autogen.sh
+./configure
+make install
+
+ldconfig
+
+echo "DOWNLOAD GO DEPENDENCIES"
+cd /opt/
+mkdir -p /opt/bin
+go get
+
+echo "START COMPILING COMPONENTS"
+go build -o /opt/bin/submgr ./cmd/submgr.go
+go build -o /opt/test/rco/rco ./test/rco/rco.go
+go build -o /opt/test/e2t/e2t ./test/e2t/e2t.go
+
+echo "SAVE RESULT"
+mkdir -p /opt/build/container/usr/local /opt/test/e2t/container/usr/local /opt/test/rco/container/usr/local
+cp -Rf /usr/local/lib /usr/local/include /opt/build/container/usr/local/
+cp -Rf /usr/local/lib /usr/local/include  /opt/test/e2t/container/usr/local/
+cp -Rf /usr/local/lib /usr/local/include  /opt/test/rco/container/usr/local/
+cp bin/submgr config/submgr.yaml /opt/build/container/
+
+echo "CLEANUP"
+rm -Rf /opt/rmr /opt/log /opt/go.sum
+
+echo "DONE"
diff --git a/build/container/Dockerfile b/build/container/Dockerfile
new file mode 100644 (file)
index 0000000..0dffd40
--- /dev/null
@@ -0,0 +1,30 @@
+#
+#==================================================================================
+#   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 the Subscription Manager's production ready container image
+#      Date:           28 May 2019
+#
+
+FROM ubuntu
+
+COPY submgr /
+COPY submgr.yaml /
+COPY run_submgr.sh /
+COPY usr/ /usr/
+RUN ldconfig
\ No newline at end of file
diff --git a/build/container/run_submgr.sh b/build/container/run_submgr.sh
new file mode 100644 (file)
index 0000000..71f9304
--- /dev/null
@@ -0,0 +1,25 @@
+#!/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_submgr.sh
+#      Abstract:       Starts the submgr service
+#      Date:           28 May 2019
+#
+exec ./submgr -f /submgr.yaml
diff --git a/cmd/submgr.go b/cmd/submgr.go
new file mode 100644 (file)
index 0000000..3af1069
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+==================================================================================
+  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 (
+       "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/control"
+)
+
+func main(){
+       c := control.NewControl()
+       c.Run()
+}
diff --git a/config/submgr.yaml b/config/submgr.yaml
new file mode 100644 (file)
index 0000000..e91fbdf
--- /dev/null
@@ -0,0 +1,23 @@
+#   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": 4
+"rmr":
+  "protPort": "tcp:4560"
+  "maxSize": 2072
+  "numWorkers": 1
diff --git a/go.mod b/go.mod
new file mode 100644 (file)
index 0000000..053212c
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,11 @@
+go 1.12
+
+module gerrit.o-ran-sc.org/r/ric-plt/submgr
+
+require gerrit.o-ran-sc.org/r/ric-plt/xapp-frame v0.0.5
+
+replace gerrit.o-ran-sc.org/r/ric-plt/sdlgo => gerrit.o-ran-sc.org/r/ric-plt/sdlgo.git v0.1.1
+
+replace gerrit.o-ran-sc.org/r/ric-plt/xapp-frame => gerrit.o-ran-sc.org/r/ric-plt/xapp-frame.git v0.0.5
+
+replace gerrit.o-ran-sc.org/r/com/golog => gerrit.o-ran-sc.org/r/com/golog.git v0.0.1
diff --git a/manifests/namespace.yaml b/manifests/namespace.yaml
new file mode 100644 (file)
index 0000000..7f598cf
--- /dev/null
@@ -0,0 +1,27 @@
+#
+#==================================================================================
+#   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: Creates a dedicated namespace for Subscription Manager deployment and related stuff
+#   Date:              28 May 2019
+#
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: example
+
diff --git a/manifests/submgr/submgr-dep.yaml b/manifests/submgr/submgr-dep.yaml
new file mode 100644 (file)
index 0000000..0ed7bec
--- /dev/null
@@ -0,0 +1,48 @@
+#
+#==================================================================================
+#   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: Subscription Manager Kubernetes manifest
+#   Date:              28 May 2019
+#
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: submgr
+  namespace: example
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: submgr
+  template:
+    metadata:
+      labels:
+        app: submgr
+    spec:
+      containers:
+      - name: submgr
+        image: cmaster:5000/submgr:0.1.0
+        command: ["/run_submgr.sh"]
+        env:
+        - name: DBAAS_SERVICE_HOST
+          value: dbaas
+        ports:
+        - containerPort: 8080
+        - containerPort: 4560
+        - containerPort: 4561
diff --git a/manifests/submgr/submgr-svc.yaml b/manifests/submgr/submgr-svc.yaml
new file mode 100644 (file)
index 0000000..bef3502
--- /dev/null
@@ -0,0 +1,42 @@
+#
+#==================================================================================
+#   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: Subscription Manager service manifest 
+#   Date:              28 May 2019
+#
+kind: Service
+apiVersion: v1
+metadata:
+  name: submgr
+  namespace: example
+spec:
+  selector:
+    app: submgr
+  clusterIP: None
+  ports:
+  - name: nbi
+    port: 8080
+    protocol: TCP
+  - name: sbi-data
+    port: 4560
+    protocol: TCP
+  - name: sbi-control
+    port: 4561
+    protocol: TCP
+
diff --git a/pkg/control/control.go b/pkg/control/control.go
new file mode 100644 (file)
index 0000000..6c75063
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+==================================================================================
+  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 control
+
+/*
+#include <rmr/RIC_message_types.h>
+
+#cgo CFLAGS: -I../
+#cgo LDFLAGS: -lrmr_nng -lnng
+*/
+import "C"
+
+
+import (
+  "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
+  "errors"
+  "strconv"
+)
+
+type Control struct {
+  e2ap *E2ap
+  registry *Registry
+}
+
+func NewControl() Control {
+  return Control{new(E2ap),new(Registry)}
+}
+
+func (c *Control) Run() {
+  xapp.Run(c)
+}
+
+func (c *Control) Consume(mtype, sub_id int, len int, payload []byte) (err error) {
+  switch mtype {
+  case C.RIC_SUB_REQ:
+    err = c.handleSubscriptionRequest(&RmrDatagram{mtype, sub_id, payload})
+  case C.RIC_SUB_RESP:
+    err = c.handleSubscriptionResponse(&RmrDatagram{mtype, sub_id, payload})
+  default:
+    err = errors.New("Message Type "+strconv.Itoa(mtype)+" discarded")
+  }
+  return
+}
+
+func (c *Control) rmrSend(datagram *RmrDatagram) (err error) {
+  if !xapp.Rmr.Send(datagram.MessageType, datagram.SubscriptionId, len(datagram.Payload), datagram.Payload) {
+    err = errors.New("rmr.Send() failed")
+  }
+  return
+}
+
+func (c *Control) handleSubscriptionRequest(datagram *RmrDatagram) ( err error) {
+  content, err := c.e2ap.GetPayloadContent(datagram.Payload)
+  xapp.Logger.Info("Subscription Request received: %v", content)
+  new_sub_id := c.registry.GetSubscriptionId()
+  payload, err := c.e2ap.SetSubscriptionSequenceNumber(datagram.Payload, new_sub_id)
+  if err != nil {
+    xapp.Logger.Error("Unable to set Subscription Sequence Number in Payload due to: "+ err.Error())
+    return
+  }
+  xapp.Logger.Info("New Subscription Accepted, Forwarding to E2T")
+  c.rmrSend(&RmrDatagram{C.RIC_SUB_REQ , new_sub_id, payload})
+  return
+}
+
+func (c *Control) handleSubscriptionResponse(datagram *RmrDatagram) ( err error) {
+  content, err := c.e2ap.GetPayloadContent(datagram.Payload)
+  xapp.Logger.Info("Subscription Response received: %v", content)
+  return
+}
\ No newline at end of file
diff --git a/pkg/control/e2ap.go b/pkg/control/e2ap.go
new file mode 100644 (file)
index 0000000..ff9c778
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+==================================================================================
+  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 control
+
+import (
+  "encoding/gob"
+  "bytes"
+  "errors"
+)
+
+type E2ap struct {
+}
+
+func (c *E2ap) GetSubscriptionSequenceNumber(payload []byte) (int, error) {
+  asn1 := new(Asn1)
+  message, err := asn1.Decode(payload)
+  if err != nil {
+    return 0, errors.New("Unable to decode payload due to "+ err.Error()) 
+  }
+  return message.SubscriptionId, nil
+}
+
+func (c *E2ap) SetSubscriptionSequenceNumber(payload []byte, newSubscriptionid int) ([]byte ,error) {
+  asn1 := new(Asn1)
+  message, err := asn1.Decode(payload)
+  if err != nil {
+    return make([]byte,0), errors.New("Unable to decode payload due to "+ err.Error()) 
+  }
+  message.SubscriptionId = newSubscriptionid
+  payload, err = asn1.Encode(message)
+  if err != nil {
+    return make([]byte,0), errors.New("Unable to encode message due to "+ err.Error()) 
+  }
+  return payload, nil
+}
+
+
+func (c *E2ap) GetPayloadContent(payload []byte) (content string, err error) {
+  asn1 := new(Asn1)
+  message, err := asn1.Decode(payload)
+  content = message.Content
+  return
+}
+/*
+Serialize and Deserialize message using this until real ASN1 GO wrapper is not in place
+*/
+type Asn1 struct {
+}
+
+func (a *Asn1) Encode(message RmrPayload) ([]byte, error) {
+       buffer := new(bytes.Buffer)
+       asn1 := gob.NewEncoder(buffer)
+       if err := asn1.Encode(message); err != nil {
+               return nil, err
+  }
+       return buffer.Bytes(), nil
+}
+
+func (a *Asn1) Decode(data []byte) (RmrPayload, error) {
+  message := new(RmrPayload)
+  buffer := bytes.NewBuffer(data)
+       asn1 := gob.NewDecoder(buffer)
+       if err := asn1.Decode(message); err != nil {
+               return RmrPayload{}, err
+  }
+       return *message, nil
+}
diff --git a/pkg/control/libe2ap.a b/pkg/control/libe2ap.a
new file mode 100644 (file)
index 0000000..529a7ce
Binary files /dev/null and b/pkg/control/libe2ap.a differ
diff --git a/pkg/control/registry.go b/pkg/control/registry.go
new file mode 100644 (file)
index 0000000..8f52f97
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+==================================================================================
+  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 control
+
+type Registry struct {
+  counter int
+}
+
+func (r *Registry) GetSubscriptionId() int {
+  return r.generateId()
+}
+
+func (r *Registry) generateId() int {
+  r.counter += 1
+  return r.counter
+}
diff --git a/pkg/control/types.go b/pkg/control/types.go
new file mode 100644 (file)
index 0000000..5f46e65
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+==================================================================================
+  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 control
+
+type RmrPayload struct {
+       MessageType int
+       SubscriptionId int
+       Content string 
+}
+
+type RmrDatagram struct {
+  MessageType int
+       SubscriptionId int
+       Payload []byte 
+}
diff --git a/test/dbaas/README.md b/test/dbaas/README.md
new file mode 100644 (file)
index 0000000..78b75bc
--- /dev/null
@@ -0,0 +1,5 @@
+# DBaaS Stub Platform Component
+## General Description
+__DBaaS__ is a Stub provides SDL backend Stub for xApp-Frame based components
+* vanilla Redis instace from DockerHub
+
diff --git a/test/dbaas/manifests/dbaas-dep.yaml b/test/dbaas/manifests/dbaas-dep.yaml
new file mode 100644 (file)
index 0000000..8c874ff
--- /dev/null
@@ -0,0 +1,42 @@
+#
+#==================================================================================
+#   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: example
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: dbaas
+  template:
+    metadata:
+      labels:
+        app: dbaas
+    spec:
+      containers:
+      - name: dbaas
+        image: redis
+        ports:
+        - containerPort: 6379
diff --git a/test/dbaas/manifests/dbaas-svc.yaml b/test/dbaas/manifests/dbaas-svc.yaml
new file mode 100644 (file)
index 0000000..53df6de
--- /dev/null
@@ -0,0 +1,36 @@
+#
+#==================================================================================
+#   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: example
+spec:
+  selector:
+    app: dbaas
+  clusterIP: None
+  ports:
+  - name: redis
+    port: 6379
+    protocol: TCP
+
diff --git a/test/e2t/README.md b/test/e2t/README.md
new file mode 100644 (file)
index 0000000..5685fca
--- /dev/null
@@ -0,0 +1,6 @@
+# E2T Test platform component
+Base project: https://gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp
+## General Description
+__E2T__ is a platform component stub which has following behaviors
+* Receives, decodes and prints out the content of any RMR messages
+* Sends Subscription Response message to each RMR message using it's sub_id
diff --git a/test/e2t/build.sh b/test/e2t/build.sh
new file mode 100644 (file)
index 0000000..d5406b7
--- /dev/null
@@ -0,0 +1,29 @@
+#!/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
+#
+
+cp -Rf ${PWD}/e2t ${PWD}/e2t.yaml ${PWD}/container/
+
+echo 'Creating E2T container'
+docker build --no-cache --tag=e2t:builder ${PWD}/container/
diff --git a/test/e2t/container/Dockerfile b/test/e2t/container/Dockerfile
new file mode 100644 (file)
index 0000000..f3a8c27
--- /dev/null
@@ -0,0 +1,30 @@
+#
+#==================================================================================
+#   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 ubuntu
+
+COPY e2t /
+COPY e2t.yaml /
+COPY run_e2t.sh /
+COPY usr/ /usr/
+RUN ldconfig
\ No newline at end of file
diff --git a/test/e2t/container/e2t.yaml b/test/e2t/container/e2t.yaml
new file mode 100644 (file)
index 0000000..e91fbdf
--- /dev/null
@@ -0,0 +1,23 @@
+#   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": 4
+"rmr":
+  "protPort": "tcp:4560"
+  "maxSize": 2072
+  "numWorkers": 1
diff --git a/test/e2t/container/run_e2t.sh b/test/e2t/container/run_e2t.sh
new file mode 100644 (file)
index 0000000..f5b3c97
--- /dev/null
@@ -0,0 +1,25 @@
+#!/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
diff --git a/test/e2t/e2t.go b/test/e2t/e2t.go
new file mode 100644 (file)
index 0000000..119e59e
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+==================================================================================
+  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 (
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
+       submgr "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/control"
+       "errors"
+)
+
+type E2t struct {
+}
+
+func (e E2t ) Consume(mtype, sub_id int, len int, payload []byte) (err error) {
+       asn1 := submgr.Asn1{}
+       message, err := asn1.Decode(payload)
+       if err != nil {
+               xapp.Logger.Debug("E2T asn1Decoding failure due to "+ err.Error())
+               return
+       }
+       xapp.Logger.Info("E2T Received Message content: %v", message)
+       err = e.subscriptionResponse(sub_id)
+       return
+}
+
+func (e E2t ) subscriptionResponse(sub_id int) (err error) {
+       asn1 := submgr.Asn1{}
+       payload, err := asn1.Encode(submgr.RmrPayload{8, sub_id, "E2T: RCO Subscribed"})
+       if err != nil {
+               return
+       }
+       if !xapp.Rmr.Send(12011, sub_id, len(payload), payload) {
+               err = errors.New("rmr.Send() failed")   
+       }
+       return
+}
+
+func main() {
+       e2t := E2t{}
+       xapp.Run(e2t)
+}
diff --git a/test/e2t/e2t.yaml b/test/e2t/e2t.yaml
new file mode 100644 (file)
index 0000000..e91fbdf
--- /dev/null
@@ -0,0 +1,23 @@
+#   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": 4
+"rmr":
+  "protPort": "tcp:4560"
+  "maxSize": 2072
+  "numWorkers": 1
diff --git a/test/e2t/manifests/e2t_dep.yaml b/test/e2t/manifests/e2t_dep.yaml
new file mode 100644 (file)
index 0000000..1b009ec
--- /dev/null
@@ -0,0 +1,48 @@
+#
+#==================================================================================
+#   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: example
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: e2t
+  template:
+    metadata:
+      labels:
+        app: e2t
+    spec:
+      containers:
+      - name: e2t
+        image: cmaster:5000/e2t:builder
+        command: ["/run_e2t.sh"]
+        env:
+        - name: DBAAS_SERVICE_HOST
+          value: dbaas
+        ports:
+        - containerPort: 8080
+        - containerPort: 4560
+        - containerPort: 4561
diff --git a/test/e2t/manifests/e2t_svc.yaml b/test/e2t/manifests/e2t_svc.yaml
new file mode 100644 (file)
index 0000000..2658d7c
--- /dev/null
@@ -0,0 +1,42 @@
+#
+#==================================================================================
+#   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: example
+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
+
diff --git a/test/rco/README.md b/test/rco/README.md
new file mode 100644 (file)
index 0000000..07910a2
--- /dev/null
@@ -0,0 +1,7 @@
+# RCO Test xApp Instance
+Base project: https://gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp
+## General Description
+__RCO__ is an xApp instance which has following behaviors
+* sends one RMR message periodically in every 2 second. 
+* alternately sends Subscription Request (12010) and other (10000) type of messages
+
diff --git a/test/rco/build.sh b/test/rco/build.sh
new file mode 100644 (file)
index 0000000..a631d87
--- /dev/null
@@ -0,0 +1,29 @@
+#!/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
+#
+
+cp -Rf ${PWD}/rco ${PWD}/rco.yaml ${PWD}/container/
+
+echo 'Creating RCO container'
+docker build --no-cache --tag=rco:builder ${PWD}/container/
diff --git a/test/rco/container/Dockerfile b/test/rco/container/Dockerfile
new file mode 100644 (file)
index 0000000..1ddf3c0
--- /dev/null
@@ -0,0 +1,30 @@
+#
+#==================================================================================
+#   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 ubuntu
+
+COPY rco /
+COPY rco.yaml /
+COPY run_rco.sh /
+COPY usr/ /usr/
+RUN ldconfig
\ No newline at end of file
diff --git a/test/rco/container/run_rco.sh b/test/rco/container/run_rco.sh
new file mode 100644 (file)
index 0000000..1bcb1ed
--- /dev/null
@@ -0,0 +1,25 @@
+#!/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
diff --git a/test/rco/manifests/rco-dep.yaml b/test/rco/manifests/rco-dep.yaml
new file mode 100644 (file)
index 0000000..1425b2b
--- /dev/null
@@ -0,0 +1,48 @@
+#
+#==================================================================================
+#   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: example
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: rco
+  template:
+    metadata:
+      labels:
+        app: rco
+    spec:
+      containers:
+      - name: rco
+        image: cmaster:5000/rco:builder
+        command: ["/run_rco.sh"]
+        env:
+        - name: DBAAS_SERVICE_HOST
+          value: dbaas
+        ports:
+        - containerPort: 8080
+        - containerPort: 4560
+        - containerPort: 4561
diff --git a/test/rco/manifests/rco-svc.yaml b/test/rco/manifests/rco-svc.yaml
new file mode 100644 (file)
index 0000000..5310ddd
--- /dev/null
@@ -0,0 +1,42 @@
+#
+#==================================================================================
+#   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: example
+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
+
diff --git a/test/rco/rco.go b/test/rco/rco.go
new file mode 100644 (file)
index 0000000..5109530
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+==================================================================================
+  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 (
+       "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
+       submgr "gerrit.o-ran-sc.org/r/ric-plt/submgr/pkg/control"
+       "time"
+       "os"
+)
+
+type Rco struct {
+}
+
+var    c chan submgr.RmrDatagram = make(chan submgr.RmrDatagram, 1)
+
+func (m Rco) Consume(mtype, sub_id int, len int, payload []byte) (err error) {
+       return
+}
+
+func (r *Rco) send(datagram submgr.RmrDatagram) {
+       xapp.Rmr.Send(datagram.MessageType, datagram.SubscriptionId, len(datagram.Payload), datagram.Payload)
+}
+
+func (r *Rco) Run() {
+       for {
+               message := <- c
+               xapp.Logger.Info("RCO Message - Type=%v SubID=%v", message.MessageType, message.SubscriptionId)
+               r.send(message)
+       }
+}
+
+func main() {
+       rco := Rco{}
+       go xapp.Rmr.Start(rco)
+       go rco.Run()
+       asn1 := submgr.Asn1{}
+       message, err := asn1.Encode(submgr.RmrPayload{8, 1111, "RCO: Subscription Request"})
+       if err != nil {
+               xapp.Logger.Debug(err.Error())
+               os.Exit(1)
+       }
+       doSubscribe := true
+       for {
+               time.Sleep(2 * time.Second)
+               if doSubscribe {
+                       c <- submgr.RmrDatagram{12010, 9999, message}
+                       doSubscribe = false
+               } else {
+                       c <- submgr.RmrDatagram{10000, 9999, make([]byte,0)}
+                       doSubscribe = true
+               }
+       }
+}
\ No newline at end of file
diff --git a/test/rco/rco.yaml b/test/rco/rco.yaml
new file mode 100644 (file)
index 0000000..e91fbdf
--- /dev/null
@@ -0,0 +1,23 @@
+#   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": 4
+"rmr":
+  "protPort": "tcp:4560"
+  "maxSize": 2072
+  "numWorkers": 1
diff --git a/test/uta_rtg.rt b/test/uta_rtg.rt
new file mode 100644 (file)
index 0000000..792e9a7
--- /dev/null
@@ -0,0 +1,6 @@
+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