Commit 6a962d51 authored by Keith Downie's avatar Keith Downie

Added section for geni-lib in Advanced Topics along with some initial script examples for review

parent 51b86cd3
......@@ -26,9 +26,59 @@ there are still some cases in which it is unfortunately useful to look at or
manipulate RSpecs directly.
@(under-construction)
@italic{Still to come: documentation of @(tb)'s extensions to the RSpec format.}
@section[#:tag "geni-lib"]{geni-lib}
Geni-lib is a tool that allows users to generate RSpec files from Python code.
The following example generates an RSpec for a single XenVM node.
@codeblock|{
#; Import the ProtoGENI library.
import geni.rspec.pg as pg
#; Create a Request object to start building the RSpec.
rspec = pg.Request()
#; Create a XenVM and add it to the RSpec.
node = pg.XenVM("node")
rspec.addResource(node)
#; Save the RSpec as the file rspec.xml.
rspec.write("rspec.xml")
}|
RSpec for two XenVM nodes with a LAN between them.
@codeblock|{
import geni.rspec.pg as pg
rspec = pg.Request()
#; Create a XenVM nodes.
node1 = pg.XenVM("node1")
node2 = pg.XenVM("node2")
#; Create interfaces for each node.
iface1 = node1.addInterface("if1")
iface2 = node2.addInterface("if2")
rspec.addResource(node1)
rspec.addResource(node2)
#; Create a link with the type of LAN.
link = pg.LAN("lan")
#; Add both node interfaces to the link.
link.addInterface(iface1)
link.addInterface(iface2)
#; Add the link to the RSpec.
rspec.addResource(link)
rspec.write("rspec.xml")
}|
@section[#:tag "public-ip-access"]{Public IP Access}
@(under-construction)
......
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