topology.
"""
- def __init__(self, listenip, port, deploy_sap=False, docker_management=False, auto_deploy=False):
+ def __init__(self, listenip, port, deploy_sap=False, docker_management=False, auto_deploy=False, auto_delete=False):
self.dcs = {}
self.ip = listenip
self.port = port
dgk.DEPLOY_SAP = deploy_sap
dgk.USE_DOCKER_MGMT = docker_management
- dgk.AUTODEPLOY = auto_deploy
+ dgk.AUTO_DEPLOY = auto_deploy
+ dgk.AUTO_DELETE = auto_delete
logging.debug("Created API endpoint %s" % self)
def __repr__(self):
# automatically deploy uploaded packages (no need to execute son-access deploy --latest separately)
AUTO_DEPLOY = False
+# and also automatically terminate any other running services
+AUTO_DELETE = False
+
def generate_subnets(prefix, base, subnet_size=50, mask=24):
# Generate a list of ipaddress in subnets
r = list()
with open(upload_path, 'wb') as f:
f.write(son_file)
size = os.path.getsize(upload_path)
+
+ # first stop and delete any other running services
+ if AUTO_DELETE:
+ for service_uuid in GK.services:
+ for instance_uuid in GK.services[service_uuid].instances:
+ # valid service and instance UUID, stop service
+ GK.services.get(service_uuid).stop_service(instance_uuid)
+ LOG.info("service instance with uuid %r stopped." % instance_uuid)
+
# create a service object and register it
s = Service(service_uuid, file_hash, upload_path)
GK.register_service_package(service_uuid, s)
rapi1.start()
# add the SONATA dummy gatekeeper to each DC
- sdkg1 = SonataDummyGatekeeperEndpoint("0.0.0.0", 5000, deploy_sap=True, auto_deploy=True, docker_management=True)
+ sdkg1 = SonataDummyGatekeeperEndpoint("0.0.0.0", 5000, deploy_sap=True, auto_deploy=True, docker_management=True, auto_delete=True)
sdkg1.connectDatacenter(dc1)
# run the dummy gatekeeper (in another thread, don't block)
sdkg1.start()