kytos-ng / telemetry_int

Kytos Telemetry Napp
MIT License
0 stars 2 forks source link

feat: integration with `of_multi_table` supporting `evpl` and `epl` table groups on table 2 and 3 by default #64

Closed viniarck closed 8 months ago

viniarck commented 8 months ago

Closes #13 Closes #43

This PR is on top of PR #39

This PR is also related to https://github.com/kytos-ng/of_multi_table/pull/21

Summary

Local Tests

Here's an output of two examples (I didn't post them all to avoid cluttering too much), intra epl and inter evpl respectively:

2023-10-11 16:55:46,683 - INFO [kytos.napps.kytos/mef_eline] [evc.py:826:deploy_to_path] (AnyIO worker thread) EVC(8f3980d93fbd40, intra_epl) was deployed.
2023-10-11 16:55:46,685 - INFO [uvicorn.access] [httptools_impl.py:506:send] (MainThread) 127.0.0.1:46818 - "POST /api/kytos/mef_eline/v2/evc/ HTTP/1.1" 201
2023-10-11 16:56:47,030 - INFO [uvicorn.access] [httptools_impl.py:506:send] (MainThread) 127.0.0.1:55696 - "GET /api/kytos/mef_eline/v2/evc/ HTTP/1.1" 200
2023-10-11 16:58:17,499 - INFO [uvicorn.access] [httptools_impl.py:506:send] (MainThread) 127.0.0.1:54040 - "GET /api/kytos/mef_eline/v2/evc/8f3980d93fbd40 HTTP/1.1" 200
2023-10-11 16:58:17,501 - INFO [kytos.napps.kytos/telemetry_int] [int.py:81:enable_int] (MainThread) Enabling INT on EVC ids: ['8f3980d93fbd40'], force: False
2023-10-11 16:58:17,510 - INFO [uvicorn.access] [httptools_impl.py:506:send] (MainThread) 127.0.0.1:54050 - "GET /api/kytos/flow_manager/v2/stored_flows?state=installed&state=pending HT
TP/1.1" 200
2023-10-11 16:58:17,518 - INFO [kytos.napps.kytos/flow_manager] [utils.py:196:flows_to_log_info] (thread_pool_app_16) Send FlowMod from KytosEvent dpid: 00:00:00:00:00:00:00:01, command
: add, force: True,  flows[0, 10]: [{'owner': 'telemetry_int', 'cookie': 12145989945604947264, 'match': {'in_port': 15, 'dl_type': 2048, 'nw_proto': 6}, 'table_id': 0, 'table_group': 'e
pl', 'priority': 10100, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'push_int'}]}, {'instruction_type': 'got
o_table', 'table_id': 3}]}, {'owner': 'telemetry_int', 'cookie': 12145989945604947264, 'match': {'in_port': 15, 'dl_type': 2048, 'nw_proto': 17}, 'table_id': 0, 'table_group': 'epl', 'p
riority': 10100, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'push_int'}]}, {'instruction_type': 'goto_table
', 'table_id': 3}]}, {'owner': 'telemetry_int', 'cookie': 12145989945604947264, 'match': {'in_port': 15}, 'table_id': 3, 'table_group': 'epl', 'priority': 10000, 'idle_timeout': 0, 'har
d_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'add_int_metadata'}, {'action_type': 'output', 'port': 19}]}]}, {'owner': 'telemetry_in
t', 'cookie': 12145989945604947264, 'match': {'in_port': 16, 'dl_type': 2048, 'nw_proto': 6}, 'table_id': 0, 'table_group': 'epl', 'priority': 10100, 'idle_timeout': 0, 'hard_timeout': 
0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'push_int'}]}, {'instruction_type': 'goto_table', 'table_id': 3}]}, {'owner': 'telemetry_int', 'coo
kie': 12145989945604947264, 'match': {'in_port': 16, 'dl_type': 2048, 'nw_proto': 17}, 'table_id': 0, 'table_group': 'epl', 'priority': 10100, 'idle_timeout': 0, 'hard_timeout': 0, 'ins
tructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'push_int'}]}, {'instruction_type': 'goto_table', 'table_id': 3}]}, {'owner': 'telemetry_int', 'cookie': 1
2145989945604947264, 'match': {'in_port': 16}, 'table_id': 3, 'table_group': 'epl', 'priority': 10000, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction_type': 'apply
_actions', 'actions': [{'action_type': 'add_int_metadata'}, {'action_type': 'output', 'port': 17}]}]}, {'owner': 'telemetry_int', 'cookie': 12145989945604947264, 'match': {'in_port': 20
}, 'table_id': 0, 'table_group': 'epl', 'priority': 10000, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'send
_report'}]}, {'instruction_type': 'goto_table', 'table_id': 3}]}, {'owner': 'telemetry_int', 'cookie': 12145989945604947264, 'match': {'in_port': 20}, 'table_id': 3, 'table_group': 'epl
', 'priority': 10000, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'pop_int'}, {'action_type': 'output', 'por
t': 16}]}]}, {'owner': 'telemetry_int', 'cookie': 12145989945604947264, 'match': {'in_port': 18}, 'table_id': 0, 'table_group': 'epl', 'priority': 10000, 'idle_timeout': 0, 'hard_timeou
t': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'send_report'}]}, {'instruction_type': 'goto_table', 'table_id': 3}]}, {'owner': 'telemetry_int
', 'cookie': 12145989945604947264, 'match': {'in_port': 18}, 'table_id': 3, 'table_group': 'epl', 'priority': 10000, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction
_type': 'apply_actions', 'actions': [{'action_type': 'pop_int'}, {'action_type': 'output', 'port': 15}]}]}]
2023-10-11 16:58:17,543 - INFO [uvicorn.access] [httptools_impl.py:506:send] (MainThread) 127.0.0.1:54052 - "POST /api/kytos/mef_eline/v2/evc/metadata HTTP/1.1" 201
2023-10-11 16:58:17,545 - INFO [uvicorn.access] [httptools_impl.py:506:send] (MainThread) 127.0.0.1:54036 - "POST /api/kytos/telemetry_int/v1/evc/enable HTTP/1.1" 201
kytos $>                                                                                                                                                                                 
2023-10-11 16:48:02,588 - WARNING [kytos.napps.kytos/mef_eline] [evc.py:880:setup_failover_path] (thread_pool_app_14) Failover path for EVC(1fe56e255dac47, inter_evpl) was not deployed:
 No available path was found
2023-10-11 16:48:12,079 - INFO [uvicorn.access] [httptools_impl.py:506:send] (MainThread) 127.0.0.1:56122 - "GET /api/kytos/mef_eline/v2/evc/1fe56e255dac47 HTTP/1.1" 200
2023-10-11 16:48:12,080 - INFO [kytos.napps.kytos/telemetry_int] [int.py:81:enable_int] (MainThread) Enabling INT on EVC ids: ['1fe56e255dac47'], force: False
2023-10-11 16:48:12,089 - INFO [uvicorn.access] [httptools_impl.py:506:send] (MainThread) 127.0.0.1:56126 - "GET /api/kytos/flow_manager/v2/stored_flows?state=installed&state=pending HT
TP/1.1" 200
2023-10-11 16:48:12,098 - INFO [kytos.napps.kytos/flow_manager] [utils.py:196:flows_to_log_info] (thread_pool_app_3) Send FlowMod from KytosEvent dpid: 00:00:00:00:00:00:00:01, command:
 add, force: True,  flows[0, 7]: [{'owner': 'telemetry_int', 'cookie': 12114653783885982791, 'match': {'in_port': 15, 'dl_vlan': 100, 'dl_type': 2048, 'nw_proto': 6}, 'table_id': 0, 'ta
ble_group': 'evpl', 'priority': 20100, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'push_int'}]}, {'instruct
ion_type': 'goto_table', 'table_id': 2}]}, {'owner': 'telemetry_int', 'cookie': 12114653783885982791, 'match': {'in_port': 15, 'dl_vlan': 100, 'dl_type': 2048, 'nw_proto': 17}, 'table_i
d': 0, 'table_group': 'evpl', 'priority': 20100, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'push_int'}]}, 
{'instruction_type': 'goto_table', 'table_id': 2}]}, {'owner': 'telemetry_int', 'cookie': 12114653783885982791, 'match': {'in_port': 15, 'dl_vlan': 100}, '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': 100}, {'action_type': 'push_vlan', 'tag_type': 's'}, {'action_type': 'set_vlan', 'vlan_id': 1}, {'action_type': 'output', 'port': 11}]}]}, {'owner': 'telemetry_int
', 'cookie': 12114653783885982791, 'match': {'in_port': 11, 'dl_vlan': 1, 'dl_type': 2048, 'nw_proto': 6}, 'table_id': 0, 'table_group': 'evpl', 'priority': 20100, 'idle_timeout': 0, 'h
ard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'add_int_metadata'}, {'action_type': 'output', 'port': 17}]}]}, {'owner': 'telemetry_
int', 'cookie': 12114653783885982791, 'match': {'in_port': 11, 'dl_vlan': 1, 'dl_type': 2048, 'nw_proto': 17}, 'table_id': 0, 'table_group': 'evpl', 'priority': 20100, 'idle_timeout': 0
, 'hard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'add_int_metadata'}, {'action_type': 'output', 'port': 17}]}]}, {'owner': 'teleme
try_int', 'cookie': 12114653783885982791, 'match': {'in_port': 18, 'dl_vlan': 1}, 'table_id': 0, 'table_group': 'evpl', 'priority': 20000, 'idle_timeout': 0, 'hard_timeout': 0, 'instruc
tions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'send_report'}]}, {'instruction_type': 'goto_table', 'table_id': 2}]}, {'owner': 'telemetry_int', 'cookie': 12
114653783885982791, 'match': {'in_port': 18, 'dl_vlan': 1}, 'table_id': 2, 'table_group': 'evpl', 'priority': 20000, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction
_type': 'apply_actions', 'actions': [{'action_type': 'pop_int'}, {'action_type': 'pop_vlan'}, {'action_type': 'output', 'port': 15}]}]}]
2023-10-11 16:48:12,104 - INFO [kytos.napps.kytos/flow_manager] [utils.py:196:flows_to_log_info] (thread_pool_app_6) Send FlowMod from KytosEvent dpid: 00:00:00:00:00:00:00:06, command:
 add, force: True,  flows[0, 7]: [{'owner': 'telemetry_int', 'cookie': 12114653783885982791, 'match': {'in_port': 22, 'dl_vlan': 100, 'dl_type': 2048, 'nw_proto': 6}, 'table_id': 0, 'ta
ble_group': 'evpl', 'priority': 20100, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'push_int'}]}, {'instruct
ion_type': 'goto_table', 'table_id': 2}]}, {'owner': 'telemetry_int', 'cookie': 12114653783885982791, 'match': {'in_port': 22, 'dl_vlan': 100, 'dl_type': 2048, 'nw_proto': 17}, 'table_i
d': 0, 'table_group': 'evpl', 'priority': 20100, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'push_int'}]}, 
{'instruction_type': 'goto_table', 'table_id': 2}]}, {'owner': 'telemetry_int', 'cookie': 12114653783885982791, 'match': {'in_port': 22, 'dl_vlan': 100}, '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': 100}, {'action_type': 'push_vlan', 'tag_type': 's'}, {'action_type': 'set_vlan', 'vlan_id': 1}, {'action_type': 'output', 'port': 11}]}]}, {'owner': 'telemetry_int
', 'cookie': 12114653783885982791, 'match': {'in_port': 11, 'dl_vlan': 1, 'dl_type': 2048, 'nw_proto': 6}, 'table_id': 0, 'table_group': 'evpl', 'priority': 20100, 'idle_timeout': 0, 'h
ard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'add_int_metadata'}, {'action_type': 'output', 'port': 25}]}]}, {'owner': 'telemetry_
int', 'cookie': 12114653783885982791, 'match': {'in_port': 11, 'dl_vlan': 1, 'dl_type': 2048, 'nw_proto': 17}, 'table_id': 0, 'table_group': 'evpl', 'priority': 20100, 'idle_timeout': 0
, 'hard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'add_int_metadata'}, {'action_type': 'output', 'port': 25}]}]}, {'owner': 'teleme
try_int', 'cookie': 12114653783885982791, 'match': {'in_port': 26, 'dl_vlan': 1}, 'table_id': 0, 'table_group': 'evpl', 'priority': 20000, 'idle_timeout': 0, 'hard_timeout': 0, 'instruc
tions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'send_report'}]}, {'instruction_type': 'goto_table', 'table_id': 2}]}, {'owner': 'telemetry_int', 'cookie': 12
114653783885982791, 'match': {'in_port': 26, 'dl_vlan': 1}, 'table_id': 2, 'table_group': 'evpl', 'priority': 20000, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction
_type': 'apply_actions', 'actions': [{'action_type': 'pop_int'}, {'action_type': 'pop_vlan'}, {'action_type': 'output', 'port': 22}]}]}]
2023-10-11 16:48:12,142 - INFO [uvicorn.access] [httptools_impl.py:506:send] (MainThread) 127.0.0.1:56132 - "POST /api/kytos/mef_eline/v2/evc/metadata HTTP/1.1" 201
2023-10-11 16:48:12,143 - INFO [uvicorn.access] [httptools_impl.py:506:send] (MainThread) 127.0.0.1:56108 - "POST /api/kytos/telemetry_int/v1/evc/enable HTTP/1.1" 201
kytos $>                                                                                                                                                                                 
❯ http localhost:8181/api/amlight/kytos_stats/v1/table/stats
HTTP/1.1 200 OK
content-length: 700
content-type: application/json
date: Wed, 11 Oct 2023 20:05:40 GMT
server: uvicorn

{
    "00:00:00:00:00:00:00:01": {
        "0": {
            "active_count": 17,
            "lookup_count": 802851678,
            "matched_count": 802753828,
            "table_id": 0
        },
        "1": {
            "active_count": 0,
            "lookup_count": 0,
            "matched_count": 0,
            "table_id": 1
        },
        "2": {
            "active_count": 2,
            "lookup_count": 628012374,
            "matched_count": 628011695,
            "table_id": 2
        },
        "3": {
            "active_count": 4,
            "lookup_count": 5146022,
            "matched_count": 5146022,
            "table_id": 3
        }
    },
    "00:00:00:00:00:00:00:06": {
        "0": {
            "active_count": 9,
            "lookup_count": 738211284,
            "matched_count": 374128980,
            "table_id": 0
        },
        "1": {
            "active_count": 0,
            "lookup_count": 0,
            "matched_count": 0,
            "table_id": 1
        },
        "2": {
            "active_count": 2,
            "lookup_count": 91668004,
            "matched_count": 91668004,
            "table_id": 2
        },
        "3": {
            "active_count": 0,
            "lookup_count": 0,
            "matched_count": 0,
            "table_id": 3
        }
    }
}

End-to-End Tests

N/A yet

viniarck commented 8 months ago

LGTM, tested it too

Appreciated your review, Aldo. Let's ship it.