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