diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2017-08-08 21:23:07 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2017-08-08 21:23:07 +0200 |
| commit | 7d791d415706dee41ea18ceb1ca2b0169f8448b2 (patch) | |
| tree | 92d055c63b29f77eeca56f8bfde2a18bfc1f8f68 /opendc-core/src/main/kotlin/nl/atlarge | |
| parent | 858d9d2dcf33941a2d1cbaea8d3a415ef93b58bb (diff) | |
Fix copyright headers and license
This change fixes the copyright headers and license of the project in
order to assign the copyright to atlarge-research.
Diffstat (limited to 'opendc-core/src/main/kotlin/nl/atlarge')
24 files changed, 1001 insertions, 0 deletions
diff --git a/opendc-core/src/main/kotlin/nl/atlarge/opendc/experiment/Experiment.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/experiment/Experiment.kt new file mode 100644 index 00000000..7638b2c8 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/experiment/Experiment.kt @@ -0,0 +1,32 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.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 {} diff --git a/opendc-core/src/main/kotlin/nl/atlarge/opendc/experiment/ExperimentRunner.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/experiment/ExperimentRunner.kt new file mode 100644 index 00000000..bb38de99 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/experiment/ExperimentRunner.kt @@ -0,0 +1,32 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.opendc.experiment + +/** + * + * @author Fabian Mastenbroek (f.s.mastenbroek@student.tudelft.nl) + */ +interface ExperimentRunner { +} diff --git a/opendc-core/src/main/kotlin/nl/atlarge/opendc/experiment/Job.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/experiment/Job.kt new file mode 100644 index 00000000..e265a031 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/experiment/Job.kt @@ -0,0 +1,34 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.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/atlarge/opendc/experiment/Scheduler.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/experiment/Scheduler.kt new file mode 100644 index 00000000..713605e4 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/experiment/Scheduler.kt @@ -0,0 +1,43 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.opendc.experiment + +import nl.atlarge.opendc.topology.Entity +import nl.atlarge.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/atlarge/opendc/experiment/Task.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/experiment/Task.kt new file mode 100644 index 00000000..ec2eb2fa --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/experiment/Task.kt @@ -0,0 +1,64 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.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/atlarge/opendc/experiment/User.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/experiment/User.kt new file mode 100644 index 00000000..d97b980b --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/experiment/User.kt @@ -0,0 +1,37 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.opendc.experiment + +import nl.atlarge.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/atlarge/opendc/sampler/Sampler.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/sampler/Sampler.kt new file mode 100644 index 00000000..2d6d4dc8 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/sampler/Sampler.kt @@ -0,0 +1,39 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.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/atlarge/opendc/simulator/Simulator.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/simulator/Simulator.kt new file mode 100644 index 00000000..07db1e4c --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/simulator/Simulator.kt @@ -0,0 +1,68 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.opendc.simulator + +import nl.atlarge.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/atlarge/opendc/simulator/SimulatorContext.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/simulator/SimulatorContext.kt new file mode 100644 index 00000000..1ddfbc6a --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/simulator/SimulatorContext.kt @@ -0,0 +1,37 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.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/atlarge/opendc/topology/Edge.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/Edge.kt new file mode 100644 index 00000000..de5bb0d4 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/Edge.kt @@ -0,0 +1,79 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.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/atlarge/opendc/topology/Entity.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/Entity.kt new file mode 100644 index 00000000..ef9f3593 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/Entity.kt @@ -0,0 +1,37 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.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/atlarge/opendc/topology/Graph.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/Graph.kt new file mode 100644 index 00000000..a87957e3 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/Graph.kt @@ -0,0 +1,47 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.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/atlarge/opendc/topology/Node.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/Node.kt new file mode 100644 index 00000000..cce5990f --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/Node.kt @@ -0,0 +1,51 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.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/atlarge/opendc/topology/container/DataCenter.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/container/DataCenter.kt new file mode 100644 index 00000000..b72b0c2a --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/container/DataCenter.kt @@ -0,0 +1,35 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.opendc.topology.container + +import nl.atlarge.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/atlarge/opendc/topology/container/rack/Rack.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/container/rack/Rack.kt new file mode 100644 index 00000000..d5ac5d99 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/container/rack/Rack.kt @@ -0,0 +1,36 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.opendc.topology.container.rack + +import nl.atlarge.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/atlarge/opendc/topology/container/rack/Slot.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/container/rack/Slot.kt new file mode 100644 index 00000000..2556598e --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/container/rack/Slot.kt @@ -0,0 +1,32 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.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/atlarge/opendc/topology/container/room/Room.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/container/room/Room.kt new file mode 100644 index 00000000..e8dcfda5 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/container/room/Room.kt @@ -0,0 +1,35 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.opendc.topology.container.room + +import nl.atlarge.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/atlarge/opendc/topology/machine/Cpu.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/machine/Cpu.kt new file mode 100644 index 00000000..5c1b8b57 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/machine/Cpu.kt @@ -0,0 +1,37 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.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/atlarge/opendc/topology/machine/Gpu.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/machine/Gpu.kt new file mode 100644 index 00000000..91a7be6a --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/machine/Gpu.kt @@ -0,0 +1,37 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.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/atlarge/opendc/topology/machine/Machine.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/machine/Machine.kt new file mode 100644 index 00000000..8944362f --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/machine/Machine.kt @@ -0,0 +1,36 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.opendc.topology.machine + +import nl.atlarge.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/atlarge/opendc/topology/machine/ProcessingUnit.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/machine/ProcessingUnit.kt new file mode 100644 index 00000000..095a0bb5 --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/machine/ProcessingUnit.kt @@ -0,0 +1,49 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.opendc.topology.machine + +import nl.atlarge.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/atlarge/opendc/topology/network/NetworkUnit.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/network/NetworkUnit.kt new file mode 100644 index 00000000..fcb5f20a --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/network/NetworkUnit.kt @@ -0,0 +1,34 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.opendc.topology.network + +import nl.atlarge.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/atlarge/opendc/topology/power/PowerUnit.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/power/PowerUnit.kt new file mode 100644 index 00000000..5fc0086d --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/power/PowerUnit.kt @@ -0,0 +1,36 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.opendc.topology.power + +import nl.atlarge.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/atlarge/opendc/topology/storage/StorageUnit.kt b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/storage/StorageUnit.kt new file mode 100644 index 00000000..6fac585f --- /dev/null +++ b/opendc-core/src/main/kotlin/nl/atlarge/opendc/topology/storage/StorageUnit.kt @@ -0,0 +1,34 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * 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.atlarge.opendc.topology.storage + +import nl.atlarge.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 |
