kytos-ng / telemetry_int

Kytos Telemetry Napp
MIT License
0 stars 2 forks source link

feat: handled kytos/topology.interfaces.metadata.added #78

Closed viniarck closed 5 months ago

viniarck commented 5 months ago

Closes #61

Summary

Local Tests

kytos $> 2024-01-08 15:18:14,425 - INFO [uvicorn.access] [httptools_impl.py:506:send] (MainThread) 127.0.0.1:35286 - "POST /api/kytos/topology/v3/interfaces/00%3A00%3A00%3A00%3A00%3A00%3
A00%3A01%3A15/metadata HTTP/1.1" 201
2024-01-08 15:18:14,433 - INFO [uvicorn.access] [httptools_impl.py:506:send] (MainThread) 127.0.0.1:35300 - "GET /api/kytos/mef_eline/v2/evc/?archived=false&metadata.telemetry.enabled=tr
ue HTTP/1.1" 200
2024-01-08 15:18:14,435 - INFO [kytos.napps.kytos/telemetry_int] [int.py:269:handle_pp_metadata_added] (MainThread) Handling interface metadata updated on Interface('novi_port_15', 15, S
witch('00:00:00:00:00:00:00:01')). It'll disable the EVCs to be safe, and then try to enable again with the updated  proxy port ProxyPort(Interface('novi_port_19', 19, Switch('00:00:00:0
0:00:00:00:01')), Interface('novi_port_20', 20, Switch('00:00:00:00:00:00:00:01')), EntityStatus.UP), EVC ids: ['0b78f967e8eb45']
2024-01-08 15:18:14,435 - INFO [kytos.napps.kytos/telemetry_int] [int.py:297:disable_int] (MainThread) Disabling INT on EVC ids: ['0b78f967e8eb45'], force: True
2024-01-08 15:18:14,441 - INFO [kytos.napps.kytos/flow_manager] [main.py:545:list_stored] (AnyIO worker thread) cookie_ranges [(12108905035701218117, 12108905035701218117)]
2024-01-08 15:18:14,443 - INFO [uvicorn.access] [httptools_impl.py:506:send] (MainThread) 127.0.0.1:35302 - "GET /api/kytos/flow_manager/v2/stored_flows?state=installed&state=pending HTT
P/1.1" 200
2024-01-08 15:18:14,450 - INFO [kytos.napps.kytos/flow_manager] [utils.py:196:flows_to_log_info] (thread_pool_app_10) Send FlowMod from KytosEvent dpid: 00:00:00:00:00:00:00:06, command:
 delete, force: True,  flows[0, 1]: [{'cookie': 12108905035701218117, 'cookie_mask': 18446744073709551615, 'table_id': 255}]
2024-01-08 15:18:14,451 - INFO [kytos.napps.kytos/flow_manager] [utils.py:196:flows_to_log_info] (thread_pool_app_1) Send FlowMod from KytosEvent dpid: 00:00:00:00:00:00:00:01, command: 
delete, force: True,  flows[0, 1]: [{'cookie': 12108905035701218117, 'cookie_mask': 18446744073709551615, 'table_id': 255}]
2024-01-08 15:18:14,469 - INFO [uvicorn.access] [httptools_impl.py:506:send] (MainThread) 127.0.0.1:35306 - "POST /api/kytos/mef_eline/v2/evc/metadata HTTP/1.1" 201
2024-01-08 15:18:14,471 - INFO [kytos.napps.kytos/telemetry_int] [int.py:339:enable_int] (MainThread) Enabling INT on EVC ids: ['0b78f967e8eb45'], force: True
2024-01-08 15:18:14,477 - INFO [kytos.napps.kytos/flow_manager] [main.py:545:list_stored] (AnyIO worker thread) cookie_ranges [(12253020223777073989, 12253020223777073989)]
2024-01-08 15:18:14,479 - INFO [uvicorn.access] [httptools_impl.py:506:send] (MainThread) 127.0.0.1:35314 - "GET /api/kytos/flow_manager/v2/stored_flows?state=installed&state=pending HTT
P/1.1" 200
2024-01-08 15:18:14,484 - 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:01, command: 
add, force: True,  flows[0, 7]: [{'owner': 'telemetry_int', 'cookie': 12108905035701218117, 'match': {'in_port': 15, 'dl_vlan': 2222, 'dl_type': 2048, 'nw_proto': 6}, 'table_id': 0, 'tab
le_group': 'evpl', 'priority': 20100, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'push_int'}]}, {'instructio
n_type': 'goto_table', 'table_id': 2}]}, {'owner': 'telemetry_int', 'cookie': 12108905035701218117, 'match': {'in_port': 15, 'dl_vlan': 2222, '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': 'push_int'}]}, {'i
nstruction_type': 'goto_table', 'table_id': 2}]}, {'owner': 'telemetry_int', 'cookie': 12108905035701218117, 'match': {'in_port': 15, 'dl_vlan': 2222}, 'table_id': 2, 'table_group': 'evp
l', 'priority': 20000, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'add_int_metadata'}, {'action_type': 'push
_vlan', 'tag_type': 's'}, {'action_type': 'set_vlan', 'vlan_id': 1}, {'action_type': 'output', 'port': 11}]}]}, {'owner': 'telemetry_int', 'cookie': 12108905035701218117, 'match': {'in_p
ort': 11, 'dl_vlan': 1, 'dl_type': 2048, 'nw_proto': 6}, 'table_id': 0, 'table_group': 'evpl', 'priority': 20100, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction_typ
e': 'apply_actions', 'actions': [{'action_type': 'add_int_metadata'}, {'action_type': 'output', 'port': 19}]}]}, {'owner': 'telemetry_int', 'cookie': 12108905035701218117, '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_t
ype': 'apply_actions', 'actions': [{'action_type': 'add_int_metadata'}, {'action_type': 'output', 'port': 19}]}]}, {'owner': 'telemetry_int', 'cookie': 12108905035701218117, 'match': {'i
n_port': 20, 'dl_vlan': 1}, 'table_id': 0, 'table_group': 'evpl', 'priority': 20000, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions
': [{'action_type': 'send_report'}]}, {'instruction_type': 'goto_table', 'table_id': 2}]}, {'owner': 'telemetry_int', 'cookie': 12108905035701218117, 'match': {'in_port': 20, '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}]}]}]
2024-01-08 15:18:14,494 - INFO [kytos.napps.kytos/flow_manager] [utils.py:196:flows_to_log_info] (thread_pool_app_9) Send FlowMod from KytosEvent dpid: 00:00:00:00:00:00:00:06, command: 
add, force: True,  flows[0, 7]: [{'owner': 'telemetry_int', 'cookie': 12108905035701218117, 'match': {'in_port': 14, 'dl_vlan': 2222, 'dl_type': 2048, 'nw_proto': 6}, 'table_id': 0, 'tab
le_group': 'evpl', 'priority': 20100, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'push_int'}]}, {'instructio
n_type': 'goto_table', 'table_id': 2}]}, {'owner': 'telemetry_int', 'cookie': 12108905035701218117, 'match': {'in_port': 14, 'dl_vlan': 2222, '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': 'push_int'}]}, {'i
nstruction_type': 'goto_table', 'table_id': 2}]}, {'owner': 'telemetry_int', 'cookie': 12108905035701218117, 'match': {'in_port': 14, 'dl_vlan': 2222}, 'table_id': 2, 'table_group': 'evp
l', 'priority': 20000, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions': [{'action_type': 'add_int_metadata'}, {'action_type': 'push
_vlan', 'tag_type': 's'}, {'action_type': 'set_vlan', 'vlan_id': 1}, {'action_type': 'output', 'port': 11}]}]}, {'owner': 'telemetry_int', 'cookie': 12108905035701218117, 'match': {'in_p
ort': 11, 'dl_vlan': 1, 'dl_type': 2048, 'nw_proto': 6}, 'table_id': 0, 'table_group': 'evpl', 'priority': 20100, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction_typ
e': 'apply_actions', 'actions': [{'action_type': 'add_int_metadata'}, {'action_type': 'output', 'port': 25}]}]}, {'owner': 'telemetry_int', 'cookie': 12108905035701218117, '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_t
ype': 'apply_actions', 'actions': [{'action_type': 'add_int_metadata'}, {'action_type': 'output', 'port': 25}]}]}, {'owner': 'telemetry_int', 'cookie': 12108905035701218117, 'match': {'i
n_port': 26, 'dl_vlan': 1}, 'table_id': 0, 'table_group': 'evpl', 'priority': 20000, 'idle_timeout': 0, 'hard_timeout': 0, 'instructions': [{'instruction_type': 'apply_actions', 'actions
': [{'action_type': 'send_report'}]}, {'instruction_type': 'goto_table', 'table_id': 2}]}, {'owner': 'telemetry_int', 'cookie': 12108905035701218117, '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': 14}]}]}]
2024-01-08 15:18:14,526 - INFO [uvicorn.access] [httptools_impl.py:506:send] (MainThread) 127.0.0.1:35326 - "POST /api/kytos/mef_eline/v2/evc/metadata HTTP/1.1" 201
❯ echo '{ "trace": { "switch": { "dpid": "00:00:00:00:00:00:00:06", "in_port": 14}, "eth": {"dl_type": 2048, "dl_vlan": 2222}, "ip": { "nw_proto": 6 } } }' | http PUT http://127.0.0.1:81
81/api/amlight/sdntrace_cp/v1/trace
HTTP/1.1 200 OK
content-length: 369
content-type: application/json
date: Mon, 08 Jan 2024 18:16:07 GMT
server: uvicorn

{
    "result": [
        {
            "dpid": "00:00:00:00:00:00:00:06",
            "port": 14,
            "time": "2024-01-08 15:16:07.416479",
            "type": "starting",
            "vlan": 2222
        },
        {
            "dpid": "00:00:00:00:00:00:00:01",
            "port": 11,
            "time": "2024-01-08 15:16:07.416519",
            "type": "intermediary",
            "vlan": 1
        },
        {
            "dpid": "00:00:00:00:00:00:00:01",
            "out": {
                "port": 15,
                "vlan": 2222
            },
            "port": 18,
            "time": "2024-01-08 15:16:07.416534",
            "type": "last",
            "vlan": 1
        }
    ]
}
❯ echo '{ "trace": { "switch": { "dpid": "00:00:00:00:00:00:00:06", "in_port": 14}, "eth": {"dl_type": 2048, "dl_vlan": 2222}, "ip": { "nw_proto": 6 } } }' | http PUT http://127.0.0.1:81
81/api/amlight/sdntrace_cp/v1/trace
HTTP/1.1 200 OK
content-length: 369
content-type: application/json
date: Mon, 08 Jan 2024 18:18:53 GMT
server: uvicorn

{
    "result": [
        {
            "dpid": "00:00:00:00:00:00:00:06",
            "port": 14,
            "time": "2024-01-08 15:18:54.494218",
            "type": "starting",
            "vlan": 2222
        },
        {
            "dpid": "00:00:00:00:00:00:00:01",
            "port": 11,
            "time": "2024-01-08 15:18:54.494256",
            "type": "intermediary",
            "vlan": 1
        },
        {
            "dpid": "00:00:00:00:00:00:00:01",
            "out": {
                "port": 15,
                "vlan": 2222
            },
            "port": 20,
            "time": "2024-01-08 15:18:54.494267",
            "type": "last",
            "vlan": 1
        }
    ]
}

End-to-End Tests

N/A yet