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.
14 import sys, os, glob, yaml
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])
26 tpl = yaml.load(file(argv[0],'r'))
28 node_labels = label.extract_labels( tpl )
31 subscribed_labels = {}
32 for key in node_labels:
33 subscribed_labels[site_id] = node_labels[key]
36 # Map nodes in the template to resource domains
37 site_map = label.map_nodes( subscribed_labels , node_labels )
40 # Select a site for each VNF
41 node_site = label.select_site( site_map )
45 file_paths = partitioner.partition_tosca("./tests/tmp/tosca",node_site,tpl,tpl_site)
48 boundary_VLs, VL_sites = partitioner.return_boundarylinks(tpl_site)
53 print('Unexpected error: %s', sys.exc_info()[0])
55 if __name__ == "__main__":