Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion services/vpn/oas_commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b7d1b614138d667d378a5fd45e2a91539a7fb02e
3fc1363ce4ead752c576a30ee9cf0e1b5836ae35
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class BGPFilterRuleMatch(BaseModel):
""" # noqa: E501

as_path_contains_any: Optional[
Annotated[List[Annotated[int, Field(le=4294967294, strict=True, ge=64512)]], Field(max_length=10)]
Annotated[List[Annotated[int, Field(le=4294967294, strict=True, ge=1)]], Field(max_length=10)]
] = Field(
default=None,
description="Matches if the AS-PATH contains any one of the listed ASNs (logical OR within the list). Treated as an unordered set; ordering is not preserved by the storage layer. When combined with firstASN, both conditions must hold (logical AND, consistent with the rest of the match block). If firstASN is also listed here, its presence as the first hop is sufficient to satisfy this list; no duplicate hop is required. ",
Expand All @@ -39,7 +39,7 @@ class BGPFilterRuleMatch(BaseModel):
default=None,
description="Matches if the route carries any one of these BGP standard communities (logical OR within the list). Format is 'asn:value' per RFC 1997 (both halves must fit in a uint32, i.e. 0..4294967295). Extended, large and well-known communities are not supported. ",
)
first_asn: Optional[Annotated[int, Field(le=4294967294, strict=True, ge=64512)]] = Field(
first_asn: Optional[Annotated[int, Field(le=4294967294, strict=True, ge=1)]] = Field(
default=None,
description="Matches if the first ASN (immediate neighbor) in the AS-PATH equals this ASN. Combines with asPathContainsAny using logical AND: when both are set, the first ASN must equal firstASN AND the path must additionally contain at least one ASN from asPathContainsAny. ",
alias="firstASN",
Expand Down
4 changes: 2 additions & 2 deletions services/vpn/src/stackit/vpn/models/bgp_tunnel_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class BGPTunnelConfig(BaseModel):
description="UUID of the BGPFilter to apply to incoming routes from this tunnel's BGP neighbor. The filter must exist in the same gateway. Multiple tunnels may reference the same BGPFilter; in that case the rules' 'match.peer' field can be used to scope behavior per neighbor. Outbound filtering is not yet supported; use gateway.bgp.overrideAdvertisedRoutes to control what is advertised. ",
alias="inboundFilterId",
)
remote_asn: Annotated[int, Field(le=4294967294, strict=True, ge=64512)] = Field(
description="ASN for private use (reserved by IANA), both 16Bit and 32Bit ranges are valid (RFC 6996). ",
remote_asn: Annotated[int, Field(le=4294967294, strict=True, ge=1)] = Field(
description='Number of an Autonomous System. Both 16Bit and 32Bit ranges are supported, excluding values reserved by: * RFC 7607 (0) * RFC 6793 (23456, AS_TRANS) * RFC 7300 (65535 and 4294967295, the "Last ASNs") ',
alias="remoteAsn",
)
__properties: ClassVar[List[str]] = ["inboundFilterId", "remoteAsn"]
Expand Down
20 changes: 18 additions & 2 deletions services/vpn/src/stackit/vpn/models/network_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@

import json
import pprint
import re # noqa: F401
from typing import Any, ClassVar, Dict, List, Optional, Set
from uuid import UUID

from pydantic import BaseModel, ConfigDict, Field
from pydantic import BaseModel, ConfigDict, Field, field_validator
from pydantic_core import to_jsonable_python
from typing_extensions import Annotated, Self

Expand All @@ -28,7 +29,7 @@ class NetworkConfig(BaseModel):
NetworkConfig
""" # noqa: E501

predefined_network_prefix: Optional[List[Annotated[str, Field(strict=True)]]] = Field(
predefined_network_prefix: Optional[Annotated[str, Field(strict=True)]] = Field(
default=None,
description="The IPv4 network prefix (CIDR notation) allocated for the VPN gateway. Must have a prefix length of /28 or larger. Once the gateway is created, is not possible to change this attribute. ",
alias="predefinedNetworkPrefix",
Expand All @@ -38,6 +39,21 @@ class NetworkConfig(BaseModel):
)
__properties: ClassVar[List[str]] = ["predefinedNetworkPrefix", "routingTableId"]

@field_validator("predefined_network_prefix")
def predefined_network_prefix_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if value is None:
return value

if not isinstance(value, str):
value = str(value)

if not re.match(r"^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}(\/([0-9]|[1-2][0-9]|3[0-2]))?$", value):
raise ValueError(
r"must validate the regular expression /^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}(\/([0-9]|[1-2][0-9]|3[0-2]))?$/"
)
return value

model_config = ConfigDict(
validate_by_name=True,
validate_by_alias=True,
Expand Down
Loading