Skip to content

Commit f67fe10

Browse files
committed
Prep networking-lab dir, doc + util
Signed-off-by: Harald Jensås <hjensas@redhat.com>
1 parent a140f72 commit f67fe10

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

scenarios/networking-lab/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Networking Lab Scenarios
2+
3+
This directory contains networking-focused lab scenarios designed for testing, development, and learning various network topologies and configurations without requiring a full OpenShift deployment.
4+
5+
## Available Scenarios
6+
7+
### devstack-nxsw-vxlan
8+
A spine-and-leaf Cisco NX-OS topology with VXLAN overlay capabilities, featuring:
9+
- 4 Cisco NX-OS switches (2 spine, 2 leaf)
10+
- Devstack node for OpenStack development
11+
- Ironic nodes for bare metal provisioning
12+
- VXLAN/EVPN ready configuration
13+
14+
See [devstack-nxsw-vxlan/README.md](devstack-nxsw-vxlan/README.md) for detailed documentation.
15+
16+
## Managing POAP Scripts
17+
18+
All POAP scripts (`*-poap.py`) in networking lab scenarios include md5sum validation. Use the `manage-poap-md5sums.sh` script to automatically update md5sums after modifying any POAP scripts:
19+
20+
```bash
21+
./scenarios/networking-lab/manage-poap-md5sums.sh
22+
```
23+
24+
This script:
25+
- Finds all `*-poap.py` files in networking-lab scenarios
26+
- Removes old md5sum lines
27+
- Calculates and adds new md5sum lines
28+
- Runs automatically via pre-commit hooks
29+
30+
## Contributing
31+
32+
When adding new networking lab scenarios:
33+
1. Create a descriptive directory name
34+
2. Follow the existing file structure
35+
3. Include comprehensive README documentation
36+
4. Document network topology with diagrams (SVG preferred)
37+
5. Provide example configurations and validation steps
38+
6. Include troubleshooting guidance
39+
7. If using POAP scripts, name them `*-poap.py` for automatic md5sum management
40+
41+
## Related Documentation
42+
43+
- [Main Scenarios README](../README.md)
44+
- [Hotstack Documentation](../../README.md)
45+
- [Switch Configuration Guide](../../docs/virtual_switches.md)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
# Script to manage POAP md5sums for all *-poap.py files in networking-lab scenarios
3+
# This script: removes md5sum -> restores md5sum for each POAP file
4+
5+
set -e
6+
7+
# Find the script directory
8+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
10+
# Find all *-poap.py files recursively in networking-lab directory
11+
mapfile -t POAP_FILES < <(find "$SCRIPT_DIR" -name "*-poap.py" -type f | sort)
12+
13+
if [ ${#POAP_FILES[@]} -eq 0 ]; then
14+
echo "No *-poap.py files found in $SCRIPT_DIR"
15+
exit 0
16+
fi
17+
18+
echo "Processing ${#POAP_FILES[@]} POAP file(s)..."
19+
20+
for f in "${POAP_FILES[@]}"; do
21+
echo "Processing: $f"
22+
23+
# Step 1: Remove the md5sum line
24+
sed -i '/^# *md5sum=/d' "$f"
25+
26+
# Step 2: Restore and update the md5sum line
27+
# Insert the md5sum line after the shebang (line 2)
28+
sed -i '1a\#md5sum="placeholder"' "$f"
29+
30+
# Generate new md5sum excluding the md5sum line itself
31+
sed '/^# *md5sum=/d' "$f" > "$f.md5"
32+
33+
# Update the md5sum line with the correct hash
34+
sed -i "s/^# *md5sum=.*/# md5sum=\"$(md5sum "$f.md5" | sed 's/ .*//')\"/" "$f"
35+
36+
# Clean up temporary files
37+
rm -f "$f.md5"
38+
39+
echo " ✓ Updated md5sum for $f"
40+
done
41+
42+
echo "All POAP files processed successfully!"

0 commit comments

Comments
 (0)