3 #Copyright 2016 Open Platform for NFV Project, Inc. and its contributors
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
16 sys.path.insert(0, glob.glob('./lib')[0])
18 from toscaparser.tosca_template import ToscaTemplate
21 from partitioner import *
25 tosca = ToscaTemplate(argv[0])
27 node_labels = label.extract_labels( tosca )
30 subscribed_labels = {}
31 for key in node_labels:
32 subscribed_labels[site_id] = node_labels[key]
35 # Map nodes in the template to resource domains
36 site_map = label.map_nodes( subscribed_labels , node_labels )
39 # Select a site for each VNF
40 node_site = label.select_site( site_map )
43 file_paths = partitioner.partition_tosca("./tests/tmp/tosca",node_site,tosca.tpl)
46 print('Unexpected error: %s', sys.exc_info()[0])
48 if __name__ == "__main__":