Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding L7 visibility fields #315

Merged
merged 2 commits into from
Sep 29, 2023
Merged

Conversation

tushartathgur
Copy link
Contributor

@tushartathgur tushartathgur commented Sep 15, 2023

Adding L7 visibility fields to the Ipfix table.

l7ProtocolName: field is used to store application layer protocol name, field will be empty if application layer flow is not exported.
httpVals: The field is added to contain all the http values and store them as a string of Json similar to labels. This helps us to store multiple http Vals for a single flow which is possible in case of persistent http.

Mistakenly removed #314

@codecov
Copy link

codecov bot commented Sep 25, 2023

Codecov Report

Merging #315 (10b82cc) into main (b8729db) will increase coverage by 0.09%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #315      +/-   ##
==========================================
+ Coverage   73.44%   73.53%   +0.09%     
==========================================
  Files          18       18              
  Lines        2790     2792       +2     
==========================================
+ Hits         2049     2053       +4     
+ Misses        574      572       -2     
  Partials      167      167              
Flag Coverage Δ
integration-tests 51.38% <ø> (ø)
unit-tests 72.60% <100.00%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
pkg/registry/registry_antrea.go 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

Copy link
Contributor

@dreamtalen dreamtalen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The L7 fields LGTM.
Could you change the PR and commit message title? It appears to be identical to the Antrea one, which is actually implementing L7 visibility support.

@@ -72,8 +72,10 @@ func loadAntreaRegistry() {
registerInfoElement(*entities.NewInfoElement("throughputFromDestinationNode", 148, 4, 56506, 8), 56506)
registerInfoElement(*entities.NewInfoElement("reverseThroughputFromSourceNode", 149, 4, 56506, 8), 56506)
registerInfoElement(*entities.NewInfoElement("reverseThroughputFromDestinationNode", 150, 4, 56506, 8), 56506)
registerInfoElement(*entities.NewInfoElement("flowEndSecondsFromSourceNode", 151, 14, 56506, 4), 56506)
registerInfoElement(*entities.NewInfoElement("flowEndSecondsFromDestinationNode", 152, 14, 56506, 4), 56506)
registerInfoElement(*entities.NewInfoElement("flowEndSecondsFromSourceNode", 151, 3, 56506, 4), 56506)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you help take a look at this @heanlan? I can't remember the reason behind the decision to use uint32 for flowEndSecondsFromSource/DestNode instead of dateTimeSeconds.

Copy link
Contributor

@heanlan heanlan Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are following the same datatype with flowEndSeconds.

registerInfoElement(*entities.NewInfoElement("flowEndSeconds", 151, 14, 0, 4), 0)

Copy link
Contributor

@heanlan heanlan Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for creating some confusions here. I just noticed there are some discrepancies in both Antrea and Go-ipfix code. FlowEndSecondsFromSourceNode and FlowEndSecondsFromDestinationNode should have the same datatype with FlowEndSeconds. And the datatype is dateTimeSeconds. @tushartathgur could you revert this change and also change the following lines to dateTimeSeconds

151,flowEndSecondsFromSourceNode,unsigned32,,current,,,,,,,,56506,
152,flowEndSecondsFromDestinationNode,unsigned32,,current,,,,,,,,56506,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, Creating a separate PR for this as this is not part of L7Visibility.
Though I am confused, the registry_antrea.go should create the elements according to their datatype, however for these two fields, it should not have generated DateTimeSeconds format if the datatype was unsigned32 !

registerInfoElement(*entities.NewInfoElement("flowEndSecondsFromSourceNode", 151, 14, 56506, 4), 56506)
registerInfoElement(*entities.NewInfoElement("flowEndSecondsFromDestinationNode", 152, 14, 56506, 4), 56506)

Copy link
Contributor

@heanlan heanlan Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The underlying structure of DateTimeSeconds is uint32: https://www.rfc-editor.org/rfc/rfc7011.html#section-6.1.7
So actually from the code level there is no difference to use uint32 or DateTimeSeconds to my knowledge. But it can be a bit of misleading. And we are sending uint32 data from flow exporter: https://github.com/antrea-io/antrea/blob/4806be3c14e21a75dd3b8e876785fbc947439474/pkg/agent/flowexporter/exporter/exporter.go#L440

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean the registry_antrea.go is autogenerated, it should not have changed the unsigned32 to dateTimeSeconds

Copy link
Contributor

@heanlan heanlan Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got your point. Yes, it should be auto-generated but I probably manually edited these two lines before, which causing the discrepancies/errors.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep these two lines of change, i.e. 14 -> 3, with this PR, as we want to correct the errors. As you mentioned, we can do the uint32 -> dateTimeSeconds changes in a separate PR if we would like to.

@tushartathgur tushartathgur changed the title L7 Visibility support in Antrea Adding L7 visibility fields Sep 25, 2023
Copy link
Member

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still wonder if the isL7 boolean should be replaced with some "enum" instead. For example: l7FlowType: "http" (an empty of missing IE would mean that we don't have L7 data). I wonder if that could be more future-proof, if we ever want to support other protocols?

What do you think @dreamtalen @heanlan @tushartathgur ?

@heanlan
Copy link
Contributor

heanlan commented Sep 28, 2023

I still wonder if the isL7 boolean should be replaced with some "enum" instead. For example: l7FlowType: "http" (an empty of missing IE would mean that we don't have L7 data). I wonder if that could be more future-proof, if we ever want to support other protocols?

I agree it's better to make the change now compared to do it later.

@dreamtalen
Copy link
Contributor

I still wonder if the isL7 boolean should be replaced with some "enum" instead. For example: l7FlowType: "http" (an empty of missing IE would mean that we don't have L7 data). I wonder if that could be more future-proof, if we ever want to support other protocols?

I agree it's better to make the change now compared to do it later.

Sounds good to me as well.

@tushartathgur
Copy link
Contributor Author

tushartathgur commented Sep 28, 2023

I still wonder if the isL7 boolean should be replaced with some "enum" instead. For example: l7FlowType: "http" (an empty of missing IE would mean that we don't have L7 data). I wonder if that could be more future-proof, if we ever want to support other protocols?

What do you think @dreamtalen @heanlan @tushartathgur ?

Sounds good to me, Adding in the next patch

@@ -54,3 +54,5 @@ ElementID,Name,Abstract Data Type,Data Type Semantics,Status,Description,Units,R
152,flowEndSecondsFromDestinationNode,unsigned32,,current,,,,,,,,56506,
153,egressName,string,,current,,,,,,,,56506,
154,egressIP,string,,current,,,,,,,,56506,
155,l7FlowType,unsigned8,,current,Supported Actions(uint8 value): L7flowNotPresent(0) L7flowTypeHttp(1),,,,,,,56506,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggested l7FlowType as an example, but from a consistency standpoint with standard IPFIX IEs, I feel like l7ProtocolName is a better name

I also feel like using a short string ("http", and maybe later "grpc", "ssh", etc) makes more sense than using an integer value, unless these integer values are standardized somewhere (I doubt it).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I got confused as it was mentioned enum, allow me to change it.

Signed-off-by: Tushar Tathgur <tathgurt@tathgurtPNQHP.vmware.com>
Signed-off-by: Tushar Tathgur <tathgurt@tathgurtPNQHP.vmware.com>
Copy link
Member

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@heanlan heanlan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tushartathgur tushartathgur merged commit a7df05f into vmware:main Sep 29, 2023
9 checks passed
dreamtalen pushed a commit to dreamtalen/go-ipfix that referenced this pull request Oct 2, 2023
* L7 Visibility support in Antrea

Signed-off-by: Tushar Tathgur <tathgurt@tathgurtPNQHP.vmware.com>

* Replaced isL7 bool with l7ProtocolName string

Signed-off-by: Tushar Tathgur <tathgurt@tathgurtPNQHP.vmware.com>

---------

Signed-off-by: Tushar Tathgur <tathgurt@tathgurtPNQHP.vmware.com>
Co-authored-by: Tushar Tathgur <tathgurt@tathgurtPNQHP.vmware.com>
dreamtalen pushed a commit that referenced this pull request Oct 2, 2023
* L7 Visibility support in Antrea

Signed-off-by: Tushar Tathgur <tathgurt@tathgurtPNQHP.vmware.com>

* Replaced isL7 bool with l7ProtocolName string

Signed-off-by: Tushar Tathgur <tathgurt@tathgurtPNQHP.vmware.com>

---------

Signed-off-by: Tushar Tathgur <tathgurt@tathgurtPNQHP.vmware.com>
Co-authored-by: Tushar Tathgur <tathgurt@tathgurtPNQHP.vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants