예제 #1
0
    def test(self):
        open(RC_EOS, 'w').write(random_string())
        open(BOOT_EXTENSIONS, 'w').write(random_string())
        os.makedirs(BOOT_EXTENSIONS_FOLDER)
        open('%s/%s' % (BOOT_EXTENSIONS_FOLDER, random_string()),
             'w').write(random_string())

        bootstrap = Bootstrap()
        bootstrap.ztps.set_config_response()
        bootstrap.ztps.set_node_check_response()
        bootstrap.ztps.set_definition_response()
        bootstrap.start_test()

        try:
            self.failUnless(bootstrap.eapi_node_information_collected())
            self.failUnless(bootstrap.missing_startup_config_failure())
            self.failIf(os.path.exists(RC_EOS))
            self.failIf(os.path.exists(BOOT_EXTENSIONS))
            self.failIf(os.path.exists(BOOT_EXTENSIONS_FOLDER))
            self.failIf(bootstrap.error)
        except AssertionError as assertion:
            print 'Output: %s' % bootstrap.output
            print 'Error: %s' % bootstrap.error
            raise_exception(assertion)
        finally:
            bootstrap.end_test()
    def test(self):
        open(RC_EOS, 'w').write(random_string())
        open(BOOT_EXTENSIONS, 'w').write(random_string())
        os.makedirs(BOOT_EXTENSIONS_FOLDER)
        open('%s/%s' % (BOOT_EXTENSIONS_FOLDER, random_string()),
             'w').write(random_string())

        bootstrap = Bootstrap()
        bootstrap.ztps.set_config_response()
        bootstrap.ztps.set_node_check_response()
        bootstrap.ztps.set_definition_response()
        bootstrap.start_test()

        try:
            self.failUnless(bootstrap.eapi_node_information_collected())
            self.failUnless(bootstrap.missing_startup_config_failure())
            self.failIf(os.path.exists(RC_EOS))
            self.failIf(os.path.exists(BOOT_EXTENSIONS))
            self.failIf(os.path.exists(BOOT_EXTENSIONS_FOLDER))
            self.failIf(bootstrap.error)
        except AssertionError as assertion:
            print 'Output: %s' % bootstrap.output
            print 'Error: %s' % bootstrap.error
            raise assertion
        finally:
            bootstrap.end_test()
예제 #3
0
    def test(self):
        bootstrap = Bootstrap()

        open(bootstrap.rc_eos, 'w').write(random_string())
        open(bootstrap.boot_extensions, 'w').write(random_string())
        os.makedirs(bootstrap.boot_extensions_folder)
        open('%s/%s' % (bootstrap.boot_extensions_folder, 
                        random_string()),
             'w').write(random_string())

        bootstrap.ztps.set_config_response()
        bootstrap.ztps.set_node_check_response()
        bootstrap.ztps.set_definition_response()
        bootstrap.start_test()

        try:
            self.failUnless(bootstrap.eapi_node_information_collected())
            self.failUnless(bootstrap.missing_startup_config_failure())
            self.failIf(os.path.exists(bootstrap.rc_eos))
            self.failIf(os.path.exists(bootstrap.boot_extensions))
            self.failIf(os.path.exists(bootstrap.boot_extensions_folder))

            self.failIf(bootstrap.error)
        except AssertionError as assertion:
            print 'Output: %s' % bootstrap.output
            print 'Error: %s' % bootstrap.error
            raise_exception(assertion)
        finally:
            bootstrap.end_test()
예제 #4
0
    def test(self):
        bootstrap = Bootstrap()

        open(bootstrap.rc_eos, 'w').write(random_string())
        open(bootstrap.boot_extensions, 'w').write(random_string())
        os.makedirs(bootstrap.boot_extensions_folder)
        open('%s/%s' % (bootstrap.boot_extensions_folder, random_string()),
             'w').write(random_string())

        bootstrap.ztps.set_config_response()
        bootstrap.ztps.set_node_check_response()
        bootstrap.ztps.set_definition_response()
        bootstrap.start_test()

        try:
            self.failUnless(bootstrap.eapi_node_information_collected())
            self.failUnless(bootstrap.missing_startup_config_failure())
            self.failIf(os.path.exists(bootstrap.rc_eos))
            self.failIf(os.path.exists(bootstrap.boot_extensions))
            self.failIf(os.path.exists(bootstrap.boot_extensions_folder))

            self.failIf(bootstrap.error)
        except AssertionError as assertion:
            print 'Output: %s' % bootstrap.output
            print 'Error: %s' % bootstrap.error
            raise_exception(assertion)
        finally:
            bootstrap.end_test()
    def test(self):
        filenames = {
            'DEBUG' : '/tmp/ztps-log-%s-debug' % os.getpid(),
            'ERROR' : '/tmp/ztps-log-%s-error' % os.getpid(),
            'INFO' : '/tmp/ztps-log-%s-info' % os.getpid(),
            'bogus' : '/tmp/ztps-log-%s-bogus' % os.getpid()
            }

        logging = []
        for level, filename in filenames.iteritems():
            logging += {'destination' : 'file:%s' % filename,
                        'level' : level},

        for filename in filenames.itervalues():
            self.failIf(os.path.isfile(filename))

        bootstrap = Bootstrap()
        bootstrap.ztps.set_config_response(logging=logging)
        bootstrap.ztps.set_node_check_response()
        bootstrap.ztps.set_definition_response()
        bootstrap.start_test()

        try:
            self.failUnless(bootstrap.eapi_node_information_collected())
            self.failUnless(bootstrap.missing_startup_config_failure())
            for filename in filenames.itervalues():
                self.failUnless(file_log(filename))
            self.assertEquals(file_log(filenames['DEBUG'],
                                       ignore_string='SyslogManager'),
                              file_log(filenames['bogus'],
                                       ignore_string='SyslogManager'))
            self.assertEquals(file_log(filenames['DEBUG'],
                                       ignore_string='SyslogManager'),
                              file_log(filenames['INFO'],
                                       ignore_string='SyslogManager'))
            self.failIfEqual(file_log(filenames['DEBUG'],
                                       ignore_string='SyslogManager'),
                             file_log(filenames['ERROR'],
                                       ignore_string='SyslogManager'))
            self.failUnless(set(file_log(filenames['ERROR'])).issubset(
                    set(file_log(filenames['DEBUG']))))
            for filename in filenames.itervalues():
                remove_file(filename)
                self.failIf(bootstrap.error)
        except AssertionError as assertion:
            print 'Output: %s' % bootstrap.output
            print 'Error: %s' % bootstrap.error
            raise assertion
        finally:
            bootstrap.end_test()
예제 #6
0
    def test(self):
        filenames = {
            'DEBUG': '/tmp/ztps-log-%s-debug' % os.getpid(),
            'ERROR': '/tmp/ztps-log-%s-error' % os.getpid(),
            'INFO': '/tmp/ztps-log-%s-info' % os.getpid(),
            'bogus': '/tmp/ztps-log-%s-bogus' % os.getpid()
        }

        logging = []
        for level, filename in filenames.iteritems():
            logging += {'destination': 'file:%s' % filename, 'level': level},

        for filename in filenames.itervalues():
            self.failIf(os.path.isfile(filename))

        bootstrap = Bootstrap()
        bootstrap.ztps.set_config_response(logging=logging)
        bootstrap.ztps.set_node_check_response()
        bootstrap.ztps.set_definition_response()
        bootstrap.start_test()

        try:
            self.failUnless(bootstrap.eapi_node_information_collected())
            self.failUnless(bootstrap.missing_startup_config_failure())
            for filename in filenames.itervalues():
                self.failUnless(file_log(filename))
            self.assertEquals(
                file_log(filenames['DEBUG'], ignore_string='SyslogManager'),
                file_log(filenames['bogus'], ignore_string='SyslogManager'))
            self.assertEquals(
                file_log(filenames['DEBUG'], ignore_string='SyslogManager'),
                file_log(filenames['INFO'], ignore_string='SyslogManager'))
            self.failIfEqual(
                file_log(filenames['DEBUG'], ignore_string='SyslogManager'),
                file_log(filenames['ERROR'], ignore_string='SyslogManager'))
            self.failUnless(
                set(file_log(filenames['ERROR'])).issubset(
                    set(file_log(filenames['DEBUG']))))
            for filename in filenames.itervalues():
                remove_file(filename)
                self.failIf(bootstrap.error)
        except AssertionError as assertion:
            print 'Output: %s' % bootstrap.output
            print 'Error: %s' % bootstrap.error
            raise_exception(assertion)
        finally:
            bootstrap.end_test()
    def test(self):
        bootstrap = Bootstrap()
        bootstrap.ztps.set_config_response()
        bootstrap.ztps.set_node_check_response()
        bootstrap.ztps.set_definition_response()
        bootstrap.start_test()

        try:
            self.failUnless(bootstrap.eapi_node_information_collected())
            self.failUnless(bootstrap.missing_startup_config_failure())
            self.failIf(bootstrap.error)
        except AssertionError as assertion:
            print 'Output: %s' % bootstrap.output
            print 'Error: %s' % bootstrap.error
            raise assertion
        finally:
            bootstrap.end_test()
예제 #8
0
    def test(self):
        bootstrap = Bootstrap()
        bootstrap.ztps.set_config_response()
        bootstrap.ztps.set_node_check_response()
        bootstrap.ztps.set_definition_response()
        bootstrap.start_test()

        try:
            self.failUnless(bootstrap.eapi_node_information_collected())
            self.failUnless(bootstrap.missing_startup_config_failure())
            self.failIf(bootstrap.error)
        except AssertionError as assertion:
            print 'Output: %s' % bootstrap.output
            print 'Error: %s' % bootstrap.error
            raise_exception(assertion)
        finally:
            bootstrap.end_test()
    def xmpp_sanity_test(self, xmpp):
        log = '/tmp/ztps-log-%s-debug' % os.getpid()

        bootstrap = Bootstrap()
        bootstrap.ztps.set_config_response(logging=[
                {'destination' : 'file:%s' % log,
                 'level' : 'DEBUG'},],
                                           xmpp=xmpp)
        bootstrap.ztps.set_node_check_response()
        bootstrap.ztps.set_definition_response()
        bootstrap.start_test()

        try:
            self.failUnless(bootstrap.eapi_node_information_collected())
            self.failUnless(bootstrap.missing_startup_config_failure())
            self.failIf(bootstrap.error)
            self.failIf('XmppClient' not in ''.join(file_log(log)))
        except AssertionError as assertion:
            print 'Output: %s' % bootstrap.output
            print 'Error: %s' % bootstrap.error
            raise assertion
        finally:
            bootstrap.end_test()