Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backup and restore not working in 0.22.0 with python2 #110

Closed
XN137 opened this issue Mar 18, 2019 · 5 comments
Closed

backup and restore not working in 0.22.0 with python2 #110

XN137 opened this issue Mar 18, 2019 · 5 comments
Assignees
Labels

Comments

@XN137
Copy link

XN137 commented Mar 18, 2019

following https://tcconfig.readthedocs.io/en/latest/pages/usage/backup_and_restore.html

problem:

user@host:~$ sudo tcshow eth0
{
    "eth0": {
        "outgoing": {},
        "incoming": {}
    }
}

user@host:~$ sudo tcset eth0 --delay 10ms --direction incoming

user@host:~$ sudo tcshow eth0 > tcconfig.json

user@host:~$ cat tcconfig.json 
{
    "eth0": {
        "outgoing": {},
        "incoming": {
            "protocol=ip": {
                "delay": "10.0ms",
                "rate": "32Gbps",
                "filter_id": "800::800"
            }
        }
    }
}

user@host:~$ sudo tcset tcconfig.json --import-setting
Traceback (most recent call last):
  File "/usr/local/bin/tcset", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/tcconfig/tcset.py", line 346, in main
    return set_tc_from_file(logger, options.device, options.overwrite)
  File "/usr/local/lib/python2.7/dist-packages/tcconfig/_importer.py", line 139, in set_tc_from_file
    loader.load_tcconfig(config_file_path)
  File "/usr/local/lib/python2.7/dist-packages/tcconfig/_importer.py", line 43, in load_tcconfig
    schema(self.__config_table)
  File "/usr/local/lib/python2.7/dist-packages/voluptuous/schema_builder.py", line 267, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python2.7/dist-packages/voluptuous/schema_builder.py", line 589, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python2.7/dist-packages/voluptuous/schema_builder.py", line 427, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: required key not provided @ data[<type 'unicode'>]

user@host:~$ pip list | grep tcconfig
tcconfig (0.22.0)

user@host:~$ pip list | grep voluptuous
voluptuous (0.11.5)
@thombashi
Copy link
Owner

thombashi commented Mar 18, 2019

@XN137
Thank you for your report.

Let me confirm one thing.
Did you execute the commands at Python 2?
I could reproduce the error at Python 2.7 environments (not at Python 3.7)

@thombashi thombashi self-assigned this Mar 18, 2019
@XN137
Copy link
Author

XN137 commented Mar 18, 2019

@thombashi yes it is python 2, see /usr/local/lib/python2.7 part of the error message.

exact version:

user@host:~$ python --version
Python 2.7.12
user@host:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.5 LTS
Release:	16.04
Codename:	xenial

thanks for looking into this

@XN137 XN137 changed the title backup and restore not working in 0.22.0 backup and restore not working in 0.22.0 with python2 Mar 18, 2019
@thombashi thombashi added the bug label Mar 18, 2019
@thombashi
Copy link
Owner

@XN137
Thank you for your additional information.

I believe the problem fixed at tcconfig 0.22.1.
Please try upgrading the package and re-execute the commands.

@XN137
Copy link
Author

XN137 commented Mar 19, 2019

@thombashi thanks for the quick feedback, 0.22.1 indeed does fix the problem:

user@host:~$ sudo tcshow eth1
{
    "eth1": {
        "outgoing": {},
        "incoming": {}
    }
}
user@host:~$ cat tcconfig.json 
{
  "eth1": {
    "incoming": {
      "dst-network=0.0.0.0/0": {},
      "dst-network=192.168.12.0/24": {
        "delay": "112ms",
        "rate": "155Mbps"
      },
      "dst-network=192.168.13.0/24": {
        "delay": "64ms",
        "rate": "200Mbps"
      }
    }
  },
  "eth2": {
    "incoming": {
      "dst-network=0.0.0.0/0": {},
      "dst-network=192.168.11.0/24": {
        "delay": "112ms",
        "rate": "155Mbps"
      },
      "dst-network=192.168.13.0/24": {
        "delay": "176ms",
        "rate": "155Mbps"
      }
    }
  },
  "eth3": {
    "incoming": {
      "dst-network=0.0.0.0/0": {},
      "dst-network=192.168.11.0/24": {
        "delay": "64ms",
        "rate": "200Mbps"
      },
      "dst-network=192.168.12.0/24": {
        "delay": "176ms",
        "rate": "155Mbps"
      }
    }
  }
}
user@host:~$ sudo tcset --import-setting tcconfig.json
user@host:~$ sudo tcshow eth1
{
    "eth1": {
        "outgoing": {},
        "incoming": {
            "dst-network=192.168.13.0/24, protocol=ip": {
                "delay": "64.0ms",
                "rate": "200Mbps",
                "filter_id": "800::800"
            },
            "dst-network=192.168.12.0/24, protocol=ip": {
                "delay": "112.0ms",
                "rate": "155Mbps",
                "filter_id": "800::801"
            }
        }
    }
}
user@host:~$ sudo tcshow eth2
{
    "eth2": {
        "outgoing": {},
        "incoming": {
            "dst-network=192.168.13.0/24, protocol=ip": {
                "delay": "176.0ms",
                "rate": "155Mbps",
                "filter_id": "800::800"
            },
            "dst-network=192.168.11.0/24, protocol=ip": {
                "delay": "112.0ms",
                "rate": "155Mbps",
                "filter_id": "800::801"
            }
        }
    }
}
user@host:~$ pip list | grep tcconfig
tcconfig (0.22.1)

closing this issue then, thanks again!

@XN137 XN137 closed this as completed Mar 19, 2019
@XN137
Copy link
Author

XN137 commented Mar 19, 2019

note that 5f76e61 was the fixing commit i think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants