blob: e9e8c10da1dc1abf0da1ea968846d7ba6eaa4847 [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
5from twisted.internet import reactor, defer
6from 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
24 reactor.callLater(0, TOSCA_WebServer)
25
26 return deferred
27
28 def start(self):
29 print "[XOS-TOSCA] Starting"
30
31 grpc_setup = GRPC_Client().start()
32 grpc_setup.addCallback(self.generate_tosca)
33
34 reactor.run()
35
36
37if __name__ == '__main__':
38 Main().start()