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)
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)
def install_p4cbm(): "" commands = [ ["sudo", "pip", "install", "-r", "requirements.txt"], ["sudo", "python", "setup.py", "install"], ] helpers.execute_commands(commands, defaults.P4C_BM_PATH)
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)
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)
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)
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)
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)
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)
def gen_root_folder(project_name): "" path = defaults.PROJECTS_PATH commands = [["mkdir", project_name]] helpers.execute_commands(commands, path)
def gen_file(file, path): "" commands = [["touch", file]] helpers.execute_commands(commands, path)
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)
def gen_images(project_name): "" path = defaults.PROJECTS_PATH + project_name + "/" commands = [["mkdir", defaults.PROJECT_IMAGES_NAME]] helpers.execute_commands(commands, path)
def install_bmv2(): "" commands = [["bash", "install_deps.sh"], ["bash", "autogen.sh"], ["bash", "configure"], ["make"], ["sudo", "make", "install"]] helpers.execute_commands(commands, defaults.BMV2_PATH)
def gen_mininet(project_name): "" path = defaults.PROJECTS_PATH + project_name + "/" commands = [["mkdir", defaults.PROJECT_MININET_NAME]] helpers.execute_commands(commands, path)
def gen_build(project_name): "" path = defaults.PROJECTS_PATH + project_name + "/" commands = [["mkdir", defaults.PROJECT_BUILD_NAME]] helpers.execute_commands(commands, path)
def initialize_modules(): "" commands = [["git", "submodule", "update", "--init", "--recursive"]] helpers.execute_commands(commands, defaults.APP_PATH)