diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-06-22 15:00:11 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-22 15:00:11 +0200 |
| commit | 8a2b475f082572033438eb5b8703d211323f1b52 (patch) | |
| tree | 76179cf3802a34d65829f4d8b9aa708c9a41eec1 /opendc-format | |
| parent | 147951f39de8f93eba6c7b0b7e6e5c9d2bce32e7 (diff) | |
| parent | dcd1bc82b9126b8122c671102d4d22843b73c847 (diff) | |
simulator: Add support for networking (v1)
This change adds support for networking in the simulator.
As outlined in #84, the network model doesn't model individual packets,
but instead considers dynamic flows between network devices.
This pull request adds the bare-minimum implementation necessary to model network traffic.
In the future, we will add advanced functionality such as routing and other L3 concepts.
* Add core model for network simulation
* Add model for network adapter that attaches to machine
* Add virtual network switch to bridge traffic between hosts.
Diffstat (limited to 'opendc-format')
4 files changed, 8 insertions, 8 deletions
diff --git a/opendc-format/src/main/kotlin/org/opendc/format/environment/MachineDef.kt b/opendc-format/src/main/kotlin/org/opendc/format/environment/MachineDef.kt index 9b799cc2..f65c4880 100644 --- a/opendc-format/src/main/kotlin/org/opendc/format/environment/MachineDef.kt +++ b/opendc-format/src/main/kotlin/org/opendc/format/environment/MachineDef.kt @@ -22,7 +22,7 @@ package org.opendc.format.environment -import org.opendc.simulator.compute.SimMachineModel +import org.opendc.simulator.compute.model.MachineModel import org.opendc.simulator.compute.power.PowerModel import java.util.* @@ -30,6 +30,6 @@ public data class MachineDef( val uid: UUID, val name: String, val meta: Map<String, Any>, - val model: SimMachineModel, + val model: MachineModel, val powerModel: PowerModel ) diff --git a/opendc-format/src/main/kotlin/org/opendc/format/environment/sc18/Sc18EnvironmentReader.kt b/opendc-format/src/main/kotlin/org/opendc/format/environment/sc18/Sc18EnvironmentReader.kt index 1f080c2d..7780a98e 100644 --- a/opendc-format/src/main/kotlin/org/opendc/format/environment/sc18/Sc18EnvironmentReader.kt +++ b/opendc-format/src/main/kotlin/org/opendc/format/environment/sc18/Sc18EnvironmentReader.kt @@ -27,7 +27,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.readValue import org.opendc.format.environment.EnvironmentReader import org.opendc.format.environment.MachineDef -import org.opendc.simulator.compute.SimMachineModel +import org.opendc.simulator.compute.model.MachineModel import org.opendc.simulator.compute.model.MemoryUnit import org.opendc.simulator.compute.model.ProcessingNode import org.opendc.simulator.compute.model.ProcessingUnit @@ -75,7 +75,7 @@ public class Sc18EnvironmentReader(input: InputStream, mapper: ObjectMapper = ja UUID(0L, counter++.toLong()), "node-$counter", emptyMap(), - SimMachineModel(cores, listOf(MemoryUnit("", "", 2300.0, 16000))), + MachineModel(cores, listOf(MemoryUnit("", "", 2300.0, 16000))), ConstantPowerModel(0.0) ) } diff --git a/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt b/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt index bef6b742..1efd2ddf 100644 --- a/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt +++ b/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20ClusterEnvironmentReader.kt @@ -24,7 +24,7 @@ package org.opendc.format.environment.sc20 import org.opendc.format.environment.EnvironmentReader import org.opendc.format.environment.MachineDef -import org.opendc.simulator.compute.SimMachineModel +import org.opendc.simulator.compute.model.MachineModel import org.opendc.simulator.compute.model.MemoryUnit import org.opendc.simulator.compute.model.ProcessingNode import org.opendc.simulator.compute.model.ProcessingUnit @@ -97,7 +97,7 @@ public class Sc20ClusterEnvironmentReader( UUID(random.nextLong(), random.nextLong()), "node-$clusterId-$it", mapOf("cluster" to clusterId), - SimMachineModel( + MachineModel( List(coresPerHost) { coreId -> ProcessingUnit(unknownProcessingNode, coreId, speed) }, diff --git a/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20EnvironmentReader.kt b/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20EnvironmentReader.kt index 2fa1caab..9b77702e 100644 --- a/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20EnvironmentReader.kt +++ b/opendc-format/src/main/kotlin/org/opendc/format/environment/sc20/Sc20EnvironmentReader.kt @@ -27,7 +27,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.readValue import org.opendc.format.environment.EnvironmentReader import org.opendc.format.environment.MachineDef -import org.opendc.simulator.compute.SimMachineModel +import org.opendc.simulator.compute.model.MachineModel import org.opendc.simulator.compute.model.MemoryUnit import org.opendc.simulator.compute.model.ProcessingNode import org.opendc.simulator.compute.model.ProcessingUnit @@ -80,7 +80,7 @@ public class Sc20EnvironmentReader(input: InputStream, mapper: ObjectMapper = ja UUID(0L, counter++.toLong()), "node-$counter", emptyMap(), - SimMachineModel(cores, memories), + MachineModel(cores, memories), // For now we assume a simple linear load model with an idle draw of ~200W and a maximum // power draw of 350W. // Source: https://stackoverflow.com/questions/6128960 |
