Skip to content

Topologies | Topology Syntax Guide

Michael Albert edited this page Nov 12, 2019 · 17 revisions

A Topology is the simulate-able structure in ns3-lxc. Topologies encompass Nodes, Links, Applications, Commands, and sub-topologies (topologies used within the topology). It is highly recommended to look at the Topology Writing Tutorial to get a grasp on how Topologies are written. Below are the technical details with a few examples.

Supported Flags (examples below)

  • include[s]: include other files (omitting .yaml extension)
  • node[s]: list of nodes to create
  • link[s]: list of links to connect interfaces to
  • topology (or topologies), referred to as sub topologies: list of sub topologies to create
  • position[s]: static position or list of time based positions
  • rotation: rotate (in degrees counter-clockwise) the nodes and sub topologies within the topology
  • application[s]: List of applications to install/run on nodes, can also be declared in node declaration
  • command[s]: list of commands to run on nodes, mapped to an application if associated with one, can also be declared in node declaration
  • ifacesProvided: variable name declaration/association list of interfaces not connected to a link
  • ifacesAccepted: variable name declaration/association list of links accepting interfaces
  • acceptIface[s]: list of ifacesAccepted from sub topologies associated with an interface to connect to

Basics

One primary topology can be declared per file. For ease of use (especially for includes), the name of the file must be the name of the topology (caps on first letter optional). Example: the SimpleNetwork topology should be in the simpleNetwork.yaml file.

Examples

Note: More examples can be found in the resources folder of the repository, or the Topology Writing Guide.

A simple example of a topology:

nodes:
  - node1:
      iface: eth0
  - node2:
      iface: eth0
link:
  - connectThem:
      ifaces:
        - node1 eth0 10.0.0.1
        - node2 eth0 10.0.0.2

This is a topology using many of the flags:

includes:
  - singleLinkTop # fake topology, using it as a single node (with two eths) connected to a csma link with an iface Accepted

MyTopology:
  position: 100 0 0
  rotation: 90 #rotates node positions within top
  nodes:
    - myNode:
        iface: eth0
    - 4ethNode:
        ifaces:
          - eth0
          - eth1
          - eth2
          - eth3
  topologies:
    - singleTop:
        offset: 0.0.2.0
        template: SingleLinkTop

  links:
    - csmaLink:
        type: csma
        ifaces:
          - myNode eth0 10.0.0.1
          - 4ethNode eth0 10.0.0.2
    - link2:
        type: csma
        ifaces:
          - 4ethNode eth2 10.0.1.1
          - singleTop extraEth

  acceptIface:
    - singleTop acceptor: 4ethNode eth1 10.0.2.1
  ifacesProvided:
    - 4ethIface: 4ethNode eth3