use crate::variable_versions::field_value::*;
use serde::Serialize;
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Serialize)]
pub enum ScopeFieldType {
System,
Interface,
LineCard,
NetflowCache,
Template,
Unknown(u16),
}
impl Default for ScopeFieldType {
fn default() -> Self {
ScopeFieldType::Unknown(0)
}
}
impl From<u16> for ScopeFieldType {
fn from(item: u16) -> Self {
match item {
1 => ScopeFieldType::System,
2 => ScopeFieldType::Interface,
3 => ScopeFieldType::LineCard,
4 => ScopeFieldType::NetflowCache,
5 => ScopeFieldType::Template,
_ => ScopeFieldType::Unknown(item),
}
}
}
impl From<ScopeFieldType> for u16 {
fn from(item: ScopeFieldType) -> Self {
match item {
ScopeFieldType::System => 1,
ScopeFieldType::Interface => 2,
ScopeFieldType::LineCard => 3,
ScopeFieldType::NetflowCache => 4,
ScopeFieldType::Template => 5,
ScopeFieldType::Unknown(n) => n,
}
}
}
#[derive(Debug, Hash, PartialEq, Eq, Clone, Ord, PartialOrd, Copy, Serialize)]
pub enum V9Field {
InBytes,
InPkts,
Flows,
Protocol,
SrcTos,
TcpFlags,
L4SrcPort,
Ipv4SrcAddr,
SrcMask,
InputSnmp,
L4DstPort,
Ipv4DstAddr,
DstMask,
OutputSnmp,
Ipv4NextHop,
SrcAs,
DstAs,
BgpIpv4NextHop,
MulDstPkts,
MulDstBytes,
LastSwitched,
FirstSwitched,
OutBytes,
OutPkts,
MinPktLngth,
MaxPktLngth,
Ipv6SrcAddr,
Ipv6DstAddr,
Ipv6SrcMask,
Ipv6DstMask,
Ipv6FlowLabel,
IcmpType,
MulIgmpType,
SamplingInterval,
SamplingAlgorithm,
FlowActiveTimeout,
FlowInactiveTimeout,
EngineType,
EngineId,
TotalBytesExp,
TotalPktsExp,
TotalFlowsExp,
Ipv4SrcPrefix,
Ipv4DstPrefix,
MplsTopLabelType,
MplsTopLabelIpAddr,
FlowSamplerId,
FlowSamplerMode,
FlowSamplerRandomInterval,
MinTtl,
MaxTtl,
Ipv4Ident,
DstTos,
InSrcMac,
OutDstMac,
SrcVlan,
DstVlan,
IpProtocolVersion,
Direction,
Ipv6NextHop,
BgpIpv6NextHop,
Ipv6OptionHeaders,
MplsLabel1,
MplsLabel2,
MplsLabel3,
MplsLabel4,
MplsLabel5,
MplsLabel6,
MplsLabel7,
MplsLabel8,
MplsLabel9,
MplsLabel10,
InDstMac,
OutSrcMac,
IfName,
IfDesc,
SamplerName,
InPermanentBytes,
InPermanentPkts,
FragmentOffset,
ForwardingStatus,
MplsPalRd,
MplsPrefixLen,
SrcTrafficIndex,
DstTrafficIndex,
ApplicationDescription,
ApplicationTag,
ApplicationName,
PostipDiffServCodePoint,
Replicationfactor,
Deprecated,
Layer2packetSectionOffset,
Layer2packetSectionSize,
Layer2packetSectionData,
BgpNextAdjacentAsNumber,
BgpPrevAdjacentAsNumber,
ExporterIpv4Address,
ExporterIpv6Address,
DroppedOctetDeltaCount,
DroppedPacketDeltaCount,
DroppedOctetTotalCount,
DroppedPacketTotalCount,
FlowEndReason,
CommonPropertiesId,
ObservationPointId,
IcmpTypeCodeIpv6,
MplsTopLabelIpv6Address,
LineCardId,
PortId,
MeteringProcessId,
ExportingProcessId,
TemplateId,
WlanChannelId,
WlanSsid,
FlowId,
ObservationDomainId,
FlowStartSeconds,
FlowEndSeconds,
FlowStartMilliseconds,
FlowEndMilliseconds,
FlowStartMicroseconds,
FlowEndMicroseconds,
FlowStartNanoseconds,
FlowEndNanoseconds,
FlowStartDeltaMicroseconds,
FlowEndDeltaMicroseconds,
SystemInitTimeMilliseconds,
FlowDurationMilliseconds,
FlowDurationMicroseconds,
ObservedFlowTotalCount,
IgnoredPacketTotalCount,
IgnoredOctetTotalCount,
NotSentFlowTotalCount,
NotSentPacketTotalCount,
NotSentOctetTotalCount,
DestinationIpv6Prefix,
SourceIpv6Prefix,
PostOctetTotalCount,
PostPacketTotalCount,
FlowKeyIndicator,
PostMcastPacketTotalCount,
PostMcastOctetTotalCount,
IcmpTypeValue,
IcmpCodeValue,
IcmpIpv6TypeValue,
IcmpIpv6CodeValue,
PostNATSourceIPv4Address,
PostNATDestinationIPv4Address,
PostNATTSourceTransportPort,
PostNATTDestinationTransportPort,
NatOriginatingAddressRealm,
NatEvent,
PostNATSourceIpv6Address,
PostNATDestinationIpv6Address,
FirewallEvent,
IngressVRFID,
EgressVRFID,
BiflowDirection,
ObservationTimeMilliseconds,
IanaAssigned(u16),
Unknown(u16),
}
impl From<V9Field> for FieldDataType {
fn from(d: V9Field) -> FieldDataType {
match d {
V9Field::InBytes => FieldDataType::UnsignedDataNumber,
V9Field::InPkts => FieldDataType::UnsignedDataNumber,
V9Field::Flows => FieldDataType::UnsignedDataNumber,
V9Field::Protocol => FieldDataType::ProtocolType,
V9Field::SrcTos => FieldDataType::UnsignedDataNumber,
V9Field::TcpFlags => FieldDataType::TcpControlBits,
V9Field::L4SrcPort => FieldDataType::UnsignedDataNumber,
V9Field::Ipv4SrcAddr => FieldDataType::Ip4Addr,
V9Field::SrcMask => FieldDataType::UnsignedDataNumber,
V9Field::InputSnmp => FieldDataType::UnsignedDataNumber,
V9Field::L4DstPort => FieldDataType::UnsignedDataNumber,
V9Field::Ipv4DstAddr => FieldDataType::Ip4Addr,
V9Field::DstMask => FieldDataType::UnsignedDataNumber,
V9Field::OutputSnmp => FieldDataType::UnsignedDataNumber,
V9Field::Ipv4NextHop => FieldDataType::Ip4Addr,
V9Field::SrcAs => FieldDataType::UnsignedDataNumber,
V9Field::DstAs => FieldDataType::UnsignedDataNumber,
V9Field::BgpIpv4NextHop => FieldDataType::Ip4Addr,
V9Field::MulDstPkts => FieldDataType::UnsignedDataNumber,
V9Field::MulDstBytes => FieldDataType::UnsignedDataNumber,
V9Field::LastSwitched => FieldDataType::DurationMillis,
V9Field::FirstSwitched => FieldDataType::DurationMillis,
V9Field::OutBytes => FieldDataType::UnsignedDataNumber,
V9Field::OutPkts => FieldDataType::UnsignedDataNumber,
V9Field::MinPktLngth => FieldDataType::UnsignedDataNumber,
V9Field::MaxPktLngth => FieldDataType::UnsignedDataNumber,
V9Field::Ipv6SrcAddr => FieldDataType::Ip6Addr,
V9Field::Ipv6DstAddr => FieldDataType::Ip6Addr,
V9Field::Ipv6SrcMask => FieldDataType::UnsignedDataNumber,
V9Field::Ipv6DstMask => FieldDataType::UnsignedDataNumber,
V9Field::Ipv6FlowLabel => FieldDataType::UnsignedDataNumber,
V9Field::IcmpType => FieldDataType::UnsignedDataNumber,
V9Field::MulIgmpType => FieldDataType::UnsignedDataNumber,
V9Field::SamplingInterval => FieldDataType::UnsignedDataNumber,
V9Field::SamplingAlgorithm => FieldDataType::UnsignedDataNumber,
V9Field::FlowActiveTimeout => FieldDataType::UnsignedDataNumber,
V9Field::FlowInactiveTimeout => FieldDataType::UnsignedDataNumber,
V9Field::EngineType => FieldDataType::UnsignedDataNumber,
V9Field::EngineId => FieldDataType::UnsignedDataNumber,
V9Field::TotalBytesExp => FieldDataType::UnsignedDataNumber,
V9Field::TotalPktsExp => FieldDataType::UnsignedDataNumber,
V9Field::TotalFlowsExp => FieldDataType::UnsignedDataNumber,
V9Field::Ipv4SrcPrefix => FieldDataType::Ip4Addr,
V9Field::Ipv4DstPrefix => FieldDataType::Ip4Addr,
V9Field::MplsTopLabelType => FieldDataType::MplsTopLabelType,
V9Field::MplsTopLabelIpAddr => FieldDataType::Ip4Addr,
V9Field::FlowSamplerId => FieldDataType::UnsignedDataNumber,
V9Field::FlowSamplerMode => FieldDataType::UnsignedDataNumber,
V9Field::FlowSamplerRandomInterval => FieldDataType::UnsignedDataNumber,
V9Field::MinTtl => FieldDataType::UnsignedDataNumber,
V9Field::MaxTtl => FieldDataType::UnsignedDataNumber,
V9Field::Ipv4Ident => FieldDataType::UnsignedDataNumber,
V9Field::DstTos => FieldDataType::UnsignedDataNumber,
V9Field::InSrcMac => FieldDataType::MacAddr,
V9Field::OutDstMac => FieldDataType::MacAddr,
V9Field::SrcVlan => FieldDataType::UnsignedDataNumber,
V9Field::DstVlan => FieldDataType::UnsignedDataNumber,
V9Field::IpProtocolVersion => FieldDataType::UnsignedDataNumber,
V9Field::Direction => FieldDataType::UnsignedDataNumber,
V9Field::Ipv6NextHop => FieldDataType::Ip6Addr,
V9Field::BgpIpv6NextHop => FieldDataType::Ip6Addr,
V9Field::Ipv6OptionHeaders => FieldDataType::Ipv6ExtensionHeaders,
V9Field::MplsLabel1
| V9Field::MplsLabel2
| V9Field::MplsLabel3
| V9Field::MplsLabel4
| V9Field::MplsLabel5
| V9Field::MplsLabel6
| V9Field::MplsLabel7
| V9Field::MplsLabel8
| V9Field::MplsLabel9
| V9Field::MplsLabel10 => FieldDataType::UnsignedDataNumber,
V9Field::InDstMac => FieldDataType::MacAddr,
V9Field::OutSrcMac => FieldDataType::MacAddr,
V9Field::IfName => FieldDataType::String,
V9Field::IfDesc => FieldDataType::String,
V9Field::SamplerName => FieldDataType::String,
V9Field::InPermanentBytes => FieldDataType::UnsignedDataNumber,
V9Field::InPermanentPkts => FieldDataType::UnsignedDataNumber,
V9Field::FragmentOffset => FieldDataType::UnsignedDataNumber,
V9Field::ForwardingStatus => FieldDataType::ForwardingStatus,
V9Field::MplsPalRd => FieldDataType::Vec,
V9Field::MplsPrefixLen => FieldDataType::UnsignedDataNumber,
V9Field::SrcTrafficIndex => FieldDataType::UnsignedDataNumber,
V9Field::DstTrafficIndex => FieldDataType::UnsignedDataNumber,
V9Field::ApplicationDescription => FieldDataType::String,
V9Field::ApplicationTag => FieldDataType::ApplicationId,
V9Field::ApplicationName => FieldDataType::String,
V9Field::PostipDiffServCodePoint => FieldDataType::UnsignedDataNumber,
V9Field::Replicationfactor => FieldDataType::UnsignedDataNumber,
V9Field::Deprecated => FieldDataType::UnsignedDataNumber,
V9Field::Layer2packetSectionOffset => FieldDataType::UnsignedDataNumber,
V9Field::Layer2packetSectionSize => FieldDataType::UnsignedDataNumber,
V9Field::Layer2packetSectionData => FieldDataType::Vec,
V9Field::BgpNextAdjacentAsNumber => FieldDataType::UnsignedDataNumber,
V9Field::BgpPrevAdjacentAsNumber => FieldDataType::UnsignedDataNumber,
V9Field::ExporterIpv4Address => FieldDataType::Ip4Addr,
V9Field::ExporterIpv6Address => FieldDataType::Ip6Addr,
V9Field::DroppedOctetDeltaCount => FieldDataType::UnsignedDataNumber,
V9Field::DroppedPacketDeltaCount => FieldDataType::UnsignedDataNumber,
V9Field::DroppedOctetTotalCount => FieldDataType::UnsignedDataNumber,
V9Field::DroppedPacketTotalCount => FieldDataType::UnsignedDataNumber,
V9Field::FlowEndReason => FieldDataType::FlowEndReason,
V9Field::CommonPropertiesId => FieldDataType::UnsignedDataNumber,
V9Field::ObservationPointId => FieldDataType::UnsignedDataNumber,
V9Field::IcmpTypeCodeIpv6 => FieldDataType::UnsignedDataNumber,
V9Field::MplsTopLabelIpv6Address => FieldDataType::Ip6Addr,
V9Field::LineCardId => FieldDataType::UnsignedDataNumber,
V9Field::PortId => FieldDataType::UnsignedDataNumber,
V9Field::MeteringProcessId => FieldDataType::UnsignedDataNumber,
V9Field::ExportingProcessId => FieldDataType::UnsignedDataNumber,
V9Field::TemplateId => FieldDataType::UnsignedDataNumber,
V9Field::WlanChannelId => FieldDataType::UnsignedDataNumber,
V9Field::WlanSsid => FieldDataType::String,
V9Field::FlowId => FieldDataType::UnsignedDataNumber,
V9Field::ObservationDomainId => FieldDataType::UnsignedDataNumber,
V9Field::FlowStartSeconds => FieldDataType::DurationSeconds,
V9Field::FlowEndSeconds => FieldDataType::DurationSeconds,
V9Field::FlowStartMilliseconds => FieldDataType::DurationMillis,
V9Field::FlowEndMilliseconds => FieldDataType::DurationMillis,
V9Field::FlowStartMicroseconds => FieldDataType::DurationMicrosNTP,
V9Field::FlowEndMicroseconds => FieldDataType::DurationMicrosNTP,
V9Field::FlowStartNanoseconds => FieldDataType::DurationNanosNTP,
V9Field::FlowEndNanoseconds => FieldDataType::DurationNanosNTP,
V9Field::FlowStartDeltaMicroseconds => FieldDataType::UnsignedDataNumber,
V9Field::FlowEndDeltaMicroseconds => FieldDataType::UnsignedDataNumber,
V9Field::SystemInitTimeMilliseconds => FieldDataType::DurationMillis,
V9Field::FlowDurationMilliseconds => FieldDataType::DurationMillis,
V9Field::FlowDurationMicroseconds => FieldDataType::UnsignedDataNumber,
V9Field::ObservedFlowTotalCount => FieldDataType::UnsignedDataNumber,
V9Field::IgnoredPacketTotalCount => FieldDataType::UnsignedDataNumber,
V9Field::IgnoredOctetTotalCount => FieldDataType::UnsignedDataNumber,
V9Field::NotSentFlowTotalCount => FieldDataType::UnsignedDataNumber,
V9Field::NotSentPacketTotalCount => FieldDataType::UnsignedDataNumber,
V9Field::NotSentOctetTotalCount => FieldDataType::UnsignedDataNumber,
V9Field::DestinationIpv6Prefix => FieldDataType::Ip6Addr,
V9Field::SourceIpv6Prefix => FieldDataType::Ip6Addr,
V9Field::PostOctetTotalCount => FieldDataType::UnsignedDataNumber,
V9Field::PostPacketTotalCount => FieldDataType::UnsignedDataNumber,
V9Field::FlowKeyIndicator => FieldDataType::UnsignedDataNumber,
V9Field::PostMcastPacketTotalCount => FieldDataType::UnsignedDataNumber,
V9Field::PostMcastOctetTotalCount => FieldDataType::UnsignedDataNumber,
V9Field::IcmpTypeValue => FieldDataType::UnsignedDataNumber,
V9Field::IcmpCodeValue => FieldDataType::UnsignedDataNumber,
V9Field::IcmpIpv6TypeValue => FieldDataType::UnsignedDataNumber,
V9Field::IcmpIpv6CodeValue => FieldDataType::UnsignedDataNumber,
V9Field::PostNATSourceIPv4Address => FieldDataType::Ip4Addr,
V9Field::PostNATDestinationIPv4Address => FieldDataType::Ip4Addr,
V9Field::PostNATTSourceTransportPort => FieldDataType::UnsignedDataNumber,
V9Field::PostNATTDestinationTransportPort => FieldDataType::UnsignedDataNumber,
V9Field::PostNATSourceIpv6Address => FieldDataType::Ip6Addr,
V9Field::PostNATDestinationIpv6Address => FieldDataType::Ip6Addr,
V9Field::ObservationTimeMilliseconds => FieldDataType::DurationMillis,
V9Field::NatOriginatingAddressRealm => FieldDataType::NatOriginatingAddressRealm,
V9Field::NatEvent => FieldDataType::NatEvent,
V9Field::FirewallEvent => FieldDataType::FirewallEvent,
V9Field::IngressVRFID | V9Field::EgressVRFID => FieldDataType::UnsignedDataNumber,
V9Field::BiflowDirection => FieldDataType::UnsignedDataNumber,
V9Field::IanaAssigned(_) | V9Field::Unknown(_) => FieldDataType::Unknown,
}
}
}
impl From<u16> for V9Field {
fn from(item: u16) -> Self {
match item {
1 => V9Field::InBytes,
2 => V9Field::InPkts,
3 => V9Field::Flows,
4 => V9Field::Protocol,
5 => V9Field::SrcTos,
6 => V9Field::TcpFlags,
7 => V9Field::L4SrcPort,
8 => V9Field::Ipv4SrcAddr,
9 => V9Field::SrcMask,
10 => V9Field::InputSnmp,
11 => V9Field::L4DstPort,
12 => V9Field::Ipv4DstAddr,
13 => V9Field::DstMask,
14 => V9Field::OutputSnmp,
15 => V9Field::Ipv4NextHop,
16 => V9Field::SrcAs,
17 => V9Field::DstAs,
18 => V9Field::BgpIpv4NextHop,
19 => V9Field::MulDstPkts,
20 => V9Field::MulDstBytes,
21 => V9Field::LastSwitched,
22 => V9Field::FirstSwitched,
23 => V9Field::OutBytes,
24 => V9Field::OutPkts,
25 => V9Field::MinPktLngth,
26 => V9Field::MaxPktLngth,
27 => V9Field::Ipv6SrcAddr,
28 => V9Field::Ipv6DstAddr,
29 => V9Field::Ipv6SrcMask,
30 => V9Field::Ipv6DstMask,
31 => V9Field::Ipv6FlowLabel,
32 => V9Field::IcmpType,
33 => V9Field::MulIgmpType,
34 => V9Field::SamplingInterval,
35 => V9Field::SamplingAlgorithm,
36 => V9Field::FlowActiveTimeout,
37 => V9Field::FlowInactiveTimeout,
38 => V9Field::EngineType,
39 => V9Field::EngineId,
40 => V9Field::TotalBytesExp,
41 => V9Field::TotalPktsExp,
42 => V9Field::TotalFlowsExp,
43 => V9Field::IanaAssigned(43),
44 => V9Field::Ipv4SrcPrefix,
45 => V9Field::Ipv4DstPrefix,
46 => V9Field::MplsTopLabelType,
47 => V9Field::MplsTopLabelIpAddr,
48 => V9Field::FlowSamplerId,
49 => V9Field::FlowSamplerMode,
50 => V9Field::FlowSamplerRandomInterval,
51 => V9Field::IanaAssigned(51),
52 => V9Field::MinTtl,
53 => V9Field::MaxTtl,
54 => V9Field::Ipv4Ident,
55 => V9Field::DstTos,
56 => V9Field::InSrcMac,
57 => V9Field::OutDstMac,
58 => V9Field::SrcVlan,
59 => V9Field::DstVlan,
60 => V9Field::IpProtocolVersion,
61 => V9Field::Direction,
62 => V9Field::Ipv6NextHop,
63 => V9Field::BgpIpv6NextHop,
64 => V9Field::Ipv6OptionHeaders,
65 => V9Field::IanaAssigned(65),
66 => V9Field::IanaAssigned(66),
67 => V9Field::IanaAssigned(67),
68 => V9Field::IanaAssigned(68),
69 => V9Field::IanaAssigned(69),
70 => V9Field::MplsLabel1,
71 => V9Field::MplsLabel2,
72 => V9Field::MplsLabel3,
73 => V9Field::MplsLabel4,
74 => V9Field::MplsLabel5,
75 => V9Field::MplsLabel6,
76 => V9Field::MplsLabel7,
77 => V9Field::MplsLabel8,
78 => V9Field::MplsLabel9,
79 => V9Field::MplsLabel10,
80 => V9Field::InDstMac,
81 => V9Field::OutSrcMac,
82 => V9Field::IfName,
83 => V9Field::IfDesc,
84 => V9Field::SamplerName,
85 => V9Field::InPermanentBytes,
86 => V9Field::InPermanentPkts,
87 => V9Field::IanaAssigned(87),
88 => V9Field::FragmentOffset,
89 => V9Field::ForwardingStatus,
90 => V9Field::MplsPalRd,
91 => V9Field::MplsPrefixLen,
92 => V9Field::SrcTrafficIndex,
93 => V9Field::DstTrafficIndex,
94 => V9Field::ApplicationDescription,
95 => V9Field::ApplicationTag,
96 => V9Field::ApplicationName,
97 => V9Field::IanaAssigned(97),
98 => V9Field::PostipDiffServCodePoint,
99 => V9Field::Replicationfactor,
100 => V9Field::Deprecated,
101 => V9Field::IanaAssigned(101),
102 => V9Field::Layer2packetSectionOffset,
103 => V9Field::Layer2packetSectionSize,
104 => V9Field::Layer2packetSectionData,
105 => V9Field::IanaAssigned(105),
106 => V9Field::IanaAssigned(106),
107 => V9Field::IanaAssigned(107),
108 => V9Field::IanaAssigned(108),
109 => V9Field::IanaAssigned(109),
110 => V9Field::IanaAssigned(110),
111 => V9Field::IanaAssigned(111),
112 => V9Field::IanaAssigned(112),
113 => V9Field::IanaAssigned(113),
114 => V9Field::IanaAssigned(114),
115 => V9Field::IanaAssigned(115),
116 => V9Field::IanaAssigned(116),
117 => V9Field::IanaAssigned(117),
118 => V9Field::IanaAssigned(118),
119 => V9Field::IanaAssigned(119),
120 => V9Field::IanaAssigned(120),
121 => V9Field::IanaAssigned(121),
122 => V9Field::IanaAssigned(122),
123 => V9Field::IanaAssigned(123),
124 => V9Field::IanaAssigned(124),
125 => V9Field::IanaAssigned(125),
126 => V9Field::IanaAssigned(126),
127 => V9Field::IanaAssigned(127),
128 => V9Field::BgpNextAdjacentAsNumber,
129 => V9Field::BgpPrevAdjacentAsNumber,
130 => V9Field::ExporterIpv4Address,
131 => V9Field::ExporterIpv6Address,
132 => V9Field::DroppedOctetDeltaCount,
133 => V9Field::DroppedPacketDeltaCount,
134 => V9Field::DroppedOctetTotalCount,
135 => V9Field::DroppedPacketTotalCount,
136 => V9Field::FlowEndReason,
137 => V9Field::CommonPropertiesId,
138 => V9Field::ObservationPointId,
139 => V9Field::IcmpTypeCodeIpv6,
140 => V9Field::MplsTopLabelIpv6Address,
141 => V9Field::LineCardId,
142 => V9Field::PortId,
143 => V9Field::MeteringProcessId,
144 => V9Field::ExportingProcessId,
145 => V9Field::TemplateId,
146 => V9Field::WlanChannelId,
147 => V9Field::WlanSsid,
148 => V9Field::FlowId,
149 => V9Field::ObservationDomainId,
150 => V9Field::FlowStartSeconds,
151 => V9Field::FlowEndSeconds,
152 => V9Field::FlowStartMilliseconds,
153 => V9Field::FlowEndMilliseconds,
154 => V9Field::FlowStartMicroseconds,
155 => V9Field::FlowEndMicroseconds,
156 => V9Field::FlowStartNanoseconds,
157 => V9Field::FlowEndNanoseconds,
158 => V9Field::FlowStartDeltaMicroseconds,
159 => V9Field::FlowEndDeltaMicroseconds,
160 => V9Field::SystemInitTimeMilliseconds,
161 => V9Field::FlowDurationMilliseconds,
162 => V9Field::FlowDurationMicroseconds,
163 => V9Field::ObservedFlowTotalCount,
164 => V9Field::IgnoredPacketTotalCount,
165 => V9Field::IgnoredOctetTotalCount,
166 => V9Field::NotSentFlowTotalCount,
167 => V9Field::NotSentPacketTotalCount,
168 => V9Field::NotSentOctetTotalCount,
169 => V9Field::DestinationIpv6Prefix,
170 => V9Field::SourceIpv6Prefix,
171 => V9Field::PostOctetTotalCount,
172 => V9Field::PostPacketTotalCount,
173 => V9Field::FlowKeyIndicator,
174 => V9Field::PostMcastPacketTotalCount,
175 => V9Field::PostMcastOctetTotalCount,
176 => V9Field::IcmpTypeValue,
177 => V9Field::IcmpCodeValue,
178 => V9Field::IcmpIpv6TypeValue,
179 => V9Field::IcmpIpv6CodeValue,
180..=224 => V9Field::IanaAssigned(item),
225 => V9Field::PostNATSourceIPv4Address,
226 => V9Field::PostNATDestinationIPv4Address,
227 => V9Field::PostNATTSourceTransportPort,
228 => V9Field::PostNATTDestinationTransportPort,
229 => V9Field::NatOriginatingAddressRealm,
230 => V9Field::NatEvent,
231..=232 => V9Field::IanaAssigned(item),
233 => V9Field::FirewallEvent,
234 => V9Field::IngressVRFID,
235 => V9Field::EgressVRFID,
236..=238 => V9Field::IanaAssigned(item),
239 => V9Field::BiflowDirection,
240..=280 => V9Field::IanaAssigned(item),
281 => V9Field::PostNATSourceIpv6Address,
282 => V9Field::PostNATDestinationIpv6Address,
283..=322 => V9Field::IanaAssigned(item),
323 => V9Field::ObservationTimeMilliseconds,
_ => V9Field::Unknown(item),
}
}
}
impl From<V9Field> for u16 {
fn from(field: V9Field) -> Self {
match field {
V9Field::InBytes => 1,
V9Field::InPkts => 2,
V9Field::Flows => 3,
V9Field::Protocol => 4,
V9Field::SrcTos => 5,
V9Field::TcpFlags => 6,
V9Field::L4SrcPort => 7,
V9Field::Ipv4SrcAddr => 8,
V9Field::SrcMask => 9,
V9Field::InputSnmp => 10,
V9Field::L4DstPort => 11,
V9Field::Ipv4DstAddr => 12,
V9Field::DstMask => 13,
V9Field::OutputSnmp => 14,
V9Field::Ipv4NextHop => 15,
V9Field::SrcAs => 16,
V9Field::DstAs => 17,
V9Field::BgpIpv4NextHop => 18,
V9Field::MulDstPkts => 19,
V9Field::MulDstBytes => 20,
V9Field::LastSwitched => 21,
V9Field::FirstSwitched => 22,
V9Field::OutBytes => 23,
V9Field::OutPkts => 24,
V9Field::MinPktLngth => 25,
V9Field::MaxPktLngth => 26,
V9Field::Ipv6SrcAddr => 27,
V9Field::Ipv6DstAddr => 28,
V9Field::Ipv6SrcMask => 29,
V9Field::Ipv6DstMask => 30,
V9Field::Ipv6FlowLabel => 31,
V9Field::IcmpType => 32,
V9Field::MulIgmpType => 33,
V9Field::SamplingInterval => 34,
V9Field::SamplingAlgorithm => 35,
V9Field::FlowActiveTimeout => 36,
V9Field::FlowInactiveTimeout => 37,
V9Field::EngineType => 38,
V9Field::EngineId => 39,
V9Field::TotalBytesExp => 40,
V9Field::TotalPktsExp => 41,
V9Field::TotalFlowsExp => 42,
V9Field::Ipv4SrcPrefix => 44,
V9Field::Ipv4DstPrefix => 45,
V9Field::MplsTopLabelType => 46,
V9Field::MplsTopLabelIpAddr => 47,
V9Field::FlowSamplerId => 48,
V9Field::FlowSamplerMode => 49,
V9Field::FlowSamplerRandomInterval => 50,
V9Field::MinTtl => 52,
V9Field::MaxTtl => 53,
V9Field::Ipv4Ident => 54,
V9Field::DstTos => 55,
V9Field::InSrcMac => 56,
V9Field::OutDstMac => 57,
V9Field::SrcVlan => 58,
V9Field::DstVlan => 59,
V9Field::IpProtocolVersion => 60,
V9Field::Direction => 61,
V9Field::Ipv6NextHop => 62,
V9Field::BgpIpv6NextHop => 63,
V9Field::Ipv6OptionHeaders => 64,
V9Field::MplsLabel1 => 70,
V9Field::MplsLabel2 => 71,
V9Field::MplsLabel3 => 72,
V9Field::MplsLabel4 => 73,
V9Field::MplsLabel5 => 74,
V9Field::MplsLabel6 => 75,
V9Field::MplsLabel7 => 76,
V9Field::MplsLabel8 => 77,
V9Field::MplsLabel9 => 78,
V9Field::MplsLabel10 => 79,
V9Field::InDstMac => 80,
V9Field::OutSrcMac => 81,
V9Field::IfName => 82,
V9Field::IfDesc => 83,
V9Field::SamplerName => 84,
V9Field::InPermanentBytes => 85,
V9Field::InPermanentPkts => 86,
V9Field::FragmentOffset => 88,
V9Field::ForwardingStatus => 89,
V9Field::MplsPalRd => 90,
V9Field::MplsPrefixLen => 91,
V9Field::SrcTrafficIndex => 92,
V9Field::DstTrafficIndex => 93,
V9Field::ApplicationDescription => 94,
V9Field::ApplicationTag => 95,
V9Field::ApplicationName => 96,
V9Field::PostipDiffServCodePoint => 98,
V9Field::Replicationfactor => 99,
V9Field::Deprecated => 100,
V9Field::Layer2packetSectionOffset => 102,
V9Field::Layer2packetSectionSize => 103,
V9Field::Layer2packetSectionData => 104,
V9Field::BgpNextAdjacentAsNumber => 128,
V9Field::BgpPrevAdjacentAsNumber => 129,
V9Field::ExporterIpv4Address => 130,
V9Field::ExporterIpv6Address => 131,
V9Field::DroppedOctetDeltaCount => 132,
V9Field::DroppedPacketDeltaCount => 133,
V9Field::DroppedOctetTotalCount => 134,
V9Field::DroppedPacketTotalCount => 135,
V9Field::FlowEndReason => 136,
V9Field::CommonPropertiesId => 137,
V9Field::ObservationPointId => 138,
V9Field::IcmpTypeCodeIpv6 => 139,
V9Field::MplsTopLabelIpv6Address => 140,
V9Field::LineCardId => 141,
V9Field::PortId => 142,
V9Field::MeteringProcessId => 143,
V9Field::ExportingProcessId => 144,
V9Field::TemplateId => 145,
V9Field::WlanChannelId => 146,
V9Field::WlanSsid => 147,
V9Field::FlowId => 148,
V9Field::ObservationDomainId => 149,
V9Field::FlowStartSeconds => 150,
V9Field::FlowEndSeconds => 151,
V9Field::FlowStartMilliseconds => 152,
V9Field::FlowEndMilliseconds => 153,
V9Field::FlowStartMicroseconds => 154,
V9Field::FlowEndMicroseconds => 155,
V9Field::FlowStartNanoseconds => 156,
V9Field::FlowEndNanoseconds => 157,
V9Field::FlowStartDeltaMicroseconds => 158,
V9Field::FlowEndDeltaMicroseconds => 159,
V9Field::SystemInitTimeMilliseconds => 160,
V9Field::FlowDurationMilliseconds => 161,
V9Field::FlowDurationMicroseconds => 162,
V9Field::ObservedFlowTotalCount => 163,
V9Field::IgnoredPacketTotalCount => 164,
V9Field::IgnoredOctetTotalCount => 165,
V9Field::NotSentFlowTotalCount => 166,
V9Field::NotSentPacketTotalCount => 167,
V9Field::NotSentOctetTotalCount => 168,
V9Field::DestinationIpv6Prefix => 169,
V9Field::SourceIpv6Prefix => 170,
V9Field::PostOctetTotalCount => 171,
V9Field::PostPacketTotalCount => 172,
V9Field::FlowKeyIndicator => 173,
V9Field::PostMcastPacketTotalCount => 174,
V9Field::PostMcastOctetTotalCount => 175,
V9Field::IcmpTypeValue => 176,
V9Field::IcmpCodeValue => 177,
V9Field::IcmpIpv6TypeValue => 178,
V9Field::IcmpIpv6CodeValue => 179,
V9Field::PostNATSourceIPv4Address => 225,
V9Field::PostNATDestinationIPv4Address => 226,
V9Field::PostNATTSourceTransportPort => 227,
V9Field::PostNATTDestinationTransportPort => 228,
V9Field::NatOriginatingAddressRealm => 229,
V9Field::NatEvent => 230,
V9Field::FirewallEvent => 233,
V9Field::IngressVRFID => 234,
V9Field::EgressVRFID => 235,
V9Field::BiflowDirection => 239,
V9Field::PostNATSourceIpv6Address => 281,
V9Field::PostNATDestinationIpv6Address => 282,
V9Field::ObservationTimeMilliseconds => 323,
V9Field::IanaAssigned(n) | V9Field::Unknown(n) => n,
}
}
}
#[cfg(test)]
mod v9_lookup_tests {
use crate::variable_versions::field_value::FieldDataType;
use super::V9Field;
use insta::assert_yaml_snapshot;
#[test]
fn it_tests_field_lookup() {
let mut fields = vec![];
for i in 1..=323 {
let field: V9Field = i.into();
fields.push(field);
}
assert_yaml_snapshot!(fields);
}
#[test]
fn it_tests_field_data_type_lookup() {
let mut fields: Vec<FieldDataType> = vec![];
for i in 1..=323 {
let field: V9Field = i.into();
fields.push(field.into());
}
assert_yaml_snapshot!(fields);
}
}