Skip to content

Commit b586e91

Browse files
Merge branch 'PalisadoesFoundation:main' into feature/Typescript-Type-Checking/Eslint-linting
2 parents 84fb794 + 2c7ff84 commit b586e91

7 files changed

Lines changed: 201 additions & 168 deletions

File tree

docs/internships/reports/gsoc/2025-abhi.md

Lines changed: 102 additions & 92 deletions
Large diffs are not rendered by default.

docs/internships/reports/gsoc/2025-abhishek.md

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
22
id: 2025-abhishek
33
title: GSoC 2025 - Abhishek Raj
4-
sidebar_position: 7
4+
sidebar_position: 202507
55
---
66

7-
87
**Project:** Enhanced SwitchMap-NG Scalability
98
**Contributor:** [Abhishek Raj](https://github.com/abbi4code)
109
**Mentors:** [Aashima Wadhwa](https://github.com/aashimawadhwa), [Dominic Mills](https://github.com/DMills27)
1110
**Organization:** [The Palisadoes Foundation](https://github.com/PalisadoesFoundation/)
1211
**Duration:** June–October 2025
1312

1413
### About me
15-
I’m **Abhishek Raj**, a **final-year student at NIT Durgapur** with a strong interest in backend engineering and distributed systems.
14+
15+
I’m **Abhishek Raj**, a **final-year student at NIT Durgapur** with a strong interest in backend engineering and distributed systems.
1616
I started my open-source journey with the Palisadoes Foundation in December 2024, where I made my first contributions and grew into the workflow.
1717

1818
### Project Goals
@@ -29,23 +29,27 @@ When I began this project, Switchmap-NG faced several critical challenges:
2929

3030
My GSoC project focused on modernizing Switchmap-NG through four key initiatives:
3131

32-
**1. Legacy Synchronous Architecture**:
33-
- Current SNMP polling system relied on the deprecated EasySNMP library and synchronous operations, causing performance bottlenecks.
34-
- Replacing `EasySNMP` with `PySNMP`'s async API for non-blocking operations, enabling efficient polling of thousands of devices.
32+
**1. Legacy Synchronous Architecture**:
33+
34+
- Current SNMP polling system relied on the deprecated EasySNMP library and synchronous operations, causing performance bottlenecks.
35+
- Replacing `EasySNMP` with `PySNMP`'s async API for non-blocking operations, enabling efficient polling of thousands of devices.
36+
37+
**2. Removed resource intensive multiprocessing**:
3538

36-
**2. Removed resource intensive multiprocessing**:
3739
- Replaced the legacy **CPU-bound** multiprocessing design with a fully asynchronous polling architecture using Python’s asyncio.
3840
- Implemented semaphore-based device polling control
3941
- Removed legacy code and consolidated async implementations
4042

4143
**3. Feature Enhancements**
44+
4245
- Added **multi-vendor** system monitoring (CPU/memory for Cisco and Juniper)
4346
- Extended **interface statistics** with comprehensive packet/byte counters
4447
- Implemented GraphQL hostname-based device lookup
4548

4649
**4. Developer Experience**
50+
4751
- Created **automated setup scripts** for complete deployment
48-
- Written and expanded test coverage with async tests from 50% to 85%.
52+
- Written and expanded test coverage with async tests from 50% to 85%.
4953
- **Improved documentation** and contributor onboarding
5054

5155
### Completed Work
@@ -54,7 +58,7 @@ My GSoC project focused on modernizing Switchmap-NG through four key initiatives
5458

5559
- Complete migration of SNMP polling infrastructure from synchronous EasySNMP to **asynchronous PySnmp**. This foundational change enabled all subsequent **performance improvements**.
5660
- MIB queries and collectors converted to async with controlled concurrency, lazy data loading, safer merging, improved error/log handling, and **better** SNMPv1/v2/v3 timeout/fallback behavior.
57-
- **Resolved** polling freeze when encountering invalid OID prefixes during SNMP walks and fixed leading dot OID parsing.
61+
- **Resolved** polling freeze when encountering invalid OID prefixes during SNMP walks and fixed leading dot OID parsing.
5862

5963
2. [[GSoC]: Replace bottleneck multiprocessing with async for device polling & fix failing tests in CI ](https://github.com/PalisadoesFoundation/switchmap-ng/pull/334)
6064

@@ -77,42 +81,46 @@ My GSoC project focused on modernizing Switchmap-NG through four key initiatives
7781
- Reworked insert_row/update_row to build insert/update dicts incrementally and encode oui/organization bytes only when non-null.
7882
- Added resolve_device_by_hostname(obj, info, hostname=None) (returns None for falsy hostnames, UTF‑8 encodes hostname, queries Device where enabled==1 ordered by ts_created desc). Exposed deviceByHostname(hostname: String) on Query and wired the resolver.
7983
- Added L1Interface fields: ifin_octets, ifout_octets, ifin_nucast_pkts, ifout_nucast_pkts, ifout_errors, ifout_discards. Updated RL1Interface row mapping to include new fields.
80-
- Populates new L1 interface fields when constructing IL1Interface rows during device ingest/update.
84+
- Populates new L1 interface fields when constructing IL1Interface rows during device ingest/update.
8185
- Updated fixtures, seeded data, and expectations to include new per-interface fields. Adjusted IL1Interface constructions and L1Interface tuple size expectations.
8286

8387
5. [[GSoC]: Increased SNMP poller test coverage with comprehensive async tests ](https://github.com/PalisadoesFoundation/switchmap-ng/pull/350)
8488

8589
- **Increased test coverage** across multiple SNMP modules
86-
- Restrict _oid_valid_format to reject OIDs where any octet (after the initial empty segment) has leading or trailing whitespace (function returns False for such octets), preserving integer parsing otherwise.
90+
- Restrict \_oid_valid_format to reject OIDs where any octet (after the initial empty segment) has leading or trailing whitespace (function returns False for such octets), preserving integer parsing otherwise.
8791

8892
6. [[GSoC]: add automated setup script for complete Switchmap deployment](https://github.com/PalisadoesFoundation/switchmap-ng/pull/360)
8993

9094
- Added a complete set of **management scripts** (setup.sh, start.sh, stop.sh, restart.sh, status.sh, logs.sh, cleanup.sh) that automate the entire Switchmap-NG lifecycle from initial setup to daily operations.
91-
- **One-Command Setup** Implemented with setup.sh with Docker MySQL as well (*opt local mysql usage also supports) support that handles the entire installation process - from prerequisite checks to database initialization, dependency installation, and service startup - reducing setup time from manual hours to a single command.
92-
- Added service Lifecycle Scripts and New lifecycle scripts to start/stop/restart services and frontend, manage PIDs, validate health and ports, check MySQL accessibility, and display colored status summaries and quick commands. Logs & Cleanup scripts/logs.sh, scripts/cleanup.sh logs.sh tails service-specific or aggregated logs; cleanup.sh provides interactive, flag-driven cleanup for var, venv, etc/config.yaml, frontend node_modules, and Docker containers/volumes with confirmation prompts and status messages.
93-
- Converted many SNMP tests modules to async (IsolatedAsyncioTestCase) expanded mocks and assertions to exercise SNMP GET/swalk/walk, VLAN/MAC/context handling, error/edge cases, and added Juniper process tests.
95+
- **One-Command Setup** Implemented with setup.sh with Docker MySQL as well (\*opt local mysql usage also supports) support that handles the entire installation process - from prerequisite checks to database initialization, dependency installation, and service startup - reducing setup time from manual hours to a single command.
96+
- Added service Lifecycle Scripts and New lifecycle scripts to start/stop/restart services and frontend, manage PIDs, validate health and ports, check MySQL accessibility, and display colored status summaries and quick commands. Logs & Cleanup scripts/logs.sh, scripts/cleanup.sh logs.sh tails service-specific or aggregated logs; cleanup.sh provides interactive, flag-driven cleanup for var, venv, etc/config.yaml, frontend node_modules, and Docker containers/volumes with confirmation prompts and status messages.
97+
- Converted many SNMP tests modules to async (IsolatedAsyncioTestCase) expanded mocks and assertions to exercise SNMP GET/swalk/walk, VLAN/MAC/context handling, error/edge cases, and added Juniper process tests.
9498

9599
### Current State
96100

97101
**Async SNMP Infrastructure**
102+
98103
- Fully migrated to PySnmp with async/await
99104
- Concurrent device polling with configurable limits
100105
- Robust error handling and retry logic
101106
- Comprehensive logging and monitoring
102107

103108
**Multi-Vendor Support**
109+
104110
- Generic RFC-standard MIBs (IF, BRIDGE, LLDP, Q-BRIDGE, ENTITY, etc.)
105111
- Cisco-specific MIBs (CDP, VTP, STACK, PROCESS, etc.)
106112
- Juniper-specific MIBs (VLAN, PROCESS)
107113
- Extensible architecture for additional vendors
108114

109115
**System Monitoring & Interface Statistics**
116+
110117
- CPU utilization tracking (5-minute average)
111118
- Memory usage monitoring (used/free)
112119
- Comprehensive packet counters (unicast, non-unicast)
113120
- Byte counters (inbound, outbound) & Error and discard tracking
114121

115122
**Developer Experience**
123+
116124
- One-command automated setup
117125
- Comprehensive documentation
118126
- Service management scripts
@@ -128,28 +136,30 @@ My GSoC project focused on modernizing Switchmap-NG through four key initiatives
128136
- **API Response Time**: under 100ms for typical queries
129137
- **Setup Time**: 3-5 minutes (down from 2-3 hours)
130138

131-
132139
### What Remains
133140

134141
While the project has achieved its primary goals and delivered a production-ready async monitoring system, there are still exciting opportunities for future enhancements that will extend Switchmap-NG's capabilities:
135142

136143
**Distributed Architecture with Store-and-Forward**:
144+
137145
- The current architecture works well for centralized deployments, but could be enhanced for distributed scenarios where pollers may have intermittent connectivity to the central API server.
138146
- Test coverage has been significantly improved from around 50% to 85%. However, achieving full coverage remains challenging since some core SNMP polling components involve complex asynchronous flows and low-level network interactions. Ongoing work focuses on building reliable test harnesses and mocks for these components to reach the 100% goal.
139147

140148
### Challenges and Lessons Learned
141149

142150
1. **Handling Real-World SNMP Data**
151+
143152
- SNMP responses were often malformed or encoded inconsistently across libraries. For instance, whitespace within OIDs or double-encoded MAC addresses caused silent failures and data mismatches. These edge cases revealed the importance of strict input validation and careful data decoding when migrating from EasySNMP to PySNMP.
144-
**Lesson:** Never assume external data is clean. Validate everything at the boundaries, it’s far easier to fail early than debug downstream corruption.
153+
**Lesson:** Never assume external data is clean. Validate everything at the boundaries, it’s far easier to fail early than debug downstream corruption.
145154

146155
2. **From Multiprocessing to Async Concurrency**
147-
The legacy multiprocessing model didn’t translate directly to async patterns. Replacing process pools with semaphores and refactoring shared state into async-safe structures took significant design effort. Adopting async context managers and using aiohttp for non-blocking HTTP calls ultimately simplified resource management.
148-
**Lesson:** Asyncio and multiprocessing solve different problems understanding when and how to use each is crucial for scalability and stability.
156+
The legacy multiprocessing model didn’t translate directly to async patterns. Replacing process pools with semaphores and refactoring shared state into async-safe structures took significant design effort. Adopting async context managers and using aiohttp for non-blocking HTTP calls ultimately simplified resource management.
157+
**Lesson:** Asyncio and multiprocessing solve different problems understanding when and how to use each is crucial for scalability and stability.
149158

150159
3. **Complexity of Async Testing**
160+
151161
- Testing asynchronous code was far more challenging than expected. The initial test suite, built for synchronous behavior, didn’t work well with async patterns. I had to think in different way for mocking async methods, and design new test flows to validate concurrency and async-safe resource handling.
152-
**Lesson:** Async systems demand a new mindset for testing. Once the right patterns are in place, async tests can be just as reliable and even faster to execute.
162+
**Lesson:** Async systems demand a new mindset for testing. Once the right patterns are in place, async tests can be just as reliable and even faster to execute.
153163

154164
### Conclusion
155165

@@ -158,4 +168,4 @@ The legacy multiprocessing model didn’t translate directly to async patterns.
158168
### Acknowledgements
159169

160170
- I'm incredibly grateful to my mentors **Aashima Wadhwa**, **Dominic Mills**, and **Peter Harrison** for their guidance and support throughout this project. Their feedback and code reviews were invaluable in shaping my work and pushing me to grow as a developer.
161-
- A huge shoutout to my fellow mentee **Abhi** as well for sharing ideas & feedback with each other and tackling challenges together made this journey so much more enjoyable and rewarding.
171+
- A huge shoutout to my fellow mentee **Abhi** as well for sharing ideas & feedback with each other and tackling challenges together made this journey so much more enjoyable and rewarding.

0 commit comments

Comments
 (0)