def resume(self, instanceid, wait=True): ''' Resume an FDU instance :param instanceid: FDU instance you want to resume :param wait: make the function blocking :return: instanceid ''' node = self.connector.glob.actual.get_fdu_instance_node( self.sysid, self.tenantid, instanceid) if node is None: raise ValueError('Unable to find node for this instanceid') record = self.connector.glob.actual.get_node_fdu_instance( self.sysid, self.tenantid, node, instanceid) record = InfraFDU(record) record.set_status('RESUME') fduid = record.get_fdu_id() res = self.connector.glob.desired.add_node_fdu( self.sysid, self.tenantid, node, fduid, instanceid, record.to_json()) if wait: self.__wait_node_fdu_state_change(instanceid, 'RUN') return res
def stop(self, instanceid, wait=True): ''' Stops the given instance paremeters ---------- instanceid : string UUID of instance wait : bool optional, call will block until FDU is stopeed returns ------- string ''' node = self.connector.glob.actual.get_fdu_instance_node( self.sysid, self.tenantid, instanceid) if node is None: raise ValueError('Unable to find node for this instanceid') record = self.connector.glob.actual.get_node_fdu_instance( self.sysid, self.tenantid, node, instanceid) record = InfraFDU(record) record.set_status('STOP') fduid = record.get_fdu_id() res = self.connector.glob.desired.add_node_fdu(self.sysid, self.tenantid, node, fduid, instanceid, record.to_json()) if wait: self.__wait_node_fdu_state_change(instanceid, 'CONFIGURE') return instanceid
def undefine(self, instanceid, wait=True): ''' This method undefine an FDU instance from a None :param instanceid: FDU instance you want to undefine :param wait: if wait before returning that the entity is undefined :return: instanceid ''' node = self.connector.glob.actual.get_fdu_instance_node( self.sysid, self.tenantid, instanceid) if node is None: raise ValueError('Unable to find node for this instanceid') record = self.connector.glob.actual.get_node_fdu_instance( self.sysid, self.tenantid, node, instanceid) record = InfraFDU(record) record.set_status('UNDEFINE') fduid = record.get_fdu_id() self.connector.glob.desired.add_node_fdu(self.sysid, self.tenantid, node, fduid, instanceid, record.to_json()) return instanceid
def undefine(self, instanceid): ''' Undefines the given instance paremeters ---------- instanceid : string UUID of instance returns ------- string ''' node = self.connector.glob.actual.get_fdu_instance_node(self.sysid, self.tenantid, instanceid) if node is None: raise ValueError('Unable to find node for this instanceid') record = self.connector.glob.actual.get_node_fdu_instance( self.sysid, self.tenantid, node, instanceid) record = InfraFDU(record) record.set_status('UNDEFINE') fduid = record.get_fdu_id() self.connector.glob.desired.add_node_fdu(self.sysid, self.tenantid, node, fduid, instanceid, record.to_json()) return instanceid