Commit acc955d0 authored by Robert Ricci's avatar Robert Ricci

Move the two-VM example to the portal, and simplify it

parent d910e747
"""An example of constructing a profile with two VMs connected by a LAN.
Wait for the profile instance to start, and then log in to either VM via the
ssh ports specified below.
import geni.portal as portal
import as rspec
request = portal.context.makeRequestRSpec()
# Create two XenVM nodes.
node1 = request.XenVM("node1")
node2 = request.XenVM("node2")
# Create a link between them
link1 = request.Link(members = [node1,node2])
......@@ -103,32 +103,19 @@ where the VM used in the earlier example did not. Profiles can
@seclink["public-ip-access"]{request public IP addresses} for VMs too,
though it does not happen by default.)
@section[#:tag "geni-lib-example-two-vm-lan"]{Two XenVM nodes with a LAN between them}
@section[#:tag "geni-lib-example-two-vm-lan"]{Two XenVM nodes with a link between them}
@profile-code-sample["PortalProfiles" "two-vm-lan"]
This example demonstrates two important @(geni-lib) concepts: first,
adding more than a single node to the request (which is a relatively
straightforward matter of calling more than one node object constructor,
being careful to use a different name each time).
It also shows how to add @bold{links}
between nodes, which is slightly more involved than the nodes themselves,
because the network topology must be described in enough detail to be
Note that every node which will be included in a network requires
at least one @bold{interface}. (This is accomplished in the example
above with the @geni-lib["" 'func] method available on the node object.)
Next, the link itself is constructed (see the invocation of @geni-lib["" "pg.LAN"]),
and then both of the previously described interfaces are added to the
link with its @geni-lib["" 'func] method. Note that the @bold{link's}
@geni-lib["" 'func] and the @bold{node's} @geni-lib["" 'func] are distinct
methods, even though they share the same name! They are also both
strictly necessary to describe the topology: although it might seem
redundant to add the same interfaces in more than one place in this case,
observe that in a more complicated profile containing more than one
network, establishing the correct correspondence between interfaces and
links would become critical.
It also shows how to add @bold{links} between nodes. It is possible to
construct links and LANs in a more complicated manner (such as explicitly
creating @geni-lib["" 'id] objects to control interfaces),
but the simplest case is to supply the member nodes at the time the link
is created.
@section[#:tag "geni-lib-example-two-arm-lan"]{Two ARM64 servers in a LAN}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment