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:
Blake Harnden 2019-07-18 08:19:51 -07:00
parent a2f6ba7e97
commit ccf5a5de60

View file

@ -23,9 +23,9 @@ class OvsService(SdnService):
executables = ("ovs-ofctl", "ovs-vsctl")
group = "SDN"
dirs = ("/etc/openvswitch", "/var/run/openvswitch", "/var/log/openvswitch")
configs = ('OvsService.sh',)
startup = ('sh OvsService.sh',)
shutdown = ('killall ovs-vswitchd', 'killall ovsdb-server')
configs = ("OvsService.sh",)
startup = ("sh OvsService.sh",)
shutdown = ("killall ovs-vswitchd", "killall ovsdb-server")
@classmethod
def generate_config(cls, node, filename):
@ -42,7 +42,7 @@ class OvsService(SdnService):
cfg += "ifconfig ovsbr0 up\n"
for ifc in node.netifs():
if hasattr(ifc, 'control') and ifc.control is True:
if hasattr(ifc, "control") and ifc.control is True:
continue
ifnumstr = re.findall(r"\d+", ifc.name)
ifnum = ifnumstr[0]
@ -76,7 +76,7 @@ class OvsService(SdnService):
# Setup default flows
portnum = 1
for ifc in node.netifs():
if hasattr(ifc, 'control') and ifc.control is True:
if hasattr(ifc, "control") and ifc.control is True:
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 + 1, portnum)
@ -90,9 +90,9 @@ class RyuService(SdnService):
executables = ("ryu-manager",)
group = "SDN"
dirs = ()
configs = ('ryuService.sh',)
startup = ('sh ryuService.sh',)
shutdown = ('killall ryu-manager',)
configs = ("ryuService.sh",)
startup = ("sh ryuService.sh",)
shutdown = ("killall ryu-manager",)
@classmethod
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
GUI for user customization.
"""
app_path = "/usr/local/lib/python2.7/dist-packages/ryu/app"
cfg = "#!/bin/sh\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