示例#1
0
def install_dependencies():
    ""
    commands = [[
        "sudo", "apt-get", "install", "-y", "build-essential", "ant", "maven",
        "python-dev", "mininet"
    ], ["sudo", "pip", "install", "Jinja2"]]
    helpers.execute_commands(commands, defaults.APP_PATH)
示例#2
0
def gen_project_json(project_folder, source_name):
    path = defaults.PROJECTS_PATH + project_folder + "/"
    commands = [[
        defaults.P4C_BM_SCRIPT, defaults.PROJECT_P4_NAME + source_name + ".p4",
        "--json", defaults.PROJECT_BUILD_NAME + source_name + ".json"
    ]]
    helpers.execute_commands(commands, path)
示例#3
0
def install_p4cbm():
    ""
    commands = [
        ["sudo", "pip", "install", "-r", "requirements.txt"],
        ["sudo", "python", "setup.py", "install"],
    ]
    helpers.execute_commands(commands, defaults.P4C_BM_PATH)
示例#4
0
def run_cli(project_name, source_name, thrift_port):
    path = defaults.PROJECTS_PATH + project_name + '/'
    commands = [[
        defaults.BMV2_CLI_PATH,
        defaults.PROJECT_BUILD_NAME + source_name + '.json', thrift_port
    ]]
    helpers.execute_commands(commands, path)
示例#5
0
文件: run_cli.py 项目: pluxos/p4-dev
def run_cli(project_name):
    ""
    path = defaults.PROJECTS_PATH + project_name + "/"
    commands = [[
        defaults.BMV2_CLI_PATH,
        defaults.PROJECT_BUILD_NAME + project_name + ".json"
    ]]
    helpers.execute_commands(commands, path)
示例#6
0
def run_mininet(project_name):
    path = defaults.PROJECTS_PATH + project_name + "/"
    commands = [[
        "sudo", "python", defaults.PROJECT_MININET_NAME + project_name + ".py",
        "--behavioral-exe", defaults.BMV2_INTERPRETER_PATH, "--json",
        defaults.PROJECT_BUILD_NAME + project_name + ".json"
    ]]
    helpers.execute_commands(commands, path)
示例#7
0
def apply_commands(project_name, source_name, thrift_port, commands_name):
    ""
    path = defaults.PROJECTS_PATH + project_name + "/"
    stdin = open(path + defaults.PROJECT_UTIL_NAME + commands_name)
    commands = [[
        defaults.BMV2_CLI_PATH,
        defaults.PROJECT_BUILD_NAME + source_name + ".json", thrift_port
    ]]
    helpers.execute_commands(commands, path, stdin)
示例#8
0
def install_floodlight():
    ""
    commands = [
        ["git", "submodule", "init"],
        ["git", "submodule", "update"],
        ["ant"],
        ["sudo", "mkdir", "/var/lib/floodlight"],
        ["sudo", "chmod", "777", "/var/lib/floodlight"],
    ]
    helpers.execute_commands(commands, defaults.FLOODLIGHT_PATH)
示例#9
0
def apply_commands(project_name):
    ""
    path = defaults.PROJECTS_PATH + project_name + "/"
    stdin = open(path + defaults.PROJECT_UTIL_NAME +
                 defaults.PROJECT_COMMANDS_NAME)
    commands = [[
        defaults.BMV2_CLI_PATH,
        defaults.PROJECT_BUILD_NAME + project_name + ".json"
    ]]
    helpers.execute_commands(commands, path, stdin)
示例#10
0
def gen_root_folder(project_name):
    ""
    path = defaults.PROJECTS_PATH
    commands = [["mkdir", project_name]]
    helpers.execute_commands(commands, path)
示例#11
0
def gen_file(file, path):
    ""
    commands = [["touch", file]]
    helpers.execute_commands(commands, path)
示例#12
0
def gen_template_file(file, context, path):
    ""
    template = helpers.render_template(file, context)
    commands = [["touch", file]]
    helpers.execute_commands(commands, path)
    helpers.write_file(path + file, template)
示例#13
0
def gen_images(project_name):
    ""
    path = defaults.PROJECTS_PATH + project_name + "/"
    commands = [["mkdir", defaults.PROJECT_IMAGES_NAME]]
    helpers.execute_commands(commands, path)
示例#14
0
def install_bmv2():
    ""
    commands = [["bash", "install_deps.sh"], ["bash", "autogen.sh"],
                ["bash", "configure"], ["make"], ["sudo", "make", "install"]]
    helpers.execute_commands(commands, defaults.BMV2_PATH)
示例#15
0
def gen_mininet(project_name):
    ""
    path = defaults.PROJECTS_PATH + project_name + "/"
    commands = [["mkdir", defaults.PROJECT_MININET_NAME]]
    helpers.execute_commands(commands, path)
示例#16
0
def gen_build(project_name):
    ""
    path = defaults.PROJECTS_PATH + project_name + "/"
    commands = [["mkdir", defaults.PROJECT_BUILD_NAME]]
    helpers.execute_commands(commands, path)
示例#17
0
def initialize_modules():
    ""
    commands = [["git", "submodule", "update", "--init", "--recursive"]]
    helpers.execute_commands(commands, defaults.APP_PATH)