Skip to content

Python3Upgrade #155

@YufengXin

Description

@YufengXin

There are a number of things that need to be taken care of. (1) using the Futurize tool solved most of the syntax upgrade (print...); (2) byte and str compatibility, esp. in socket communication; (3) upgrade to python3, pip3, and future in the vagrant file (4) change in the Dockerfile (5) "relative import" doesn't work well, back to the "absolute import". (6) invoking "Ryu-manager" in the RyuControllerInterface.

### Automatic conversion to Py2/3
Futurize stage 1

futurize --stage1 -w /**/.py >future-step1-port.txt
Python2.7 unittest seem fine
conda activate python27
export PYTHONPATH=/Users/yxin/NSF/AW-SDX-Audit-Local/atlanticwave-proto
pip install --requirement requirements.txt
python -m unittest discover -v
conda deactivate

Python3 unittest causes multiple failures in dependencies so continue:

  • Futurize stage 2
    . futurize --stage2 /**/.py
  • Go through all the python modules to change:
    .metaclass
    .pickle (loads byte, no str; dump str to bytes)
    . list(dict.keys())
    . Modifying socket implementation due to the incompatibility between str and bytes.
    -update requirements.txt: ryu4.34, Flask
  • Making changes in vagrant, Docker-file, run_sdx.sh, run_lc.sh, and vendor-updates:
    . use python3 as the default python
    . use pip3
    . use Ubuntu 18.04 in docker and ryu4.34

Going through all the unittest.

./lib
./shared
./localctlr
./sdxctlr

Jenkins deployment in vagrant

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions