Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
}
},
'pw': {
'num_pw': int,
'num_pw_up': int,
},
Optional('pbb'): {
'num_pbb': int,
'num_pbb_up': int,
},
Optional('vni'): {
'num_vni': int,
'num_vni_up': int,
},
Optional('evpn'): {
Any(): {
'state': str,
}
}
},
}
}
}
}
class ShowL2vpnBridgeDomain(ShowL2vpnBridgeDomainSchema):
"""Parser for show l2vpn bridge-domain"""
cli_command = 'show l2vpn bridge-domain'
def cli(self, output=None):
if output is None:
Optional('load_balance'): {
Optional('load_balance'): str,
Optional('link_order_signaling'): str,
Optional('hash_type'): str,
Optional('locality_threshold'): str,
},
'lacp': {
'lacp': str,
Optional('flap_suppression_timer'): str,
Optional('cisco_extensions'): str,
Optional('non_revertive'): str,
},
'mlacp': {
'mlacp': str,
Optional('iccp_group'): str,
Optional('role'): str,
Optional('foreign_links_active'): int,
Optional('foreign_links_configured'): int,
Optional('switchover_type'): str,
Optional('recovery_delay'): str,
Optional('maximize_threshold'): str,
},
'ipv4_bfd': {
'ipv4_bfd': str,
Optional('state'): str,
Optional('fast_detect'): str,
Optional('start_timer'): str,
Optional('neighbor_unconfigured_timer'): str,
Optional('preferred_min_interval_ms'): int,
Optional('preferred_multiple'): int,
Optional('destination_address'): str,
},
# ============================================
# Schema for '/dna/intent/api/v1/interface'
# ============================================
class InterfaceSchema(MetaParser):
"""schema for /dna/intent/api/v1/interface, /dna/intent/api/v1/interface/{interface}"""
schema = {
'hostname': {
Any(): {
'interfaces': {
Any(): {
"adminStatus": str,
Optional("className"): str,
Optional("description"): str,
"deviceId": str,
Optional("duplex"): str,
Optional("id"): str,
"ifIndex": str,
Optional("instanceTenantId"): str,
Optional("instanceUuid"): str,
"interfaceType": str,
Optional("ipv4Address"): str,
Optional("ipv4Mask"): str,
"isisSupport": str,
"lastUpdated": str,
Optional("macAddress"): str,
Optional("mappedPhysicalInterfaceId"): str,
Optional("mappedPhysicalInterfaceName"): str,
Optional("mediaType"): str,
Optional("nativeVlanId"): str,
"ospfSupport": str,
"pid": str,
},
Optional('l4'): {
Any(): { # protocols
Optional('type'): int,
Optional('code'): int,
Optional('acknowledgement_number'): int,
Optional('data_offset'): int,
Optional('reserved'): int,
Optional('flags'): str,
Optional('window_size'): int,
Optional('urgent_pointer'): int,
Optional('options'): int,
Optional('options_name'): str,
Optional('established'): bool,
Optional('source_port'): {
Optional('range'): {
'lower_port': int,
'upper_port': int,
},
Optional('operator'): {
'operator': str,
'port': str,
}
},
Optional('destination_port'): {
Optional('range'): {
'lower_port': int,
'upper_port': int,
},
Optional('operator'): {
'operator': str,
'port': int,
# Pass firmware list as value
if not isinstance(value, list):
raise SchemaTypeError('inner chassis hardware is not a list')
chassis_inner_hardware_schema = Schema(
{
Optional("chassis-sub-sub-module"): {
"description": str,
"name": str,
"part-number": str,
"serial-number": str
},
Optional("description"): str,
"name": str,
Optional("part-number"): str,
Optional("serial-number"): str,
Optional("version"): str
}
)
# Validate each dictionary in list
for item in value:
chassis_inner_hardware_schema.validate(item)
return value
Optional("active-defects"): {
Optional("interface-alarms"): {
Optional("alarm-not-present"): bool,
Optional("ethernet-alarm-link-down"): bool
}
},
Optional("admin-status"): {
Optional("#text"): str,
Optional("@junos:format"): str
},
Optional("bpdu-error"): str,
Optional("clocking"): str,
Optional("current-physical-address"): str,
Optional("description"): str,
Optional("eth-switch-error"): str,
Optional("ethernet-fec-mode"): {
Optional("@junos:style"): str,
"enabled_fec_mode": str
},
Optional("ethernet-fec-statistics"): {
Optional("@junos:style"): str,
"fec_ccw_count": str,
"fec_ccw_error_rate": str,
"fec_nccw_count": str,
"fec_nccw_error_rate": str
},
Optional("ethernet-pcs-statistics"): {
Optional("@junos:style"): str,
"bit-error-seconds": str,
"errored-blocks-seconds": str
},
Optional("hardware-physical-address"): str,
"output-mac-control-frames": str,
"output-mac-pause-frames": str,
"output-multicasts": str,
"output-packets": str,
Optional("output-total-errors"): str,
"output-unicasts": str
},
Optional("input-error-list"): {
Optional("framing-errors"): str,
Optional("input-discards"): str,
Optional("input-drops"): str,
Optional("input-errors"): str,
Optional("input-fifo-errors"): str,
Optional("input-giants"): str,
Optional("input-l2-channel-errors"): str,
Optional("input-l2-mismatch-timeouts"): str,
Optional("input-l3-incompletes"): str,
Optional("input-resource-errors"): str,
Optional("input-runts"): str
},
Optional("transit-traffic-statistics"): {
"input-bps": str,
"input-bytes": str,
"input-packets": str,
"input-pps": str,
Optional("ipv6-transit-statistics"): {
"input-bps": str,
"input-bytes": str,
"input-packets": str,
"input-pps": str,
"output-bps": str,
"output-bytes": str,
{
'accepted-prefix-count': str,
'active-prefix-count': str,
'name': str,
'received-prefix-count': str,
'suppressed-prefix-count': str
}
)
for item in value:
bgp_peer_rib_schema.validate(item)
return value
bgp_peer_schema = Schema(
{
Optional('bgp-rib'): Use(validate_bgp_peer_rib_list),
Optional("description"): str,
"elapsed-time": {
"#text": str,
Optional("@junos:seconds"): str,
},
"flap-count": str,
"input-messages": str,
"output-messages": str,
"peer-address": str,
"peer-as": str,
"peer-state": str,
"route-queue-count": str,
}
)
for item in value:
bgp_peer_schema.validate(item)
'multicast_group': str,
'distance': int,
Optional('timers'): {
Optional('update_interval'): int,
Optional('expire_in'): int,
Optional('collect_garbage'): int,
},
'default_metric': int,
'maximum_paths': int,
Optional('default_originate'): str,
'process': str,
Optional('interfaces'): {
Any(): {
},
},
Optional('redistribute'): {
Any(): {
Optional('route_policy'): str,
},
},
},
},
},
},
},
},
}
class ShowIpRipVrfAll(ShowIpRipVrfAllSchema):
"""Parser for:
* show ip rip
schema = {
Optional('main'): {
Optional('switch_mac_address'): str,
Optional('mac_persistency_wait_time'): str,
Optional('chassis'): str
},
'slot': {
Any(): {
Optional('rp'): {
Any(): {
Optional('sn'): str,
'state': str,
Optional('num_of_ports'): str,
Optional('mac_address'): str,
Optional('hw_ver'): str,
Optional('sw_ver'): str,
Optional('swstack_role'): str,
Optional('swstack_priority'): str,
Optional('ports'): str,
Optional('role'): str,
Optional('name'): str,
Optional('slot'): str,
Optional('priority'): str,
Optional('insert_time'): str,
Optional('fw_ver'): str,
Optional('cpld_ver'): str,
}
},
Optional('lc'): {
Any(): {
Optional('cpld_ver'): str,
Optional('fw_ver'): str,