Skip to the content.

Building your first topology

To start creating our topology we first need our experiment tag where we put the name of the docker image we previously installed, if you followed our steps it will be “kollaps:2.0”.

<?xml version="1.0" encoding="UTF-8" ?>
<experiment boot="kollaps:2.0">
<experiment/>

Choosing the applications and creating the services

Now we need to think about what applications will run in the containers, for this example, we will use 3 iperf3-client:1.0 and 3 iperf3-server:1.0.

<services>
      <service name="dashboard" image="kollaps/dashboard:1.0" supervisor="true" port="8088"/>
      <service name="client1" image="kollaps/iperf3-client:1.0" />
      <service name="client2" image="kollaps/iperf3-client:1.0" />
      <service name="client3" image="kollaps/iperf3-client:1.0" />
      <service name="server" image="kollaps/iperf3-server:1.0" >
</services>

The names of the services are completely up to you.

We always need the dashboard thus we created a service using our own docker image, which is purposely tagged as “supervisor=true” so Kollaps knows this is the Dashboard that will run in port 8088.

The iperf3-client image contains a script that runs iperf3, however, it needs some arguments to find the ip of the server to connect. Thus we will use the command tag to pass arguments to the script. What this does when running is passing this arguments to the ENTRYPOINT defined in the iperf3-client dockerfile.

<services>
    <service name="client1" image="kollaps/iperf3-client:1.0" command="['server','1']"/>
    <service name="client2" image="kollaps/iperf3-client:1.0" command="['server','2']"/>
    <service name="client3" image="kollaps/iperf3-client:1.0" command="['server','3']"/>
    <service name="server" image="kollaps/iperf3-server:1.0" >
</services>

You might notice we only defined one server when we mentioned our topology would have three, this is easily done in Kollaps by passing the replicas tag to the server service.

<services>
    <service name="client1" image="kollaps/iperf3-client:1.0" command="['server','1']"/>
    <service name="client2" image="kollaps/iperf3-client:1.0" command="['server','2']"/>
    <service name="client3" image="kollaps/iperf3-client:1.0" command="['server','3']"/>
    <service name="server" image="kollaps/iperf3-server:1.0" replicas ="3" >
</services>

Creating Bridges between services

To initialize bridges, we only need to create a bridges tag, and naming them.

<bridges>
        <bridge name="s1"/>
        <bridge name="s2"/>
</bridges>

Now we must choose how our services will connect to each other, in this scenario we setup a dumbbell experiment. clients->s1->s2->servers.

<links>
    <link origin="client1" dest="s1" network="kollaps_network"/>
    <link origin="client2" dest="s1" network="kollaps_network"/>
    <link origin="client3" dest="s1" network="kollaps_network"/>
    <link origin="s1" dest="s2" network="kollaps_network"/>
    <link origin="s2" dest="server" network="kollaps_network"/>
</links>

The network attribute must be named after a suitable docker network, check Installation if you did not set this up.

Setting up network properties

Now let’s setup network properties between these nodes, in this scenario the clients to the s1 bridge have a very good network connection, as well as the servers to the s2 bridge.

However, the link between s1 and s2 is old and extremely laggy with some packet loss.

<links>
    <link origin="client1" dest="s1" latency="1" upload="10Gbps" download="10Gbps" network="kollaps_network"/>
    <link origin="client2" dest="s1" latency="1" upload="10Gbps" download="10Gbps" network="kollaps_network"/>
    <link origin="client3" dest="s1" latency="1" upload="10Mbps" download="10Gbps" network="kollaps_network"/>
    <link origin="s1" dest="s2" latency="25" upload="50Mbps" download="50Mbps" drop="0.01" network="kollaps_network"/>
    <link origin="s2" dest="server" latency="5" upload="10Gbps" download="10Gbps" network="kollaps_network"/>
</links>

Complete Topology

<?xml version="1.0" encoding="UTF-8" ?>
<experiment boot="kollaps:2.0">
    <services>
    	<service name="dashboard" image="kollaps/dashboard:1.0" supervisor="true" port="8088"/>
        <service name="client1" image="kollaps/iperf3-client:1.0" command="['server','1']"/>
        <service name="client2" image="kollaps/iperf3-client:1.0" command="['server','2']"/>
        <service name="client3" image="kollaps/iperf3-client:1.0" command="['server','3']"/>
        <service name="server" image="kollaps/iperf3-server:1.0" replicas ="3"/>
    </services>
    <bridges>
        <bridge name="s1"/>
        <bridge name="s2"/>
    </bridges>
    <links>
        <link origin="client1" dest="s1" latency="1" upload="10Gbps" download="10Gbps" network="kollaps_network"/>
        <link origin="client2" dest="s1" latency="1" upload="10Gbps" download="10Gbps" network="kollaps_network"/>
        <link origin="client3" dest="s1" latency="1" upload="10Mbps" download="10Gbps" network="kollaps_network"/>
        <link origin="s1" dest="s2" latency="25" upload="50Mbps" download="50Mbps" drop="0.01" network="kollaps_network"/>
        <link origin="s2" dest="server" latency="5" upload="10Gbps" download="10Gbps" network="kollaps_network"/>
    </links>
</experiment>

You are now done with your first topology! Learn how to run it, in How to Run.

If you want to know more about our DSL check Topology Description.

If you only want to emulate a fixed network state this is all you need to know, however, if you want to have dynamic events happen overtime, check, Dynamic Experiments.