Commit c69de2dd authored by Gary Wong's avatar Gary Wong

Incorporate all updates to pnext API.

Unfortunately these haven't been accepted upstream and so are somewhat
subject to change.  However, the interface described here does match
what is currently installed on ops, so it is real for the time being.
parent caa6db9c
Pipeline #1748 passed with stage
in 2 minutes and 28 seconds
......@@ -17,25 +17,46 @@ import geni.rspec.emulab.pnext as PN
pc = geni.portal.Context()
rspec = geni.rspec.pg.Request()
PN.EPCNode.bindRSpec( rspec )
PN.EPClan.bindRSpec( rspec )
# Create OpenEPC nodes:
epcen = PN.mkepcnode( "epc", PN.EPCROLES.ENABLERS )
rspec.addResource( epcen )
epcen = PN.EPCNode( "epc", PN.EPCROLES.ENABLERS )
PN.EPClan.addToLAN( PN.EPCLANS.NET_A, epcen )
pgw = PN.mkepcnode( "pgw", PN.EPCROLES.PGW )
rspec.addResource( pgw )
pgw = PN.EPCNode( "pgw", PN.EPCROLES.PGW )
PN.EPClan.addToLAN( PN.EPCLANS.NET_A, pgw )
PN.EPClan.addToLAN( PN.EPCLANS.NET_B, pgw )
sgw = PN.mkepcnode( "sgw", PN.EPCROLES.SGW_MME_SGSN )
rspec.addResource( sgw )
sgw = PN.EPCNode( "sgw", PN.EPCROLES.SGW_MME_SGSN )
PN.EPClan.addToLAN( PN.EPCLANS.NET_B, sgw )
PN.EPClan.addToLAN( PN.EPCLANS.NET_D, sgw )
enodeb = PN.mkepcnode( "enodeb", PN.EPCROLES.ENODEB )
rspec.addResource( enodeb )
enodeb = PN.EPCNode( "enodeb", PN.EPCROLES.ENODEB )
PN.EPClan.addToLAN( PN.EPCLANS.NET_D, enodeb )
PN.EPClan.addToLAN( PN.EPCLANS.AN_LTE, enodeb )
ue = PN.mkepcnode( "ue", PN.EPCROLES.CLIENT )
rspec.addResource( ue )
ue = PN.EPCNode( "ue", PN.EPCROLES.CLIENT )
PN.EPClan.addToLAN( PN.EPCLANS.AN_LTE, ue )
# Create LANs:
mgmt = rspec.EPClan( PN.EPCLANS.MGMT )
net_a = rspec.EPClan( PN.EPCLANS.NET_A )
net_b = rspec.EPClan( PN.EPCLANS.NET_B )
net_d = rspec.EPClan( PN.EPCLANS.NET_D )
an_lte = rspec.EPClan( PN.EPCLANS.AN_LTE )
# Add nodes to appropriate LANs:
mgmt.addMember( epcen )
mgmt.addMember( pgw )
mgmt.addMember( sgw )
mgmt.addMember( enodeb )
mgmt.addMember( ue )
net_a.addMember( epcen )
net_a.addMember( pgw )
net_b.addMember( pgw )
net_b.addMember( sgw )
net_d.addMember( sgw )
net_d.addMember( enodeb )
an_lte.addMember( enodeb )
an_lte.addMember( ue )
pc.printRequestRSpec( rspec )
#!/usr/bin/python
"""
An example of a profile including RF links.
Instructions:
This is an example profile to demonstrate the description of RF links.
It is not particularly useful to instantiate directly.
"""
import geni.portal
import geni.rspec.pg
import geni.rspec.emulab.pnext as PN
pc = geni.portal.Context()
rspec = geni.rspec.pg.Request()
node0 = geni.rspec.pg.RawPC( "node0" )
iface0 = node0.addInterface( "rf0" )
rspec.addResource( node0 )
node1 = geni.rspec.pg.RawPC( "node1" )
iface1 = node1.addInterface( "rf1" )
rspec.addResource( node1 )
rflink = rspec.RFLink( "rflink" )
rflink.addInterface( iface0 )
rflink.addInterface( iface1 )
pc.printRequestRSpec( rspec )
......@@ -166,7 +166,7 @@ and then added to the corresponding interface.
@tt{geni-lib} includes convenience functions to assist constructing
profiles including OpenEPC core networks. Although it is possible
to instantiate OpenEPC using @tt{geni-lib} primitives only, the
@tt{geni.rspec.pnext} module hides some of the OpenEPC details, and
@tt{geni.rspec.emulab.pnext} module hides some of the OpenEPC details, and
allows more concise profile scripts. An example of a profile
using @tt{pnext} is given below.
......@@ -176,13 +176,20 @@ and then added to the corresponding interface.
familiar from their use in general @tt{geni-lib} profiles, the
@tt{pnext} module is new, and provides two main classes: @tt{EPCNode}
and @tt{EPClan}. These convenience classes provide facilities for
adding OpenEPC nodes and networks, respectively. Before either one
is used, it must be @italic{bound} to the RSpec under construction,
using the @tt{EPCNode.bindRSpec} or @tt{EPClan.bindRSpec} call as
appropriate.
Once bound, OpenEPC nodes can be requested as necessary, with the
@tt{EPCNode} constructor. This call has two mandatory parameters:
adding OpenEPC nodes and networks, respectively. Both classes
are also added as extensions to @tt{Request}, so that (assuming
@tt{rspec} is a valid @tt{Request} object) a simple call like
@tt{mgmt = rspec.EPClan( PN.EPCLANS.MGMT )} will both create a LAN
and add it to the request.
For the @tt{EPCNode} class only, a factory method @tt{mkepcnode}
is also defined. (The advantage of using the factory method instead
of invoking the @tt{EPCNode} constructor directly is that it allows
specifying default hardware types and disk images to be used by
all EPC nodes in the profile. By default, @tt{mkepcnode} will
use a binary OpenEPC disk image.)
The @tt{mkepcnode} call has two mandatory parameters:
the node identifier (just as seen in previous generic @tt{geni-lib}
examples), and a new @italic{role}, specific to OpenEPC nodes.
The role must be chosen from the following, each defined within
......@@ -201,12 +208,12 @@ and then added to the corresponding interface.
Once nodes are assigned, they should be connected with appropriate
core network links. This is the job of the @tt{EPClan} class, and
in particular the @tt{EPClan.addToLAN} call. It requires two
parameters: the first is the network identifier (chosen from the
list below), and the second is the node object (as returned by
@tt{EPCNode}).
each LAN should be created by invoking the @tt{EPClan} constructor
with a single mandatory parameter chosen from the following list
of network identifiers:
@(tabular #:style 'boxed #:sep (hspace 3) (list
(list "MGMT")
(list "NET_A")
(list "NET_B")
(list "NET_C")
......@@ -215,12 +222,20 @@ and then added to the corresponding interface.
The
@hyperlink["https://wiki.phantomnet.org/wiki/phantomnet/oepc-protected/openepc-tutorial-profile"]{OpenEPC Tutorial}
gives an overview of the purpose and topology of each network.
gives an overview of the purpose and topology of each network. Once
the LAN has been created, its @tt{addMember} method may be invoked to
describe the nodes it should connect.
@section[#:tag "geni-lib-rflinks"]{RF communication}
@(tb) provides facilities for radio frequency links well suited
for wireless protocols, and @tt{geni-lib} support is provided for
requesting them in the form of the @tt{pnext} module @tt{RFLink}
class. @tt{RFLink} behaves much like standard LANs, except that all
connections are made point-to-point (and so any @tt{RFLink} must
connect exactly two interfaces).
Please note that in addition to the above five networks, a
@tt{MGMT} network is also available; however, all nodes are automatically
connected to the management network over a dedicated interface, and
no explicit @tt{addToLAN} call is required.
@code-sample["trivialrf.py"]
}
@section[#:tag "geni-lib-example-os-install-scripts"]{Specify an operating system and set install and execute scripts}
......
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