Updated service files to support new format

This commit is contained in:
cspiker 2017-06-08 12:30:43 -07:00
parent 46baca85d9
commit a1007e2391
2 changed files with 15 additions and 33 deletions

View file

@ -1,15 +1,12 @@
# """
# CORE This service starts Open vSwitch (if already installed) on nodes
# Copyright (c)2010-2012 the Boeing Company. running the service.
# See the LICENSE file included in this distribution. """
#
''' Sample user-defined service.
'''
import os import os
import re import re
from core.service import CoreService, addservice from core.service import CoreService
from core.service import ServiceManager
class OvsService(CoreService): class OvsService(CoreService):
''' This is a sample user-defined service. ''' This is a sample user-defined service.
@ -104,10 +101,10 @@ class OvsService(CoreService):
@staticmethod @staticmethod
def subnetentry(x): def subnetentry(x):
# TODO - Maybe move default flow rules to here? # Maybe move default flow rules to here?
return return
# this line is required to add the above class to the list of available services # this line is required to add the above class to the list of available services
addservice(OvsService) ServiceManager.add(OvsService)

View file

@ -1,15 +1,11 @@
# """
# CORE Ryu SDN controller service.
# Copyright (c)2010-2012 the Boeing Company. """
# See the LICENSE file included in this distribution.
#
''' Ryu SDN controller user-defined service.
'''
import os import os
from core.service import CoreService, addservice from core.service import CoreService
from core.misc.ipaddr import IPv4Prefix, IPv6Prefix from core.service import ServiceManager
class ryuService(CoreService): class ryuService(CoreService):
''' This is a ryu user-defined service. ''' This is a ryu user-defined service.
@ -41,12 +37,6 @@ class ryuService(CoreService):
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 += '/usr/local/bin/ryu-manager --observe-links %s/ofctl_rest.py %s/rest_topology.py' % (app_path, app_path)
#for ifc in node.netifs():
# cfg += 'echo "Node %s has interface %s"\n' % (node.name, ifc.name)
# # here we do something interesting
# cfg += "\n".join(map(cls.subnetentry, ifc.addrlist))
# break
return cfg return cfg
@staticmethod @staticmethod
@ -54,13 +44,8 @@ class ryuService(CoreService):
''' Generate a subnet declaration block given an IPv4 prefix string ''' Generate a subnet declaration block given an IPv4 prefix string
for inclusion in the config file. for inclusion in the config file.
''' '''
if x.find(":") >= 0: return
# this is an IPv6 address
return ""
else:
net = IPv4Prefix(x)
return 'echo " network %s"' % (net)
# this line is required to add the above class to the list of available services # this line is required to add the above class to the list of available services
addservice(ryuService) ServiceManager.add(ryuService)