This is the second Tech Preview release with a lot of exciting updates:
Summary
- Support for Generic Model and Node Extensions in the schema.
- Visualize Diff between branches, in the API and in the Frontend
- Branch aware schema and idempotent schema endpoints
- Lots of updates related to the frontend : new forms, better views, support for Generic, better management of relationships
- Major refactoring and improvements of the Python SDK, it now supports both Sync and Async
This release introduces some breaking changes, please check the migration guide below
Schema
Generic Object
Generic Object introduce a concept of inheritance between models and allows users to create more specific objects with specific attributes or relationships without complicating the schema or the UI
As an example, the schema that we are using for the demo now defines a Generic Interface
model and 2 additional models for InterfaceL2
and InterfaceL3
. They both share all the properties of Interface
but they also have their own properties
- name: interface_l3
kind: InterfaceL3
display_labels:
- name__value
inherit_from: ["Interface", "Endpoint"]
relationships:
- name: ip_addresses
peer: IPAddress
optional: true
cardinality: many
kind: Component
- name: interface_l2
kind: InterfaceL2
display_labels:
- name__value
inherit_from: ["Interface", "Endpoint"]
attributes:
- name: l2_mode
label: Layer2 Mode
kind: Text
enum: ["Access", "Trunk"]
relationships:
- name: untagged_vlan
label: Untagged VLAN
peer: VLAN
optional: true
cardinality: one
kind: Component
identifier: interface_l2__untagged_vlan
- name: tagged_vlan
label: Tagged VLANs
peer: VLAN
optional: true
cardinality: one
kind: Component
identifier: interface_l2__tagged_vlan
Node Extensions
Node Extensions allows users to add an attribute or a relationship on an existing model.
The example below, show how to add a new rack model and extend the location model with a new racks
relationship
---
version: '1.0'
nodes:
- name: rack
kind: Rack
default_filter: name__value
display_labels:
- name__value
attributes:
- name: name
kind: Text
unique: true
[..]
relationships:
- name: location
peer: Location
optional: false
cardinality: one
kind: Attribute
[..]
extensions:
nodes:
- kind: Location
relationships:
- name: racks
peer: Rack
optional: true
cardinality: many
kind: Generic
Branch Aware Schema
With the infrahubctl schema load
command, it's now possible to update the schema on any given branch and it's also possible to load the same schema multiple time without impact.
Schema Migrations not supported at this point which mean that if you update a part of the schema that is actively used by some nodes, the existing nodes won't be updated at this point. This feature is planned for the second part of 2023.
Diff Preview
This release introduces the first preview of the Diff view in the frontend and in the API to quickly visualize the changes between 2 branches.
At this time it's possible to visualize the changes in the graph and in the schema but not yet the changes done on the files as part of a git repository.
It's also possible to select the time to
and from
which the diff should be constructed.
Frontend
Hard to list all the improvements and the new features that have been added to the frontent, here are the main one:
- New Create and Edit Forms based on a Side Panel
- Added support for Generic Model in all forms
- Refactored the branch view, added support for the diff
- New view to visualize/manage the relationships associated with a given object and the associated metadata
Python SDK
The Python SDK now has feature parity for both Sync and Async and we have completed the support for relationships.
It's now possible to do all CRUD operations using the Python SDK
Migration Guide and Breaking Changes
It's mandatory to completely rebuild your environment with the following commands.
invoke demo.destroy demo.build demo.init demo.start
invoke demo.load-infra-schema
invoke demo.load-infra-data
All data will be lost, please make sure to backup everything you need before running this command.
The demo schema has been updated to leverage some Generics and as such is slightly different than the previous version, If you have some scripts that are currently relying on this schema, they will need to be updated.
The Git repository infrahub-demo-edge
has been updated to use the new schema, please be sure to pull the latest version in your fork