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

[SWL-8183] Add yaml compatibility. #257

Closed
wants to merge 10 commits into from
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "submodules/loxigen-artifacts"]
path = submodules/loxigen-artifacts
url = git@github.com:bigswitch/loxigen-artifacts
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ OFTest OpenFlow Testing Framework

---

Update October 2021: this repository is forked from floodlight/oftest.
It is closed for better tracking/control of branches.

---

# Introduction

OFTest is a Python based OpenFlow switch test framework and collection of test cases. It is based on unittest, which is included in the standard Python distribution.
Expand Down
7 changes: 6 additions & 1 deletion oft
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
"""
@package oft

Expand Down Expand Up @@ -28,6 +28,11 @@ import copy

ROOT_DIR = os.path.dirname(os.path.realpath(__file__))

LOXI_SRC_DIR = os.path.join(ROOT_DIR,
'submodules', 'loxigen-artifacts', 'pyloxi')
if os.path.exists(os.path.join(LOXI_SRC_DIR, 'loxi')):
# Running from source tree
sys.path.insert(0, LOXI_SRC_DIR)
PY_SRC_DIR = os.path.join(ROOT_DIR, 'src', 'python')
if os.path.exists(os.path.join(PY_SRC_DIR, 'oftest')):
# Running from source tree
Expand Down
7 changes: 7 additions & 0 deletions platforms/compat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import yaml

def yaml_load(f):
if hasattr(yaml, "FullLoader"):
return yaml.load(f, Loader=yaml.FullLoader)
else:
return yaml.load(f)
5 changes: 3 additions & 2 deletions platforms/veth_inject.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import argparse
import subprocess
import yaml
from compat import yaml_load

# The loopback port specification is passed via the "--platform-args"
# option to OFTest.
Expand Down Expand Up @@ -77,13 +78,13 @@
if os.path.isfile(lbcfgfile):
print(lbcfgfile)
with open(lbcfgfile) as f:
lbcfg = yaml.load(f)
lbcfg = yaml_load(f)
else:
lbcfg = {}
if os.path.isfile(if2numcfgfile):
print(if2numcfgfile)
with open(if2numcfgfile) as f:
if2numcfg = yaml.load(f)
if2numcfg = yaml_load(f)
else:
if2numcfg = {}

Expand Down
5 changes: 3 additions & 2 deletions platforms/veth_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import sys
import argparse
import yaml
from compat import yaml_load

if not "--platform-args" in " ".join(sys.argv):
raise Exception("--platform-args must be specified")
Expand Down Expand Up @@ -43,13 +44,13 @@
if os.path.isfile(vethcfgfile):
print(vethcfgfile)
with open(vethcfgfile) as f:
vethcfg = yaml.load(f)
vethcfg = yaml_load(f)

if2numcfg = {}
if os.path.isfile(if2numcfgfile):
print(if2numcfgfile)
with open(if2numcfgfile) as f:
if2numcfg = yaml.load(f)
if2numcfg = yaml_load(f)

port_map = { int(v) : vethcfg[k]
for k, v in if2numcfg.items() if k in vethcfg}
Expand Down
36 changes: 0 additions & 36 deletions src/python/loxi/LICENSE.pyloxi

This file was deleted.

74 changes: 0 additions & 74 deletions src/python/loxi/__init__.py

This file was deleted.

Loading