oepc.py 1.62 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
#!/usr/bin/python

"""
An example of a minimal OpenEPC profile.

Instructions:
Five nodes will be instantiated by this profile: three packet core
nodes, and two emulated RAN nodes (one eNodeB and one UE).  Please
refer to the OpenEPC documentation for instructions on how to
operate OpenEPC.
"""

13 14 15
# Import the standard RSpec and portal modules
import geni.portal as portal
import geni.rspec.pg as rspec
16

17 18
# Import phantoment-specific functionality
import geni.rspec.emulab.pnext as pn
19

20
request = portal.context.makeRequestRSpec()
21

22 23 24 25
# Create OpenEPC nodes; nodes made with this helper function must
# be explicitly added to request after creating them
epcen = pn.mkepcnode( "epc", pn.EPCROLES.ENABLERS )
request.addResource( epcen )
26

27 28
pgw = pn.mkepcnode( "pgw", pn.EPCROLES.PGW )
request.addResource( pgw )
29

30 31
sgw = pn.mkepcnode( "sgw", pn.EPCROLES.SGW_MME_SGSN )
request.addResource( sgw )
32

33 34 35 36 37
enodeb = pn.mkepcnode( "enodeb", pn.EPCROLES.ENODEB )
request.addResource( enodeb )

ue = pn.mkepcnode( "ue", pn.EPCROLES.CLIENT )
request.addResource( ue )
38

39
# Create LANs:
40 41 42 43 44
mgmt = request.EPClan( pn.EPCLANS.MGMT )
net_a = request.EPClan( pn.EPCLANS.NET_A )
net_b = request.EPClan( pn.EPCLANS.NET_B )
net_d = request.EPClan( pn.EPCLANS.NET_D )
an_lte = request.EPClan( pn.EPCLANS.AN_LTE )
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

# 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 )
64

65
portal.context.printRequestRSpec()