{"id":18151454,"url":"https://github.com/shun159/tres","last_synced_at":"2025-09-25T20:57:12.304Z","repository":{"id":62430520,"uuid":"120765292","full_name":"shun159/tres","owner":"shun159","description":"OpenFlow Controller In Elixir","archived":false,"fork":false,"pushed_at":"2019-09-24T09:00:37.000Z","size":6188,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-04-14T13:10:48.379Z","etag":null,"topics":["elixir","erlang","networking","openflow","openflow-controller","sdn"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shun159.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-08T13:32:37.000Z","updated_at":"2024-06-19T18:18:35.000Z","dependencies_parsed_at":"2022-11-01T20:20:42.873Z","dependency_job_id":null,"html_url":"https://github.com/shun159/tres","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shun159%2Ftres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shun159%2Ftres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shun159%2Ftres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shun159%2Ftres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shun159","download_url":"https://codeload.github.com/shun159/tres/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251362979,"owners_count":21577557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","erlang","networking","openflow","openflow-controller","sdn"],"created_at":"2024-11-02T01:07:41.356Z","updated_at":"2025-09-25T20:57:07.268Z","avatar_url":"https://github.com/shun159.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tres - an Elixir OpenFlow development platform\n\n[![Build Status](https://img.shields.io/travis/shun159/tres.svg?style=flat-square)](https://travis-ci.org/shun159/tres) \n[![codecov](https://img.shields.io/codecov/c/github/shun159/tres/develop.svg?style=flat-square)](https://codecov.io/gh/shun159/tres) \n[![Supported OTP version](https://img.shields.io/badge/erlang-22.x-blue.svg?style=flat-square)](http://erlang.org/) \n[![LICENSE](https://img.shields.io/badge/license-SUSHI--WARE%F0%9F%8D%A3-blue.svg?style=flat-square)](https://github.com/MakeNowJust/sushi-ware)\n[![Hex Version](https://img.shields.io/hexpm/v/tres.svg?style=flat-square)](https://hex.pm/packages/tres)\n\n## Overview\n\nTres is a framework and set of helper libraries to develop OpenFlow controllers in Elixir.\n\n## How to build your own controller application\n\n### Installation\n\n```elixir\ndef deps do\n  [\n    {:tres, \"~\u003e 0.1.2\"}\n  ]\nend\n```\n\n### callbacks\n \n```elixir\nconfig :tres,\n  callback_module: Tres.ExampleHandler,\n  callback_args:   []\n```\n\nTo use `Tres.Controller` with your code, set the handler callback_module to your callback module.\nThis module must implement the `Module.start_link/1` that returns `on_start`.\n\nSet the callback_args to the terms you want pass to the `start_link/2` callback function.\n\n```\n% cat lib/sample.ex\ndefmodule Sample do\n  use GenServer\n  use Tres.Controller\n\n  def start_link([datapath_id, _start_args]) do\n    GenServer.start_link(__MODULE__, [datapath_id])\n  end\n  \n  def init([datapath_id]) do\n    # As an example create a flow to receive all packet_ins from port 1\n    redirect_action = Output.new(:controller)\n    apply_ins = ApplyActions.new(redirect_action)\n    match = Match.new(in_port: 1)\n    :ok = send_flow_mod_add(datapath_id, \n                            priority: 1,\n                            match: match,\n                            instructions: [apply_ins])\n    {:ok, datapath_id}\n  end\n  \n  def handle_info(%PacketIn{} = packet_in, datapath_id) do\n    # print the packet_in message struct\n    IO.inspect(packet_in)\n    {:noreply, datapath_id}\n  end\nend\n```\n\n## To run the controller\n\n```bash\n$ iex -S mix\n```\n\n## Examples\n\n- learning-switch: Simple Layer2 switch\n- leader-example: Simple election based multiple controller using Ulf Wiger's Locks Leader\n- patch\\_panel: inteligent patch\\_panel example\n- simple\\_router: An OpenFlow controller that emulates layer 3 switch (router).\n- nx\\_learning\\_switch: Example for very simple-minded L2 switch using NXAST_LEARN action.\n\nLicense\n-------\nTres is released under the __SUSHI-WARE LICENSE__.\n\n__私に寿司をおごってください__\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshun159%2Ftres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshun159%2Ftres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshun159%2Ftres/lists"}