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
# Copyright (c)2010-2012 the Boeing Company.
# See the LICENSE file included in this distribution.
#
''' Sample user-defined service.
'''
"""
This service starts Open vSwitch (if already installed) on nodes
running the service.
"""
import os
import re
from core.service import CoreService, addservice
from core.service import CoreService
from core.service import ServiceManager
class OvsService(CoreService):
''' This is a sample user-defined service.
@ -104,10 +101,10 @@ class OvsService(CoreService):
@staticmethod
def subnetentry(x):
# TODO - Maybe move default flow rules to here?
# Maybe move default flow rules to here?
return
# 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
# Copyright (c)2010-2012 the Boeing Company.
# See the LICENSE file included in this distribution.
#
''' Ryu SDN controller user-defined service.
'''
"""
Ryu SDN controller service.
"""
import os
from core.service import CoreService, addservice
from core.misc.ipaddr import IPv4Prefix, IPv6Prefix
from core.service import CoreService
from core.service import ServiceManager
class ryuService(CoreService):
''' This is a ryu user-defined service.
@ -41,12 +37,6 @@ class ryuService(CoreService):
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)
#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
@staticmethod
@ -54,13 +44,8 @@ class ryuService(CoreService):
''' Generate a subnet declaration block given an IPv4 prefix string
for inclusion in the config file.
'''
if x.find(":") >= 0:
# this is an IPv6 address
return ""
else:
net = IPv4Prefix(x)
return 'echo " network %s"' % (net)
return
# this line is required to add the above class to the list of available services
addservice(ryuService)
ServiceManager.add(ryuService)