kytos / flow_manager

MIT License
1 stars 16 forks source link

Add support to list of exceptions in consistency mechanism #112

Closed cmagnobarbosa closed 3 years ago

cmagnobarbosa commented 3 years ago

:octocat: Are you working on some issue? Identify the issue!

Fix https://github.com/kytos/kytos/issues/1221 Related https://github.com/kytos/kytos/issues/1120

:bookmark_tabs: Description of the Change

Add support for consistency checking to ignore flows by cookie range and table_id range. This feature is interesting to avoid accidental removal of administrative flows installed by external tools.

How to use:

The user can define the interval that is ignored in the setting.py file.

Format:

[(begin, end)]  # Flows in this interval are not verified by the consistency mechanism
[cookie] # Flow that have this cookie are not veridied by the consistency mechanism
[table_id] # Flow that have this `table_id` are not verified by the consistency mechanism

Using cookie range:

CONSISTENCY_COOKIE_IGNORED_RANGE = [(0x2b00000000000011, 0x2b000000000000ff)]

The flows that if the flow.cookie field are in this range are ignored by the consistency check.

Filtering for a unique cookie:

CONSISTENCY_COOKIE_IGNORED_RANGE = [0x2b00000000000011]

Filtering by range and single value:

CONSISTENCY_COOKIE_IGNORED_RANGE = [0x2b00000000000011, (0x2b00000000000014, 0x2b00000000000017)]

Using table_id range:

CONSISTENCY_TABLE_ID_IGNORED_RANGE = [(1, 2)]

The flows that if the flow.table_id field are in this range are ignored by the consistency check.

Need to know

By default, all flows are checked by the consistency mechanism.

CONSISTENCY_COOKIE_IGNORED_RANGE = []
CONSISTENCY_TABLE_ID_IGNORED_RANGE = []

For the exception interval mechanism to work it is necessary to define an initial and final value in the tuple. If the final value is not defined, only the first value will be excluded.

This PR can be changed in the review process.

:computer: Verification Process

:page_facing_up: Release Notes

hdiogenes commented 3 years ago

Suggestion: use a more simple syntax for unique cookie:

CONSISTENCY_COOKIE_EXCEPTION_RANGE = [0x2b00000000000011]

And allow ranges with a more specific syntax:

CONSISTENCY_COOKIE_EXCEPTION_RANGE = [0x2b00000000000011-0x2b000000000000ff]

cmagnobarbosa commented 3 years ago

Suggestion: use a more simple syntax for unique cookie:

CONSISTENCY_COOKIE_EXCEPTION_RANGE = [0x2b00000000000011]

And allow ranges with a more specific syntax:

CONSISTENCY_COOKIE_EXCEPTION_RANGE = [0x2b00000000000011-0x2b000000000000ff]

To try to make this more simple the suggestion made by @josemauro was implemented. Using a tuple to define an interval.