Simulator API¶
telecom_net_sim¶
telecom_net_sim.CellSite
dataclass
¶
CellSite(cell_id: str, name: str, tech: str, city: str, lat: float, lon: float, band: str, azimuth: int, tilt: int, tx_dbm: float, backhaul_gbps: float)
A radio cell site (BTS/NodeB/eNodeB/gNodeB).
Attributes:
| Name | Type | Description |
|---|---|---|
cell_id |
str
|
Unique cell identifier, e.g. "4G-TEH-0021". |
name |
str
|
Human-readable name, e.g. "Tehran-4G-5". |
tech |
str
|
Radio access technology: "2G", "3G", "4G", "5G", or "6G". |
city |
str
|
City name where the site is deployed. |
lat |
float
|
Latitude in decimal degrees. |
lon |
float
|
Longitude in decimal degrees. |
band |
str
|
Frequency band, e.g. "LTE-B3", "NR-n78", "THz-140". |
azimuth |
int
|
Antenna azimuth in degrees (0-359). |
tilt |
int
|
Antenna electrical tilt in degrees (0-15). |
tx_dbm |
float
|
Transmit power in dBm (20-46). |
backhaul_gbps |
float
|
Backhaul capacity in Gbps. |
telecom_net_sim.CoreNode
dataclass
¶
CoreNode(node_id: str, name: str, role: str, tech: str, city: str, capacity_tps: int)
A core network node (MSC, MME, AMF, UPF, NWDAF, ...).
Attributes:
| Name | Type | Description |
|---|---|---|
node_id |
str
|
Unique node identifier, e.g. "AMF-01". |
name |
str
|
Human-readable name, e.g. "TELECOM-AMF-TEH-01". |
role |
str
|
Functional role: "MSC", "BSC", "RNC", "MME", "SGW", "PGW", "HSS", "PCRF", "AMF", "SMF", "UPF", "IMS", "MMSC", "RCS-AS", "NWDAF", "RIS-C", "ISAC", or "AI-RAN". |
tech |
str
|
Technology scope, e.g. "4G/5G" or "6G". |
city |
str
|
City where the node is deployed. |
capacity_tps |
int
|
Peak throughput capacity in transactions per second. |
telecom_net_sim.Subscriber
dataclass
¶
Subscriber(msisdn: str, imsi: str, imei: str, city: str, plan: str, kyc_age_days: int, roaming_enabled: bool, risk_score: float, line_class: str, international_access: bool, filter_bypass: bool, clir_enabled: bool, clir_override: bool, priority_qos: int, lawful_intercept: bool, direct_routing: bool, whitelisted_asns: list[str] = list(), encryption_required: bool = False, cipher_suite: str = 'None', key_id: str = '', key_rotation_days: int = 0, e2e_enabled: bool = False)
A mobile subscriber with line-class, QoS, and encryption attributes.
Line classes ("Normal", "VIP", "Government", "Corporate", "Emergency", "Test") determine default privileges and QoS range.
Attributes:
| Name | Type | Description |
|---|---|---|
msisdn |
str
|
Mobile number in E.164-ish form ("98" + 10 digits). |
imsi |
str
|
International Mobile Subscriber Identity (15 digits). |
imei |
str
|
15-digit device identity (Luhn-valid). |
city |
str
|
Home city. |
plan |
str
|
Tariff plan, e.g. "Prepaid-Basic". |
kyc_age_days |
int
|
Days since KYC was last refreshed. |
roaming_enabled |
bool
|
True if roaming is allowed. |
risk_score |
float
|
Fraud risk score in [0, 1]. |
line_class |
str
|
One of LINE_CLASSES. |
international_access |
bool
|
True if international calls/data allowed. |
filter_bypass |
bool
|
True if content filtering is bypassed. |
clir_enabled |
bool
|
True if caller-ID suppression is authorized. |
clir_override |
bool
|
True if caller-ID can be spoofed. |
priority_qos |
int
|
QoS class in [0, 9] (higher = better). |
lawful_intercept |
bool
|
True if the line is under LI. |
direct_routing |
bool
|
True if the line uses direct routing. |
whitelisted_asns |
list[str]
|
ASNs whitelisted for unfiltered access. |
encryption_required |
bool
|
True if E2E encryption is mandatory. |
cipher_suite |
str
|
Cipher suite name, or "None". |
key_id |
str
|
Key identifier for E2E crypto. |
key_rotation_days |
int
|
Key rotation interval in days. |
e2e_enabled |
bool
|
True if E2E encryption is active. |
telecom_net_sim.parse_args ¶
parse_args(argv=None)
Parse CLI arguments.
Returns Namespace with: seed, random_seed, subs, cdrs.
Source code in telecom_net_sim.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
telecom_net_sim.build_topology ¶
build_topology()
Source code in telecom_net_sim.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | |
telecom_net_sim.build_subscribers ¶
build_subscribers(n: int = 5000) -> list[Subscriber]
Source code in telecom_net_sim.py
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | |
telecom_net_sim.gen_cdrs ¶
gen_cdrs(subs, cells, n: int = 60000) -> list[dict]
Source code in telecom_net_sim.py
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 | |
telecom_net_sim.main ¶
main(argv=None)
Source code in telecom_net_sim.py
1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 | |