Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mitshell/corenet
Minimal 3G and LTE / EPC core network
https://github.com/mitshell/corenet
Last synced: 2 months ago
JSON representation
Minimal 3G and LTE / EPC core network
- Host: GitHub
- URL: https://github.com/mitshell/corenet
- Owner: mitshell
- License: gpl-2.0
- Created: 2015-09-05T11:20:15.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-03-02T14:37:34.000Z (11 months ago)
- Last Synced: 2024-08-02T21:38:48.943Z (6 months ago)
- Language: Python
- Homepage:
- Size: 55.7 KB
- Stars: 105
- Watchers: 19
- Forks: 36
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: license.txt
Awesome Lists containing this project
- awesome-telco-cloud - Corenet - Minimal 3G and LTE / EPC core network (Open Source Cellular Network NFs / 3G Network NFs)
README
What is corenet
===============Corenet is a minimal 3G and LTE / EPC core network. It implements the minimal set of
functions to handle home-NodeBs through Iuh interfaces, e-NodeBs through S1 interfaces,
and UEs through NAS and GTPU interfaces:```
LTE-Uu S1
UE <-----Radio/UP------> eNodeB <---GTPU/UP-----> corenet <---UP---> LAN
UE <---Radio/RRC/NAS---> eNodeB <---S1AP/NAS----> corenet <---SMS>
eNodeB <-----S1AP------> corenet3G-Uu Iuh
UE <-----Radio/UP------> hNodeB <---GTPU/UP-----> corenet <---UP---> LAN
UE <---Radio/RRC/NAS---> hNodeB <-RUA/RANAP/NAS-> corenet <---SMS>
hNodeB <-----HNBAP-----> corenet
```No other interfaces are supported by corenet (no interface to S-GW, P-GW, HSS / HLR,
no support for GTP-C or Diameter interfaces, ...).
It has been successfully tested with the open-source Eurecom OpenAirInterface eNodeB,
the commercial Amarisoft eNodeB, ip.access 3G femtocells, and handsets from multiple
vendors (Qualcomm, Samsung, Mediatek, ...).Installation
============Operating system and Python version
------------------------------------The application is made to work with Python 3.4 and over, but should also work with
Python 2.7, just like *Pycrate*. Beware that with Python 2.7, explicit unicode declarations
are required for some parameters, hence prefer Python 3.
It works on Linux, because of the need for SCTP support and Ethernet raw sockets.
It may work on other UNIX-like system, but this has not been tested.Dependencies
------------The following libraries are required for corenet to work:
* [ipython](http://ipython.org/) is used to wrap the execution of corenet and
to provide a friendly ipython-shell interface
* [pysctp](https://github.com/philpraxis/pysctp) is used to wrap the Linux
kernel SCTP stack, and provides a Python API that is used by the MME server.
Take care to install one of the fork that supports Python 3 in case you are
working with Python 3.
* [pycrypto](https://www.dlitz.net/software/pycrypto/) is used for handling the
AES computation for EEA2 / EIA2 and Milenage as provided in CryptoMobile
* [CryptoMobile](https://github.com/mitshell/CryptoMobile/) is used for handling
Milenage and all UEA / UIA / EEA / EIA computations
* [pycrate](https://github.com/pycrate-org/pycrate/) contains all components needed
for running the 3G and LTE / EPC core network stacksAs I am currently missing some hardware / eNB / femtocells to properly test and run corenet,
it could be that some recent changes in pycrate are breaking corenet. If it is the case,
go for an earlier version of pycrate, e.g.: 0.5.5 or 0.5.4.Installation
------------After all dependencies have been installed, there is no further installation
needed. The *corenet.py* file can be launched as is from the command line,
after adapting its main settings: for this, you need to edit the file according
to your required configuration, and edit the *AuC.db* file too.Launch
------You need to have the right to open raw Ethernet socket: for this, you need to be
root (e.g. *sudo python corenet.py*), or to set the CAP_NET_RAW capability for
the Python interpreter (e.g. *sudo setcap cap_net_raw+eip /usr/lib/python35*).You can launch the corenet application as is, the application will then wait for
home-NodeBs and eNodeBs to connect, and UEs to attach. All logs are written to the
*/tmp/corenet.log* file, the verbosity of each log category can be configured within
the *corenet.py* file.```bash
$ python ./corenet.py
user@LSF-TELECOM:~/corenet$ ./corenet.py
CorenetServer: loading all ASN.1 and NAS modules, be patient...
Corenet 0.2.0 loaded -- interactive mobile core networkASN.1 modules: HNBAP, RUA, RANAP, S1AP, SS, RRC3G, RRCLTE and ASN_GLOBAL
ASN.1 PDU: PDU_HNBAP, PDU_RUA, PDU_RANAP, PDU_S1AP, PDU_SS_Facility
NAS module for messages and IEs: NAS
Protocol procedures modules:
- ProcHnbap, ProcRua, ProcRanap, ProcS1ap
- ProcMM, ProcSMS, ProcGMM, ProcSM, ProcEMM, ProcESM
Protocol stack classes (and attribute's names at runtime):
- HNBd
- ENBd
- UEd -> UEIuCSd (IuCS) -> UEMMd (MM)
-> UESMSd (SMS)
-> UEIuPSd (IuPS) -> UEGMMd (GMM)
-> UESMd (SM)
-> UES1d (S1) -> UEEMMd (EMM)
-> UESMSd (SMS)
-> UEESMd (ESM)
Instances:
- Server: signalling server (instance of CorenetServer),
handling instances of HNBd and ENBd under the .RAN attribute
handling instances of UEd under the .UE attribute
- AUCd : AuC Authentication center
- GTPUd : GTP-U tunnel manager
- SMSd : SMS relay
Functions:
- show, hex, bin: to represent NAS messages and IEs
- sleep: to take a break !
Constants:
- BLACKHOLE_LAN, BLACKHOLE_WANIn [1]:
```We can see the home-NodeBs and eNodeBs connected, their config as set during their
signalling link setup, and all procedures handled:```bash
In [1]: Server.RAN
Out[1]:
{('00101', '0010002'): ,
('00101', '1a2d0'): }In [17]: hnb = Server.RAN[('00101', '0010002')]
In [47]: hnb.Config
Out[47]:
{'CellIdentity': '0010002',
'HNB_Cell_Access_Mode': 'open',
'HNB_Identity': {'hNB-Identity-Info': b'[email protected]'},
'HNB_Location_Information': {'iE-Extensions': [{'criticality': 'reject',
'extensionValue': ('IP-Address',
{'ipaddress': ('ipv4info', b'\n\x01\x01\x1f')}),
'id': 17}]},
'LAC': 1,
'PLMNidentity': '00101',
'RAC': 1,
'SAC': 65535}In [18]: hnb._proc # track of all procedures handled for the hnb
Out[18]:
[,
,
,
,
,
,
[...]
,
,
,
]In [19]: enb = Server.RAN[('00101', '1a2d0')]
In [48]: enb.Config
Out[48]:
{'ENBname': 'enb1a2d0',
'Global_ENB_ID': {'eNB-ID': ('macroENB-ID', '1a2d0'),
'pLMNidentity': '00101'},
'PagingDRX': 'v128',
'SupportedTAs': [{'broadcastPLMNs': ['00101'], 'tAC': 1}],
'TAIs': [('00101', 1)]}In [20]: enb._proc
Out[20]:
[,
]
```We can also see UEs attached to the core network, and their last access network used:
```bash
In [3]: Server.UE
Out[3]: {'001011664001104': }In [4]: ue = Server.UE['001011664001104']
In [49]: ue._last_ran
Out[49]:
```After a given UE has moved to both the 3G and 4G access networks, all identities,
localization and capabilities are available:```bash
In [45]: ue.IMSI, ue.TMSI, ue.PTMSI, ue.MTMSI
Out[45]: ('001011664001104', 3559055791, 3186190919, 1912293922)In [46]: ue.PLMN, ue.LAC, ue.RAC, ue.TAC
Out[46]: ('00101', 1, 1, 1)In [30]: list(ue.Cap.keys())
Out[30]:
['MSCm1',
'MSCm2',
'VoiceDomPref',
'MSNetCap',
'HNBAP',
'DRXParam',
'UESecCap',
'UERadioCap',
'MSNetFeatSupp',
'UENetCap',
'MSRACap']In [31]: ue.Cap['MSCm1']
Out[31]:
(b'W',
>)In [32]: show(ue.Cap['MSCm2'][1])
### MSCm2 ###
In [33]: show(ue.Cap['MSNetCap'][1])
>
<
]>>
]>In [34]: show(ue.Cap['DRXParam'][1])
### DRXParam ###
In [35]: show(ue.Cap['UESecCap'][1])
### UESecCap ###
In [39]: ue.Cap['UERadioCap'][2]
Out[39]:
{'eutra': {'accessStratumRelease': 'rel11',
'featureGroupIndicators': (2144337598, 32),
'interRAT-Parameters': {'geran': {'interRAT-PS-HO-ToGERAN': 0,
'supportedBandListGERAN': ['gsm850', 'gsm900E', 'gsm1800', 'gsm1900']},
'utraFDD': {'supportedBandListUTRA-FDD': ['bandI',
'bandII',
'bandIV',
'bandV',
'bandVIII']}},
[...],
'rf-Parameters-v1020': {'supportedBandCombination-r10': [[{'bandEUTRA-r10': 7,
'bandParametersDL-r10': [{'ca-BandwidthClassDL-r10': 'a',
'supportedMIMO-CapabilityDL-r10': 'twoLayers'}],
'bandParametersUL-r10': [{'ca-BandwidthClassUL-r10': 'a'}]}],
[{'bandEUTRA-r10': 20,
'bandParametersDL-r10': [{'ca-BandwidthClassDL-r10': 'a',
'supportedMIMO-CapabilityDL-r10': 'twoLayers'}],
'bandParametersUL-r10': [{'ca-BandwidthClassUL-r10': 'a'}]}],
[...],
[{'bandEUTRA-r10': 40,
'bandParametersDL-r10': [{'ca-BandwidthClassDL-r10': 'c',
'supportedMIMO-CapabilityDL-r10': 'twoLayers'}],
'bandParametersUL-r10': [{'ca-BandwidthClassUL-r10': 'a'}]}]]},
'ue-BasedNetwPerfMeasParameters-r10': {'loggedMeasurementsIdle-r10': 'supported',
'standaloneGNSS-Location-r10': 'supported'},
'ue-Category-v1020': 6}},
'phyLayerParameters-v920': {'enhancedDualLayerTDD-r9': 'supported'},
'son-Parameters-r9': {'rach-Report-r9': 'supported'}},
'pdcp-Parameters': {'maxNumberROHC-ContextSessions': 'cs16',
'supportedROHC-Profiles': {'profile0x0001': 1,
'profile0x0002': 1,
'profile0x0003': 0,
'profile0x0004': 0,
'profile0x0006': 0,
'profile0x0101': 0,
'profile0x0102': 0,
'profile0x0103': 0,
'profile0x0104': 0}},
'phyLayerParameters': {'ue-SpecificRefSigsSupported': 0,
'ue-TxAntennaSelectionSupported': 0},
'rf-Parameters': {'supportedBandListEUTRA': [{'bandEUTRA': 7,
'halfDuplex': 0},
{'bandEUTRA': 20, 'halfDuplex': 0},
{'bandEUTRA': 28, 'halfDuplex': 0},
{'bandEUTRA': 3, 'halfDuplex': 0},
{'bandEUTRA': 1, 'halfDuplex': 0},
{'bandEUTRA': 5, 'halfDuplex': 0},
{'bandEUTRA': 8, 'halfDuplex': 0},
{'bandEUTRA': 32, 'halfDuplex': 0},
{'bandEUTRA': 38, 'halfDuplex': 0},
{'bandEUTRA': 40, 'halfDuplex': 0}]},
'ue-Category': 4}}In [41]: show(ue.Cap['UENetCap'][1])
### UENetCap ###
In [42]: show(ue.Cap['MSRACap'][1])
<[
<
<{'1', [
<
]>>]}>
<{'1', [
<
<{'1', [
]}>
<{'0', []}>
<{'0', []}>
<{'1', [
]}>
<{'0', []}>]>>]}>
<{'1', [
<_8PSK_Power_Capability: 2>]}>
<{'0', []}>
<{'0', []}>
<'0'>
<_8_PSK_Multislot_Power_Profile: 2>
<{'0', []}>
<{'0', []}>
<>
]>>
<[]>]>]>>]}>
<{'1', [
[...]
<{'0', []}>]>>]}>]>>]}>]>>
<[]>]>
```After an UE has connected to the mobile network, it is possible to let it connect to
the data services, over 3G and 4G. Connection statistics are then available under
the *GTPUd.stats* attribute:```bash
In [50]: GTPUd.stats
Out[50]:
{'192.168.1.204': {'DNS': {'8.8.8.8'},
'ICMP': set(),
'NTP': {'97.127.86.125'},
'TCP': {('172.217.18.195', 80),
('172.217.18.202', 443),
('172.217.19.228', 443),
('172.217.22.131', 80),
('172.217.22.132', 443),
('216.58.198.195', 80),
('216.58.198.202', 443),
('216.58.201.234', 443),
('216.58.204.100', 443),
('216.58.205.10', 443),
('216.58.209.234', 443),
('216.58.213.138', 443),
('216.58.213.170', 443),
('216.58.213.174', 443),
('216.58.215.42', 443),
('66.102.1.188', 5228)},
'UDP': {('172.217.19.234', 443), ('8.8.8.8', 53), ('97.127.86.125', 123)},
'alien': set(),
'resolved': {b'android.clients.google.com',
b'android.googleapis.com',
b'chromecontentsuggestions-pa.googleapis.com',
b'cloudconfig.googleapis.com',
b'connectivitycheck.gstatic.com',
b'mtalk.google.com',
b'north-america.pool.ntp.org',
b'play.googleapis.com',
b'telephonyspamprotect-pa.googleapis.com',
b'translate.googleapis.com',
b'www.google.com',
b'www.googleapis.com',
b'www.nperf.com',
b'youtubei.googleapis.com'}},
'fe80::1:0:cc': {'DNS': set(),
'ICMP': {'ff02::2'},
'NTP': set(),
'TCP': set(),
'UDP': set(),
'alien': set(),
'resolved': set()}}
```It is also possible to exchange SMS between attached UEs. All SMS are forwarded
through the SMSd service handler. It can itself send SMS to given UEs. In case the
destination UE is not connected, it will get paged by the network. All SMS PDU
received and sent by the SMS service handler are stored under the *SMSd._pdu*
attribute (in case SMSd.TRACK_PDU is True in *corenet.py*):```bash
In [52]: ue.MSISDN
Out[52]: '16641104'In [9]: SMSd.send_text('hello back', num='16641104')
In [51]: SMSd._pdu
Out[51]:
[(1518531263.470469,
'UL',
Net : RP-DATA)>>>>>>>>>>>>>>>>),
[...]
]In [53]: show(SMSd._pdu[0][2])
### RP_DATA_MO ###