Flow: Rename IPFIX exporter.
[vpp.git] / src / plugins / ioam / analyse / ioam_summary_export.h
1 /*
2  * Copyright (c) 2017 Cisco and/or its affiliates.
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 #ifndef __included_ip6_ioam_flow_report_h__
16 #define __included_ip6_ioam_flow_report_h__
17
18 #include <ioam/analyse/ioam_analyse.h>
19 #include <vnet/ipfix-export/flow_report.h>
20
21 #define foreach_ioam_ipfix_info_element           \
22 _(ioamPacketSent, 5239, u32)                     \
23 _(ioamPacketCount, 5237, u32)                     \
24 _(ioamByteCount, 5238, u32)                       \
25 _(ioamPathMap, 5262, u32)                         \
26 _(ioamNumberOfPaths, 5264, u16)                   \
27 _(ioamSfcValidatedCount, 5278, u32)               \
28 _(ioamSfcInValidatedCount, 5279, u32)             \
29 _(ioamSeqnoRxCount, 5280, u32)                    \
30 _(ioamSeqnoLostCount, 5281, u32)                  \
31 _(ioamSeqnoReorderedCount, 5282, u32)             \
32 _(ioamSeqnoDupCount, 5283, u32)
33
34
35 typedef enum
36 {
37 #define _(n,v,t) n = v,
38   foreach_ioam_ipfix_info_element
39 #undef _
40 } ioam_ipfix_info_element_id_t;
41
42 #define foreach_ioam_ipfix_field                                          \
43 _(pkt_sent, 0xffffffff, ioamPacketSent, 4)                      \
44 _(pkt_counter, 0xffffffff, ioamPacketCount, 4)                      \
45 _(bytes_counter, 0xffffffff, ioamByteCount, 4)                      \
46 _(pot_data.sfc_validated_count, 0xffffffff, ioamSfcValidatedCount, 4)     \
47 _(pot_data.sfc_invalidated_count, 0xffffffff, ioamSfcInValidatedCount, 4) \
48 _(seqno_data.rx_packets, 0xffffffff, ioamSeqnoRxCount, 4) \
49 _(seqno_data.lost_packets, 0xffffffff, ioamSeqnoLostCount, 4) \
50 _(seqno_data.reordered_packets, 0xffffffff, ioamSeqnoReorderedCount, 4) \
51 _(seqno_data.dup_packets, 0xffffffff, ioamSeqnoDupCount, 4)
52
53 clib_error_t *ioam_flow_report_init (vlib_main_t * vm);
54
55 typedef struct
56 {
57   u8 num_nodes;
58   u8 trace_type;
59   u16 reserve;
60   u32 mean_delay;
61   u32 pkt_counter;
62   u32 bytes_counter;
63   ioam_path_map_t path[0];
64 } ioam_path;
65
66 clib_error_t *ioam_flow_create (u8 del);
67
68 u8 *ioam_template_rewrite (flow_report_main_t * frm, flow_report_t * fr,
69                            ip4_address_t * collector_address,
70                            ip4_address_t * src_address, u16 collector_port);
71
72 u16 ioam_analyse_add_ipfix_record (flow_report_t * fr,
73                                    ioam_analyser_data_t * record,
74                                    vlib_buffer_t * b0, u16 offset,
75                                    ip6_address_t * src, ip6_address_t * dst,
76                                    u16 src_port, u16 dst_port);
77
78 #endif /* __included_ip6_ioam_flow_report_h__ */
79
80 /*
81  * fd.io coding-style-patch-verification: ON
82  *
83  * Local Variables:
84  * eval: (c-set-style "gnu")
85  * End:
86  */