Skip to content

Commit

Permalink
Remove the visible todos from the lsm docs. (PR #7201)
Browse files Browse the repository at this point in the history
# Description

add docs/ remove todos
follow-up ticket:
1. https://app.zenhub.com/workspaces/core-5a7c152b04a1652024289b7b/issues/gh/inmanta/inmanta-core/7202
2. https://app.zenhub.com/workspaces/core-5a7c152b04a1652024289b7b/issues/gh/inmanta/std/504
3. https://app.zenhub.com/workspaces/core-5a7c152b04a1652024289b7b/issues/gh/inmanta/apt/281

closes #7134

# Self Check:

Strike through any lines that are not applicable (`~~line~~`) then check the box

- [x] Attached issue to pull request
- [ ] Changelog entry
- [ ] Type annotations are present
- [ ] Code is clear and sufficiently documented
- [ ] No (preventable) type errors (check using make mypy or make mypy-diff)
- [ ] Sufficient test cases (reproduces the bug/tests the requested feature)
- [ ] Correct, in line with design
- [x] End user documentation is included or an issue is created for end-user documentation (add ref to issue here: )
- [ ] If this PR fixes a race condition in the test suite, also push the fix to the relevant stable branche(s) (see [test-fixes](https://internal.inmanta.com/development/core/tasks/build-master.html#test-fixes) for more info)
  • Loading branch information
FloLey authored and inmantaci committed Feb 19, 2024
1 parent 2dda16a commit 61397b5
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 14 deletions.
6 changes: 6 additions & 0 deletions changelogs/unreleased/7134-remove-todo-lsm-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description: Remove the visible todos from the lsm docs.
change-type: patch
destination-branches:
- master
- iso7
- iso6
2 changes: 0 additions & 2 deletions docs/lsm/allocation/allocation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ In the network, this virtual wire is implemented as a VXlan tunnel, tied to both
Each such tunnel requires a "VXLAN Network Identifier (VNI)" that uniquely identifies the tunnel.
In the allocation phase, the orchestrator selects a VNI and ensures no other customer is assigned the same VNI.

.. todo: add picture of service
Correct allocation is crucial for the correct functioning of automated services.
However, when serving multiple customers at once or when mediating between multiple inventories, correct allocation can be challenging, due to concurrency and distribution effects.

Expand Down
41 changes: 29 additions & 12 deletions docs/lsm/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,41 @@

- The name of the service entity
- A list of attributes that have a name, a type (number, string, ...) and a modifier. This modifier determines whether the attribute is:
- r / readonly: readonly from the client perspective and allocated server side by the LSM
- rw / read-write: Attributes can be set at creation time, but are readonly after the creation
- rw+ / read-write always: Attribute can be set at creation time and modified when the service state allows it
- ``r`` / readonly: readonly from the client perspective and allocated server side by the LSM
- ``rw`` / read-write: Attributes can be set at creation time, but are readonly after the creation
- ``rw+`` / read-write always: Attribute can be set at creation time and modified when the service state allows it
- The :ref:`fsm` that defines the lifecycle of the service.

For each service entity the lifecycle service manager will create an REST API endpoint on the service inventory to perform create,
read, update and delete (CRUD) service instances of service entities.

Creating service entities
=========================
Service entities are :ref:`entities <lang-entity>` that extend ``lsm::ServiceEntity``
We define attributes for the service entity the same way as for entities. We can also define a modifier for the attribute.
If no modifier is defined for an attribute, it will be ``rw`` by default.
Here is an example of an entity definition where the modifier of the ``address`` attribute is set to ``rw+``.

TODO:
How to define a new service entity. "Exported" entity is high level entity in a service model.
.. literalinclude:: index_sources/service_creation.cf
:linenos:
:language: inmanta
:lines: 1-29

It's also possible to define a service identity for a service. For more information, see :ref:`service_identity`.
We also need to add a lifecycle and a name to the service. This is done by creating an instance of the ``ServiceEntityBinding`` entity:

Updating service entities
=========================
.. literalinclude:: index_sources/service_creation.cf
:linenos:
:language: inmanta
:lines: 30-36
:lineno-start: 25

TODO:
How to update the definition of a service entity and keeping the instance in the inventory stable
It's also possible to define a service identity for a service. For more information, see :ref:`service_identity`.

..
TODO:
Updating service entities
=========================
How to update the definition of a service entity and keeping the instance in the inventory stable
Service Inventory
-----------------
Expand All @@ -89,12 +103,15 @@

The state machine attached to the lifecycle will determine whether the API call is successful or not.

TODO: Three set of attributes
..
TODO: Three set of attributes

Lifecycle Manager
-----------------

TODO: add example/default lifecycle
..
TODO: add example/default lifecycle

.. _fsm:
Expand Down
43 changes: 43 additions & 0 deletions docs/lsm/index_sources/service_creation.cf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import lsm
import lsm::fsm
import ip

entity InterfaceIPAssignment extends lsm::ServiceEntity:
"""
Interface details.

:attr service_id: A unique ID for this service.

:attr router_ip: The IP address of the SR linux router that should be configured.
:attr router_name: The name of the SR linux router that should be configured.
:attr interface_name: The name of the interface of the router that should be configured.
:attr address: The IP-address to assign to the given interface.
"""
string service_id

string router_ip
string router_name
string interface_name

string address
lsm::attribute_modifier address__modifier="rw+"

end

index InterfaceIPAssignment(service_id)

implement InterfaceIPAssignment using parents

binding = lsm::ServiceEntityBindingV2(
service_entity="__config__::InterfaceIPAssignment",
lifecycle=lsm::fsm::service,
service_entity_name="service_simple",
)

for instance in lsm::all(binding):
InterfaceIPAssignment(
instance_id=instance["id"],
entity_binding=binding,
**instance["attributes"],
)
end

0 comments on commit 61397b5

Please sign in to comment.