Esempio n. 1
0
 def get_SFC_relialibility(self, VNF_list):
     SFCReliability = 1
     for i in range(len(VNF_list)):
         vnfid = VNF_list[i]
         # VNFInstance = VNF(vnfid,
         #                   vnfListSingelton.dict_VNFListType[vnfid],
         #                   vnfListSingelton.dict_VNFRequestCPU[vnfid],
         #                   vnfListSingelton.dict_VNFRequestMemory[vnfid],
         #                   vnfListSingelton.dict_locatedVMID[vnfid],
         #                   vnfListSingelton.dict_locatedSFCIDList[vnfid],
         #                   vnfListSingelton.dict_numbersOnSFCList[vnfid],
         #                   vnfListSingelton.dict_VNFReliability[vnfid])
         # print("VNF的可靠性为: %f" %VNFInstance.getVNFRliability(vnfid))
         # SFCReliability *= VNFInstance.getVNFRliability(vnfid)
         VNFInstance = VNF(vnfid, vnfListSingelton.dict_VNFListType[vnfid],
                           vnfListSingelton.dict_VNFRequestCPU[vnfid],
                           vnfListSingelton.dict_VNFRequestMemory[vnfid],
                           vnfListSingelton.dict_locatedVMID[vnfid],
                           vnfListSingelton.dict_locatedSFCIDList[vnfid],
                           vnfListSingelton.dict_numbersOnSFCList[vnfid],
                           vnfListSingelton.dict_VNFReliability[vnfid])
         # 读取所在的VM
         vmid = VNFInstance.get_VM_id(vnfid)
         vmInstance = VM(vmid, vmListSingelton.dict_VMRequestCPU[vmid],
                         vmListSingelton.dict_VMRequestMemory[vmid],
                         vmListSingelton.dict_VMLocatedPhysicalnode[vmid],
                         vmListSingelton.dict_VMReliability[vmid])
         nodeid = vmInstance.get_physicalNode_id(vmid)
         SFCReliability *= nodeListSingelton.dict_provided_reliablity[
             nodeid]
     print("SFC的可靠性为:%f" % SFCReliability)
     return SFCReliability
Esempio n. 2
0
 def getSFCRequestedResource(self):
     requestedCPU = 0
     requestedMemory = 0
     VNF_list = self.getVNFList()
     for vnfInstanceId in VNF_list:
         vnfInstance = VNF(
             vnfInstanceId,
             vnfListSingelton.dict_VNFListType[vnfInstanceId],
             vnfListSingelton.dict_VNFRequestCPU[vnfInstanceId],
             vnfListSingelton.dict_VNFRequestMemory[vnfInstanceId],
             vnfListSingelton.dict_locatedVMID[vnfInstanceId],
             vnfListSingelton.dict_locatedSFCIDList[vnfInstanceId],
             vnfListSingelton.dict_numbersOnSFCList[vnfInstanceId],
             vnfListSingelton.dict_VNFReliability[vnfInstanceId])
         requestedCPU += vnfInstance.getVNF_request_CPU()
         requestedMemory += vnfInstance.getVNF_request_Memory()
     return requestedCPU + requestedMemory
Esempio n. 3
0
    def get_SFC_relialibility1(self, vnflist, updatevnfid, nodeid_in):
        print("////////计算SFC可靠性的新方法")
        print("updatevnfid = %d" % updatevnfid)
        print("nodeid = %d" % nodeid_in)
        SFCReliability = 1
        for i in range(len(vnflist)):
            vnfid = vnflist[i]
            print("vnfid = %d" % vnfid)
            if vnfid == updatevnfid:
                print("vnfid == updatevnfid")
                nodeid = nodeid_in
                SFCReliability *= nodeListSingelton.dict_provided_reliablity[
                    nodeid_in]
                print("nodeid = %d" % nodeid_in)
                print(
                    "nodeListSingelton.dict_provided_reliablity[nodeid] = %f" %
                    nodeListSingelton.dict_provided_reliablity[nodeid_in])

            else:
                VNFInstance = VNF(
                    vnfid, vnfListSingelton.dict_VNFListType[vnfid],
                    vnfListSingelton.dict_VNFRequestCPU[vnfid],
                    vnfListSingelton.dict_VNFRequestMemory[vnfid],
                    vnfListSingelton.dict_locatedVMID[vnfid],
                    vnfListSingelton.dict_locatedSFCIDList[vnfid],
                    vnfListSingelton.dict_numbersOnSFCList[vnfid],
                    vnfListSingelton.dict_VNFReliability[vnfid])
                # 读取所在的VM
                vmid = VNFInstance.get_VM_id(vnfid)
                vmInstance = VM(
                    vmid, vmListSingelton.dict_VMRequestCPU[vmid],
                    vmListSingelton.dict_VMRequestMemory[vmid],
                    vmListSingelton.dict_VMLocatedPhysicalnode[vmid],
                    vmListSingelton.dict_VMReliability[vmid])
                nodeid = vmInstance.get_physicalNode_id(vmid)
                SFCReliability *= nodeListSingelton.dict_provided_reliablity[
                    nodeid]
                print("nodeid = %d" % nodeid)
                print("nodeListSingelton.dict_provided_reliablity[nodeid] %f" %
                      nodeListSingelton.dict_provided_reliablity[nodeid])
        print("SFC的新的可靠性为:%f" % SFCReliability)
        return SFCReliability
 def getAdditonalCostOfSFC(self, migrated_SFC_id, needMigratedVNFList,
                           destinationPhysicalNodeList):
     additionDelay = 0
     # 考虑每个需要迁移的VNF
     for i in range(len(needMigratedVNFList)):
         vnfInstanceId = needMigratedVNFList[i]
         vnfInstance = VNF(
             vnfInstanceId,
             vnfListSingelton.dict_VNFListType[vnfInstanceId],
             vnfListSingelton.dict_VNFRequestCPU[vnfInstanceId],
             vnfListSingelton.dict_VNFRequestMemory[vnfInstanceId],
             vnfListSingelton.dict_locatedVMID[vnfInstanceId],
             vnfListSingelton.dict_locatedSFCIDList[vnfInstanceId],
             vnfListSingelton.dict_numbersOnSFCList[vnfInstanceId],
             vnfListSingelton.dict_VNFReliability[vnfInstanceId])
         SFCIdListOfThisVNF = vnfInstance.get_SFC_id_list()
         # 考虑此VNF经过的每一个SFC
         # for sfcId in SFCIdListOfThisVNF:
         #     if(sfcId != migrated_SFC_id):
         #         # VNF位于除此条SFC之外的其他SFC上
         #         SFCInstance = SFC(sfcId,
         #                           sfcListSingleton.dict_maxDelay[sfcId],
         #                           sfcListSingleton.dict_minReliability[sfcId],
         #                           sfcListSingleton.dict_VNFList[sfcId],
         #                           sfcListSingleton.dict_createdtime[sfcId]
         #                           )
         #         delayBefore = SFCInstance.getDelay()
         #         # 更新SFC中的VNFList
         #         VNFList = SFCInstance.getVNFList()
         # VMInstance = VM(vnfInstance.get_VM_id(vnfInstanceId),
         #                 vmListSingelton.dict_VMRequestCPU[vnfInstance.get_VM_id(vnfInstanceId)],
         #                 vmListSingelton.dict_VMRequestMemory[vnfInstance.get_VM_id(vnfInstanceId)],
         #                 vmListSingelton.dict_VMLocatedPhysicalnode[vnfInstance.get_VM_id(vnfInstanceId)],
         #                 vmListSingelton.dict_VMReliability[vnfInstance.get_VM_id(vnfInstanceId)]
         #                 )
         # VMInstance.setPhysicalNodeId(destinationPhysicalNodeList[i])
         # SFCInstance.setVNFList(VNFList)
         # # 更新SFC的VNFList之后重新计算SFC的时延
         # delayAfter = SFCInstance.get_SFC_delay(VNFList)
         # additionDelay += delayAfter - delayBefore
     return additionDelay
 def getMigrationTime(self, migrated_SFC_id, needMigratedVNFList,
                      destinationPhysicalNodeList):
     # 存放此SFC上需要迁移的VNF们的迁移所需要的时间
     VNFsMigrationTimeList = []
     # 由SFC的ID得到此条SFC上所有的VNF
     SFCInstance = SFC(
         migrated_SFC_id, sfcListSingleton.dict_maxDelay[migrated_SFC_id],
         sfcListSingleton.dict_minReliability[migrated_SFC_id],
         sfcListSingleton.dict_VNFList[migrated_SFC_id],
         sfcListSingleton.dict_createdtime[migrated_SFC_id])
     VNFList = SFCInstance.getVNFList
     total_time = 0
     # 寻找此SFC上应当进行迁移的VNF(s),根据不同的迁移情形分别获取,在本项目中的其他位置实现此方法
     # 假设此时在此处已经获取到了需要迁移的VNF,即为needMigratedVNFList,此列表作为输入参数由外部传入
     # 系统开始运行之前随机给每个VNF赋一个迁移时间的系数,当迁移发生时,此系数乘以源至目的地的距离,作为相对迁移时间。
     # 也就是说还需要一个迁移目的地列表,此处同样作为输入参数传入,源到目的地之间的距离直接用拓扑中的时延来代替
     for i in range(len(needMigratedVNFList)):
         vnfid = needMigratedVNFList[i]
         VNFInstance = VNF(vnfid, vnfListSingelton.dict_VNFListType[vnfid],
                           vnfListSingelton.dict_VNFRequestCPU[vnfid],
                           vnfListSingelton.dict_VNFRequestMemory[vnfid],
                           vnfListSingelton.dict_locatedVMID[vnfid],
                           vnfListSingelton.dict_locatedSFCIDList[vnfid],
                           vnfListSingelton.dict_numbersOnSFCList[vnfid],
                           vnfListSingelton.dict_VNFReliability[vnfid])
         VMId = VNFInstance.get_VM_id(needMigratedVNFList[i])
         VMInstance = VM(VMId, vmListSingelton.dict_VMRequestCPU[VMId],
                         vmListSingelton.dict_VMRequestMemory[VMId],
                         vmListSingelton.dict_VMLocatedPhysicalnode[VMId],
                         vmListSingelton.dict_VMReliability[VMId])
         physicalNodeId = VMInstance.get_physicalNode_id(VMId)
         # physicalNodeId与destinationPhysicalNodeList[i]两个物理节点之间的时延
         delayBetweenSandDNodes = SFCInstance.getDelayBetweenPhysicalNode(
             physicalNodeId, destinationPhysicalNodeList[i])
         # 计算出此VNF迁移所花费的时间,并将其存放进VNFsMigrationTimeList中的第i个位置
         VNFsMigrationTimeList.append(
             delayBetweenSandDNodes *
             VNFInstance.migration_time_coefficient)
         total_time += delayBetweenSandDNodes * VNFInstance.migration_time_coefficient
     return total_time
    def getDelayIncreationOfSFC(self, migrated_SFC_id, SFCDelayBeforMigration):
        SFCInstance = SFC(
            migrated_SFC_id, sfcListSingleton.dict_maxDelay[migrated_SFC_id],
            sfcListSingleton.dict_minReliability[migrated_SFC_id],
            sfcListSingleton.dict_VNFList[migrated_SFC_id],
            sfcListSingleton.dict_createdtime[migrated_SFC_id])
        VNFList = SFCInstance.getVNFList()
        print(VNFList)
        nodeidlist = []
        i = 0
        for vnfid in VNFList:
            if vnfid == 15:
                VNFinstance = VNF(
                    vnfid, vnfListSingelton.dict_VNFListType[vnfid],
                    vnfListSingelton.dict_VNFRequestCPU[vnfid],
                    vnfListSingelton.dict_VNFRequestMemory[vnfid],
                    vnfListSingelton.dict_locatedVMID[vnfid],
                    vnfListSingelton.dict_locatedSFCIDList[vnfid],
                    vnfListSingelton.dict_numbersOnSFCList[vnfid],
                    vnfListSingelton.dict_VNFReliability[vnfid])
                vmid = VNFinstance.get_VM_id(vnfid)
                VMinstance = VM(
                    vmid, vmListSingelton.dict_VMRequestCPU[vmid],
                    vmListSingelton.dict_VMRequestMemory[vmid],
                    vmListSingelton.dict_VMLocatedPhysicalnode[vmid],
                    vmListSingelton.dict_VMReliability[vmid])
                nodeid = VMinstance.get_physicalNode_id(vmid)

                print("before node id = %d" % nodeid)

                VMinstance.setPhysicalNodeId(16)

        SFCDelayAfterMigration = SFCInstance.get_SFC_delay(VNFList)

        print("SFCDelayAfterMigration = %f" % SFCDelayAfterMigration)
        print("SFCDelayBeforMigration = %f" % SFCDelayBeforMigration)
        print(SFCDelayAfterMigration - SFCDelayBeforMigration)
        return SFCDelayAfterMigration - SFCDelayBeforMigration
Esempio n. 7
0
 def getAVNFByType(self, VNFtype):
     print("***********************根据类型寻找VNF方法开始")
     print("vnftype = ")
     print(VNFtype)
     # 网络中总共的VNFs
     allVNFList = vnfListSingelton.getAllVNFList()
     for i in range(len(allVNFList)):
         vnfid = allVNFList[i]
         VNFinstance = VNF(vnfid, vnfListSingelton.dict_VNFListType[vnfid],
                           vnfListSingelton.dict_VNFRequestCPU[vnfid],
                           vnfListSingelton.dict_VNFRequestMemory[vnfid],
                           vnfListSingelton.dict_locatedVMID[vnfid],
                           vnfListSingelton.dict_locatedSFCIDList[vnfid],
                           vnfListSingelton.dict_numbersOnSFCList[vnfid],
                           vnfListSingelton.dict_VNFReliability[vnfid])
         if VNFinstance.getVNFType(allVNFList[i]) == VNFtype \
                 and allVNFList[i] not in self.VNFHadPicked1:
             self.VNFHadPicked1.append(allVNFList[i])
             print("根据类型寻找VNF方法结束,vnf为:")
             print(VNFinstance.VNF_id)
             return VNFinstance.VNF_id
     print("根据类型寻找VNF方法结束,VNF为空")
     return None
Esempio n. 8
0
 def find_a_SFC(self, MaxSFCDelay, MinSFCReliablity, VNFTyprList,
                VNFRequestCPU, VNFRequestMemory):
     print("发现一条SFC方法")
     # 存储根据VNF类型和所需CPU、内存资源条件筛选出来的VNFs
     VNFList = []
     for i in range(len(VNFTyprList)):
         aVNFInstance = VNF()
         vmInstance = VM()
         physicalInstace = PhysicalNode()
         vmId = aVNFInstance.get_VM_id(self.getAVNFByType())
         physicalNodeId = vmInstance.get_physicalNode_id(vmId)
         if (physicalInstace.getAvailable_CPU(physicalNodeId) >
                 VNFRequestCPU
                 and physicalInstace.getAvailable_Memory(physicalNodeId) >
                 VNFRequestMemory):
             # 将此VNF的id加入到list中,作为此SFC中的一环
             VNFList.append(self.getAVNFByType())
     # 所有需要的VNF都找到了,一条SFC就挑选出来了
     sfcid = sfcListSingleton.getSFCCount() + 1
     sfcInstance = SFC(sfcid, MaxSFCDelay, MinSFCReliablity, VNFList,
                       datetime.datetime.now())
     # 接下来判断此SFC是否满足时延和可靠性的约束
     if (sfcInstance.get_SFC_delay(VNFList) < MaxSFCDelay):
         if (sfcInstance.get_SFC_relialibility(VNFList) > MinSFCReliablity
                 and sfcInstance.SFC_id
                 not in sfcListSingleton.SFCList):  # 此SFC没有被选择过
             sfcInstance.setDelay(sfcInstance.get_SFC_delay(VNFList))
             # SFC满足要求,返回值是SFC实例
             sfcListSingleton.addSFCCount()
             sfcInstance.SFC_id = sfcListSingleton.getSFCCount() + 1
             sfcListSingleton.addSFC(sfcListSingleton.getSFCCount() + 1)
             return sfcInstance
         else:
             print("此SFC实例的可靠性不满足要求")
     else:
         print("此SFC实例的时延不满足要求")
    def flow_monitor(self):
        # 用当前网络中VNF所需要的资源(CPU)的总量来代表流量
        # VNFListIntance = VNFList()
        # 当前网络中活动的VNF列表,使用单例调用
        current_active_VNF_list = vnfListSingelton.getActiveVNFList()
        dict_VNFListType = vnfListSingelton.get_dict_VNFListType()
        dict_VNFRequestCPU = vnfListSingelton.get_dict_VNFRequestCPU()
        dict_VNFRequestMemory = vnfListSingelton.get_dict_VNFRequestMemory()
        dict_locatedVMID = vnfListSingelton.get_dict_locatedVMID()
        dict_locatedSFCIDList = vnfListSingelton.get_dict_locatedSFCIDList()
        dict_numbersOnSFCList = vnfListSingelton.get_dict_numbersOnSFCList()
        dict_VNFReliability = vnfListSingelton.get_dict_VNFReliability()
        # print(dict_VNFReliability)
        # current_active_VNF_list = VNFListIntance.getActiveVNFList()
        # 总的资源需求值,初始为0
        totalNeededResource = 0
        # 根据活动VNF列表获取列表中每个VNF此刻的资源需求值
        for i in range(len(current_active_VNF_list)):
            # 根据VNF的ID,去文件中获取此VNF的所有数据,用于初始化VNF实例
            VNFID = current_active_VNF_list[i]

            VNFType = dict_VNFListType[VNFID]
            print("VNF Type = %d" % VNFType)
            VNFRequestCPU = dict_VNFRequestCPU[VNFID]
            print("VNF需要的CPU资源是:%d" % VNFRequestCPU)
            VNFRequestMemory = dict_VNFRequestMemory[VNFID]
            print("VNF所需要的内存资源:%d" % VNFRequestMemory)
            locatedVMID = dict_locatedVMID[VNFID]
            print("VNF所在的VM的ID:%d" % locatedVMID)
            locatedSFCIDList = dict_locatedSFCIDList[VNFID]
            print("VNF所处的SFC的ID列表: %d" % locatedSFCIDList)
            numbersOnSFCList = dict_numbersOnSFCList[VNFID]
            print("VNF在所处的SFC上的序号列表: %d" % numbersOnSFCList)
            VNFReliability = dict_VNFReliability[VNFID]
            print("VNF的可靠性:%d" % VNFReliability)
            currentVNF = VNF(current_active_VNF_list[i], VNFType,
                             VNFRequestCPU, VNFRequestMemory, locatedVMID,
                             locatedSFCIDList, numbersOnSFCList,
                             VNFReliability)
            totalNeededResource += currentVNF.VNF_request_CPU
        # 返回所需的资源(CPU)总量
        return totalNeededResource
Esempio n. 10
0
    def delayBetweenVNFs(self, VNFIdLeft, VNFRight):

        delay = 1000000
        VNFInstanceLeft = VNF(
            VNFIdLeft, vnfListSingelton.dict_VNFListType[VNFIdLeft],
            vnfListSingelton.dict_VNFRequestCPU[VNFIdLeft],
            vnfListSingelton.dict_VNFRequestMemory[VNFIdLeft],
            vnfListSingelton.dict_locatedVMID[VNFIdLeft],
            vnfListSingelton.dict_locatedSFCIDList[VNFIdLeft],
            vnfListSingelton.dict_numbersOnSFCList[VNFIdLeft],
            vnfListSingelton.dict_VNFReliability[VNFIdLeft])
        VNFInstanceRight = VNF(
            VNFRight, vnfListSingelton.dict_VNFListType[VNFRight],
            vnfListSingelton.dict_VNFRequestCPU[VNFRight],
            vnfListSingelton.dict_VNFRequestMemory[VNFRight],
            vnfListSingelton.dict_locatedVMID[VNFRight],
            vnfListSingelton.dict_locatedSFCIDList[VNFRight],
            vnfListSingelton.dict_numbersOnSFCList[VNFRight],
            vnfListSingelton.dict_VNFReliability[VNFRight])
        vmIdleft = VNFInstanceLeft.get_VM_id(VNFIdLeft)
        vmIdRight = VNFInstanceRight.get_VM_id(VNFRight)
        vmInstanceleft = VM(
            vmIdleft, vmListSingelton.dict_VMRequestCPU[vmIdleft],
            vmListSingelton.dict_VMRequestMemory[vmIdleft],
            vmListSingelton.dict_VMLocatedPhysicalnode[vmIdleft],
            vmListSingelton.dict_VMReliability[vmIdleft])
        vmInstanceright = VM(
            vmIdRight, vmListSingelton.dict_VMRequestCPU[vmIdRight],
            vmListSingelton.dict_VMRequestMemory[vmIdRight],
            vmListSingelton.dict_VMLocatedPhysicalnode[vmIdRight],
            vmListSingelton.dict_VMReliability[vmIdRight])
        LeftphysicalNodeId = vmInstanceleft.get_physicalNode_id(vmIdleft)
        RightphysicalNodeId = vmInstanceright.get_physicalNode_id(vmIdRight)
        # 由拓扑结构获取到左右两个物理节点之间的时延
        for i in range(len(leftPhysicalNodelist)):
            if LeftphysicalNodeId == leftPhysicalNodelist[i]:
                if RightphysicalNodeId == rightPhysicalNodelist[i]:
                    delay = delaylist[i]
            elif LeftphysicalNodeId == rightPhysicalNodelist[i]:
                if RightphysicalNodeId == leftPhysicalNodelist[i]:
                    delay = delaylist[i]
        return delay
Esempio n. 11
0
    def find_a_SFC1(self, MaxSFCDelay, MinSFCReliablity, VNFTyprList,
                    VNFRequestCPU, VNFRequestMemory):
        print("发现一条SFC方法开始")
        # 存储根据VNF类型和所需CPU、内存资源条件筛选出来的VNFs
        VNFList = []
        for i in range(len(VNFTyprList)):
            vnftype = VNFTyprList[i]
            vnfid = self.getAVNFByType(vnftype)
            if vnfid != None:
                aVNFInstance = VNF(
                    vnfid, vnfListSingelton.dict_VNFListType[vnfid],
                    vnfListSingelton.dict_VNFRequestCPU[vnfid],
                    vnfListSingelton.dict_VNFRequestMemory[vnfid],
                    vnfListSingelton.dict_locatedVMID[vnfid],
                    vnfListSingelton.dict_locatedSFCIDList[vnfid],
                    vnfListSingelton.dict_numbersOnSFCList[vnfid],
                    vnfListSingelton.dict_VNFReliability[vnfid])
                vmid = aVNFInstance.get_VM_id(vnfid)
                vmInstance = VM(
                    vmid, vmListSingelton.dict_VMRequestCPU[vmid],
                    vmListSingelton.dict_VMRequestMemory[vmid],
                    vmListSingelton.dict_VMLocatedPhysicalnode[vmid],
                    vmListSingelton.dict_VMReliability[vmid])
                nodeid = vmInstance.get_physicalNode_id(vmid)
                physicalInstace = PhysicalNode(
                    nodeid, nodeListSingelton.dict_capacity_CPU[nodeid],
                    nodeListSingelton.dict_capacity_Memory[nodeid],
                    nodeListSingelton.dict_provided_reliablity[nodeid])
                if (physicalInstace.getAvailable_CPU(nodeid) > VNFRequestCPU[i]
                        and physicalInstace.getAvailable_Memory(nodeid) >
                        VNFRequestMemory[i]):
                    # 将此VNF的id加入到list中,作为此SFC中的一环
                    VNFList.append(vnfid)
            else:
                print("VNFid = none")
        # 所有需要的VNF都找到了,一条SFC就挑选出来了
        sfcid = self.SFCCount + 1
        sfcInstance = SFC(sfcid, MaxSFCDelay, MinSFCReliablity, VNFList,
                          datetime.datetime.now())
        # 接下来判断此SFC是否满足时延和可靠性的约束
        print("SFC的时延与可靠性分别为:")
        delay = sfcInstance.get_SFC_delay(VNFList)
        print("SFC的时延为:%f" % delay)
        reli = sfcInstance.get_SFC_relialibility(VNFList)
        print("SFC的可靠性为:%f" % reli)

        if (sfcInstance.get_SFC_delay(VNFList) < MaxSFCDelay):
            if (sfcInstance.get_SFC_relialibility(VNFList) > MinSFCReliablity):
                # and sfcInstance.SFC_id not in sfcListSingleton.getSFCList()):  # 此SFC没有被选择过
                sfcInstance.setDelay(sfcInstance.get_SFC_delay(VNFList))
                # SFC满足要求,返回值是SFC实例
                sfcListSingleton.addSFCCount()
                sfcInstance.SFC_id = sfcListSingleton.getSFCCount() + 1
                sfcListSingleton.addSFC(sfcListSingleton.getSFCCount() + 1)
                print("SFC基本数据:-------------------------------------")
                print("基本数据--SFC的ID为: %d" % sfcInstance.getSFCId())
                print("基本数据--SFC中的vnflist为:")
                print(VNFList)
                print("基本数据--SFC的时延为: %f" % delay)
                print("基本数据--SFC的可靠性为: %f " % reli)

                with open('D:/pycharm workspace/GraduationProject/res/res.csv',
                          'a+',
                          newline='') as csvfile:
                    writer = csv.writer(csvfile)
                    # 先写入columns_name
                    writer.writerow(["VNFlist", "delay", "reliability"])
                    data = [[[VNFList], delay, reli]]
                    print(data)
                    # 写入多行用writerows
                    writer.writerows(data)
                print("发现一条SFC方法结束")
                return sfcInstance
            else:
                print("此SFC实例的可靠性不满足要求")
        else:
            print("此SFC实例的时延不满足要求")