tutorials.simple_server

This is a tutorial Model Component which is an implementation of the Simple Server Tutorials. Generally, this MC creates a Python web server and a number of clients which pull the files. Each of the clients have a random delay on their network link.

Attribute Provides:
  • topology

Attribute Depends:
  • graph

Model Component Dependencies:

Plugin

class tutorials.simple_server_plugin.Plugin(graph, log)[source]

Bases: AbstractPlugin

tutorials.simple_server plugin documentation.

This Plugin creates a basic topology with a Server and several clients. The clients all have a random delay on their outbound connection.

__annotations__ = {}
create_client(name, server_ip)[source]

Create a single client.

Parameters:
  • name (str) – The name of the vertex.

  • server_ip (str) – The IP Address of the Server.

Returns:

The newly created client.

Return type:

tutorials.simple_server.SimpleClient

run(num_clients='1')[source]

Run method documentation.

This method contains the primary logic for the Plugin.

Parameters:

num_clients (str) – The number of clients in the topology. This should be convertible to an integer.

Raises:
  • TypeError – If the number of clients is not a valid integer.

  • ValueError – If the number of clients is not a valid integer.

Available Objects

This module contains all necessary Model Component Objects for tutorials.simple_server.

class tutorials.simple_server.SimpleClient(*args, **kwargs)[source]

Bases: object

SimpleClient Class documentation.

__init__(*args, **kwargs)
grab_file(server_ip)[source]

Add a curl format to the VM and then the cURL command to grab the file. The custom format will help output the time of the download in JSON format for easy analysis.

class tutorials.simple_server.SimpleServer(*args, **kwargs)[source]

Bases: object

SimpleServer Class documentation.

__init__(*args, **kwargs)
configure_files_to_serve(file_size=52428800)[source]

Generate a file that is of size file_size (e.g. default of 50MB) and drop it on the VM.

Parameters:

file_size (int) – The size of the file to create. By default is 52428800 (i.e. 50MB.