Matteo Scandolo | a8bd93e | 2018-09-13 13:36:50 -0700 | [diff] [blame^] | 1 | // Copyright 2018 Open Networking Foundation |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package main |
| 16 | |
| 17 | // KPI Events format |
| 18 | |
| 19 | type Metrics struct { |
| 20 | TxBytes float64 `json:"tx_bytes"` |
| 21 | TxPackets float64 `json:"tx_packets"` |
| 22 | TxErrorPackets float64 `json:"tx_error_packets"` |
| 23 | TxBcastPackets float64 `json:"tx_bcast_packets"` |
| 24 | TxUnicastPackets float64 `json:"tx_ucast_packets"` |
| 25 | TxMulticastPackets float64 `json:"tx_mcast_packets"` |
| 26 | RxBytes float64 `json:"rx_bytes"` |
| 27 | RxPackets float64 `json:"rx_packets"` |
| 28 | RxErrorPackets float64 `json:"rx_error_packets"` |
| 29 | RxBcastPackets float64 `json:"rx_bcast_packets"` |
| 30 | RxMulticastPackets float64 `json:"rx_mcast_packets"` |
| 31 | } |
| 32 | |
| 33 | type Context struct { |
| 34 | InterfaceID string `json:"intf_id"` |
| 35 | PonID string `json:"pon_id"` |
| 36 | PortNumber string `json:"port_no"` |
| 37 | } |
| 38 | |
| 39 | type Metadata struct { |
| 40 | LogicalDeviceID string `json:"logical_device_id"` |
| 41 | Title string `json:"title"` |
| 42 | SerialNumber string `json:"serial_no"` |
| 43 | Timestamp float64 `json:"ts"` |
| 44 | DeviceID string `json:"device_id"` |
| 45 | Context *Context `json:"context"` |
| 46 | } |
| 47 | |
| 48 | type SliceData struct { |
| 49 | Metrics *Metrics `json:"metrics"` |
| 50 | Metadata *Metadata `json:"metadata"` |
| 51 | } |
| 52 | |
| 53 | type KPI struct { |
| 54 | Type string `json:"type"` |
| 55 | Timestamp float64 `json:"ts"` |
| 56 | SliceDatas []*SliceData `json:"slice_data"` |
| 57 | } |