Skip to content

Links | Topology Syntax Guide

mike edited this page Oct 26, 2019 · 1 revision

Links connect interfaces to eachother, and are the element simulated by ns-3.

Flags Supported

  • iface[s]/interface[s]: list of interfaces being connected with IPs
  • ifacesAccepted: list of names to advertise to a higher-level topology that link is accepting an interface (loose end)
  • bandwidth: bandwidth of link, used by LinkType (may or may not be supported depending on LinkType)
  • latency: latency of link, used by LinkType (may or may not be supported depending on LinkType)
  • subnetMask: IPv4 subnet mask (like '255.255.255.0')
  • cidr: alternative to subnetMask, specify the subnet mask via a cidr (just an integer between 0 and 32)
  • template: link to inherit attributes from
  • type: type of link, used for instantiation via LinkTypeMap
  • User-specified Flags: any flag not listed above is saved and passed to the NodeType to handle (if it so chooses)

Link Types Supported

Link types correspond directly to an ns-3 module. There are two link types implemented as of v0.1, listed below with corresponding ns-3 module.

  • csma: Csma
  • wifi: Wi-Fi module with YansWifiHelper and AdHoc mode

Link types can be added using the LinkTypeMap.

Examples

A basic link connecting two eth0 interfaces of nodes named Node1 and Node2

#...
links:
  - myLink: #name of link
      type: csma #link type
      ifaces: #list of interfaces to connect
        - Node1 eth0 10.0.0.1 #connect Node1's eth0 with ip of 10.0.0.1
        - Node2 eth0 10.0.0.2 #connect Node2's eth0 with ip of 10.0.0.2

A more advanced example (below) connects Node1's eth0 to a wifi type link, which is accepting more interfaces and has a subnet mask of 255.255.252.0. The accepted interfaces are named and can be referenced in the next higher level topology.

#...
links:
  - complexLink:
      type: wifi
      subnetMask: 255.255.252.0
      # cidr: 22 #note that the same could be accomplished with this tag
      iface: Node1 eth0
      ifacesAccepted: #explicitly advertising 4 interfaces can be accepted. wifi type supports up to 5 interfaces, but all do not have to be advertised (they will be "unconnectable")
        - complexLink_1
        - complexLink_2
        - complexLink_3
        - complexLink_4