This project uses the POX SDN controller:
https://github.com/MurphyMc/pox
Run the controller with:
python3 pox.py openflow.discovery forwarding.l2_learning SDN-Smart-Routing.Smart_Routing_Modulepox/
├── pox.py
├── sdn_smart_routing/
│ ├── __init__.py
│ └── Smart_Routing_Module.py
└── ...
⚠️ This project is based on legacy SDN libraries and is not fully compatible with Python 3.12 without version constraints. (Ubuntu 24 LTS)
Create a requirements.txt:
networkx>=2.0,<3.0
fnss==0.9.1
pyzmq
numpy>=1.21,<2.0
scipy>=1.7,<2.0
matplotlib
python-igraph
fastnumbers
mininetpip install "fnss==0.9.1" "networkx>=2.0,<3.0"and
apt install mininetThe graph is undirected, but dictionary keys depend on ordering.
(3, 2) != (2, 3)Always normalize edges:
edge = tuple(sorted(Edges[i]))def edge_key(e):
return tuple(sorted(e))Usage:
edge = edge_key(Edges[i])Edge normalization must be applied in:
-
CC computation loop
-
MTBF computation loop
-
MTTR computation loop
-
Any access to:
Links_Lengths_Dictionary[Edges[i]]
edge = tuple(sorted(Edges[i]))
cc.append(Links_Lengths_Dictionary[edge] / minimum)edge = tuple(sorted(Edges[i]))
MTBF.append((cc[i] * 365 * 24) / Links_Lengths_Dictionary[edge])edge = tuple(sorted(Edges[i]))
mttr = round(Links_Lengths_Dictionary[edge] * Gama[i])
if mttr < 1:
mttr = 1
MTTR.append(mttr)edge = tuple(sorted(Edges[i]))
L.append(
Links(
Edges[i],
i,
Links_Lengths_Dictionary[edge],
MTBF[i],
MTTR[i],
0, 0, 0, True
)
)numpy arrays used instead of scalars
TTF = np.random.exponential(scale=L[i].MTBF)
L[i].Next_Failure = round(TTF) + 1moderator = np.random.uniform(0.1, 0.9)Log_Normal = np.random.lognormal(mu, sig)
print(
'The link', L[link].ID,
'will wait up to', round(Log_Normal),
'to get recovery'
)TTF2 = np.random.exponential(scale=L[link_return].MTBF)Issues were caused by:
- Undirected graph edge ordering inconsistency
- Mixing numpy arrays and scalar values
- Deprecated SciPy API usage
- FNSS + NetworkX version mismatch
- Incompatibility with Python 3.12 ecosystem
For stable execution:
- Use Python ≤ 3.10 (recommended: 3.7)
- Normalize all edges using
tuple(sorted(edge)) - Ensure all stochastic outputs are scalars
- Avoid numpy arrays in scheduling logic
- Use compatible versions of NetworkX and FNSS