Exemple #1
0
func dnsSubstrate() spi.Substrate {
	var s spi.Substrate
	s.Name = "dnslink"
	s.Capacity = spi.Capacity{float64(100.0) * 1000, spi.Kind{"max"}}
	s.Latency = spi.Latency{float64(4.0), spi.Kind{"max"}}

	return s
}
Exemple #2
0
func krySubstrate() spi.Substrate {

	var ks spi.Substrate
	ks.Name = "krynet"
	ks.Capacity = spi.Capacity{float64(1000.0) * 1000, spi.Kind{"max"}}
	ks.Latency = spi.Latency{float64(0.0), spi.Kind{"max"}}

	return ks

}
Exemple #3
0
func swSubstrate(sw *addie.Switch) spi.Substrate {

	var ss spi.Substrate
	ss.Name = sw.Name
	ss.Capacity = spi.Capacity{float64(sw.Capacity) * 1000, spi.Kind{"max"}}
	ss.Latency = spi.Latency{float64(sw.Latency), spi.Kind{"max"}}

	return ss

}
Exemple #4
0
func linkSubstrate(link *addie.Link, dsg *addie.Design,
	xp *spi.Experiment,
	cMap map[addie.Id]*spi.Computer,
	sMap map[addie.Id]*spi.Substrate) *spi.Substrate {

	var ss spi.Substrate
	ss.Name = link.Name
	ss.Capacity = spi.Capacity{float64(link.Capacity) * 1000, spi.Kind{"max"}}
	ss.Latency = spi.Latency{float64(link.Latency), spi.Kind{"max"}}

	a, ok := dsg.Elements[link.Endpoints[0].Id]
	if !ok {
		log.Printf("link '%s' references element '%v' but no such element exists",
			link.Name, link.Endpoints[0].Id)
		return nil
	}
	b, ok := dsg.Elements[link.Endpoints[1].Id]
	if !ok {
		log.Printf("link '%s' references element '%v' but no such element exists",
			link.Name, link.Endpoints[0].Id)
		return nil
	}

	ta := reflect.TypeOf(a).Name()
	tb := reflect.TypeOf(b).Name()

	taIsHost := ta == "Computer" || ta == "Router" || ta == "Sax"
	tbIsHost := tb == "Computer" || tb == "Router" || tb == "Sax"

	if taIsHost && tbIsHost {
		updateEndpoint(link.Name, link.Endpoints[0], dsg, xp, cMap)
		updateEndpoint(link.Name, link.Endpoints[1], dsg, xp, cMap)
		return &ss
	} else if taIsHost && !tbIsHost {
		sw := b.(addie.Switch)
		updateEndpoint(sw.Name, link.Endpoints[0], dsg, xp, cMap)
		return nil
	} else if !taIsHost && tbIsHost {
		sw := a.(addie.Switch)
		updateEndpoint(sw.Name, link.Endpoints[1], dsg, xp, cMap)
		return nil
	}

	return nil
}