updates to ryu service to run in a more general way avoiding the need for specific pathing and local installs
This commit is contained in:
parent
a2f6ba7e97
commit
ccf5a5de60
1 changed files with 9 additions and 10 deletions
|
@ -23,9 +23,9 @@ class OvsService(SdnService):
|
||||||
executables = ("ovs-ofctl", "ovs-vsctl")
|
executables = ("ovs-ofctl", "ovs-vsctl")
|
||||||
group = "SDN"
|
group = "SDN"
|
||||||
dirs = ("/etc/openvswitch", "/var/run/openvswitch", "/var/log/openvswitch")
|
dirs = ("/etc/openvswitch", "/var/run/openvswitch", "/var/log/openvswitch")
|
||||||
configs = ('OvsService.sh',)
|
configs = ("OvsService.sh",)
|
||||||
startup = ('sh OvsService.sh',)
|
startup = ("sh OvsService.sh",)
|
||||||
shutdown = ('killall ovs-vswitchd', 'killall ovsdb-server')
|
shutdown = ("killall ovs-vswitchd", "killall ovsdb-server")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def generate_config(cls, node, filename):
|
def generate_config(cls, node, filename):
|
||||||
|
@ -42,7 +42,7 @@ class OvsService(SdnService):
|
||||||
cfg += "ifconfig ovsbr0 up\n"
|
cfg += "ifconfig ovsbr0 up\n"
|
||||||
|
|
||||||
for ifc in node.netifs():
|
for ifc in node.netifs():
|
||||||
if hasattr(ifc, 'control') and ifc.control is True:
|
if hasattr(ifc, "control") and ifc.control is True:
|
||||||
continue
|
continue
|
||||||
ifnumstr = re.findall(r"\d+", ifc.name)
|
ifnumstr = re.findall(r"\d+", ifc.name)
|
||||||
ifnum = ifnumstr[0]
|
ifnum = ifnumstr[0]
|
||||||
|
@ -76,7 +76,7 @@ class OvsService(SdnService):
|
||||||
# Setup default flows
|
# Setup default flows
|
||||||
portnum = 1
|
portnum = 1
|
||||||
for ifc in node.netifs():
|
for ifc in node.netifs():
|
||||||
if hasattr(ifc, 'control') and ifc.control is True:
|
if hasattr(ifc, "control") and ifc.control is True:
|
||||||
continue
|
continue
|
||||||
cfg += "ovs-ofctl add-flow ovsbr0 priority=1000,in_port=%d,action=output:%d\n" % (portnum, portnum + 1)
|
cfg += "ovs-ofctl add-flow ovsbr0 priority=1000,in_port=%d,action=output:%d\n" % (portnum, portnum + 1)
|
||||||
cfg += "ovs-ofctl add-flow ovsbr0 priority=1000,in_port=%d,action=output:%d\n" % (portnum + 1, portnum)
|
cfg += "ovs-ofctl add-flow ovsbr0 priority=1000,in_port=%d,action=output:%d\n" % (portnum + 1, portnum)
|
||||||
|
@ -90,9 +90,9 @@ class RyuService(SdnService):
|
||||||
executables = ("ryu-manager",)
|
executables = ("ryu-manager",)
|
||||||
group = "SDN"
|
group = "SDN"
|
||||||
dirs = ()
|
dirs = ()
|
||||||
configs = ('ryuService.sh',)
|
configs = ("ryuService.sh",)
|
||||||
startup = ('sh ryuService.sh',)
|
startup = ("sh ryuService.sh",)
|
||||||
shutdown = ('killall ryu-manager',)
|
shutdown = ("killall ryu-manager",)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def generate_config(cls, node, filename):
|
def generate_config(cls, node, filename):
|
||||||
|
@ -100,8 +100,7 @@ class RyuService(SdnService):
|
||||||
Return a string that will be written to filename, or sent to the
|
Return a string that will be written to filename, or sent to the
|
||||||
GUI for user customization.
|
GUI for user customization.
|
||||||
"""
|
"""
|
||||||
app_path = "/usr/local/lib/python2.7/dist-packages/ryu/app"
|
|
||||||
cfg = "#!/bin/sh\n"
|
cfg = "#!/bin/sh\n"
|
||||||
cfg += "# auto-generated by ryuService (ryuService.py)\n"
|
cfg += "# auto-generated by ryuService (ryuService.py)\n"
|
||||||
cfg += '/usr/local/bin/ryu-manager --observe-links %s/ofctl_rest.py %s/rest_topology.py' % (app_path, app_path)
|
cfg += "ryu-manager --observe-links ryu.app.ofctl_rest ryu.app.rest_topology &\n"
|
||||||
return cfg
|
return cfg
|
||||||
|
|
Loading…
Add table
Reference in a new issue