def put(self, nffg): """ Manage the request of NF-FG instantiation """ logging.debug('Put from user '+self.user_data.username+" of tenant "+self.user_data.tenant) if self.checkNFFGStatus(nffg.id) is True: logging.debug('NF-FG already instantiated, trying to update it') session_id = self.update(nffg) logging.debug('Update completed') else: session_id = uuid.uuid4().hex Session().inizializeSession(session_id, self.user_data.getUserID(), nffg.id, nffg.name) try: # Manage profile self.prepareNFFG(nffg) # TODO: To split the graph we have to loop the following three instructions # Take a decision about where we should schedule the serving graph (UN or HEAT), and the node Graph().id_generator(nffg, session_id) orchestrator, node = Scheduler(nffg.db_id, self.user_data).schedule(nffg) # If the orchestrator have to connect two graphs in different nodes, # the end-points must be characterized to allow a connection between nodes remote_nffgs_dict = self.analizeRemoteConnection(nffg, node) # If needed, update the remote graph self.updateRemoteGraph(remote_nffgs_dict) # Save the NFFG in the database, with the state initializing Graph().addNFFG(nffg, session_id) Graph().setNodeID(nffg.db_id, node.id) # Instantiate profile logging.info('Call CA to instantiate NF-FG') logging.debug(nffg.getJSON()) orchestrator.instantiateProfile(nffg, node) logging.debug('NF-FG instantiated') Session().updateSessionNode(session_id, node.id, node.id) except Exception as ex: logging.exception(ex) ''' Graph().delete_graph(nffg.db_id) ''' Session().set_error(session_id) raise ex Session().updateStatus(session_id, 'complete') return session_id