Skip to content

Commit 9d75381

Browse files
Add remove_private_as option on bgp neighbors
Note that StrEnum subclass can't have members with string method names, for example title or replace. Therefore options are named REPLACE instead of replace to avoid this issue: python/mypy#14494
1 parent 9ae9fc8 commit 9d75381

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

docs/reporef/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ Can contain the following dictionaries with specified keys:
274274
* update_source: Specify local source interface for the BGP session
275275
* auth_string: String used to calculate MD5 hash for authentication (password)
276276
* description: Description of remote peer (optional, defaults to "undefined")
277+
* remove_private_as: Optional, if set must be either "all" or "replace".
278+
Remove all private AS numbers from AS_PATH, or replace private AS numbers with local AS.
277279
* cli_append_str: Custom configuration to append to this peer (optional)
278280
* neighbor_v6:
279281

src/cnaas_nms/db/settings_fields.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from enum import StrEnum, auto
12
from ipaddress import AddressValueError, IPv4Interface
23
from typing import Annotated, Dict, List, Optional, Union
34

@@ -73,6 +74,11 @@
7374
)
7475

7576

77+
class RemovePrivateASEnum(StrEnum):
78+
ALL = auto()
79+
REPLACE = auto()
80+
81+
7682
def validate_ipv4_if(ipv4if: str):
7783
try:
7884
assert "/" in ipv4if, "Not a CIDR notation/no netmask"
@@ -248,6 +254,7 @@ class f_extroute_bgp_neighbor_v4(BaseModel):
248254
maximum_routes: Optional[int] = maximum_routes_schema
249255
auth_type: Optional[str] = None
250256
auth_string: Optional[str] = None
257+
remove_private_as: Optional[RemovePrivateASEnum] = None
251258
cli_append_str: str = ""
252259

253260

0 commit comments

Comments
 (0)