2 * Copyright (c) 2019 AT&T Intellectual Property.
3 * Copyright (c) 2018-2019 Nokia.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * This source code is part of the near-RT RIC (RAN Intelligent Controller)
18 * platform project (RICP).
28 type VespaMgr struct {
30 vesAgent *CommandRunner
40 alertManagerBindAddr string
44 // Structs are copied from https://github.com/nokia/ONAP-VESPA/tree/master/ves-agent/config
45 // and from https://github.com/nokia/ONAP-VESPA/blob/master/govel/config.go
48 // HeartbeatConfiguration parameters
49 type HeartbeatConfiguration struct {
50 DefaultInterval time.Duration `yaml:"defaultInterval"`
53 // Label represents a VES field by it's name, with an expression
54 // for getting its value
56 Name string `yaml:"name"`
57 Expr string `yaml:"expr"`
60 // MetricRule defines how to retrieve metrics and map them
61 // into a list of evel.EventMeasurement struct
62 type MetricRule struct {
63 Target string `yaml:"target"` // Target VES event field
64 Expr string `yaml:"expr"` // Prometheus query expression
65 VMIDLabel string `yaml:"vmId"` // Metric label holding the VNF ID
66 Labels []Label `yaml:"labels"` // Set of VES fields to map to values of given label
67 ObjectName string `yaml:"object_name"` // JSON Object Name
68 ObjectInstance string `yaml:"object_instance"` // JSON Object instance
69 ObjectKeys []Label `yaml:"object_keys"` // JSON Object keys
72 // MetricRules defines a list of rules, and defaults values for them
73 type MetricRules struct {
74 DefaultValues *MetricRule `yaml:"defaults"` // Default rules to apply (except for expr), labels are merged
75 Metrics []MetricRule `yaml:"metrics"` // List of query and mapping of rules
78 // PrometheusConfig parameters
79 type PrometheusConfig struct {
80 Address string `yaml:"address"` // Base URL to prometheus API
81 Timeout time.Duration `yaml:"timeout"` // API request timeout
82 KeepAlive time.Duration `yaml:"keepalive"` // HTTP Keep-Alive
83 Rules MetricRules `yaml:"rules"` // Querying rules
86 // MeasurementConfiguration parameters
87 type MeasurementConfiguration struct {
88 DomainAbbreviation string `yaml:"domainAbbreviation"` // "Measurement" or "Mfvs"
89 DefaultInterval time.Duration `yaml:"defaultInterval"` // Default measurement interval
90 MaxBufferingDuration time.Duration `yaml:"maxBufferingDuration"` // Maximum timeframe size of buffering
91 Prometheus PrometheusConfig `yaml:"prometheus"` // Prometheus configuration
94 // CollectorConfiguration parameters
95 type CollectorConfiguration struct {
96 ServerRoot string `yaml:"serverRoot"`
97 FQDN string `yaml:"fqdn"`
98 Port int `yaml:"port"`
99 Secure bool `yaml:"secure"`
100 Topic string `yaml:"topic"`
101 User string `yaml:"user"`
102 Password string `yaml:"password"`
103 PassPhrase string `yaml:"passphrase,omitempty"` // passPhrase used to encrypt collector password in file
106 //NfcNamingCode mapping bettween NfcNamingCode (oam or etl) and Vnfcs
107 type NfcNamingCode struct {
108 Type string `yaml:"type"`
109 Vnfcs []string `yaml:"vnfcs"`
112 // EventConfiguration parameters
113 type EventConfiguration struct {
114 VNFName string `yaml:"vnfName"` // Name of this VNF, eg: dpa2bhsxp5001v
115 ReportingEntityName string `yaml:"reportingEntityName"` // Value of reporting entity field. Usually local VM (VNFC) name
116 ReportingEntityID string `yaml:"reportingEntityID"` // Value of reporting entity UUID. Usually local VM (VNFC) UUID
117 MaxSize int `yaml:"maxSize"`
118 NfNamingCode string `yaml:"nfNamingCode,omitempty"` // "hspx"
119 NfcNamingCodes []NfcNamingCode `yaml:"nfcNamingCodes,omitempty"`
120 RetryInterval time.Duration `yaml:"retryInterval,omitempty"`
121 MaxMissed int `yaml:"maxMissed,omitempty"`
124 // VESAgentConfiguration parameters
125 type VESAgentConfiguration struct {
126 PrimaryCollector CollectorConfiguration `yaml:"primaryCollector"`
127 Heartbeat HeartbeatConfiguration `yaml:"heartbeat,omitempty"`
128 Measurement MeasurementConfiguration `yaml:"measurement,omitempty"`
129 Event EventConfiguration `yaml:"event,omitempty"`
130 Debug bool `yaml:"debug,omitempty"`
131 CaCert string `yaml:"caCert,omitempty"` // Root certificate content
132 DataDir string `yaml:"datadir"` // Path to directory containing data
135 // AppMetricsStruct contains xapplication metrics definition
136 type AppMetricsStruct struct {
142 ObjectInstance string
146 // AppMetrics contains metrics definitions for all Xapps
147 type AppMetrics map[string]AppMetricsStruct