Commit e8788149 authored by Robert Ricci's avatar Robert Ricci

Start prototyping moving code samples in their own files

The intent is to be able to provide nice download links directly
to the code, and to help me actually execute the code on my laptop
to test.
parent a1a80434
#; 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)
#; Output the RSpec to the enclosing page.
printRspec(rspec)
......@@ -247,20 +247,7 @@ about @tt{geni-lib} and additional examples, can be found in the
@subsection[#:tag "geni-lib-example-1"]{A Single XEN VM 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)
#; Output the RSpec to the enclosing page.
printRspec(rspec)
}|
@code-sample["geni-lib-single-vm.py"]
@subsection[#:tag "geni-lib-example-2"]{Two XenVM nodes with a LAN between them}
@codeblock|{
......
#lang racket/base
(require scribble/base)
(require scribble/decode)
(require scribble/manual)
(require racket/class)
(require racket/draw)
(require racket/system)
(require racket/port)
(require racket/vector)
(require racket/file)
(provide (all-defined-out))
......@@ -115,3 +117,6 @@
(define (ssh)
(tt "ssh"))
(define (code-sample filename)
(codeblock (file->string (string-append "code-samples/" filename))))
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