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
45 // Structs are copied from https://github.com/nokia/ONAP-VESPA/tree/master/ves-agent/config
46 // and from https://github.com/nokia/ONAP-VESPA/blob/master/govel/config.go
49 // HeartbeatConfiguration parameters
50 type HeartbeatConfiguration struct {
51 DefaultInterval time.Duration `yaml:"defaultInterval"`
54 // Label represents a VES field by it's name, with an expression
55 // for getting its value
57 Name string `yaml:"name"`
58 Expr string `yaml:"expr"`
61 // MetricRule defines how to retrieve metrics and map them
62 // into a list of evel.EventMeasurement struct
63 type MetricRule struct {
64 Target string `yaml:"target"` // Target VES event field
65 Expr string `yaml:"expr"` // Prometheus query expression
66 VMIDLabel string `yaml:"vmId"` // Metric label holding the VNF ID
67 Labels []Label `yaml:"labels"` // Set of VES fields to map to values of given label
68 ObjectName string `yaml:"object_name"` // JSON Object Name
69 ObjectInstance string `yaml:"object_instance"` // JSON Object instance
70 ObjectKeys []Label `yaml:"object_keys"` // JSON Object keys
73 // MetricRules defines a list of rules, and defaults values for them
74 type MetricRules struct {
75 DefaultValues *MetricRule `yaml:"defaults"` // Default rules to apply (except for expr), labels are merged
76 Metrics []MetricRule `yaml:"metrics"` // List of query and mapping of rules
79 // PrometheusConfig parameters
80 type PrometheusConfig struct {
81 Address string `yaml:"address"` // Base URL to prometheus API
82 Timeout time.Duration `yaml:"timeout"` // API request timeout
83 KeepAlive time.Duration `yaml:"keepalive"` // HTTP Keep-Alive
84 Rules MetricRules `yaml:"rules"` // Querying rules
87 // MeasurementConfiguration parameters
88 type MeasurementConfiguration struct {
89 DomainAbbreviation string `yaml:"domainAbbreviation"` // "Measurement" or "Mfvs"
90 DefaultInterval time.Duration `yaml:"defaultInterval"` // Default measurement interval
91 MaxBufferingDuration time.Duration `yaml:"maxBufferingDuration"` // Maximum timeframe size of buffering
92 Prometheus PrometheusConfig `yaml:"prometheus"` // Prometheus configuration
95 // CollectorConfiguration parameters
96 type CollectorConfiguration struct {
97 ServerRoot string `yaml:"serverRoot"`
98 FQDN string `yaml:"fqdn"`
99 Port int `yaml:"port"`
100 Secure bool `yaml:"secure"`
101 Topic string `yaml:"topic"`
102 User string `yaml:"user"`
103 Password string `yaml:"password"`
104 PassPhrase string `yaml:"passphrase,omitempty"` // passPhrase used to encrypt collector password in file
107 //NfcNamingCode mapping bettween NfcNamingCode (oam or etl) and Vnfcs
108 type NfcNamingCode struct {
109 Type string `yaml:"type"`
110 Vnfcs []string `yaml:"vnfcs"`
113 // EventConfiguration parameters
114 type EventConfiguration struct {
115 VNFName string `yaml:"vnfName"` // Name of this VNF, eg: dpa2bhsxp5001v
116 ReportingEntityName string `yaml:"reportingEntityName"` // Value of reporting entity field. Usually local VM (VNFC) name
117 ReportingEntityID string `yaml:"reportingEntityID"` // Value of reporting entity UUID. Usually local VM (VNFC) UUID
118 MaxSize int `yaml:"maxSize"`
119 NfNamingCode string `yaml:"nfNamingCode,omitempty"` // "hspx"
120 NfcNamingCodes []NfcNamingCode `yaml:"nfcNamingCodes,omitempty"`
121 RetryInterval time.Duration `yaml:"retryInterval,omitempty"`
122 MaxMissed int `yaml:"maxMissed,omitempty"`
125 // VESAgentConfiguration parameters
126 type VESAgentConfiguration struct {
127 PrimaryCollector CollectorConfiguration `yaml:"primaryCollector"`
128 Heartbeat HeartbeatConfiguration `yaml:"heartbeat,omitempty"`
129 Measurement MeasurementConfiguration `yaml:"measurement,omitempty"`
130 Event EventConfiguration `yaml:"event,omitempty"`
131 Debug bool `yaml:"debug,omitempty"`
132 CaCert string `yaml:"caCert,omitempty"` // Root certificate content
133 DataDir string `yaml:"datadir"` // Path to directory containing data
136 // AppMetricsStruct contains xapplication metrics definition
137 type AppMetricsStruct struct {
143 ObjectInstance string
147 // AppMetrics contains metrics definitions for all Xapps
148 type AppMetrics map[string]AppMetricsStruct