Exemple #1
0
    def validate_neighbor_list(value):
        if not isinstance(value, list):
            raise SchemaTypeError('RSVP Neighbor not a list')

        rsvp_neighbor_list = Schema({
            "rsvp-neighbor-address": str,
            Optional("rsvp-neighbor-interface"): str,
            "rsvp-neighbor-status": str,
            Optional("rsvp-neighbor-node"): bool,
            "last-changed-time": str,
            "neighbor-idle": str,
            "neighbor-up-count": str,
            "neighbor-down-count": str,
            "messages-received": str,
            "hello-interval": str,
            "hellos-sent": str,
            "hellos-received": str,
            "rsvp-neighbor-remote-instance": str,
            "rsvp-neighbor-local-instance": str,
            "rsvp-refresh-reduct-status": str,
            "rsvp-refresh-reduct-remote-status": str,
            "rsvp-refresh-reduct-ack-status": str,
            "rsvp-nbr-enh-local-protection": {
                "rsvp-nbr-enh-lp-status": str,
                Optional("rsvp-nbr-enh-lp-total-lsp-count"): str,
                Optional("rsvp-nbr-enh-lp-phop-lsp-count"): str,
                Optional("rsvp-nbr-enh-lp-pphop-lsp-count"): str,
                Optional("rsvp-nbr-enh-lp-nhop-lsp-count"): str,
                Optional("rsvp-nbr-enh-lp-nnhop-lsp-count"): str,
            }
        })

        for item in value:
            rsvp_neighbor_list.validate(item)
        return value
Exemple #2
0
 def validate_route_table_list(value):
     # Pass route-table list of dict in value
     if not isinstance(value, list):
         raise SchemaTypeError('route-table is not a list')
     # Create RouteEntry Schema
     route_entry_schema = Schema({
         "active-route-count": str,
         "destination-count": str,
         "hidden-route-count": str,
         "holddown-route-count": str,
         Optional("rt"): {
             "rt-destination": str,
             "rt-entry": {
                 "active-tag": str,
                 "age": str,
                 "nh": {
                     "to": str,
                     "via": str
                 },
                 "preference": str,
                 "protocol-name": str
             }
         },
         "table-name": str,
         "total-route-count": str
     })
     # Validate each dictionary in list
     for item in value:
         route_entry_schema.validate(item)
     return value
Exemple #3
0
        def validate_explicit_route(value):
            if not isinstance(value, list):
                raise SchemaTypeError('Explicit route is not a list')

            explicit_route = Schema({
                "address": str,
            })

            for item in value:
                explicit_route.validate(item)
            return value
Exemple #4
0
        def validate_record_route(value):
            if not isinstance(value, list):
                raise SchemaTypeError('Record route is not a list')

            record_route = Schema({
                "address": str,
            })

            for item in value:
                record_route.validate(item)
            return value
Exemple #5
0
    def validate_ldp_binding(value):
        if not isinstance(value, list):
            raise SchemaTypeError('LDP binding is not a list')

        ldp_binding = Schema({
            "ldp-label": str,
            "ldp-prefix": str
        })

        for item in value:
            ldp_binding.validate(item)
        return value
Exemple #6
0
    def validate_ldp_neighbor(value):
        if not isinstance(value, list):
            raise SchemaTypeError('LDP neighbor is not a list')

        ldp_neighbor = Schema({
            "interface-name": str,
            "ldp-label-space-id": str,
            "ldp-neighbor-address": str,
            "ldp-remaining-time": str
        })

        for item in value:
            ldp_neighbor.validate(item)
        return value
Exemple #7
0
    def validate_ldp_database(value):
        if not isinstance(value, list):
            raise SchemaTypeError('LDP database is not a list')

        ldp_database = Schema({
            "ldp-binding": Use(ShowLdpDatabaseSessionIpaddress.validate_ldp_binding),
            "ldp-database-type": str,
            Optional("ldp-label-received"): str,
            Optional("ldp-label-advertised"): str,
            "ldp-session-id": str
        })

        for item in value:
            ldp_database.validate(item)
        return value
    def validate_ldp_session(value):
        if not isinstance(value, list):
            raise SchemaTypeError('LDP Session not a list')

        ldp_session = Schema({
            "ldp-neighbor-address": str,
            "ldp-session-state": str,
            "ldp-connection-state": str,
            "ldp-remaining-time": str,
            Optional("ldp-session-adv-mode"): str,
        })

        for item in value:
            ldp_session.validate(item)
        return value
Exemple #9
0
 def validate_commit_history_list(value):
     # Pass commit-history list as value
     if not isinstance(value, list):
         raise SchemaTypeError('commit-history is not a list')
     commit_history_schema = Schema({
         "client": str,
         "date-time": {
             "#text": str
         },
         "sequence-number": str,
         "user": str
     })
     # Validate each dictionary in list
     for item in value:
         commit_history_schema.validate(item)
     return value
Exemple #10
0
        def validate_packet_information(value):
            if not isinstance(value, list):
                raise SchemaTypeError('Packet information is not a list')

            packet_information = Schema({
                "heading": str,
                Optional("next-hop"): str,
                Optional("previous-hop"): str,
                "interface-name": str,
                "count": str,
                Optional("entropy-label"): str,
            })

            for item in value:
                packet_information.validate(item)
            return value
Exemple #11
0
 def validate_interface_queue_list(value):
     # Pass interface-queue list as value
     if not isinstance(value, list):
         raise SchemaTypeError('commit-history is not a list')
     interface_queue_schema = Schema({
         "max-octets-allowed": str,
         "max-packets-allowed": str,
         "name": str,
         "number-of-queue-drops": str,
         "octets-in-queue": str,
         "packets-in-queue": str
     })
     # Validate each dictionary in list
     for item in value:
         interface_queue_schema.validate(item)
     return value
Exemple #12
0
    def validate_ted_link(val):
        ''' Validates each value in ted link '''
        if not isinstance(val, list):
            raise SchemaTypeError('ted link is not a list')
        
        ted_link_schema = Schema({
            "ted-link-local-address": str,
            "ted-link-local-ifindex": str,
            "ted-link-protocol": str,
            "ted-link-remote-address": str,
            "ted-link-remote-ifindex": str,
            "ted-link-to": str
        })

        for item in val:
            ted_link_schema.validate(item)
        return val
Exemple #13
0
    def validate_neighbor_list(value):
        if not isinstance(value, list):
            raise SchemaTypeError('RSVP Neighbor not a list')

        rsvp_neighbor_list = Schema({
            "rsvp-neighbor-address": str,
            "neighbor-idle": str,
            "neighbor-up-count": str,
            "neighbor-down-count": str,
            "last-changed-time": str,
            "hello-interval": str,
            "hellos-sent": str,
            "hellos-received": str,
            "messages-received": str,
        })

        for item in value:
            rsvp_neighbor_list.validate(item)
        return value
Exemple #14
0
        def validate_session_list(value):
            if not isinstance(value, list):
                raise SchemaTypeError('RSVP session not a list')

            rsvp_session_list = Schema({
                "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,
            })

            for item in value:
                rsvp_session_list.validate(item)
            return value
Exemple #15
0
    def validate_session_data_list(value):
        if not isinstance(value, list):
            raise SchemaTypeError('RSVP session data not a list')

        def validate_session_list(value):
            if not isinstance(value, list):
                raise SchemaTypeError('RSVP session not a list')

            rsvp_session_list = Schema({
                "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,
            })

            for item in value:
                rsvp_session_list.validate(item)
            return value

        rsvp_session_data_list = Schema({
            "session-type":
            str,
            "count":
            str,
            Optional("rsvp-session"):
            Use(validate_session_list),
            "display-count":
            str,
            "up-count":
            str,
            "down-count":
            str,
        })

        for item in value:
            rsvp_session_data_list.validate(item)
        return value
Exemple #16
0
 def validate_system_user_list(value):
     if not isinstance(value, list):
         raise SchemaTypeError('ospf-neighbor is not a list')
     neighbor_schema = Schema({
         "command": str,
         "from": str,
         "idle-time": {
             "#text": str,
             Optional("@junos:seconds"): str
         },
         "login-time": {
             "#text": str,
             Optional("@junos:seconds"): str
         },
         "tty": str,
         "user": str
     })
     for item in value:
         neighbor_schema.validate(item)
     return value
Exemple #17
0
 def validate_file_information_list(value):
     # Pass file-information list as value
     if not isinstance(value, list):
         raise SchemaTypeError('ospf-interface is not a list')
     file_information_schema = Schema({
         "file-date": {
             Optional("#text"): str,
             "@junos:format": str
         },
         "file-group": str,
         "file-links": str,
         "file-name": str,
         "file-owner": str,
         "file-permissions": {
             Optional("#text"): str,
             "@junos:format": str
         },
         "file-size": str
     })
     # Validate each dictionary in list
     for item in value:
         file_information_schema.validate(item)
     return value
Exemple #18
0
 def validate_filesystem_list(value):
     # Pass filesystem list as value
     if not isinstance(value, list):
         raise SchemaTypeError('filesystem is not a list')
     filesystem_schema = Schema({
         "available-blocks": {
             "junos:format": str
         },
         "filesystem-name": str,
         "mounted-on": str,
         "total-blocks": {
             Optional("#text"): str,
             "junos:format": str
         },
         "used-blocks": {
             "junos:format": str
         },
         "used-percent": str
     })
     # Validate each dictionary in list
     for item in value:
         filesystem_schema.validate(item)
     return value
Exemple #19
0
    def validate_rsvp_session_data(value):
        if not isinstance(value, list):
            raise SchemaTypeError('RSVP session data is not a list')

        def validate_packet_information(value):
            if not isinstance(value, list):
                raise SchemaTypeError('Packet information is not a list')

            packet_information = Schema({
                "heading": str,
                Optional("next-hop"): str,
                Optional("previous-hop"): str,
                "interface-name": str,
                "count": str,
                Optional("entropy-label"): str,
            })

            for item in value:
                packet_information.validate(item)
            return value

        def validate_explicit_route(value):
            if not isinstance(value, list):
                raise SchemaTypeError('Explicit route is not a list')

            explicit_route = Schema({
                "address": str,
            })

            for item in value:
                explicit_route.validate(item)
            return value

        def validate_record_route(value):
            if not isinstance(value, list):
                raise SchemaTypeError('Record route is not a list')

            record_route = Schema({
                "address": str,
            })

            for item in value:
                record_route.validate(item)
            return value

        rsvp_session_data = Schema({
            "session-type": str,
            "count": str,
            Optional("rsvp-session"): {
                "destination-address": str,
                "source-address": str,
                "lsp-state": str,
                "route-count": str,
                "name": str,
                "lsp-path-type": str,
                "suggested-label-in": str,
                "suggested-label-out": str,
                "recovery-label-in": str,
                "recovery-label-out": str,
                "rsb-count": str,
                "resv-style": str,
                "label-in": str,
                "label-out": str,
                "psb-lifetime": str,
                "psb-creation-time": str,
                "sender-tspec": str,
                "lsp-id": str,
                "tunnel-id": str,
                "proto-id": str,
                "packet-information": Use(validate_packet_information),
                "adspec": str,
                "explicit-route": {
                    "explicit-route-element": Use(validate_explicit_route)
                },
                "record-route": {
                    "record-route-element": Use(validate_record_route)
                }
            },
            "display-count": str,
            "up-count": str,
            "down-count": str,
        })

        for item in value:
            rsvp_session_data.validate(item)
        return value