Skip to content

Commit

Permalink
Check items in vlan list with validator instead, don't think it's pos…
Browse files Browse the repository at this point in the history
…sible with just pydantic model
  • Loading branch information
indy-independence committed Sep 13, 2021
1 parent e613c4f commit f54c9a9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cnaas_nms/db/settings_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,14 @@ class f_interface(BaseModel):
description: Optional[str] = ifdescr_schema
enabled: Optional[bool] = None
untagged_vlan: Optional[int] = vlan_id_schema_optional
tagged_vlan_list: List[vlan_id_schema] = []
tagged_vlan_list: Optional[List[int]] = None
aggregate_id: Optional[int] = None

@validator("tagged_vlan_list", each_item=True)
def check_valid_vlan_ids(cls, v):
assert 0 < v < 4096
return v


class f_vrf(BaseModel):
name: str = None
Expand Down

0 comments on commit f54c9a9

Please sign in to comment.