You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- 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%.
49
53
-**Improved documentation** and contributor onboarding
50
54
51
55
### Completed Work
@@ -54,7 +58,7 @@ My GSoC project focused on modernizing Switchmap-NG through four key initiatives
54
58
55
59
- Complete migration of SNMP polling infrastructure from synchronous EasySNMP to **asynchronous PySnmp**. This foundational change enabled all subsequent **performance improvements**.
56
60
- 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.
58
62
59
63
2.[[GSoC]: Replace bottleneck multiprocessing with async for device polling & fix failing tests in CI ](https://github.com/PalisadoesFoundation/switchmap-ng/pull/334)
60
64
@@ -77,42 +81,46 @@ My GSoC project focused on modernizing Switchmap-NG through four key initiatives
77
81
- Reworked insert_row/update_row to build insert/update dicts incrementally and encode oui/organization bytes only when non-null.
78
82
- 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.
79
83
- 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.
81
85
- Updated fixtures, seeded data, and expectations to include new per-interface fields. Adjusted IL1Interface constructions and L1Interface tuple size expectations.
82
86
83
87
5.[[GSoC]: Increased SNMP poller test coverage with comprehensive async tests ](https://github.com/PalisadoesFoundation/switchmap-ng/pull/350)
84
88
85
89
-**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.
87
91
88
92
6.[[GSoC]: add automated setup script for complete Switchmap deployment](https://github.com/PalisadoesFoundation/switchmap-ng/pull/360)
89
93
90
94
- 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.
94
98
95
99
### Current State
96
100
97
101
**Async SNMP Infrastructure**
102
+
98
103
- Fully migrated to PySnmp with async/await
99
104
- Concurrent device polling with configurable limits
- Byte counters (inbound, outbound) & Error and discard tracking
114
121
115
122
**Developer Experience**
123
+
116
124
- One-command automated setup
117
125
- Comprehensive documentation
118
126
- Service management scripts
@@ -128,28 +136,30 @@ My GSoC project focused on modernizing Switchmap-NG through four key initiatives
128
136
-**API Response Time**: under 100ms for typical queries
129
137
-**Setup Time**: 3-5 minutes (down from 2-3 hours)
130
138
131
-
132
139
### What Remains
133
140
134
141
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:
135
142
136
143
**Distributed Architecture with Store-and-Forward**:
144
+
137
145
- 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.
138
146
- 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.
139
147
140
148
### Challenges and Lessons Learned
141
149
142
150
1.**Handling Real-World SNMP Data**
151
+
143
152
- 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.
145
154
146
155
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.
149
158
150
159
3.**Complexity of Async Testing**
160
+
151
161
- 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.
153
163
154
164
### Conclusion
155
165
@@ -158,4 +168,4 @@ The legacy multiprocessing model didn’t translate directly to async patterns.
158
168
### Acknowledgements
159
169
160
170
- 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