Skip to content
Snippets Groups Projects
Verified Commit e9dadc8d authored by Aleksandr Kurbatov's avatar Aleksandr Kurbatov Committed by Karel van Klink
Browse files

rework of the parms order on the form

parent bc0b8be0
No related branches found
No related tags found
1 merge request!298Add BFD configuration to Service binding ports
......@@ -57,32 +57,40 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
class BFDSettingsForm(BaseModel):
bfd_enabled: bool = False
bfd_interval_rx: int | None = None
bfd_interval_rx: int | None = Field(default=None, examples=["BFD RX defaults"])
bfd_interval_tx: int | None = None
bfd_multiplier: int | None = None
class BaseBGPPeer(BaseModel):
bfd_enabled: bool = False
has_custom_policies: bool = False
class IPv4BGPPeer(BaseModel):
peer_address: IPv4AddressType
authentication_key: str | None = None
has_custom_policies: bool = False
bfd_enabled: bool = False
multipath_enabled: bool = False
send_default_route: bool = False
is_passive: bool = False
class IPv4BGPPeer(BaseBGPPeer):
peer_address: IPv4AddressType
add_v4_multicast: bool = Field(default=False, exclude=True)
ip_type: IPTypes = IPTypes.IPV4
send_default_route: bool = False
@computed_field # type: ignore[misc]
@property
def families(self) -> list[IPFamily]:
return [IPFamily.V4UNICAST, IPFamily.V4MULTICAST] if self.add_v4_multicast else [IPFamily.V4UNICAST]
class IPv6BGPPeer(BaseBGPPeer):
@computed_field # type: ignore[misc]
@property
def ip_type(self) -> IPTypes:
return IPTypes.IPV4
class IPv6BGPPeer(BaseModel):
ip_type: IPTypes = IPTypes.IPV6
peer_address: IPv6AddressType
authentication_key: str | None = None
has_custom_policies: bool = False
bfd_enabled: bool = False
multipath_enabled: bool = False
is_passive: bool = False
add_v6_multicast: bool = Field(default=False, exclude=True)
ip_type: IPTypes = IPTypes.IPV6
send_default_route: bool = False
@computed_field # type: ignore[misc]
@property
......@@ -100,15 +108,19 @@ def initial_input_form_generator(product_name: str) -> FormGenerator:
geant_sid: str
is_tagged: bool = False
v4_bfd_settings: BFDSettingsForm = BFDSettingsForm(bfd_enabled=False)
v6_bfd_settings: BFDSettingsForm = BFDSettingsForm(bfd_enabled=False)
vlan_id: VLAN_ID
custom_firewall_filters: bool = False
divider: Divider = Field(None, exclude=True)
v4_label: Label = Field("IPV4 SBP interface params", exclude=True)
ipv4_address: IPv4AddressType
ipv4_mask: IPV4Netmask
v4_bfd_settings: BFDSettingsForm = BFDSettingsForm(bfd_enabled=False)
divider2: Divider = Field(None, exclude=True)
v6_label: Label = Field("IPV6 SBP interface params", exclude=True)
ipv6_address: IPv6AddressType
ipv6_mask: IPV6Netmask
custom_firewall_filters: bool = False
divider: Divider = Field(None, exclude=True)
v6_bfd_settings: BFDSettingsForm = BFDSettingsForm(bfd_enabled=False)
divider3: Divider = Field(None, exclude=True)
v4_bgp_peer: IPv4BGPPeer
v6_bgp_peer: IPv6BGPPeer
......
......@@ -65,7 +65,11 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
bfd_interval_tx: int | None = None
bfd_multiplier: int | None = None
class BaseBGPPeer(BaseModel):
class IPv4BGPPeer(BaseModel):
peer_address: IPv4AddressType
add_v4_multicast: bool = Field(default=False, exclude=True)
ip_type: IPTypes = IPTypes.IPV4
bfd_enabled: bool = False
has_custom_policies: bool = False
authentication_key: str | None
......@@ -73,21 +77,23 @@ def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
send_default_route: bool = False
is_passive: bool = False
class IPv4BGPPeer(BaseBGPPeer):
peer_address: IPv4AddressType
add_v4_multicast: bool = Field(default=False, exclude=True)
ip_type: IPTypes = IPTypes.IPV4
@computed_field # type: ignore[misc]
@property
def families(self) -> list[IPFamily]:
return [IPFamily.V4UNICAST, IPFamily.V4MULTICAST] if self.add_v4_multicast else [IPFamily.V4UNICAST]
class IPv6BGPPeer(BaseBGPPeer):
class IPv6BGPPeer(BaseModel):
peer_address: IPv6AddressType
add_v6_multicast: bool = Field(default=False, exclude=True)
ip_type: IPTypes = IPTypes.IPV6
bfd_enabled: bool = False
has_custom_policies: bool = False
authentication_key: str | None
multipath_enabled: bool = False
send_default_route: bool = False
is_passive: bool = False
@computed_field # type: ignore[misc]
@property
def families(self) -> list[IPFamily]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment