blob: 92c21ee8293cd4384dbfbcf5304e7f4b419f2b12 [file] [log] [blame]
Matteo Scandolo9ce18252017-06-22 10:48:25 -07001import os
2from grpc_client.main import GRPC_Client
3from tosca.generator import TOSCA_Generator
4from web_server.main import TOSCA_WebServer
Matteo Scandolo21dde412017-07-11 18:54:12 -07005from twisted.internet import defer
Matteo Scandolo9ce18252017-06-22 10:48:25 -07006from xosconfig import Config
7
8current_dir = os.path.dirname(os.path.realpath(__file__))
9config_file = os.path.join(current_dir, './xos-tosca-config.yaml')
10config_schema = os.path.join(current_dir, './xos-tosca-config-schema.yaml')
11Config.init(config_file, config_schema)
12
13class Main:
14
15 def __init__(self):
16 self.grpc_client = None
17
18 def generate_tosca(self, client):
19
20 deferred = defer.Deferred()
21
22 TOSCA_Generator().generate(client)
23
Matteo Scandolo9ce18252017-06-22 10:48:25 -070024
25 return deferred
26
27 def start(self):
28 print "[XOS-TOSCA] Starting"
29
30 grpc_setup = GRPC_Client().start()
31 grpc_setup.addCallback(self.generate_tosca)
32
Matteo Scandolo21dde412017-07-11 18:54:12 -070033 # NOTE that TOSCA_WebServer create a Klein app that call reactor.run()
34 TOSCA_WebServer()
Matteo Scandolo9ce18252017-06-22 10:48:25 -070035
36
37if __name__ == '__main__':
38 Main().start()