Add peers readonly api and instancelink constraint (#13916)

Add Disconnected link state

introspect_receptor_connections is a periodic
task that examines active receptor connections
and cross-checks it with the InstanceLink info.

Any links that should be active but are not
will be put into a Disconnected state. If
active, it will be in an Established state.

UI - Add hop creation and peers mgmt (#13922)

* add UI for mgmt peers, instance edit and add

* add peer info on detail and bug fix on detail

* remove unused chip and change peer label

* rename lookup, put Instance type disable on edit

---------

Co-authored-by: tanganellilore <lorenzo.tanagnelli@hotmail.it>
This commit is contained in:
Lorenzo Tanganelli
2023-04-27 00:34:26 +02:00
committed by Seth Foster
parent d8abd4912b
commit f7fdb7fe8d
29 changed files with 1068 additions and 83 deletions

View File

@@ -67,14 +67,20 @@ class InstanceLink(BaseModel):
class States(models.TextChoices):
ADDING = 'adding', _('Adding')
ESTABLISHED = 'established', _('Established')
DISCONNECTED = 'disconnected', _('Disconnected')
REMOVING = 'removing', _('Removing')
link_state = models.CharField(
choices=States.choices, default=States.ESTABLISHED, max_length=16, help_text=_("Indicates the current life cycle stage of this peer link.")
choices=States.choices, default=States.DISCONNECTED, max_length=16, help_text=_("Indicates the current life cycle stage of this peer link.")
)
class Meta:
unique_together = ('source', 'target')
ordering = ("id",)
constraints = [models.CheckConstraint(check=~models.Q(source=models.F('target')), name='source_and_target_can_not_be_equal')]
def get_absolute_url(self, request=None):
return reverse('api:peers_detail', kwargs={'pk': self.pk}, request=request)
class Instance(HasPolicyEditsMixin, BaseModel):