2 This module implements a simple REST API that behaves like SONATA's gatekeeper.
4 It is only used to support the development of SONATA's SDK tools and to demonstrate
5 the year 1 version of the emulator until the integration with WP4's orchestrator is done.
10 import dummygatekeeper
as dgk
13 class SonataDummyGatekeeperEndpoint(object):
15 Creates and starts a REST API based on Flask in an
18 Can connect this API to data centers defined in an emulator
22 def __init__(self
, listenip
, port
):
26 logging
.debug("Created API endpoint %s" % self
)
29 return "%s(%s:%d)" % (self
.__class
__.__name
__, self
.ip
, self
.port
)
31 def connectDatacenter(self
, dc
):
32 self
.dcs
[dc
.label
] = dc
33 logging
.info("Connected DC(%s) to API endpoint %s" % (
37 thread
= threading
.Thread(target
=self
._api
_server
_thread
, args
=())
40 logging
.debug("Started API endpoint %s" % self
)
42 def _api_server_thread(self
):
43 dgk
.start_rest_api(self
.ip
, self
.port
, self
.dcs
)