本文整理汇总了Golang中github.com/cloudfoundry-incubator/bosh-fuzz-tests/input.Input.FindNetworkByName方法的典型用法代码示例。如果您正苦于以下问题:Golang Input.FindNetworkByName方法的具体用法?Golang Input.FindNetworkByName怎么用?Golang Input.FindNetworkByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry-incubator/bosh-fuzz-tests/input.Input
的用法示例。
在下文中一共展示了Input.FindNetworkByName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: sameStaticIps
func (f *fixedMigratedFrom) sameStaticIps(job bftinput.Job, previousJob bftinput.Job, input bftinput.Input) []staticIPInfo {
ips := []staticIPInfo{}
for _, network := range job.Networks {
previousNetwork, networkFound := previousJob.FindNetworkByName(network.Name)
if networkFound {
for _, currentIP := range network.StaticIps {
for _, prevIP := range previousNetwork.StaticIps {
if prevIP == currentIP {
cloudNetwork, cloudNetworkFound := input.FindNetworkByName(network.Name)
if cloudNetworkFound {
ip := staticIPInfo{
IP: currentIP,
Network: cloudNetwork,
}
ips = append(ips, ip)
}
}
}
}
}
}
return ips
}
示例2: nothingChanged
func (n *nothingChangedComparator) nothingChanged(job bftinput.Job, currentInput bftinput.Input, previousInputs []bftinput.Input) bool {
mostRecentInput := previousInputs[len(previousInputs)-1]
prevJob, found := mostRecentInput.FindJobByName(job.Name)
if !found {
return false
}
if len(previousInputs) > 1 {
inputBeforePrevious := previousInputs[len(previousInputs)-2]
jobBeforePrevious, found := inputBeforePrevious.FindJobByName(job.Name)
if found && jobBeforePrevious.HasPersistentDisk() && !prevJob.HasPersistentDisk() {
return false
}
for _, migratedFromConfig := range prevJob.MigratedFrom {
jobBeforePrevious, found := inputBeforePrevious.FindJobByName(migratedFromConfig.Name)
if found && jobBeforePrevious.HasPersistentDisk() && !prevJob.HasPersistentDisk() {
return false
}
}
}
if !prevJob.IsEqual(job) {
return false
}
for _, azName := range job.AvailabilityZones {
currentAz, _ := currentInput.FindAzByName(azName)
prevAz, _ := mostRecentInput.FindAzByName(azName)
if !currentAz.IsEqual(prevAz) {
return false
}
}
if job.PersistentDiskPool != "" {
currentPersistentDiskPool, _ := currentInput.FindDiskPoolByName(job.PersistentDiskPool)
prevPersistentDiskPool, _ := mostRecentInput.FindDiskPoolByName(job.PersistentDiskPool)
if !currentPersistentDiskPool.IsEqual(prevPersistentDiskPool) {
return false
}
}
if job.PersistentDiskType != "" {
currentPersistentDiskType, _ := currentInput.FindDiskTypeByName(job.PersistentDiskType)
prevPersistentDiskType, _ := mostRecentInput.FindDiskTypeByName(job.PersistentDiskType)
if !currentPersistentDiskType.IsEqual(prevPersistentDiskType) {
return false
}
}
if job.ResourcePool != "" {
currentResourcePool, _ := currentInput.FindResourcePoolByName(job.ResourcePool)
prevResourcePool, _ := mostRecentInput.FindResourcePoolByName(job.ResourcePool)
if !currentResourcePool.IsEqual(prevResourcePool) {
return false
}
}
if job.VmType != "" {
currentVmType, _ := currentInput.FindVmTypeByName(job.VmType)
prevVmType, _ := mostRecentInput.FindVmTypeByName(job.VmType)
if !currentVmType.IsEqual(prevVmType) {
return false
}
}
if job.Stemcell != "" {
currentStemcell, _ := currentInput.FindStemcellByName(job.Stemcell)
prevStemcell, _ := mostRecentInput.FindStemcellByName(job.Stemcell)
if !currentStemcell.IsEqual(prevStemcell) {
return false
}
}
for _, jobNetwork := range job.Networks {
currentNetwork, _ := currentInput.FindNetworkByName(jobNetwork.Name)
prevNetwork, _ := mostRecentInput.FindNetworkByName(jobNetwork.Name)
if !currentNetwork.IsEqual(prevNetwork) {
return false
}
}
return true
}