Create util directory

This commit is contained in:
Wojciech Kozlowski 2019-04-07 01:37:24 +02:00
parent a71cf2b6f3
commit 228defd9f0
4 changed files with 4 additions and 3 deletions

View File

@ -6,8 +6,8 @@ import os
from mininet.net import Mininet from mininet.net import Mininet
from mininet.cli import CLI from mininet.cli import CLI
from router import Router from util.router import Router
from experiment import Experiment from util.experiment import Experiment
def start_daemon(node, daemon, conf_dir): def start_daemon(node, daemon, conf_dir):

0
util/__init__.py Normal file
View File

View File

@ -1,5 +1,6 @@
import importlib import importlib
import os import os
import sys
class Experiment(object): class Experiment(object):
@ -14,7 +15,7 @@ class Experiment(object):
""" """
def __init__(self, topology, scenario): def __init__(self, topology, scenario):
root_dir = os.path.dirname(os.path.realpath(__file__)) root_dir = os.path.dirname(sys.modules['__main__'].__file__)
# Check if the topology directory exists. # Check if the topology directory exists.
topo_dir = os.path.join(root_dir, "topology/{}".format(topology)) topo_dir = os.path.join(root_dir, "topology/{}".format(topology))