kytos / flow_manager

MIT License
1 stars 16 forks source link

KeyError: 'flow' when running Mininet #103

Open hdiogenes opened 3 years ago

hdiogenes commented 3 years ago

When upgrading from kytos 2020.2rc1 to 2020.2 with flow_manager 3.0 and running mininet, a KeyError: 'flow' is issued on the Kytos console. After that it says Flows loaded.

Steps to reproduce: upgrade an existing instance of Kytos, run kytosd -f and then run Mininet.

sudo mn --topo linear,3 --mac --controller=remote,ip=127.0.0.1 --switch ovsk,protocols=OpenFlow13

2020-12-30 17:11:01,817 - INFO [kytos.core.atcp_server] (MainThread) New connection from 127.0.0.1:35060
2020-12-30 17:11:01,820 - INFO [kytos.core.atcp_server] (MainThread) New connection from 127.0.0.1:35062
2020-12-30 17:11:01,821 - INFO [kytos.core.atcp_server] (MainThread) New connection from 127.0.0.1:35064
2020-12-30 17:11:02,399 - INFO [kytos.napps.kytos/of_core] (Thread-38) Connection ('127.0.0.1', 35060), Switch 00:00:00:00:00:00:00:01: OPENFLOW HANDSHAKE COMPLETE
2020-12-30 17:11:02,402 - INFO [kytos.napps.kytos/of_core] (Thread-40) Connection ('127.0.0.1', 35064), Switch 00:00:00:00:00:00:00:02: OPENFLOW HANDSHAKE COMPLETE
2020-12-30 17:11:02,409 - INFO [kytos.napps.kytos/of_core] (Thread-39) Connection ('127.0.0.1', 35062), Switch 00:00:00:00:00:00:00:03: OPENFLOW HANDSHAKE COMPLETE
Exception in thread Thread-45:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File kytos/core/helpers.py", line 70, in threaded_handler
    handler(*args)
  File "venv/ky/var/lib/kytos/napps/kytos/flow_manager/main.py", line 68, in resend_stored_flows
    flows_dict = {"flows": [flow['flow']]}
KeyError: 'flow'
kytos $> 2020-12-30 17:12:00,421 - INFO [kytos.napps.kytos/flow_manager] (flow_manager) Flows loaded.
cmagnobarbosa commented 3 years ago

Hello, @hdiogenes, I cannot reproduce this error in my virtual environment. I think that maybe this error is occurring because the resend_stored_flows method is using old data stored in the storehouse, related to the first versions of the flow persistence implemented in PR #90. Deleting the namespace (kytos.Flow.Persistence) in the storehouse can resolve this error. But I think it may be necessary to implement a version field, or something like that in the persistence data, avoiding errors of this kind.

If cleaning the box does not solve the problem, you can provide me with more information on how to reproduce this error.


Information about my env, generated with kytos bug-report:

Platform

Release information

Distributor ID: Ubuntu Description: Ubuntu 20.04.1 LTS Release: 20.04 Codename: focal

System Information

Linux carlosmagno-Lenovo-ideapad-330S-15IKB 5.8.0-25-generic 26-Ubuntu SMP Thu Oct 15 10:30:38 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Python

path=/home/carlosmagno/workspace/kytos/Teste_Coverage/env_keyError/bin/python version=Python 3.6.12

Pip

path=/home/carlosmagno/workspace/kytos/Teste_Coverage/env_keyError/bin/pip version=pip 20.3.3 from /home/carlosmagno/workspace/kytos/Teste_Coverage/env_keyError/lib/python3.6/site-packages/pip (python 3.6)

Python Packages

kytos | github.com:cmagnobarbosa/kytos | f145a7f7
kytos_flow_manager | github.com:cmagnobarbosa/flow_manager | a1d756f0
kytos_mef_eline | github.com:kytos/mef_eline | e670270a
kytos_of_core | github.com:cmagnobarbosa/of_core | ccaa0d2c
kytos_of_l2ls | github.com:cmagnobarbosa/of_l2ls | 1de43719
kytos_of_lldp | github.com:cmagnobarbosa/of_lldp | 4f22cf52
kytos_pathfinder | github.com/kytos/pathfinder | d8ba617a
kytos_storehouse | github.com:cmagnobarbosa/storehouse | e1425d16
kytos_topology | github.com:cmagnobarbosa/topology | 581dc01c
kytos_utils | github.com:cmagnobarbosa/kytos-utils | a16a659e
python_openflow | github.com:cmagnobarbosa/python-openflow | 0537c626

Kytos environment

Kytosd

path=/home/carlosmagno/workspace/kytos/Teste_Coverage/env_keyError/bin/kytosd version=kytosd 2020.2

Kytos

path=/home/carlosmagno/workspace/kytos/Teste_Coverage/env_keyError/bin/kytos version=kytos command line, version 2020.2

Installed napps

Status | NApp ID | Description
=======+========================+================================================================================== [ie] | kytos/flow_manager:3.0 | Manage switches' flows through a REST API.
[ie] | kytos/mef_eline:2.4 | NApp to provision circuits from user request
[ie] | kytos/of_core:1.5.1 | OpenFlow Core of Kytos Controller, responsible for main OpenFlow operations.
[ie] | kytos/of_l2ls:1.2.0 | A L2 learning switch application for OpenFlow switches.
[ie] | kytos/of_lldp:1.1 | Discover network-to-network interfaces (NNIs) using the LLDP protocol.
[ie] | kytos/pathfinder:2.2.3 | Keeps track of topology changes, and calculates the best path between two points. [ie] | kytos/storehouse:1.3.1 | Persistence NApp with support for multiple backends
[ie] | kytos/topology:3.7.1 | Manage the network topology.

Status: (i)nstalled, (e)nabled