LoginSignup
0
1

More than 5 years have passed since last update.

raspberrypiにOpenFlowコントローラーをデーモン化する

Posted at

openflow.serviceの準備

下記のような「openflow.service」ファイルを/etc/systemd/system配下に作成する。

[Unit]
Description = openflow controler

[Service]
ExecStart=/usr/local/bin/ryu-manager /usr/local/lib/python2.7/dist-packages/ryu/app/simple_switch_13.py
Restart=always
Type=simple

[Install]
WantedBy=multi-user.target

正しく設定できているか確認する

root@raspberrypi:/home/pi# systemctl list-unit-files --type=service | grep openflow
openflow.service                       disabled

サービスを起動する。

root@raspberrypi:/home/pi# systemctl start openflow

プロセスが起動していることを確認する

root@raspberrypi:/home/pi# ps -alxg | grep ryu-manager
4     0  1576     1  20   0  37932 33412 SyS_ep Ss   ?          0:03 /usr/bin/python /usr/local/bin/ryu-manager /usr/local/lib/python2.7/dist-packages/ryu/app/simple_switch_13.py
0     0  1599  1571  20   0   3772  1844 pipe_w S+   pts/0      0:00 grep ryu-manager

さらにjournalctlで起動ログを確認する

root@raspberrypi:/home/pi# journalctl

ログの後半に下記の出力が行われていれば正しく起動されている。

 8月 13 23:02:36 raspberrypi systemd[1]: Starting openflow controler...
 8月 13 23:02:36 raspberrypi systemd[1]: Started openflow controler.
 8月 13 23:02:37 raspberrypi ryu-manager[1776]: Registered VCS backend: git
 8月 13 23:02:37 raspberrypi ryu-manager[1776]: Registered VCS backend: hg
 8月 13 23:02:38 raspberrypi ryu-manager[1776]: Registered VCS backend: svn
 8月 13 23:02:38 raspberrypi ryu-manager[1776]: Registered VCS backend: bzr
 8月 13 23:02:39 raspberrypi ryu-manager[1776]: loading app /usr/local/lib/python2.7/dist-packages/ryu/app/simple_switch_13.py
 8月 13 23:02:39 raspberrypi ryu-manager[1776]: loading app ryu.controller.ofp_handler
 8月 13 23:02:39 raspberrypi ryu-manager[1776]: instantiating app /usr/local/lib/python2.7/dist-packages/ryu/app/simple_switch_13.py of SimpleSwitch13
 8月 13 23:02:39 raspberrypi ryu-manager[1776]: instantiating app ryu.controller.ofp_handler of OFPHandler

OpenFlowコントローラーをデーモン化する。

root@raspberrypi:/home/pi# systemctl enable openflow
Created symlink from /etc/systemd/system/multi-user.target.wants/openflow.service to /etc/systemd/system/openflow.service.
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1