def perspective_load(self, profile='jcli-prod', scope='all'):
        try:
            if scope in ['all', 'groups']:
                # Load groups configuration
                path = '%s/%s.router-groups' % (self.config.store_path, profile)
                self.log.info('Loading/Activating [%s] profile Groups configuration from %s',
                              profile, path)

                # Load configuration from file
                fh = open(path, 'r')
                lines = fh.readlines()
                fh.close()

                # Init migrator
                cf = ConfigurationMigrator(context='groups', header=lines[0], data=''.join(lines[1:]))

                # Remove current configuration
                self.log.info('Removing current Groups (%d)', len(self.groups))
                self.perspective_group_remove_all()

                # Adding new groups
                self.groups = cf.getMigratedData()
                self.log.info('Added new Groups (%d)', len(self.groups))

                # Set persistance state to True
                self.persistenceState['groups'] = True

            if scope in ['all', 'users']:
                # Load users configuration
                path = '%s/%s.router-users' % (self.config.store_path, profile)
                self.log.info('Loading/Activating [%s] profile Users configuration from %s',
                              profile, path)

                # Load configuration from file
                fh = open(path, 'r')
                lines = fh.readlines()
                fh.close()

                # Init migrator
                cf = ConfigurationMigrator(context='users', header=lines[0], data=''.join(lines[1:]))

                # Remove current configuration
                self.log.info('Removing current Users (%d)', len(self.users))
                self.perspective_user_remove_all()

                # Adding new users
                self.users = cf.getMigratedData()
                self.log.info('Added new Users (%d)', len(self.users))

                # Set persistance state to True
                self.persistenceState['users'] = True
                for u in self.users:
                    u.mt_credential.quotas_updated = False

            if scope in ['all', 'mointerceptors']:
                # Load mointerceptors configuration
                path = '%s/%s.router-mointerceptors' % (self.config.store_path, profile)
                self.log.info('Loading/Activating [%s] profile MO Interceptors configuration from %s',
                              profile, path)

                # Load configuration from file
                fh = open(path, 'r')
                lines = fh.readlines()
                fh.close()

                # Init migrator
                cf = ConfigurationMigrator(context='mointerceptors',
                                           header=lines[0], data=''.join(lines[1:]))

                # Adding new MO Interceptors
                self.mo_interception_table = cf.getMigratedData()
                self.log.info('Added new MOInterceptionTable with %d routes',
                              len(self.mo_interception_table.getAll()))

                # Set persistance state to True
                self.persistenceState['mointerceptors'] = True

            if scope in ['all', 'mtinterceptors']:
                # Load mtinterceptors configuration
                path = '%s/%s.router-mtinterceptors' % (self.config.store_path, profile)
                self.log.info('Loading/Activating [%s] profile MT Interceptors configuration from %s',
                              profile, path)

                # Load configuration from file
                fh = open(path, 'r')
                lines = fh.readlines()
                fh.close()

                # Init migrator
                cf = ConfigurationMigrator(context='mtinterceptors',
                                           header=lines[0], data=''.join(lines[1:]))

                # Adding new MT Interceptors
                self.mt_interception_table = cf.getMigratedData()
                self.log.info('Added new MTInterceptionTable with %d routes',
                              len(self.mt_interception_table.getAll()))

                # Set persistance state to True
                self.persistenceState['mtinterceptors'] = True

            if scope in ['all', 'moroutes']:
                # Load moroutes configuration
                path = '%s/%s.router-moroutes' % (self.config.store_path, profile)
                self.log.info('Loading/Activating [%s] profile MO Routes configuration from %s',
                              profile, path)

                # Load configuration from file
                fh = open(path, 'r')
                lines = fh.readlines()
                fh.close()

                # Init migrator
                cf = ConfigurationMigrator(context='moroutes',
                                           header=lines[0], data=''.join(lines[1:]))

                # Adding new MO Routes
                self.mo_routing_table = cf.getMigratedData()
                self.log.info('Added new MORoutingTable with %d routes',
                              len(self.mo_routing_table.getAll()))

                # Set persistance state to True
                self.persistenceState['moroutes'] = True

            if scope in ['all', 'mtroutes']:
                # Load mtroutes configuration
                path = '%s/%s.router-mtroutes' % (self.config.store_path, profile)
                self.log.info('Loading/Activating [%s] profile MT Routes configuration from %s',
                              profile, path)

                # Load configuration from file
                fh = open(path, 'r')
                lines = fh.readlines()
                fh.close()

                # Init migrator
                cf = ConfigurationMigrator(context='mtroutes',
                                           header=lines[0], data=''.join(lines[1:]))

                # Adding new MT Routes
                self.mt_routing_table = cf.getMigratedData()
                self.log.info('Added new MTRoutingTable with %d routes',
                              len(self.mt_routing_table.getAll()))

                # Set persistance state to True
                self.persistenceState['mtroutes'] = True

        except __HOLE__, e:
            self.log.error('Cannot load configuration from %s: %s', path, str(e))
            return False
        except Exception, e:
            self.log.error('Unknown error occurred while loading configuration: %s', e)
            return False

        return True
dataset/ETHPy150Open jookies/jasmin/jasmin/routing/router.py/RouterPB.perspective_load