diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2017-08-08 01:50:32 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2017-08-08 01:51:24 +0200 |
| commit | 858d9d2dcf33941a2d1cbaea8d3a415ef93b58bb (patch) | |
| tree | e0a6f64b7bc9478f57f8d164df0fcb518dc2c3f2 /opendc-core/src/main | |
| parent | adbcee2afae0febda9da7b9109554591432aabcd (diff) | |
Create initial architecture
This change adds the initial architecture of the Kotlin rewrite. The
representation of the topology of a cloud network is unfinished and I am
still not sure what would be the best way to represent it.
Diffstat (limited to 'opendc-core/src/main')
24 files changed, 1001 insertions, 0 deletions
diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/Experiment.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/Experiment.kt new file mode 100644 index 00000000..c91f55da --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/Experiment.kt @@ -0,0 +1,32 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.experiment + +/** + * A simulation of multiple simultaneous workloads running on top of a topology. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +class Experiment {}
\ No newline at end of file diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/ExperimentRunner.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/ExperimentRunner.kt new file mode 100644 index 00000000..43b9ddac --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/ExperimentRunner.kt @@ -0,0 +1,32 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.experiment + +/** + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +interface ExperimentRunner { +} diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/Job.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/Job.kt new file mode 100644 index 00000000..8b225bd8 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/Job.kt @@ -0,0 +1,34 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.experiment + +/** + * A job that is submitted to a cloud network, which consists of one or multiple [Task]s. + * + * @param owner The user to which the job belongs. + * @param tasks The tasks of which the job consists. + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +data class Job(val owner: User, val tasks: Collection<Task>) diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/Scheduler.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/Scheduler.kt new file mode 100644 index 00000000..4e000af3 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/Scheduler.kt @@ -0,0 +1,43 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.experiment + +import nl.tudelft.opendc.topology.Entity +import nl.tudelft.opendc.topology.Node + +/** + * A task scheduler that is coupled to an [Entity] in the topology of the cloud network. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +interface Scheduler<in E: Entity> { + /** + * Schedule the given jobs for the given entity. + * + * @param node The node in the cloud network topology representing the entity. + * @param jobs The jobs that have been submitted to the cloud network. + */ + fun schedule(node: Node<E>, jobs: Set<Job>) +} diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/Task.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/Task.kt new file mode 100644 index 00000000..f425ccac --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/Task.kt @@ -0,0 +1,64 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.experiment + +/** + * A task represents some computation that is part of a [Job]. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +data class Task( + val id: Int, + val dependencies: Set<Task>, + val flops: Long +) { + /** + * The remaining amount of flops to compute. + */ + var remaining: Long = flops + private set + + /** + * A flag to indicate whether the task is finished. + */ + var finished: Boolean = false + private set + + /** + * Consume the given amount of flops of this task. + * + * @param flops The total amount of flops to consume. + */ + fun consume(flops: Long) { + if (finished) + return + if (remaining <= flops) { + finished = true + remaining = 0 + } else { + remaining -= flops + } + } +} diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/User.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/User.kt new file mode 100644 index 00000000..a818fc5f --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/experiment/User.kt @@ -0,0 +1,37 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.experiment + +import nl.tudelft.opendc.topology.Node + +/** + * A user of a cloud network that provides [Job]s for the simulation. + * + * <p>Each [User] in a simulation has its own logical view of the cloud network which is used to route its jobs in the + * physical network. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +data class User(val id: Int, val name: String, val view: Node<*>) {} diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/sampler/Sampler.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/sampler/Sampler.kt new file mode 100644 index 00000000..a89486ec --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/sampler/Sampler.kt @@ -0,0 +1,39 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.sampler + +/** + * A sampler generates data points (samples) of the simulation based on the events that occur to [Entity] instances that + * are part of the simulation. + * + * <p>[Sampler]s work by observing [Entity] instances in the simulation and transforming this stream of events into a + * stream of data points. + * + * <p>An example would be a sampler that tracks [Machine] occupation per time unit, which is achieved by observing the + * [Entity]'s event stream and filtering for [JobAssignment] events. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +interface Sampler diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/simulator/Simulator.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/simulator/Simulator.kt new file mode 100644 index 00000000..c1ea6b2d --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/simulator/Simulator.kt @@ -0,0 +1,68 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.simulator + +import nl.tudelft.opendc.topology.Entity + +/** + * A simulator that simulates a single entity in the topology of a cloud network. + * + * @param entity The entity to simulate. + * @param ctx The context in which the simulation is run. + * @param <E> The type of entity to simulate. + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +abstract class Simulator<out E: Entity>(val entity: E, val ctx: SimulatorContext) { + /** + * This method is invoked at least once before a tick. This allows the [Simulator] to setup its state before a tick + * event. + * + * <p>The pre-tick consists of multiple sub-cycles in which all messages which have been sent + * in the previous sub-cycle can optionally be processed in the sub-cycle by the receiving [Simulator]. + */ + fun preTick() {} + + /** + * This method is invoked once per tick, which allows the [Simulator] to process events and simulate an entity in a + * cloud network. + */ + fun tick() {} + + /** + * This method is invoked at least once per tick. This allows the [Simulator] to do work after a tick. + * + * <p>Like the pre-tick, the post-tick consists of multiple sub-cycles in which all messages which have been sent + * in the previous sub-cycle can optionally be processed in the sub-cycle by the receiving [Simulator]. + */ + fun postTick() {} + + /** + * Send the given message to the given [Entity] for processing. + * + * @param destination The entity to send the message to. + * @param message The message to send to the entity. + */ + fun send(destination: Entity, message: Any?) {} +} diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/simulator/SimulatorContext.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/simulator/SimulatorContext.kt new file mode 100644 index 00000000..e7729bea --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/simulator/SimulatorContext.kt @@ -0,0 +1,37 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.simulator + +/** + * The context in which a [Simulator] runs. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +class SimulatorContext { + /** + * The current tick of the simulation. + */ + var tick: Long = 0 +} diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/Edge.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/Edge.kt new file mode 100644 index 00000000..05541775 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/Edge.kt @@ -0,0 +1,79 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.topology + +/** + * An edge that represents a connection between exactly two instances of [Node]. + * Instances of [Edge] may be either directed or undirected. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +interface Edge<out T> { + /** + * The label of this edge. + */ + val label: T + + /** + * An [Edge] that is directed, having a source and destination [Node]. + */ + interface Directed<out T>: Edge<T> { + /** + * The source of the edge. + */ + val from: Node<*> + + /** + * The destination of the edge. + */ + val to: Node<*> + } + + /** + * An [Edge] that is undirected. + */ + interface Undirected<out T>: Edge<T> + + /** + * Return the [Node] at the opposite end of this [Edge] from the + * specified node. + * + * Throws [IllegalArgumentException] if <code>node</code> is + * not incident to this edge. + * + * @param node The node to get the opposite of for this edge pair. + * @return The node at the opposite end of this edge from the specified node. + * @throws IllegalArgumentException if <code>node</code> is not incident to this edge. + */ + fun opposite(node: Node<*>): Node<*> + + /** + * Return a [Pair] representing this edge consisting of both incident nodes. + * Note that the pair is in no particular order. + * + * @return The edge represented as pair of both incident nodes. + */ + fun endpoints(): Pair<Node<*>, Node<*>> +} diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/Entity.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/Entity.kt new file mode 100644 index 00000000..37423959 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/Entity.kt @@ -0,0 +1,37 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.topology + +/** + * An entity in a cloud network. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +interface Entity { + /** + * A unique identifier of this node within the topology represented as a [Int]. + */ + val id: Int +} diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/Graph.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/Graph.kt new file mode 100644 index 00000000..1cbbdb95 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/Graph.kt @@ -0,0 +1,47 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.topology + +/** + * A graph data structure which represents the logical topology of a cloud network consisting of one or more data + * centers. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +interface Graph { + /** + * Add the given [Node] to this graph. + * + * @param node The node to add. + */ + fun addNode(node: Node<*>) + + /** + * Add the given [Edge] to this graph. + * + * @param edge The edge to add. + */ + fun addEdge(edge: Edge<*>) +} diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/Node.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/Node.kt new file mode 100644 index 00000000..da0d183c --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/Node.kt @@ -0,0 +1,51 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.topology + +/** + * A node in the logical topology of a cloud network, representing some [Entity]. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +interface Node<out E: Entity> { + /** + * The [Entity] this node represents. + */ + val entity: E + + /** + * Return the set of incoming edges of this node. + * + * @return All edges whose destination is this node. + */ + fun incomingEdges(): Set<Edge<*>> + + /** + * Return the set of outgoing edges of this node. + * + * @return All edges whose source is this node. + */ + fun outgoingEdges(): Set<Edge<*>> +} diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/container/DataCenter.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/container/DataCenter.kt new file mode 100644 index 00000000..56d0366e --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/container/DataCenter.kt @@ -0,0 +1,35 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.topology.container + +import nl.tudelft.opendc.topology.Entity + +/** + * A representation of a facility used to house computer systems and associated components. + * + * @param id The unique identifier of this entity. + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +class DataCenter(override val id: Int): Entity diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/container/rack/Rack.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/container/rack/Rack.kt new file mode 100644 index 00000000..b64da3bb --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/container/rack/Rack.kt @@ -0,0 +1,36 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.topology.container.rack + +import nl.tudelft.opendc.topology.Entity + +/** + * A type of physical steel and electronic framework that is designed to house servers, networking devices, cables and + * other data center computing equipment. + * + * @param id The unique identifier of this entity. + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +data class Rack(override val id: Int): Entity diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/container/rack/Slot.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/container/rack/Slot.kt new file mode 100644 index 00000000..ce371e24 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/container/rack/Slot.kt @@ -0,0 +1,32 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.topology.container.rack + +/** + * This class represents a slot in a [Rack] of [Machine]s. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +data class Slot(val index: Int) diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/container/room/Room.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/container/room/Room.kt new file mode 100644 index 00000000..0b73963d --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/container/room/Room.kt @@ -0,0 +1,35 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.topology.container.room + +import nl.tudelft.opendc.topology.Entity + +/** + * A physical room in a data center which contains [Entity]s. + * + * @param id The unique identifier of this entity. + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +abstract class Room(override val id: Int): Entity diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/machine/Cpu.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/machine/Cpu.kt new file mode 100644 index 00000000..612af5ce --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/machine/Cpu.kt @@ -0,0 +1,37 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.topology.machine + +/** + * A central processing unit. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +data class Cpu( + override val id: Int, + override val speed: Int, + override val cores: Int, + override val energyConsumption: Int +): ProcessingUnit diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/machine/Gpu.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/machine/Gpu.kt new file mode 100644 index 00000000..f4851f9c --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/machine/Gpu.kt @@ -0,0 +1,37 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.topology.machine + +/** + * A graphics processing unit. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +data class Gpu( + override val id: Int, + override val speed: Int, + override val cores: Int, + override val energyConsumption: Int +): ProcessingUnit diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/machine/Machine.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/machine/Machine.kt new file mode 100644 index 00000000..f50fc717 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/machine/Machine.kt @@ -0,0 +1,36 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.topology.machine + +import nl.tudelft.opendc.topology.Entity + +/** + * A Physical Machine (PM) inside a rack of a data center. It has a speed, and can be given a workload on which it will + * work until finished or interrupted. + * + * @param id The unique identifier of this entity. + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +data class Machine(override val id: Int): Entity diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/machine/ProcessingUnit.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/machine/ProcessingUnit.kt new file mode 100644 index 00000000..e7194a80 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/machine/ProcessingUnit.kt @@ -0,0 +1,49 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.topology.machine + +import nl.tudelft.opendc.topology.Entity + +/** + * An interface representing a generic processing unit which is placed into a [Machine]. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +interface ProcessingUnit: Entity { + /** + * The speed of this [ProcessingUnit] per core. + */ + val speed: Int + + /** + * The amount of cores within this [ProcessingUnit]. + */ + val cores: Int + + /** + * The energy consumption of this [ProcessingUnit] in Kj/s. + */ + val energyConsumption: Int +} diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/network/NetworkUnit.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/network/NetworkUnit.kt new file mode 100644 index 00000000..c4a81d9b --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/network/NetworkUnit.kt @@ -0,0 +1,34 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.topology.network + +import nl.tudelft.opendc.topology.Entity + +/** + * A generic interface for a network unit in a cloud network. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +interface NetworkUnit: Entity diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/power/PowerUnit.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/power/PowerUnit.kt new file mode 100644 index 00000000..19eeaea3 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/power/PowerUnit.kt @@ -0,0 +1,36 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.topology.power + +import nl.tudelft.opendc.topology.Entity + +/** + * An [Entity] which provides power for other entities a cloud network to run. + * + * @param id The unique identifier of the [Entity]. + * @param output The output of the power unit in Watts. + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +data class PowerUnit(override val id: Int, val output: Double): Entity diff --git a/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/storage/StorageUnit.kt b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/storage/StorageUnit.kt new file mode 100644 index 00000000..d601e027 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/tudelft/opendc/topology/storage/StorageUnit.kt @@ -0,0 +1,34 @@ +/* + * MIT License + * + * Copyright (c) 2017 tudelft-atlarge + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package nl.tudelft.opendc.topology.storage + +import nl.tudelft.opendc.topology.Entity + +/** + * A generic interface for a storage unit in a cloud network. + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +interface StorageUnit: Entity |
