dev.name)))
                output = dev.parse('show ip route')
        # Not sure what to review to decide if test is passing or failed
        self.failed("Failed? Fail or Passing criteria not specified")
                
                
# #####################################################################
# ####                       COMMON CLEANUP SECTION                 ###
# #####################################################################


# This is how to create a CommonCleanup
# You can have 0 , or 1 CommonCleanup.
# CommonCleanup can be named whatever you want :)
class common_cleanup(aetest.CommonCleanup):
    """ Common Cleanup for Sample Test """

    # CommonCleanup follow exactly the same rule as CommonSetup regarding
    # subsection
    # You can have 1 to as many subsections as wanted
    # here is an example of 1 subsection

    @aetest.subsection
    def clean_everything(self):
        """ Common Cleanup Subsection """
        log.info("Aetest Common Cleanup ")


if __name__ == '__main__':  # pragma: no cover
    aetest.main()
Ejemplo n.º 2
0
    #*      - parsing should only ever be done using parse_known_args(), as
    #*        AEtest also parses its argument during main()
    #*
    #*  in the example below, we've added the --testbed argument for you:
    #*  the equivalent of -testbed_file, loading testbed file into topology
    #*  object.

    #
    # local standalone parsing
    #
    parser = argparse.ArgumentParser(description="standalone parser")
    parser.add_argument('--testbed',
                        dest='testbed',
                        help='testbed YAML file',
                        type=topology.loader.load,
                        default=None)

    # do the parsing
    args = parser.parse_known_args()[0]

    #**********************************
    #* aetest.main()
    #*
    #*  this runs the testscript. Pass in any additional script arguments
    #*  in so that it becomes the base part of your testscript parameters.

    #
    # calling aetest.main() to start testscript run
    #
    aetest.main(testbed=args.testbed)
        self.parameters = {}


class CommonCleanup(aetest.CommonCleanup):
    @aetest.subsection
    def cleanup(self):
        logger.info('Common Cleanup')

    @aetest.subsection
    def cleanup_second(self):
        logger.info('Done')


if __name__ == '__main__':
    import sys
    import argparse

    logging.root.setLevel('INFO')
    parser = argparse.ArgumentParser(description="example_parser")

    parser.add_argument('--digit', dest='digit')

    args, sys.argv[1:] = parser.parse_known_args(sys.argv[1:])

    digit = int(args.digit)

    # pass all arguments to aetest.main() as kwargs
    aetest.main(datafile='data_file.yaml', foo=500, digit=digit)

    # Run under standalone execution ! ---> python conditions_example.py --digit 100
Ejemplo n.º 4
0
    '''disconnect from ios routers'''

    @aetest.subsection
    def disconnect(self, steps, routers):
        '''disconnect from both devices'''

        for rtr in routers:
            with steps.start('Disconnecting from {}'.format(rtr)):
                rtr.disconnect()
        for rtr in routers:
            if rtr.connected:
                # abort/fail the testscript if device connection still exists
                self.failed('One of the devices could not be disconnected from',
                            goto = ['exit'])


if __name__ == '__main__':

    # local imports
    import argparse
    from ats.topology import loader

    parser = argparse.ArgumentParser(description = "standalone parser")
    parser.add_argument('--testbed', dest = 'testbed',
                        type = loader.load)
    # parse args
    args, unknown = parser.parse_known_args()

    # and pass all arguments to aetest.main() as kwargs
    aetest.main(**vars(args))
Ejemplo n.º 5
0
    @aetest.test
    def verify_enforce(self):
        'Verify licensing enforce mode is either evaluation or authorized'
        asa = self.parameters['asa']
        output = asa.vty1.execute('show version')
        LOGGER.info('Successfully retrieved version:\n%s' % output)
        assert 'enforce mode: Authorized' in output or 'enforce mode: Eval' in output, \
               'Expected the Licensing enforce mode to be Eval or Authorized'

    @aetest.test
    def verify_failover(self):
        'Check for Active/Active or Active/Standby failover'
        asa = self.parameters['asa']
        output = asa.vty1.execute('show version')
        LOGGER.info('Successfully retrieved version:\n%s' % output)
        assert 'Active/Standby' in output or 'Active/Active' in output, \
               'Check failover in the licensed features'

    @aetest.cleanup
    def windup(self):
        asa = self.parameters['asa']
        asa.vty1.disconnect()

if __name__ == '__main__':
    aetest.main(testbed_file='../etc/pyclass.yaml')