NFNamingCode is read from environment variable VESMGR_NFNAMINGCODE.
If not set, the default value is "ricp".
NfcNamingCodes is an empty list.
Also add vesmgr version information log at vesmgr startup.
The version information is generated at compile time
from the container-tag.yaml file (if exists) and
from the git hash of the last commit.
Change-Id: If524e679dbba2ee56217b2e03b1daf18eb2c46fb
Signed-off-by: Roni Riska <roni.riska@nokia.com>
# Copy vesmgr to the Working Directory
COPY $HOME/ .
-RUN GO111MODULE=on go mod download
-
-# Run vesmgr UT
-RUN export GOPATH=$HOME/go && \
- export PATH=$GOPATH/bin:$GOROOT/bin:$PATH && \
- go test ./...
-
-# Install vesmgr
-RUN export GOPATH=$HOME/go && \
- export PATH=$GOPATH/bin:$GOROOT/bin:$PATH && \
- go install -v ./cmd/vesmgr
+RUN ./build_vesmgr.sh
#################
#
-# RIC VESPA manager
+RIC VESPA manager
+=================
-The VESPA manager uses the VES Agent (https://github.com/nokia/ONAP-VESPA)
-to adapt near-RT RIC internal statistics' collection using Prometheus
+The VESPA manager uses the VES Agent [https://github.com/nokia/ONAP-VESPA](https://github.com/nokia/ONAP-VESPA)
+to adapt near-RT RIC internal statistics' collection using Prometheus
(xApps and platform containers) to ONAP's VES (VNF event streaming).
The vesmgr container runs two processes: the VESPA manager and the VES
The VESPA manager starts and configures the VES Agent.
-The VES Agent is a service acting as a bridge between Prometheus and
+The VES Agent is a service acting as a bridge between Prometheus and
ONAP's VES Collector.
# Application metrics definition
The application metrics are defined in the application descriptor.
-For each counter, the following fields are required in the "metrics"
+For each counter, the following fields are required in the "metrics"
section of the descriptor:
* name - Prometheus name of the counter
* objectInstance - object instance in VE
The VESPA manager receives the application metrics configuration from the
-application manager. It subscribes the app notification messages from the
+application manager. It subscribes the app notification messages from the
application manager, and after having received one, requests the latest
application configuration, creates the VES Agent configuration based on it,
and restarts the VES Agent.
# VES Collector event format
-The VES Agent transmits events to the VES Collector in the
-VES Common Event Format v5.4.1.
+The VES Agent transmits events to the VES Collector in the
+VES Common Event Format v5.4.1.
The Common Event Format is expressed in JSON schema v28.4.1.
VES Event Listener 5.4.1:
The VESPA manager container requires the following environment variables:
* VESMGR_VNFNAME - VNF name as a string. Default: Vespa.
+* VESMGR_NFNAMINGCODE - NF naming code as a string. Default: ricp.
* VESMGR_HB_INTERVAL - VES heartbeat interval as a string. For example: 30s.
* VESMGR_MEAS_INTERVAL - Measurement interval as a string. For example: 60s.
* VESMGR_PROMETHEUS_ADDR - Prometheus address. For example: http://127.0.0.1:123
-
* VESMGR_PRICOLLECTOR_ADDR - Primary collector FQDN as a string. For example: ricaux-entry.
* VESMGR_PRICOLLECTOR_PORT - Primary collector port id as an integer. Default: 8443.
* VESMGR_PRICOLLECTOR_SERVERROOT - Path before the /eventListener part of the POST URL as a string.
* VESMGR_PRICOLLECTOR_PASSWORD - Password as a string.
* VESMGR_PRICOLLECTOR_PASSPHASE - Passphrase as a string.
-
* VESMGR_APPMGRDOMAIN - Application manager domain. This is for testing purposes, only. Default: service-ricplt-appmgr-http.ricplt.svc.cluster.local.
# Liveness probe
The VESPA manager replies to liveness HTTP GET at path /supervision.
+# Errors
+
+The VESPA manager exits in the following error cases:
+
+* The VES Agent exits
+* An unrecoverable system error during the initialization, for example
+ * Creation of the VES Agent configuration file fails
+ * Creation of a HTTP request message fails
+
# Unit Tests
In order to run the VESPA manager unit tests, give the following command:
-```
+```shell
go test ./... -v
```
# License
-See [LICENSES.txt](LICENSES.txt) file.
+See [LICENSES.txt](./LICENSES.txt) file.
--- /dev/null
+#!/bin/bash
+#
+# Copyright (c) 2019 AT&T Intellectual Property.
+# Copyright (c) 2018-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.
+#
+
+set -e
+set -x
+# Load modules
+GO111MODULE=on go mod download
+export GOPATH=$HOME/go
+export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
+
+# Run vesmgr UT
+go test ./...
+
+# setup version tag
+if [ -f container-tag.yaml ]
+then
+ tag=$(grep "tag:" container-tag.yaml | awk '{print $2}')
+else
+ tag="-"
+fi
+
+hash=$(git rev-parse --short HEAD || true)
+
+# Install vesmgr
+go install -ldflags "-X main.Version=$tag -X main.Hash=$hash" -v ./cmd/vesmgr
+
+
const defaultReportingEntityID = "00000000-0000-0000-0000-000000000000"
const defaultVNFName = "Vespa"
+const defaultNFNamingCode = "ricp"
func readSystemUUID() string {
data, err := ioutil.ReadFile("/sys/class/dmi/id/product_uuid")
return VNFName
}
+func getNFNamingCode() string {
+ NFNamingCode := os.Getenv("VESMGR_NFNAMINGCODE")
+ if NFNamingCode == "" {
+ return defaultNFNamingCode
+ }
+ return NFNamingCode
+}
+
func basicVespaConf() VESAgentConfiguration {
var vespaconf = VESAgentConfiguration{
DataDir: "/tmp/data",
ReportingEntityName: "Vespa",
ReportingEntityID: readSystemUUID(),
MaxSize: 2000000,
- NfNamingCode: "hsxp",
- NfcNamingCodes: []NfcNamingCode{
- NfcNamingCode{
- Type: "oam",
- Vnfcs: []string{"lr-ope-0", "lr-ope-1", "lr-ope-2"},
- },
- NfcNamingCode{
- Type: "etl",
- Vnfcs: []string{"lr-pro-0", "lr-pro-1"},
- },
- },
+ NfNamingCode: getNFNamingCode(),
+ NfcNamingCodes: []NfcNamingCode{},
RetryInterval: time.Second * 5,
MaxMissed: 2,
},
assert.Equal(t, vesconf.Event.RetryInterval, time.Second*5)
assert.Equal(t, vesconf.Measurement.Prometheus.KeepAlive, time.Second*30)
assert.Equal(t, vesconf.Event.VNFName, defaultVNFName)
+ assert.Equal(t, vesconf.Event.NfNamingCode, defaultNFNamingCode)
assert.Equal(t, vesconf.Event.ReportingEntityName, "Vespa")
// depending on the credentials with which this test is run,
// root or non-root, the code either reads the UUID from the file or
func TestBasicConfigContainsCorrectVNFName(t *testing.T) {
os.Setenv("VESMGR_VNFNAME", "VNF-111")
+ os.Setenv("VESMGR_NFNAMINGCODE", "code55")
vesconf := basicVespaConf()
assert.Equal(t, vesconf.Event.VNFName, "VNF-111")
+ assert.Equal(t, vesconf.Event.NfNamingCode, "code55")
os.Unsetenv("VESMGR_VNFNAME")
+ os.Unsetenv("VESMGR_NFNAMINGCODE")
}
func TestCollectorConfiguration(t *testing.T) {
os.Unsetenv("VESMGR_VNFNAME")
+ os.Unsetenv("VESMGR_NFNAMINGCODE")
os.Setenv("VESMGR_PRICOLLECTOR_USER", "user123")
os.Setenv("VESMGR_PRICOLLECTOR_PASSWORD", "pass123")
os.Setenv("VESMGR_PRICOLLECTOR_PASSPHRASE", "phrase123")
func TestCollectorConfigurationWhenEnvironmentVariablesAreNotDefined(t *testing.T) {
os.Unsetenv("VESMGR_VNFNAME")
+ os.Unsetenv("VESMGR_NFNAMINGCODE")
os.Unsetenv("VESMGR_PRICOLLECTOR_USER")
os.Unsetenv("VESMGR_PRICOLLECTOR_PASSWORD")
os.Unsetenv("VESMGR_PRICOLLECTOR_PASSPHRASE")
var logger *mdcloggo.MdcLogger
+// Version information, which is filled during compilation
+// Version tag of vesmgr container
+var Version string
+
+// Hash of the git commit used in building
+var Hash string
+
const vesmgrXappNotifPort = "8080"
const vesmgrXappNotifPath = "/vesmgr_xappnotif/"
const timeoutPostXAppSubscriptions = 5
// Init initializes the vesmgr
func (vesmgr *VesMgr) Init(listenPort string) *VesMgr {
logger.Info("vesmgrInit")
+ logger.Info("version %s (%s)", Version, Hash)
+
var err error
if vesmgr.myIPAddress, err = getMyIP(); err != nil || vesmgr.myIPAddress == "" {
logger.Error("Cannot get myIPAddress: IP %s, err %s", vesmgr.myIPAddress, err.Error())
# The Jenkins job uses this string for the tag in the image name
# for example nexus3.o-ran-sc.org:10004/my-image-name:0.0.1
---
-tag: 0.0.6
+tag: 0.0.7