Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • emulab-devel emulab-devel
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 160
    • Issues 160
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 6
    • Merge requests 6
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • emulab
  • emulab-develemulab-devel
  • Issues
  • #317
Closed
Open
Created Jul 13, 2017 by Leigh Stoller@stollerMaintainer

Discussion about geni-lib syntax for MLE

Here is the code I showed at the meeting today. First, the existing NS syntax:

set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]

# 1
set seg1 [$ns duplex-link $n1 $n2 * 0ms DropTail]
set seg2 [$ns duplex-link $n2 $n3 * 0ms DropTail]
tb-set-link-layer $seg1 1
tb-set-link-layer $seg2 1

# 2
set mypath [$ns make-path "seg1 seg2"]

# 3
set link0 [$ns duplex-link $n1 $n3 * 0ms DropTail]
$link0 implemented_by $mypath

Then the direct translation to geni-lib, which we agree is cumbersome:

node1 = request.RawPC("node1")
iface1 = node1.addInterface()
node2 = request.RawPC("node2")
iface2a = node2.addInterface()
iface2b = node2.addInterface()
node3 = request.RawPC("node2")
iface3 = node2.addInterface()

seg1 = request.LayerOneLink()
seg1.addInterface(iface1)
seg1.addInterface(iface2a)

seg2 = request.LayerOneLink()
seg2.addInterface(iface2b)
seg2.addInterface(iface3)

l1path = request.LayeOnePath(seg1, seg2, ...);

link = request.Link()
link.addInterface(l1path.if0);
link.addInterface(l1path.if1);

And then a strawman for a less cumbersome syntax:

node1 = request.RawPC("node1")
node2 = request.RawPC("node2")
node3 = request.RawPC("node3")

l1path = request.LayerOnePath(node1, node2, node3, ...)

link = request.Link()
link.l1path = l1path;

# Attach layer2 things to l1path endpoint interfaces.
l1path.if0().addAddress(pg.IPv4Address("192.168.1.1", "255.255.255.0"))
l1path.if1().addAddress(pg.IPv4Address("192.168.1.2", "255.255.255.0"))

But @gtw mentioned that this does not really capture the case that node2 is a switch, so something better might be:

node1 = request.RawPC("node1")
node2 = request.RawPC("node2")
node3 = request.RawPC("node3")

# Two layer one segments to the switch
l1link1 = request.LayerOneLink(node1, node2)
l1link2 = request.LayerOneLink(node3, node2)

# A layer one path (a virtual wire)
l1path = request.LayerOnePath(l1link1, l1link2);

# A layer two link implemented by the layer one path
link = request.Link()
link.l1path = l1path;

# Attach layer2 things to l1path endpoint interfaces.
l1path.if0().addAddress(pg.IPv4Address("192.168.1.1", "255.255.255.0"))
l1path.if1().addAddress(pg.IPv4Address("192.168.1.2", "255.255.255.0"))
Edited Jul 13, 2017 by Leigh Stoller
Assignee
Assign to
Time tracking