How to use the pyats.utils.schemaengine.Optional function in pyats

To help you get started, we’ve selected a few pyats examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CiscoTestAutomation / genielibs / pkgs / conf-pkg / src / genie / libs / conf / topology_mapper / schema.py View on Github external
# Constraints
            Optional('type'): Use(transform_to_list_or_None),  # TODO platform vs type
            Optional('name'): Use(transform_to_list_or_None),  # -> match_name
            Optional('platform'): Use(transform_to_list_or_None),  # TODO platform vs type
            Optional('tgen_platform'): Use(transform_to_list_or_None),
            Optional('os'): Use(transform_to_list_or_None),
            # TODO Optional('series'): Use(transform_to_list_or_None),
            # TODO Optional('model'): Use(transform_to_list_or_None),
            Optional('multinode_requested'): Or(bool, NoneType),
            Optional('predicates'): SequenceOfPredicates,

        },
    },

    Optional('topology'): {
        Optional('links'): {
            Any(): {  # TODO Optional(Link.validate_name)

                # Parameters
                Optional('label'): Use(transform_to_list),

                # Constraints
                Optional('type'): Use(transform_to_list_or_None),
                Optional('interface'): Use(transform_to_list_or_None),
                Optional('name'): Use(transform_to_list_or_None),  # -> match_name
                Optional('predicates'): SequenceOfPredicates,

            }
        },
        Any(): {
            'interfaces': {
                Any(): {  # TODO Optional(Interface.validate_name_I)
github CiscoTestAutomation / genielibs / pkgs / conf-pkg / src / genie / libs / conf / topology_mapper / schema.py View on Github external
Optional('name'): str,  # not to be filled by hand
    Optional('topology_file'): str,  # not to be filled by hand

    Optional('subsets'): {
        Any(): Use(transform_to_list),
    },

    'devices': {
        Any(): {  # TODO Optional(Device.validate_name)

            # Parameters
            Optional('label'): Use(transform_to_list),
            Optional('role'): Use(transform_to_list),
            Optional('draw_rank'): int,
            Optional('draw_cluster'): str,

            # Constraints
            Optional('type'): Use(transform_to_list_or_None),  # TODO platform vs type
            Optional('name'): Use(transform_to_list_or_None),  # -> match_name
            Optional('platform'): Use(transform_to_list_or_None),  # TODO platform vs type
            Optional('tgen_platform'): Use(transform_to_list_or_None),
            Optional('os'): Use(transform_to_list_or_None),
            # TODO Optional('series'): Use(transform_to_list_or_None),
            # TODO Optional('model'): Use(transform_to_list_or_None),
            Optional('multinode_requested'): Or(bool, NoneType),
            Optional('predicates'): SequenceOfPredicates,

        },
    },

    Optional('topology'): {
github CiscoTestAutomation / genielibs / pkgs / conf-pkg / src / genie / libs / conf / topology_mapper / schema.py View on Github external
},

    'devices': {
        Any(): {  # TODO Optional(Device.validate_name)

            # Parameters
            Optional('label'): Use(transform_to_list),
            Optional('role'): Use(transform_to_list),
            Optional('draw_rank'): int,
            Optional('draw_cluster'): str,

            # Constraints
            Optional('type'): Use(transform_to_list_or_None),  # TODO platform vs type
            Optional('name'): Use(transform_to_list_or_None),  # -> match_name
            Optional('platform'): Use(transform_to_list_or_None),  # TODO platform vs type
            Optional('tgen_platform'): Use(transform_to_list_or_None),
            Optional('os'): Use(transform_to_list_or_None),
            # TODO Optional('series'): Use(transform_to_list_or_None),
            # TODO Optional('model'): Use(transform_to_list_or_None),
            Optional('multinode_requested'): Or(bool, NoneType),
            Optional('predicates'): SequenceOfPredicates,

        },
    },

    Optional('topology'): {
        Optional('links'): {
            Any(): {  # TODO Optional(Link.validate_name)

                # Parameters
                Optional('label'): Use(transform_to_list),
github CiscoTestAutomation / genielibs / pkgs / conf-pkg / src / genie / libs / conf / topology_mapper / schema.py View on Github external
production_schema = {

    Optional('name'): str,  # not to be filled by hand
    Optional('topology_file'): str,  # not to be filled by hand

    Optional('subsets'): {
        Any(): Use(transform_to_list),
    },

    'devices': {
        Any(): {  # TODO Optional(Device.validate_name)

            # Parameters
            Optional('label'): Use(transform_to_list),
            Optional('role'): Use(transform_to_list),
            Optional('draw_rank'): int,
            Optional('draw_cluster'): str,

            # Constraints
            Optional('type'): Use(transform_to_list_or_None),  # TODO platform vs type
            Optional('name'): Use(transform_to_list_or_None),  # -> match_name
            Optional('platform'): Use(transform_to_list_or_None),  # TODO platform vs type
            Optional('tgen_platform'): Use(transform_to_list_or_None),
            Optional('os'): Use(transform_to_list_or_None),
            # TODO Optional('series'): Use(transform_to_list_or_None),
            # TODO Optional('model'): Use(transform_to_list_or_None),
            Optional('multinode_requested'): Or(bool, NoneType),
            Optional('predicates'): SequenceOfPredicates,

        },
    },
github CiscoTestAutomation / genielibs / pkgs / conf-pkg / src / genie / libs / conf / topology_mapper / schema.py View on Github external
'devices': {
        Any(): {  # TODO Optional(Device.validate_name)

            # Parameters
            Optional('label'): Use(transform_to_list),
            Optional('role'): Use(transform_to_list),
            Optional('draw_rank'): int,
            Optional('draw_cluster'): str,

            # Constraints
            Optional('type'): Use(transform_to_list_or_None),  # TODO platform vs type
            Optional('name'): Use(transform_to_list_or_None),  # -> match_name
            Optional('platform'): Use(transform_to_list_or_None),  # TODO platform vs type
            Optional('tgen_platform'): Use(transform_to_list_or_None),
            Optional('os'): Use(transform_to_list_or_None),
            # TODO Optional('series'): Use(transform_to_list_or_None),
            # TODO Optional('model'): Use(transform_to_list_or_None),
            Optional('multinode_requested'): Or(bool, NoneType),
            Optional('predicates'): SequenceOfPredicates,

        },
    },

    Optional('topology'): {
        Optional('links'): {
            Any(): {  # TODO Optional(Link.validate_name)

                # Parameters
                Optional('label'): Use(transform_to_list),

                # Constraints
github CiscoTestAutomation / genielibs / pkgs / conf-pkg / src / genie / libs / conf / topology_mapper / schema.py View on Github external
Optional('subsets'): {
        Any(): Use(transform_to_list),
    },

    'devices': {
        Any(): {  # TODO Optional(Device.validate_name)

            # Parameters
            Optional('label'): Use(transform_to_list),
            Optional('role'): Use(transform_to_list),
            Optional('draw_rank'): int,
            Optional('draw_cluster'): str,

            # Constraints
            Optional('type'): Use(transform_to_list_or_None),  # TODO platform vs type
            Optional('name'): Use(transform_to_list_or_None),  # -> match_name
            Optional('platform'): Use(transform_to_list_or_None),  # TODO platform vs type
            Optional('tgen_platform'): Use(transform_to_list_or_None),
            Optional('os'): Use(transform_to_list_or_None),
            # TODO Optional('series'): Use(transform_to_list_or_None),
            # TODO Optional('model'): Use(transform_to_list_or_None),
            Optional('multinode_requested'): Or(bool, NoneType),
            Optional('predicates'): SequenceOfPredicates,

        },
    },

    Optional('topology'): {
        Optional('links'): {
            Any(): {  # TODO Optional(Link.validate_name)
github CiscoTestAutomation / genielibs / pkgs / conf-pkg / src / genie / libs / conf / topology_mapper / schema.py View on Github external
# Parameters
            Optional('label'): Use(transform_to_list),
            Optional('role'): Use(transform_to_list),
            Optional('draw_rank'): int,
            Optional('draw_cluster'): str,

            # Constraints
            Optional('type'): Use(transform_to_list_or_None),  # TODO platform vs type
            Optional('name'): Use(transform_to_list_or_None),  # -> match_name
            Optional('platform'): Use(transform_to_list_or_None),  # TODO platform vs type
            Optional('tgen_platform'): Use(transform_to_list_or_None),
            Optional('os'): Use(transform_to_list_or_None),
            # TODO Optional('series'): Use(transform_to_list_or_None),
            # TODO Optional('model'): Use(transform_to_list_or_None),
            Optional('multinode_requested'): Or(bool, NoneType),
            Optional('predicates'): SequenceOfPredicates,

        },
    },

    Optional('topology'): {
        Optional('links'): {
            Any(): {  # TODO Optional(Link.validate_name)

                # Parameters
                Optional('label'): Use(transform_to_list),

                # Constraints
                Optional('type'): Use(transform_to_list_or_None),
                Optional('interface'): Use(transform_to_list_or_None),
                Optional('name'): Use(transform_to_list_or_None),  # -> match_name
                Optional('predicates'): SequenceOfPredicates,
github CiscoTestAutomation / genielibs / pkgs / conf-pkg / src / genie / libs / conf / topology_mapper / schema.py View on Github external
def match(value):
        if re.match(expression, value):
            return value
        else:
            raise YamlConfigError("Value '%s' does not match regex '%s'" %
                                  (value, expression))

    return match


production_schema = {

    Optional('name'): str,  # not to be filled by hand
    Optional('topology_file'): str,  # not to be filled by hand

    Optional('subsets'): {
        Any(): Use(transform_to_list),
    },

    'devices': {
        Any(): {  # TODO Optional(Device.validate_name)

            # Parameters
            Optional('label'): Use(transform_to_list),
            Optional('role'): Use(transform_to_list),
            Optional('draw_rank'): int,
            Optional('draw_cluster'): str,

            # Constraints
            Optional('type'): Use(transform_to_list_or_None),  # TODO platform vs type
            Optional('name'): Use(transform_to_list_or_None),  # -> match_name
            Optional('platform'): Use(transform_to_list_or_None),  # TODO platform vs type
github CiscoTestAutomation / genielibs / pkgs / conf-pkg / src / genie / libs / conf / topology_mapper / schema.py View on Github external
# Parameters
            Optional('label'): Use(transform_to_list),
            Optional('role'): Use(transform_to_list),
            Optional('draw_rank'): int,
            Optional('draw_cluster'): str,

            # Constraints
            Optional('type'): Use(transform_to_list_or_None),  # TODO platform vs type
            Optional('name'): Use(transform_to_list_or_None),  # -> match_name
            Optional('platform'): Use(transform_to_list_or_None),  # TODO platform vs type
            Optional('tgen_platform'): Use(transform_to_list_or_None),
            Optional('os'): Use(transform_to_list_or_None),
            # TODO Optional('series'): Use(transform_to_list_or_None),
            # TODO Optional('model'): Use(transform_to_list_or_None),
            Optional('multinode_requested'): Or(bool, NoneType),
            Optional('predicates'): SequenceOfPredicates,

        },
    },

    Optional('topology'): {
        Optional('links'): {
            Any(): {  # TODO Optional(Link.validate_name)

                # Parameters
                Optional('label'): Use(transform_to_list),

                # Constraints
                Optional('type'): Use(transform_to_list_or_None),
                Optional('interface'): Use(transform_to_list_or_None),
                Optional('name'): Use(transform_to_list_or_None),  # -> match_name
github CiscoTestAutomation / genielibs / pkgs / conf-pkg / src / genie / libs / conf / topology_mapper / schema.py View on Github external
def regex(expression):

    def match(value):
        if re.match(expression, value):
            return value
        else:
            raise YamlConfigError("Value '%s' does not match regex '%s'" %
                                  (value, expression))

    return match


production_schema = {

    Optional('name'): str,  # not to be filled by hand
    Optional('topology_file'): str,  # not to be filled by hand

    Optional('subsets'): {
        Any(): Use(transform_to_list),
    },

    'devices': {
        Any(): {  # TODO Optional(Device.validate_name)

            # Parameters
            Optional('label'): Use(transform_to_list),
            Optional('role'): Use(transform_to_list),
            Optional('draw_rank'): int,
            Optional('draw_cluster'): str,

            # Constraints
            Optional('type'): Use(transform_to_list_or_None),  # TODO platform vs type