kytos-ng / sdntrace_cp

MIT License
1 stars 6 forks source link

`sdntrace_cp` isn't completely supporting `goto_table` yet #104

Closed viniarck closed 11 months ago

viniarck commented 1 year ago

sdntrace_cp isn't currently aware of which table id it's exactly matching, so in cases where you have the same match but in different tables but different actions it can end up tracing incorrectly (depending on which one was last updated and if they both have the same priority).

When performing a trace in a switch, when it hits a "instruction_type": "goto_table",, "table_id": <x>, the subsequent matches of this same switch should only match "table_id": <x>. The initial lookup table should always be table 0.

This is a case where we'll have with telemetry_int as described on EP031, for instance, notice two flows with same match but in different tables (one managed by mef_eline and the other by telemetry_int) but with different actions, so if telemetry_int ends up using sdntrace_cp for consistency then this will need to be supported (this will be discussed in the new update of the blueprint).

We'll need to cover the following:

  1. When sdntrace_cp hits a goto_table it doesn't stop matching
  2. Potentially try to ensure that telemetry_int regardless of the table uses a slightly higher priority to also facilitate for matching, there cases in the blueprint where the priority would be the same, since the table was different, but if it can facilitate we might consider it. To be more robust though, ideally, point 1 should be fully covered and sdntrace_cp fully aware of which table it's matching on a switch.

Example of a mef_eline and telemetry_int flow:

{
    "flow": {
        "owner": "telemetry_int",
        "cookie": 12173162911825964365,
        "match": {
            "in_port": 2,
            "dl_vlan": 200
        },
        "table_id": 2,
        "table_group": "evpl",
        "priority": 20000,
        "idle_timeout": 0,
        "hard_timeout": 0,
        "instructions": [
            {
                "instruction_type": "apply_actions",
                "actions": [
                    {
                        "action_type": "add_int_metadata"
                    },
                    {
                        "action_type": "set_vlan",
                        "vlan_id": 200
                    },
                    {
                        "action_type": "output",
                        "port": 5
                    }
                ]
            }
        ]
    },
    "flow_id": "cb7c1ef5696999d8460f7b45820c8d6a",
    "id": "d588e8045f377720d6b2eddc60bd2dcb",
    "inserted_at": "2023-07-25T20:03:43.734000",
    "state": "installed",
    "switch": "00:00:00:00:00:00:00:01",
    "updated_at": "2023-07-25T20:03:43.748000"
}
{
    _id: 'd588e8045f377720d6b2eddc60bd2dcb',
    flow: {
      owner: 'mef_eline',
      cookie: Decimal128("12317278099901820237"),
      match: { in_port: 2, dl_vlan: 200 },
      actions: [
        { action_type: 'set_vlan', vlan_id: 200 },
        { action_type: 'output', port: 1 }
      ],
      table_id: 0,
      table_group: 'evpl',
      priority: 20000,
      idle_timeout: 0,
      hard_timeout: 0
    },
    flow_id: 'cb7c1ef5696999d8460f7b45820c8d6a',
    id: 'd588e8045f377720d6b2eddc60bd2dcb',
    inserted_at: ISODate("2023-07-25T20:03:43.734Z"),
    state: 'installed',
    switch: '00:00:00:00:00:00:00:01',
    updated_at: ISODate("2023-07-25T20:03:43.748Z")
  }