pa_api.xmlapi.types.config.devicegroup
1from typing import Optional 2 3from pydantic import AliasPath, ConfigDict, Field 4 5from pa_api.xmlapi.types.utils import List, String, XMLBaseModel 6 7from .address import Address, AddressGroup 8from .profiles import Profile 9from .rules import RuleBase 10 11 12class DeviceGroup(XMLBaseModel): 13 """ 14 This is used to parse the output of the running configuration. 15 """ 16 17 model_config = ConfigDict(extra="allow") 18 19 name: String = Field(validation_alias="@name") 20 description: String = "" 21 22 devices: List[String] = Field( 23 validation_alias=AliasPath("devices", "entry", "@name"), default_factory=list 24 ) 25 profiles: Optional[Profile] = None 26 addresses: List[Address] = Field( 27 validation_alias=AliasPath("address", "entry"), default_factory=list 28 ) 29 address_groups: List[AddressGroup] = Field( 30 validation_alias=AliasPath("address-group", "entry"), default_factory=list 31 ) 32 post_rulebase: Optional[RuleBase] = Field( 33 validation_alias="post-rulebase", default=None 34 ) 35 pre_rulebase: Optional[RuleBase] = Field( 36 validation_alias="pre-rulebase", default=None 37 ) 38 # applications: List[Application] = Field( 39 # validation_alias=AliasPath("application", "entry"), default_factory=list 40 # ) 41 tags: List[String] = Field( 42 validation_alias=AliasPath("tag", "member"), default_factory=list 43 ) 44 45 def iter_rulebases(self): 46 for rulebase in (self.pre_rulebase, self.post_rulebase): 47 if rulebase is not None: 48 yield rulebase
13class DeviceGroup(XMLBaseModel): 14 """ 15 This is used to parse the output of the running configuration. 16 """ 17 18 model_config = ConfigDict(extra="allow") 19 20 name: String = Field(validation_alias="@name") 21 description: String = "" 22 23 devices: List[String] = Field( 24 validation_alias=AliasPath("devices", "entry", "@name"), default_factory=list 25 ) 26 profiles: Optional[Profile] = None 27 addresses: List[Address] = Field( 28 validation_alias=AliasPath("address", "entry"), default_factory=list 29 ) 30 address_groups: List[AddressGroup] = Field( 31 validation_alias=AliasPath("address-group", "entry"), default_factory=list 32 ) 33 post_rulebase: Optional[RuleBase] = Field( 34 validation_alias="post-rulebase", default=None 35 ) 36 pre_rulebase: Optional[RuleBase] = Field( 37 validation_alias="pre-rulebase", default=None 38 ) 39 # applications: List[Application] = Field( 40 # validation_alias=AliasPath("application", "entry"), default_factory=list 41 # ) 42 tags: List[String] = Field( 43 validation_alias=AliasPath("tag", "member"), default_factory=list 44 ) 45 46 def iter_rulebases(self): 47 for rulebase in (self.pre_rulebase, self.post_rulebase): 48 if rulebase is not None: 49 yield rulebase
This is used to parse the output of the running configuration.
model_config =
{'extra': 'allow'}
Configuration for the model, should be a dictionary conforming to [ConfigDict
][pydantic.config.ConfigDict].
name: typing.Annotated[str, BeforeValidator(func=<function ensure_str at 0x7f4bd793fac0>, json_schema_input_type=PydanticUndefined)]
description: typing.Annotated[str, BeforeValidator(func=<function ensure_str at 0x7f4bd793fac0>, json_schema_input_type=PydanticUndefined)]
devices: Annotated[List[Annotated[str, BeforeValidator(func=<function ensure_str at 0x7f4bd793fac0>, json_schema_input_type=PydanticUndefined)]], BeforeValidator(func=<function ensure_list at 0x7f4bd793f9a0>, json_schema_input_type=PydanticUndefined)]
profiles: Optional[pa_api.xmlapi.types.config.profiles.profile.Profile]
addresses: Annotated[List[pa_api.xmlapi.types.config.address.Address], BeforeValidator(func=<function ensure_list at 0x7f4bd793f9a0>, json_schema_input_type=PydanticUndefined)]
address_groups: Annotated[List[pa_api.xmlapi.types.config.address.AddressGroup], BeforeValidator(func=<function ensure_list at 0x7f4bd793f9a0>, json_schema_input_type=PydanticUndefined)]
post_rulebase: Optional[pa_api.xmlapi.types.config.rules.rulebase.RuleBase]
pre_rulebase: Optional[pa_api.xmlapi.types.config.rules.rulebase.RuleBase]