1#!/router/bin/python
2
3import os
4import sys
5
6def add_root_to_path ():
7    """adds trex_control_plane root dir to script path, up to `depth` parent dirs"""
8    root_dirname = 'trex_control_plane'
9    file_path    = os.path.dirname(os.path.realpath(__file__))
10
11    components = file_path.split(os.sep)
12    sys.path.append( str.join(os.sep, components[:components.index(root_dirname)+1]) )
13    return
14
15add_root_to_path()
16