blob: 453e20c9037869396ce888ba83cd723d4f9cc502 [file] [log] [blame]
peustermd7cbd212017-09-07 08:55:14 +02001"""
2Copyright (c) 2017 SONATA-NFV and Paderborn University
3ALL RIGHTS RESERVED.
4
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11Unless required by applicable law or agreed to in writing, software
12distributed under the License is distributed on an "AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14See the License for the specific language governing permissions and
15limitations under the License.
16
17Neither the name of the SONATA-NFV, Paderborn University
18nor the names of its contributors may be used to endorse or promote
19products derived from this software without specific prior written
20permission.
21
22This work has been performed in the framework of the SONATA project,
23funded by the European Commission under Grant number 671517 through
24the Horizon 2020 and 5G-PPP programmes. The authors would like to
25acknowledge the contributions of their colleagues of the SONATA
26partner consortium (www.sonata-nfv.eu).
27"""
peusterm00199782017-05-17 08:48:12 +020028import uuid
29
30
31class Stack:
32 def __init__(self, id=None):
33 self.servers = dict()
34 self.nets = dict()
35 self.ports = dict()
36 self.routers = dict()
37 self.stack_name = None
38 self.creation_time = None
39 self.update_time = None
40 self.status = None
peusterm8bac1be2017-06-19 10:27:44 +020041 self.template = None
peusterm00199782017-05-17 08:48:12 +020042 if id is None:
43 self.id = str(uuid.uuid4())
44 else:
45 self.id = id
46
47 def add_server(self, server):
48 """
49 Adds one server to the server dictionary.
50
51 :param server: The server to add.
52 :type server: :class:`heat.resources.server`
53 """
54 self.servers[server.name] = server
55
56 def add_net(self, net):
57 """
58 Adds one network to the network dictionary.
59
60 :param net: Network to add.
61 :type net: :class:`heat.resources.net`
62 """
63 self.nets[net.name] = net
64
65 def add_port(self, port):
66 """
67 Adds one port to the port dictionary.
68
69 :param port: Port to add.
70 :type port: :class:`heat.resources.port`
71 """
72 self.ports[port.name] = port
73
74 def add_router(self, router):
75 """
76 Adds one router to the port dictionary.
77
78 :param router: Router to add.
79 :type router: :class:`heat.resources.router`
80 """
81 self.routers[router.name] = router