class ShowLacpInterfacesInterfaceSchema(MetaParser): """ Schema for: * show lacp interfaces {interface} """ schema = { "lacp-interface-information-list": { "lacp-interface-information": { "lag-lacp-header": { "aggregate-name": str }, "lag-lacp-protocol": ListOf({ "lacp-mux-state": str, "lacp-receive-state": str, "lacp-transmit-state": str, "name": str }), "lag-lacp-state": ListOf({ "lacp-activity": str, "lacp-aggregation": str, "lacp-collecting": str, "lacp-defaulted": str, "lacp-distributing": str, "lacp-expired": str, "lacp-role": str, "lacp-synchronization": str, "lacp-timeout": str, "name": str }) } } }
class ShowRSVPSessionSchema(MetaParser): """ Schema for: * show rsvp session * show rsvp session transit """ schema = { "rsvp-session-information": { "rsvp-session-data": ListOf({ "session-type": str, "count": str, Optional("rsvp-session"): ListOf({ "destination-address": str, "source-address": str, "lsp-state": str, "route-count": str, "rsb-count": str, "resv-style": str, "label-in": str, "label-out": str, "name": str, }), "display-count": str, "up-count": str, "down-count": str, }) } }
class ShowRunningConfigFlowRecordSchema(MetaParser): schema = { 'flow_record': { Any(): { Optional('match_list'): ListOf(str), Optional('collect_list'): ListOf(str), } } }
class ShowMplsLdpDiscoveryDetailSchema(MetaParser): """ Schema for show mpls ldp discovery detail """ schema = { 'vrf': { Optional('local_ldp_identifier'): str, 'vrfs': ListOf({ 'vrf_name': str, 'interfaces': ListOf({ Optional('interface'): str, Optional('vrf_hex'): str, Optional('source_ip_addr'): str, Optional('transport_ip_addr'): str, Optional('xmit'): str, Optional('recv'): str, Optional('hello_interval_ms'): str, Optional('hello_due_time_ms'): str, Optional('quick_start'): str, Optional('ldp_id'): { Optional('network_addr'): str, "ldp_entries": ListOf({ Optional('source_ip_addr'): str, Optional('transport_ip_addr'): str, Optional('holdtime_sec'): str, Optional('proposed_local'): str, Optional('proposed_peer'): str, Optional('expiring_in'): str, Optional('established_date'): str, Optional('established_elapsed'): str, Optional('last_session_connection_failures'): ListOf({ Optional('timestamp'): str, Optional('reason'): str, Optional('last_up_for'): str, }) }) } }) }) } }
class ShowFlowRecordSchema(MetaParser): schema = { 'flow_record_name': { Any(): { 'description': str, 'no_of_users': int, 'total_field_space': int, 'fields': { Optional('match_list'): ListOf(str), Optional('collect_list'): ListOf(str), } } } }
class FileListDetailSchema(MetaParser): schema = { Optional("@xmlns:junos"): str, "directory-list": { Optional("@junos:seconds"): str, Optional("@junos:style"): str, Optional("@root-path"): str, "directory": { Optional("@name"): str, "file-information": ListOf({ "file-date": { Optional("#text"): str, Optional("@junos:format"): str }, "file-group": str, "file-links": str, "file-name": str, "file-owner": str, "file-permissions": { Optional("#text"): str, Optional("@junos:format"): str }, "file-size": str }), "total-files": str } } }
class ShowVersionSchema(MetaParser): """ schema = { "software-information": { "host-name": str, "junos-version": str, "product-model": str, "product-name": str, "package-information": [ { "comment": str, "name": str, } ] } """ # main schema schema = { "software-information": { "host-name": str, "junos-version": str, "product-model": str, "product-name": str, "package-information": ListOf({ "comment": str, "name": str, }) } }
class ShowLdpNeighborSchema(MetaParser): """ Schema for: * show ldp neighbor """ '''schema = { Optional("@xmlns:junos"): str, "ldp-neighbor-information": { Optional("@xmlns"): str, "ldp-neighbor": [ { "interface-name": str, "ldp-label-space-id": str, "ldp-neighbor-address": str, "ldp-remaining-time": str } ] } }''' schema = { Optional("@xmlns:junos"): str, "ldp-neighbor-information": { Optional("@xmlns"): str, "ldp-neighbor": ListOf({ "interface-name": str, "ldp-label-space-id": str, "ldp-neighbor-address": str, "ldp-remaining-time": str }) } }
class ShowLoggingOnboardRpActiveTemperatureContinuousSchema(MetaParser): '''Schema for: show logging onboard rp active temperature continuous show logging onboard rp active voltage continuous show logging onboard rp active message continuous ''' schema={ 'application':str, Optional('temperature_sensors'):{ Any():{ 'id': int, 'history':{ Any():int, }, }, }, Optional('voltage_sensors'):{ Any():{ 'id': int, 'history':{ Any():int, }, }, }, Optional('error_message'):{ Any():ListOf(str), }, }
class ShowArpNoResolveSchema(MetaParser): """ Schema for: * show arp no-resolve """ """schema = { Optional("@xmlns:junos"): str, "arp-table-information": { Optional("@junos:style"): str, Optional("@xmlns"): str, "arp-entry-count": str, "arp-table-entry": [ { "arp-table-entry-flags": str, "interface-name": str, "ip-address": str, "mac-address": str } ] } }""" # Main Schema schema = { "arp-table-information": { "arp-entry-count": str, "arp-table-entry": ListOf({ "arp-table-entry-flags": str, "interface-name": str, "ip-address": str, "mac-address": str }) } }
class ShowArpSchema(MetaParser): """ Schema for: * show arp * show arp | no-more """ """schema = { "arp-table-information": { "arp-entry-count": str, "arp-table-entry": [ { "arp-table-entry-flags": str, "hostname": str, "interface-name": str, "ip-address": str, "mac-address": str } ] } }""" # Main Schema schema = { "arp-table-information": { "arp-entry-count": str, "arp-table-entry": ListOf({ "arp-table-entry-flags": str, "hostname": str, "interface-name": str, "ip-address": str, "mac-address": str }) } }
class ShowBFDSessionSchema(MetaParser): """ Schema for * show bfd session """ schema = { "bfd-session-information": { Optional("bfd-session"): ListOf({ "session-neighbor": str, "session-state": str, Optional("session-interface"): str, "session-detection-time": str, "session-transmission-interval": str, "session-adaptive-multiplier": str, }), "clients": str, "cumulative-reception-rate": str, "cumulative-transmission-rate": str, "sessions": str } }
class ShowL2routeEvpnMacIpDetailSchema(MetaParser): """ Schema for show l2route evpn mac ip detail show l2route evpn mac ip host-ip <ip> detail show l2route evpn mac ip host-ip <ip> esi <esi> detail show l2route evpn mac ip host-ip <ip> mac-address <mac_addr> detail show l2route evpn mac ip host-ip <ip> mac-address <mac_addr> esi <esi> detail show l2route evpn mac ip host-ip <ip> next-hop <next_hop> detail show l2route evpn mac ip host-ip <ip> next-hop <next_hop> esi <esi> detail show l2route evpn mac ip host-ip <ip> next-hop <next_hop> mac-address <mac_addr> detail show l2route evpn mac ip host-ip <ip> next-hop <next_hop> mac-address <mac_addr> esi <esi> detail show l2route evpn mac ip host-ip <ip> producer <producer> mac-address <mac_addr> detail show l2route evpn mac ip host-ip <ip> producer <producer> mac-address <mac_addr> esi <esi> detail show l2route evpn mac ip host-ip <ip> topology <evi> detail show l2route evpn mac ip host-ip <ip> topology <evi> esi <esi> detail show l2route evpn mac ip host-ip <ip> topology <evi> mac-address <mac_addr> detail show l2route evpn mac ip host-ip <ip> topology <evi> mac-address <mac_addr> esi <esi> detail show l2route evpn mac ip host-ip <ip> topology <evi> next-hop <next_hop> detail show l2route evpn mac ip host-ip <ip> topology <evi> next-hop <next_hop> esi <esi> detail show l2route evpn mac ip host-ip <ip> topology <evi> next-hop <next_hop> mac-address <mac_addr> detail show l2route evpn mac ip host-ip <ip> topology <evi> next-hop <next_hop> mac-address <mac_addr> esi <esi> detail show l2route evpn mac ip host-ip <ip> topology <evi> producer <producer> mac-address <mac_addr> detail show l2route evpn mac ip host-ip <ip> topology <evi> producer <producer> mac-address <mac_addr> esi <esi> detail show l2route evpn mac ip host-ip <ip> topology <evi>:<etag> detail show l2route evpn mac ip host-ip <ip> topology <evi>:<etag> esi <esi> detail show l2route evpn mac ip host-ip <ip> topology <evi>:<etag> mac-address <mac_addr> detail show l2route evpn mac ip host-ip <ip> topology <evi>:<etag> mac-address <mac_addr> esi <esi> detail show l2route evpn mac ip host-ip <ip> topology <evi>:<etag> next-hop <next_hop> detail show l2route evpn mac ip host-ip <ip> topology <evi>:<etag> next-hop <next_hop> esi <esi> detail show l2route evpn mac ip host-ip <ip> topology <evi>:<etag> next-hop <next_hop> mac-address <mac_addr> detail show l2route evpn mac ip host-ip <ip> topology <evi>:<etag> next-hop <next_hop> mac-address <mac_addr> esi <esi> detail show l2route evpn mac ip host-ip <ip> topology <evi>:<etag> producer <producer> mac-address <mac_addr> detail show l2route evpn mac ip host-ip <ip> topology <evi>:<etag> producer <producer> mac-address <mac_addr> esi <esi> detail """ schema = { 'evi': { Any(): { 'producer': { Any(): { 'host_ips': { Any(): { 'eth_tag': int, 'mac_addr': str, 'seq_number': int, 'label_2': int, 'esi': str, 'mac_rt_flags': str, 'next_hops': ListOf( { 'next_hop': str } ) } } } } } } }
class ShowNetconfYangDatastoresSchema(MetaParser): '''Schema for: * 'show netconf-yang datastores' ''' schema = { 'datastores': { 'names': ListOf(str), } }
class ShowLdpDatabaseSessionIpaddressSchema(MetaParser): """ Schema for: * show ldp database session ipaddress """ '''schema = { "ldp-database-information": { "ldp-database": [ { "ldp-binding": [ { "ldp-label": str, "ldp-prefix": str } ], "ldp-database-type": str, "ldp-label-received": str, "ldp-label-advertised": str, "ldp-session-id": str } ] } }''' schema = { "ldp-database-information": { "ldp-database": ListOf({ "ldp-binding": ListOf({ "ldp-label": str, "ldp-prefix": str }), "ldp-database-type": str, Optional("ldp-label-received"): str, Optional("ldp-label-advertised"): str, "ldp-session-id": str }) } }
class ShowL2fibPathListIdSchema(MetaParser): """ Schema for show l2fib path-list {id} show l2fib path-list detail """ schema = { 'pathlist_id': { Any(): { 'type': str, 'eth_seg': str, 'path_cnt': int, 'path_list': ListOf({'path': str}) } } }
class ShowPPMTransmissionsProtocolBfdDetailSchema(MetaParser): ''' Schema for: * 'show ppm transmissions protocol bfd detail' ''' ''' schema = { "ppm-transmissions": { "transmission-data": [{ "protocol": str, "transmission-destination": str, "transmission-distributed": str, Optional("transmission-host"): str, "transmission-interface-index": str, "transmission-interval": str, "transmission-pfe-addr": str, "transmission-pfe-handle": str }] } } ''' schema = { "ppm-transmissions": { Optional("remote-transmissions"): str, Optional("total-transmissions"): str, "transmission-data": ListOf({ "protocol": str, Optional("transmission-count"): str, Optional("transmission-delay-difference"): str, Optional("transmission-delayed"): str, Optional("transmission-delayed-count"): str, "transmission-destination": str, "transmission-distributed": str, Optional("transmission-host"): str, "transmission-interface-index": str, "transmission-interval": str, Optional("transmission-interval-threshold"): str, Optional("transmission-jitter"): str, Optional("transmission-largest-difference"): str, Optional("transmission-last-interval"): str, Optional("transmission-pfe-addr"): str, Optional("transmission-pfe-handle"): str }) } }
class ShowLDPSessionSchema(MetaParser): """ Schema for * show ldp session """ schema = { "ldp-session-information": { "ldp-session": ListOf({ "ldp-neighbor-address": str, "ldp-session-state": str, "ldp-connection-state": str, "ldp-remaining-time": str, Optional("ldp-session-adv-mode"): str, }) } }
class ShowSnmpMibWalkSystemSchema(MetaParser): """ Schema for: * show snmp mib walk system """ schema = { "snmp-object-information": { "snmp-object": ListOf({ "name": str, "object-value": str, Optional("object-value-type"): str, Optional("oid"): str }), } }
class ShowRunningConfigFlowExporterSchema(MetaParser): schema = { 'flow_exporter_name': { Any(): { Optional('description'): str, Optional('destination'): str, Optional('source'): str, Optional('dscp'): int, Optional('ttl'): int, Optional('transport_protocol'): str, Optional('transport_protocol_port'): int, Optional('export_protocol'): str, Optional('options'): ListOf(str), Optional('match_counter_packets_long_gt'): int } } }
class ShowConfigurationSystemNtpSchema(MetaParser): """Schema for: show configuration system ntp """ schema = { "configuration": { "system": { "ntp": { Optional("server"): ListOf({ 'name': str, }), Optional("source-address"): { "name": str } } } } }
class ShowServicesAccountingErrorsSchema(MetaParser): """ Schema for: * show services accounting errors """ schema = { "services-accounting-information": { "v9-error-information": ListOf({ "interface-name": str, "service-set-dropped": str, "active-timeout-failures": str, "export-packet-failures": str, "flow-creation-failures": str, "memory-overload": str, }), } }
class ShowServicesAccountingUsageSchema(MetaParser): """ Schema for: * show services accounting usage """ schema = { "services-accounting-information": { "usage-information": ListOf({ "interface-name": str, "uptime": str, "inttime": str, "five-second-load": str, "one-minute-load": str, }), } }
class ShowLacpStatisticsInterfacesInterfaceSchema(MetaParser): """ Schema for: * show lacp statistics interfaces {interface} """ """ schema = { Optional("@xmlns:junos"): str, "lacp-interface-statistics-list": { Optional("@xmlns"): str, "lacp-interface-statistics": { Optional("@xmlns"): str, "lag-lacp-header": { "aggregate-name": str }, "lag-lacp-statistics": [ { "illegal-rx-packets": str, "lacp-rx-packets": str, "lacp-tx-packets": str, "name": str, "unknown-rx-packets": str } ] } } } """ schema = { "lacp-interface-statistics-list": { "lacp-interface-statistics": { "lag-lacp-header": { "aggregate-name": str }, "lag-lacp-statistics": ListOf({ "illegal-rx-packets": str, "lacp-rx-packets": str, "lacp-tx-packets": str, "name": str, "unknown-rx-packets": str, }), } } }
class ShowPfeRouteSummarySchema(MetaParser): """ Schema for: * show pfe route summary """ schema = { 'slot': { Any(): { 'route-tables': { Any(): ListOf({ 'index': str, 'routes': str, 'size': str }), } } } }
class ShowIpv6NeighborsSchema(MetaParser): """ Schema for: * show ipv6 neighbors """ """schema = { Optional("@xmlns:junos"): str, "ipv6-nd-information": { Optional("@junos:style"): str, Optional("@xmlns"): str, "ipv6-nd-entry": [ { "ipv6-nd-expire": str, "ipv6-nd-interface-name": str, "ipv6-nd-isrouter": str, "ipv6-nd-issecure": str, "ipv6-nd-neighbor-address": str, "ipv6-nd-neighbor-l2-address": str, "ipv6-nd-state": str } ], "ipv6-nd-total": str } }""" # Main Schema schema = { Optional("@xmlns:junos"): str, "ipv6-nd-information": { Optional("@junos:style"): str, Optional("@xmlns"): str, "ipv6-nd-entry": ListOf({ "ipv6-nd-expire": str, "ipv6-nd-interface-name": str, "ipv6-nd-isrouter": str, "ipv6-nd-issecure": str, "ipv6-nd-neighbor-address": str, "ipv6-nd-neighbor-l2-address": str, "ipv6-nd-state": str }), Optional("ipv6-nd-total"): str } }
def validate_community_list(value): if not isinstance(value, list): raise SchemaError('snmp community is not a list') snmp_community_schema = Schema({ "name": str, "authorization": str, "clients": ListOf({ "name": str, Optional("restrict"): bool }), }) # Validate each dictionary in list for item in value: snmp_community_schema.validate(item) return value
class ShowConfigurationProtocolsMplsPathSchema(MetaParser): """ Schema for: show configuration protocols mpls path {path} """ schema = { "configuration": { "protocols": { "mpls": { "path": { "path-list": ListOf({ 'name': str, 'type': str, }) } } } } }
class ShowL2routeEvpnMacIpSchema(MetaParser): """ Schema for show l2route evpn mac ip show l2route evpn mac ip esi <esi> show l2route evpn mac ip mac-address <macaddr> show l2route evpn mac ip mac-address <macaddr> esi <esi> show l2route evpn mac ip next-hop <next-hop> show l2route evpn mac ip next-hop <next-hop> mac-address <macaddr> show l2route evpn mac ip next-hop <next-hop> mac-address <macaddr> esi <esi> show l2route evpn mac ip producer <prod> show l2route evpn mac ip producer <prod> next-hop <next-hop> show l2route evpn mac ip producer <prod> next-hop <next-hop> mac-address <macaddr> show l2route evpn mac ip producer <prod> next-hop <next-hop> mac-address <macaddr> esi <esi> show l2route evpn mac ip topology <evi:etag> show l2route evpn mac ip topology <evi:etag> producer <prod> show l2route evpn mac ip topology <evi:etag> producer <prod> next-hop <next-hop> show l2route evpn mac ip topology <evi:etag> producer <prod> next-hop <next-hop> mac-address <macaddr> show l2route evpn mac ip topology <evi:etag> producer <prod> next-hop <next-hop> mac-address <macaddr> esi <esi> show l2route evpn mac ip topology <evi> show l2route evpn mac ip topology <evi> producer <prod> show l2route evpn mac ip topology <evi> producer <prod> next-hop <next-hop> show l2route evpn mac ip topology <evi> producer <prod> next-hop <next-hop> mac-address <macaddr> show l2route evpn mac ip topology <evi> producer <prod> next-hop <next-hop> mac-address <macaddr> esi <esi> """ schema = { 'evi': { Any(): { 'producer': { Any(): { 'host_ip': { Any(): { 'eth_tag': int, 'mac_addr': str, 'next_hops': ListOf(str) } } } } } } }
class TracerouteNoResolveSchema(MetaParser): """ Schema for: * traceroute {ipaddress} no-resolve * traceroute {ipaddress} source {ipaddress2} no-resolve """ """schema = { "traceroute": { "to": { "domain": str, "address": str }, "max-hops": str, "packet-size": str, "hops": [ { "hop-number": str, Optional("router-name"): str, "address": str, "round-trip-time": str } ] } } """ # Main Schema schema = { "traceroute": { "to": { "domain": str, "address": str }, "max-hops": str, "packet-size": str, Optional("hops"): ListOf({ "hop-number": str, Optional("router-name"): str, "address": str, "round-trip-time": str }) } }