Skip to content

Commit 377bdf1

Browse files
committed
Merge branch 'service_path_visual' into 'main'
updated version of segment_path view displaying terminations of circuits as... See merge request 701/netbox/cesnet_service_path_plugin!40
2 parents 91694c3 + 28f6e5b commit 377bdf1

20 files changed

+1682
-33
lines changed

CHANGELOG.md

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,82 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [5.2.0] - TBD
8+
## [5.2.1] - 2025-11-07
9+
10+
### Added
11+
- **Topology Visualization**: Interactive network topology visualization using Cytoscape.js
12+
- Visual representation of segment connections and circuit terminations
13+
- Multi-topology support for service paths with multiple segments
14+
- Automatic topology generation for both segments and service paths
15+
- Clean NetBox Blue styled visualization with gradients and shadows
16+
- Interactive topology viewer with hover tooltips showing node details
17+
- Topology visualization integrated into segment and service path detail views
18+
- Topology visualization added to circuit detail pages showing related segments/service paths
19+
- Toggle between multiple topologies when segment belongs to multiple service paths
20+
21+
- **Commitment End Date Tracking**: Enhanced financial commitment monitoring
22+
- Automatic calculation of commitment end date based on install date and commitment period
23+
- Color-coded commitment status indicators:
24+
- Red: More than 30 days until end
25+
- Orange: Within 30 days of end
26+
- Green: Commitment period has ended
27+
- Gray: No commitment period set
28+
- Interactive tooltips showing days remaining until commitment end
29+
- Visual feedback for commitment periods that have ended
30+
- Commitment end date displayed in segment detail view with badge styling
31+
- GraphQL API support for commitment end dates with ISO format
32+
33+
### Changed
34+
- **Circuit Extensions Refactoring**: Improved code organization
35+
- Renamed `CircuitKomoraSegmentExtension` to `CircuitSegmentExtension` for better naming consistency
36+
- Enhanced circuit detail view with topology visualization support
37+
- Better separation of concerns in template content extensions
38+
- Circuit pages now show topology visualizations for associated segments
39+
40+
- **Currency Field Enhancement**: Made charge_currency field required
41+
- Removed default currency value to ensure explicit currency selection
42+
- Migration `0031` updates currency field constraints
43+
- Currency must now be explicitly set when creating financial information
44+
- Prevents accidental use of default currency when not intended
45+
46+
- **Table Improvements**: Enhanced data presentation
47+
- Circuit column in SegmentCircuitMappingTable now orders by CID instead of name
48+
- Improved ordering logic for better data organization and searchability
49+
50+
- **Version Update**: Updated to version 5.2.1b5 in pyproject.toml
51+
52+
### Fixed
53+
- Added missing `python-dateutil` dependency to pyproject.toml for date calculations
54+
- Improved commitment end date calculation with proper timezone handling using `django.utils.timezone`
55+
- Enhanced tooltip rendering with proper Bootstrap integration
56+
- Fixed tooltip data attributes for proper display of commitment information
57+
58+
### Technical Details
59+
- New utility module `utils_topology.py` with `TopologyBuilder` class for generating network graphs
60+
- Cytoscape.js (v3.28.1) integration for advanced graph visualization
61+
- Reusable topology visualization templates:
62+
- `topology_visualization.html` - Core Cytoscape includes and initialization
63+
- `topology_segment_card.html` - Topology display card with multi-topology support
64+
- `topology_styles.html` - Styling for topology containers and tooltips
65+
- Support for multiple topologies on single page with tab switching functionality
66+
- Topology data stored as JSON and rendered client-side for performance
67+
- Color-coding system for commitment status based on time remaining (30-day threshold)
68+
- New GraphQL field resolver for `commitment_end_date` with ISO format output
69+
- Template extensions now check for service path membership to generate appropriate topologies
70+
71+
### Migration Notes
72+
- **Migration 0031**: Updates `charge_currency` field to remove default value - requires explicit currency selection
73+
- **New Dependencies**: Added `python-dateutil` for relativedelta calculations in commitment period tracking
74+
- **Template Updates**: New topology visualization templates require Cytoscape.js CDN (included automatically)
75+
- **API Changes**: GraphQL API now includes `commitment_end_date` field in SegmentFinancialInfoType
76+
77+
### Upgrade Instructions
78+
1. Run migrations: `python manage.py migrate cesnet_service_path_plugin`
79+
2. Install new dependency: `pip install python-dateutil` (or upgrade plugin package)
80+
3. Update existing financial records to set currency explicitly if using default
81+
4. Refresh browser cache to load new topology visualization assets
82+
83+
## [5.2.0] - 2025-10-29
984

1085
### Added
1186
- **Financial Information Management**: New segment financial tracking system

README.md

Lines changed: 123 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CESNET ServicePath Plugin for NetBox
22

3-
A NetBox plugin for managing service paths and segments in network infrastructure with advanced geographic path visualization and financial tracking.
3+
A NetBox plugin for managing service paths and segments in network infrastructure with advanced geographic path visualization, interactive topology visualization, and financial tracking.
44

55
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
66
[![PyPI version](https://img.shields.io/pypi/v/cesnet-service-path-plugin.svg)](https://pypi.org/project/cesnet-service-path-plugin/)
@@ -21,6 +21,7 @@ A NetBox plugin for managing service paths and segments in network infrastructur
2121
- [Custom Kind Choices](#custom-kind-choices)
2222
- [Currency Configuration](#currency-configuration)
2323
- [Geographic Path Data](#geographic-path-data)
24+
- [Topology Visualization](#topology-visualization)
2425
- [Financial Information Management](#financial-information-management)
2526
- [API Usage](#api-usage)
2627
- [Development](#development)
@@ -32,9 +33,11 @@ A NetBox plugin for managing service paths and segments in network infrastructur
3233
## Overview
3334

3435
The CESNET ServicePath Plugin extends NetBox's capabilities by providing comprehensive network service path management with:
35-
- Interactive geographic path visualization using Leaflet maps, introduced in version 5.0.x
36+
- Interactive geographic path visualization using Leaflet maps (introduced in version 5.0.x)
37+
- **Interactive topology visualization using Cytoscape.js** (new in 5.2.1)
3638
- Support for KML, KMZ, and GeoJSON path data
37-
- **Financial information tracking for segments** (new in 5.2.0)
39+
- **Financial information tracking for segments** (introduced in 5.2.0)
40+
- **Commitment end date tracking with visual indicators** (new in 5.2.1)
3841
- Service path and segment relationship management
3942
- Advanced filtering and search capabilities
4043
- REST API and GraphQL support
@@ -56,6 +59,7 @@ The CESNET ServicePath Plugin extends NetBox's capabilities by providing compreh
5659
- Track service path status and metadata
5760
- Link multiple segments to create complete paths
5861
- Visual relationship mapping
62+
- **Interactive topology visualization** showing complete service path topology
5963

6064
### Segment Management
6165
- Track network segments between locations
@@ -65,13 +69,35 @@ The CESNET ServicePath Plugin extends NetBox's capabilities by providing compreh
6569
- **One-click Circuit generation** from Segment data with auto-filled forms
6670
- Automatic status tracking based on dates
6771
- **Geographic path visualization with actual route data**
72+
- **Interactive topology visualization** showing segment connections and circuit terminations
6873
- Segment types (dark fiber, optical spectrum, ethernet) with type specific data
69-
- **Financial information tracking with multi-currency support** (new in 5.2.0)
74+
- **Financial information tracking with multi-currency support**
75+
- **Commitment end date tracking** with color-coded status indicators (new in 5.2.1)
76+
77+
### Topology Visualization (New in 5.2.1)
78+
- **Interactive network topology graphs** powered by Cytoscape.js
79+
- **Automatic topology generation** for segments and service paths
80+
- **Visual representation** of segment connections, circuits, and terminations
81+
- **Multi-topology support** - view multiple service paths when a segment belongs to multiple paths
82+
- **Clean NetBox Blue styling** with gradients and modern design
83+
- **Interactive hover tooltips** displaying detailed node information
84+
- **Integrated views**:
85+
- Segment detail pages show segment topology or service path topology
86+
- Service path detail pages show complete path topology
87+
- Circuit detail pages show topologies for related segments/service paths
88+
- **Toggle between topologies** when multiple topologies are available
7089

7190
### Financial Information Management
7291
- **Monthly charge tracking** with configurable currencies
7392
- **Non-recurring charge** (one-time setup/installation fees)
7493
- **Commitment period** tracking in months
94+
- **Commitment end date** automatic calculation and tracking (new in 5.2.1)
95+
- **Visual commitment status indicators** with color coding:
96+
- 🔴 Red: More than 30 days remaining
97+
- 🟠 Orange: Within 30 days of expiration
98+
- 🟢 Green: Commitment period ended
99+
- ⚫ Gray: No commitment period set
100+
- **Interactive tooltips** showing days remaining until commitment end
75101
- **Automatic cost calculations**:
76102
- Total commitment cost (monthly × commitment period)
77103
- Total cost including setup fees
@@ -117,10 +143,11 @@ The CESNET ServicePath Plugin extends NetBox's capabilities by providing compreh
117143
- **Financial information** (optional one-to-one relationship)
118144
- Automated status monitoring
119145

120-
### Segment Financial Info (New in 5.2.0)
146+
### Segment Financial Info
121147
- **Monthly charges** with currency selection
122148
- **Non-recurring charges** for setup/installation
123-
- **Commitment period** tracking
149+
- **Commitment period** tracking in months
150+
- **Commitment end date** automatic calculation (new in 5.2.1)
124151
- **Automatic cost calculations**
125152
- **Notes** field for additional financial context
126153
- **Permission-based visibility**
@@ -438,6 +465,52 @@ PLUGINS_CONFIG = {
438465
- **Overlapping segment handling** with selection popups
439466
- **Status-based color coding** for visual identification
440467

468+
## Topology Visualization
469+
470+
### Overview (New in 5.2.1)
471+
472+
The plugin includes interactive network topology visualization using Cytoscape.js, providing a graph-based view of your network segments, circuits, and their interconnections.
473+
474+
### Features
475+
476+
- **Automatic topology generation**: Topologies are automatically generated for segments and service paths
477+
- **Interactive graph visualization**: Pan, zoom, and hover over nodes to see details
478+
- **Multi-topology support**: When a segment belongs to multiple service paths, you can toggle between different topology views
479+
- **Clean visual design**: NetBox Blue themed styling with gradients and modern aesthetics
480+
- **Node information**: Hover tooltips display detailed information about locations, circuits, and segments
481+
482+
### Where Topologies Appear
483+
484+
Topologies are automatically displayed in:
485+
486+
1. **Segment Detail Pages**:
487+
- Shows segment topology with connected circuits and terminations
488+
- If segment belongs to service paths, shows service path topology instead
489+
- Multiple topology tabs if segment is part of multiple service paths
490+
491+
2. **Service Path Detail Pages**:
492+
- Shows complete service path topology
493+
- Visualizes all segments in the path and their connections
494+
495+
3. **Circuit Detail Pages**:
496+
- Shows topology for segments associated with the circuit
497+
- Displays service path topology if the segment belongs to a service path
498+
499+
### Topology Components
500+
501+
Topologies visualize:
502+
- **Location nodes**: Sites and locations where segments terminate
503+
- **Circuit nodes**: Circuits connected to segments
504+
- **Circuit termination nodes**: A-side and B-side terminations
505+
- **Edges**: Connections between nodes showing network relationships
506+
507+
### Technical Details
508+
509+
- Uses Cytoscape.js v3.28.1 for graph rendering
510+
- Client-side rendering for performance
511+
- Responsive design adapts to different screen sizes
512+
- Automatic layout algorithms for optimal node placement
513+
441514
## Financial Information Management
442515

443516
### Adding Financial Information
@@ -458,10 +531,28 @@ Financial information can be added to any segment through the segment detail vie
458531
Financial information is displayed on the segment detail page for users with view permissions:
459532
- Monthly charge with currency
460533
- Non-recurring charge (if applicable)
461-
- Commitment period
534+
- Commitment period in months
535+
- **Commitment end date** with color-coded status badge (new in 5.2.1)
462536
- Automatically calculated total costs
463537
- Additional notes
464538

539+
### Commitment End Date Tracking (New in 5.2.1)
540+
541+
The plugin automatically calculates and tracks commitment end dates:
542+
543+
- **Automatic calculation**: Based on segment install date + commitment period
544+
- **Visual status indicators** with color coding:
545+
- 🔴 **Red badge**: More than 30 days until commitment ends
546+
- 🟠 **Orange badge**: Within 30 days of commitment end (action required soon)
547+
- 🟢 **Green badge**: Commitment period has ended
548+
- ⚫ **Gray badge**: No commitment period set or install date not defined
549+
- **Interactive tooltips**: Hover over the badge to see:
550+
- Exact commitment end date
551+
- Days remaining until expiration
552+
- Status message
553+
554+
**Note**: Commitment end date is calculated when both the segment install date and commitment period are set. If the install date is missing, a gray badge indicates that the date will be calculated once the install date is defined.
555+
465556
### Permission Requirements
466557

467558
Financial information has separate permissions from segments:
@@ -506,6 +597,7 @@ Segment API responses include a `financial_info` field:
506597
"charge_currency": "EUR",
507598
"non_recurring_charge": "5000.00",
508599
"commitment_period_months": 36,
600+
"commitment_end_date": "2028-11-07",
509601
"total_commitment_cost": "36000.00",
510602
"total_cost_including_setup": "41000.00",
511603
"notes": "Special discount applied"
@@ -563,6 +655,21 @@ query {
563655
}
564656
}
565657
}
658+
659+
# Query financial information with commitment end date (new in 5.2.1)
660+
query {
661+
segment_list {
662+
id
663+
name
664+
financialInfo {
665+
monthlyCharge
666+
chargeCurrency
667+
commitmentPeriodMonths
668+
commitmentEndDate
669+
totalCommitmentCost
670+
}
671+
}
672+
}
566673
```
567674

568675
#### GraphQL Features
@@ -572,6 +679,7 @@ query {
572679
- **Advanced filtering**: Status, dates, providers, sites, path data availability
573680
- **Nested relationships**: Query related circuits, providers, locations in single request
574681
- **Type-specific data**: Query segment type information and technical specifications
682+
- **Commitment tracking**: Query commitment end dates and financial calculations (new in 5.2.1)
575683

576684
## Development
577685

@@ -605,7 +713,7 @@ sudo apt-get install gdal-bin libgdal34 libgeos-c1t64 libproj25
605713
brew install gdal geos proj
606714
607715
# Install Python packages
608-
pip install geopandas fiona shapely
716+
pip install geopandas fiona shapely python-dateutil
609717
```
610718

611719
**Note**: For development, you typically only need the runtime libraries. The Python packages (geopandas, fiona, shapely) use precompiled wheels that already include the necessary bindings. Development headers (`-dev` packages) are only needed if you're compiling these libraries from source.
@@ -637,11 +745,13 @@ The plugin adds a **Service Paths** menu with:
637745
- **Quick action buttons**: Add and Import shortcuts in navigation menu
638746
- **Bulk operations**: Edit, delete, and import multiple records at once
639747
- **Advanced search**: Full-text search across names, comments, network labels, and path notes
748+
- **Topology visualization cards**: Interactive network graphs on detail pages (new in 5.2.1)
749+
- **Commitment status badges**: Color-coded indicators for financial commitments (new in 5.2.1)
640750

641751
### Template Extensions
642752

643753
Automatic integration with existing NetBox models:
644-
- **Circuit pages**: Show related segments
754+
- **Circuit pages**: Show related segments with topology visualization (enhanced in 5.2.1)
645755
- **Provider pages**: List provider segments
646756
- **Site/Location pages**: Display connected segments
647757
- **Tenant pages**: Show associated provider information
@@ -652,6 +762,7 @@ Financial information appears on segment detail pages when:
652762
- User has view permission
653763
- Segment has financial information attached
654764
- Displayed in a dedicated panel with all cost details and calculations
765+
- Shows commitment end date with color-coded status badge (new in 5.2.1)
655766

656767
## Troubleshooting
657768

@@ -664,6 +775,8 @@ Financial information appears on segment detail pages when:
664775
5. **Library version mismatch**: If you encounter errors about missing libraries, check that library package names match your OS version (e.g., `libgdal34` vs `libgdal32`)
665776
6. **Financial info not visible**: Check user permissions for `view_segmentfinancialinfo`
666777
7. **Currency not appearing**: Verify plugin configuration in `configuration/plugins.py`
778+
8. **Topology not rendering**: Check browser console for Cytoscape.js CDN errors (new in 5.2.1)
779+
9. **Commitment end date not showing**: Ensure segment has both install date and commitment period defined (new in 5.2.1)
667780

668781
### Debug Mode
669782

@@ -684,6 +797,7 @@ LOGGING = {
684797
- Created using [Cookiecutter](https://github.com/audreyr/cookiecutter) and [`netbox-community/cookiecutter-netbox-plugin`](https://github.com/netbox-community/cookiecutter-netbox-plugin)
685798
- Based on the [NetBox plugin tutorial](https://github.com/netbox-community/netbox-plugin-tutorial)
686799
- Geographic features powered by [GeoPandas](https://geopandas.org/), [Leaflet](https://leafletjs.com/), and [PostGIS](https://postgis.net/)
800+
- Topology visualization powered by [Cytoscape.js](https://js.cytoscape.org/)
687801

688802
## License
689803

cesnet_service_path_plugin/api/serializers/segment_financial_info.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class Meta:
3838
"charge_currency",
3939
"non_recurring_charge",
4040
"commitment_period_months",
41+
"commitment_end_date",
4142
"notes",
4243
"total_commitment_cost",
4344
"total_cost_including_setup",

cesnet_service_path_plugin/graphql/types.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ def total_cost_including_setup(self, info) -> Optional[Decimal]:
6464
"""Total cost including non-recurring charge - only if user has permission"""
6565
return self.total_cost_including_setup
6666

67+
@field
68+
def commitment_end_date(self, info) -> Optional[str]:
69+
"""Calculate the end date of the commitment period - only if user has permission"""
70+
end_date = self.commitment_end_date
71+
if end_date:
72+
return end_date.isoformat()
73+
return None
74+
6775

6876
@strawberry_django_type(Segment, filters=SegmentFilter)
6977
class SegmentType(NetBoxObjectType):
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.2.7 on 2025-11-06 17:08
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('cesnet_service_path_plugin', '0030_alter_segment_location_a_alter_segment_location_b'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='segmentfinancialinfo',
15+
name='charge_currency',
16+
field=models.CharField(max_length=3),
17+
),
18+
]

0 commit comments

Comments
 (0)