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
Much of the schema is based on the [Infrahub schema library](https://github.com/opsmill/schema-library), which provides reusable schema components for quickly scaffolding a schema.
@@ -240,6 +338,7 @@ The generator is a powerful feature of Infrahub that allows you to codify the ru
240
338
We want to build the generator with the concept of **idempotency** in mind, meaning it should be repeatable: it assigns resources the first time it runs, and if run again, it changes nothing if the desired state is already achieved. This approach ensures the code is robust and predictable.
241
339
242
340
Infrahub provides a set of features to help:
341
+
243
342
- Resource manager: It allows users to create pools and allocate resources from them, such as prefixes, IP addresses, or even numbers. We will use this feature to allocate our prefixes/vlan in a branch-agnostic and idempotent way. Learn more about [resource managers](https://docs.infrahub.app/topics/resource-manager).
244
343
- `allow_upsert=True`: This parameter is provided when saving the node, allowing it to be created if it doesn't exist or updated if it does. This is useful for ensuring that the generator can run multiple times without creating duplicates or errors.
245
344
@@ -502,10 +601,141 @@ class DedicatedInternetGenerator(InfrahubGenerator):
502
601
503
602
```
504
603
505
-
:::success
604
+
### Generator architecture patterns
605
+
606
+
1.**Resource Tracking**: Every allocation linked to the service
classDef service fill:#ffb6c1,stroke:#333,stroke-width:2px
622
+
623
+
%% Nodes
624
+
SR[Service Request]:::request
625
+
SP[Service Object]:::service
626
+
627
+
VP["VLAN Pool<br/>100-199"]:::pool
628
+
PP["Prefix Pool<br/>10.0.0.0/16"]:::pool
629
+
630
+
V[VLAN 142]:::resource
631
+
P["Prefix 10.0.42.0/28"]:::resource
632
+
SW["Switch Port<br/>ge-0/0/5"]:::resource
633
+
GW["Gateway IP<br/>10.0.42.1/28"]:::resource
634
+
635
+
%% Flow
636
+
SR -->|Creates| SP
637
+
SP -->|"Allocates from"| VP
638
+
SP -->|"Allocates from"| PP
639
+
VP -->|Provides| V
640
+
PP -->|Provides| P
641
+
SP -->|"Finds available"| SW
642
+
P -->|"First IP becomes"| GW
643
+
644
+
%% Assignments
645
+
V -.->|"Assigned to"| SP
646
+
P -.->|"Assigned to"| SP
647
+
SW -.->|"Assigned to"| SP
648
+
GW -.->|"Assigned to"| SP
649
+
```
506
650
507
-
At this stage, we have a generator that transforms a high-level service request into a complete service, sourcing resources from predefined pools with consistency and in just seconds.
651
+
### Summary: From request to reality
508
652
509
-
:::
653
+
The generator transforms a service request:
654
+
655
+
```yaml
656
+
Service: DI-12345
657
+
Location: Atlanta
658
+
Bandwidth: 1 Gbps
659
+
IP Package: Medium
660
+
```
661
+
662
+
Into fully provisioned infrastructure:
663
+
664
+
- VLAN 142 allocated and configured
665
+
- IP prefix 10.0.42.0/28 assigned
666
+
- Switch port ge-0/0/5 configured
667
+
- Router interface vlan_142 with IP 10.0.42.1/28
668
+
669
+
All in seconds, consistently, and idempotently!
510
670
511
671
<ReferenceLink title="Learn about Infrahub generators" url="https://docs.infrahub.app/topics/generator" openInNewTab/>
672
+
673
+
## The service portal architecture
674
+
675
+
### Streamlit for the user interface
676
+
677
+
The demo uses [Streamlit](https://streamlit.io/) for the user interface because it:
678
+
679
+
- Builds web UIs with pure Python (no JavaScript required)
680
+
- Provides ready-made components for forms and data display
681
+
- Integrates seamlessly with the Infrahub Python SDK
682
+
- Enables rapid prototyping of service catalogs
683
+
684
+
### Portal design patterns
685
+
686
+
#### Infrahub SDK integration
687
+
688
+
The portal uses several patterns to efficiently interact with Infrahub:
- Additional service types (MPLS, Cloud Connect, etc.)
727
+
- Approval workflows with human checkpoints
728
+
- Integration with ITSM platforms
729
+
- Automated testing of provisioned services
730
+
- Rollback and decommissioning automation
731
+
732
+
## Next steps
733
+
734
+
Now that you understand the architecture:
735
+
736
+
1. **Run the Demo**: Follow the [installation guide](installation) to set up locally
737
+
2. **Try the Portal**: Walk through the [user experience](user-walkthrough)
738
+
3. **Explore Further**: Modify the schema or create new service types
739
+
4. **Build Your Own**: Apply these patterns to your infrastructure needs
740
+
741
+
The combination of Infrahub's flexible schema, powerful generators, and Python-based portals enables you to build sophisticated service automation tailored to your organization's needs.
0 commit comments