Skip navigation.
Home
A virtual network infrastructure
PlanetLab logo
Powered by PlanetLab

Network.rb

This file contains the definitions of the Node and Link classes that experimenters use to configure an experiment. It also defines an Iface class that is used internally to store information about specific network interfaces. Each class and its methods are documented below. Jump ahead to:


Slice Class

A Slice object corresponds to a PlanetLab or VINI slice that has already been created on the infrastructure. All the nodes in a particular slice are configured in the same way (e.g., all use the same set of ports and run the same routing software, but an experiment can span multiple slices.

Variables

  • click_port Integer, the TCP port that Click's telnet interface listens on.
  • udp_port Integer, the UDP port over which the overlay tunnels packets.
  • slice String containing the name of the PlanetLab/VINI slice.
  • click_forwarding Boolean specifying whether the Click's IP FEA should forward IP packets.
  • router String indicating which router to run inside UML; values are "XORP", "Quagga", or "none".


Node Class

A Node object corresponds to a virtual node in the experiment (i.e., a sliver containing a running instance of UML).

Variables

  • clientnet An Iface object storing information about the local OpenVPN clients
  • dnsname The DNS name of the VINI node
  • fea An Iface object storing information about the local Click forwarding engine
  • ibgp_route_reflector The client node for which this node is serving as a route reflector (experimental, untested)
  • iface An array of Iface objects corresponding to UML network interfaces: iface[0] is eth0, iface[1] is eth1, etc.
  • label A short string used to refer to this node, by default the second component of the DNS name
  • nat_dests An array of strings containing the networks (e.g., '128.112.0.0/16') for which this node will be a NAT egress
  • nat_gateway An Iface object storing information about the "NAT gateway" UML network interface
  • realip String containing the actual IP address of the VINI node
  • router String indicating which router to run inside UML; values are "XORP", "Quagga", or "none"
  • run_ibgp Boolean indicating whether the router should run the iBGP protocol
  • run_ospf Boolean indicating whether the router should run the OSPF protocol
  • run_openvpn Boolean indicating whether an OpenVPN server should be run in the sliver
  • slice The name of the slice in which Click, UML, etc. run
  • tap0 An Iface object storing information about the VINI node's local tap0 interface

Methods

Node.new(dnsname, slice, label=nil)
Creates a new Node object for VINI node dnsname. The slice argument specifies the slice in which the virtual node will run, and the optional label argument specifies a label for the node.
Node.add_nat_dests(ipnets)
Appends an array of networks (argument ipnets) to the set of networks for which this node should serve as a NAT egress.
Node.create_iface(link, ipaddr)
Creates an Iface object associating a Link object (link argument) with this Node. The new Iface has IP address ipaddr. This method is called when a new Link object is created.
Node.hostinfo(realip, tapip, tapmac)
Specifies address information for the node. Argument realip is the node's real IP address, tapip is the local tap0 interface's IP address, and tapmac is tap0's MAC address. If this information is not specified for a node, the scripts will ssh to the node to gather it.
Node.ibgp(val)
Sets the Node's run_ibgp variable to val.
Node.openvpn(val)
Sets the Node's run_openvpn variable to val.
Node.route_reflector(node)
Sets the Node's ibgp_route_reflector variable to node.


Link Class

A Link object corresponds to a virtual link in the experiment between two Nodes. Links are assumed to be point-to-point. Each virtual link is given its own /24 IPv4 address block, and the network interfaces at each end are assigned addresses from this block.

Variables

  • iface0 The Iface object where the Link meets node0
  • iface1 The Iface object where the Link meets node1
  • loss The amount of packet loss to configure on the virtual link, a value between 0 (no loss) and 1 (all packets dropped)
  • node0 The Node object at one end of the Link
  • node1 The Node object at the other end of the Link
  • ospf_cost The OSPF cost for the virtual link

Methods

Link.new(node0, node1, ospf_cost=nil, loss=nil)
Creates a virtual link between Node objects node0 and node1. The ospf_cost and loss arguments are optional. As a side effect this method creates two Iface objects, one associated with each node.


Iface Class

An Iface object corresponds to a virtual network interface and stores interface-specific information. Abstractly, it associates a Node with a Link.

Variables

  • ipaddr A string containing the IP address of the interface
  • link The Link object associated with this Iface
  • macaddr A string containing the MAC address of the interface
  • name A string indicating the name of this interface (e.g., "eth1")
  • neighbor The Iface object at the other end of the Link
  • node The Node object associated with this Iface

Methods

Iface.new(link, node, name, ipaddr, macaddr=nil)
An Iface object associates a Link object (argument link) with a Node object (argument node). The name is a string naming the interface (e.g., eth1), ipaddr is its IP address, and macaddr is its MAC address. If no macaddr is specified, one will be created from the IP address as described below.
Iface.add_neighbor(nbr)
Gives the Iface a pointer to the Iface object at the opposite end of the Link.
Iface.ip_to_uml_mac(ipaddr)
Converts the IP address to a MAC address in the same way that UML does when assigning a MAC address to an interface.


Global Variables

  • $Nodes A list of all Node objects created by the experiment
  • $Links A list of all Link objects created by the experiment
  • $Network A string containing the initial network prefix used to assign /24 address blocks to virtual links.