1616 as_global ,
1717 as_variable ,
1818)
19- from catalystwan .models .common import AcceptRejectActionType
19+ from catalystwan .models .common import AcceptRejectActionType , AsPrepend
2020from catalystwan .models .configuration .feature_profile .common import RefIdItem
2121
2222Community = Literal ["internet" , "local-AS" , "no-advertise" , "no-export" ]
@@ -130,11 +130,11 @@ class SetAsPath(BaseModel):
130130 model_config = ConfigDict (
131131 populate_by_name = True ,
132132 )
133- prepend : Optional [List [ Global [int ]]] = None
133+ prepend : Optional [Global [List [ AsPrepend ]]] = None
134134
135135 @classmethod
136- def from_list (cls , prepend : List [int ]) -> SetAsPath :
137- return cls (prepend = [ as_global ( i ) for i in prepend ] )
136+ def from_list (cls , prepend : List [Union [ str , int ] ]) -> SetAsPath :
137+ return cls (prepend = Global [ List [ AsPrepend ]]( value = prepend ) )
138138
139139
140140class SetCommunity (BaseModel ):
@@ -146,7 +146,7 @@ class SetCommunity(BaseModel):
146146 populate_by_name = True ,
147147 )
148148 additive : Union [Global [bool ], Default [bool ]] = as_default (False )
149- community : Optional [ Union [Global [List [str ]], Variable ]] = None
149+ community : Union [Global [List [str ]], Variable ] = Global [ List [ str ]]( value = [])
150150
151151
152152class Accept (BaseModel ):
@@ -167,8 +167,11 @@ class Accept(BaseModel):
167167 as_path : Optional [SetAsPath ] = Field (
168168 default = None , serialization_alias = "setAsPath" , validation_alias = "setAsPath" , description = "Set AS Path"
169169 )
170- community : Optional [SetCommunity ] = Field (
171- default = None , serialization_alias = "setCommunity" , validation_alias = "setCommunity" , description = "Set Community"
170+ community : SetCommunity = Field (
171+ default_factory = SetCommunity ,
172+ serialization_alias = "setCommunity" ,
173+ validation_alias = "setCommunity" ,
174+ description = "Set Community" ,
172175 )
173176 local_preference : Optional [Global [int ]] = Field (
174177 default = None ,
@@ -330,7 +333,7 @@ def match_ipv6_next_hop(self, ipv6_next_hop: UUID) -> None:
330333 def associate_reject_action (self ) -> None :
331334 self .actions = [(RejectActions (reject = as_default (True )))]
332335
333- def associate_as_path_action (self , prepend : List [int ]) -> None :
336+ def associate_as_path_action (self , prepend : List [Union [ str , int ] ]) -> None :
334337 self ._accept_action .as_path = SetAsPath .from_list (prepend )
335338
336339 def associate_communities_action (self , additive : bool , communities : List [str ]) -> None :
0 commit comments