test/system/test_cvp_api.py
def _create_task(self):
        ''' Create a task by making a simple change to a configlet assigned
            to the device.

            Returns:
                (task_id, config)
                task_id (str): Task ID
                config (str): Previous configlets contents
        '''
        task_id = self._get_next_task_id()

        # Update the lldp time in the first configlet in the list.
        configlet = None
        for conf in self.dev_configlets:
            if conf['netElementCount'] == 1:
                configlet = conf
                break
        if configlet is None:
            configlet = self.dev_configlets[0]

        config = configlet['config']
        org_config = config

        match = re.match(r'lldp timer (\d+)', config)
        if match is not None:
            value = int(match.group(1)) + 1
            repl = 'lldp timer %d' % value
            config = re.sub(match.group(0), repl, config)
        else:
            value = 13
            config = ('lldp timer %d\n' % value) + config
        configlet['config'] = config

        # Updating the configlet will cause a task to be created to apply
        # the change to the device.
        self.api.update_configlet(config, configlet['key'], configlet['name'])

        # Wait 30 seconds for task to get created
        cnt = 30
        if self.clnt.apiversion is None:
            self.api.get_cvp_info()
        if self.clnt.apiversion >= 2.0:
            # Increase timeout by 30 sec for CVP 2018.2 and beyond
            cnt += 30
        while cnt > 0:
            time.sleep(1)
            result = self.api.get_task_by_id(task_id)
            if result is not None:
                break
            cnt -= 1
        err_msg = 'Timeout waiting for task id %s to be created' % task_id
        self.assertGreater(cnt, 0, msg=err_msg)

        return task_id, org_config
 Create a task by making a simple change to a configlet assigned
            to the device.

            Returns:
                (task_id, config)
                task_id (str): Task ID
                config (str): Previous configlets contents
        
Create a task by making a simple change to a configlet assigned
to the device.
Create a task by making a simple change to a configlet assigned to the device .
def _create_task(self):
        task_id = self._get_next_task_id()
        configlet = None
        for conf in self.dev_configlets:
            if conf['netElementCount'] == 1:
                configlet = conf
                break
        if configlet is None:
            configlet = self.dev_configlets[0]
        config = configlet['config']
        org_config = config
        match = re.match(r'lldp timer (\d+)', config)
        if match is not None:
            value = int(match.group(1)) + 1
            repl = 'lldp timer %d' % value
            config = re.sub(match.group(0), repl, config)
        else:
            value = 13
            config = ('lldp timer %d\n' % value) + config
        configlet['config'] = config
        self.api.update_configlet(config, configlet['key'], configlet['name'])
        cnt = 30
        if self.clnt.apiversion is None:
            self.api.get_cvp_info()
        if self.clnt.apiversion >= 2.0:
            cnt += 30
        while cnt > 0:
            time.sleep(1)
            result = self.api.get_task_by_id(task_id)
            if result is not None:
                break
            cnt -= 1
        err_msg = 'Timeout waiting for task id %s to be created' % task_id
        self.assertGreater(cnt, 0, msg=err_msg)
        return task_id, org_config
def _create_task ( self ) : task_id = self . _get_next_task_id ( ) configlet = None for conf in self . dev_configlets : if conf [ 'netElementCount' ] == 1 : configlet = conf break if configlet is None : configlet = self . dev_configlets [ 0 ] config = configlet [ 'config' ] org_config = config match = re . match ( r'lldp timer (\d+)' , config ) if match is not None : value = int ( match . group ( 1 ) ) + 1 repl = 'lldp timer %d' % value config = re . sub ( match . group ( 0 ) , repl , config ) else : value = 13 config = ( 'lldp timer %d\n' % value ) + config configlet [ 'config' ] = config self . api . update_configlet ( config , configlet [ 'key' ] , configlet [ 'name' ] ) cnt = 30 if self . clnt . apiversion is None : self . api . get_cvp_info ( ) if self . clnt . apiversion >= 2.0 : cnt += 30 while cnt > 0 : time . sleep ( 1 ) result = self . api . get_task_by_id ( task_id ) if result is not None : break cnt -= 1 err_msg = 'Timeout waiting for task id %s to be created' % task_id self . assertGreater ( cnt , 0 , msg = err_msg ) return task_id , org_config
Create a task by making a simple change to a configlet assigned
to the device.
Create a task by making a simple change to a configlet assigned to the device .
''' Create a task by making a simple change to a configlet assigned
            to the device.

            Returns:
                (task_id, config)
                task_id (str): Task ID
                config (str): Previous configlets contents
        ''' # Update the lldp time in the first configlet in the list. # Updating the configlet will cause a task to be created to apply # the change to the device. # Wait 30 seconds for task to get created # Increase timeout by 30 sec for CVP 2018.2 and beyond
(task_id, config)
task_id (str): Task ID
config (str): Previous configlets contents
( task_id config ) task_id ( str ) : Task ID config ( str ) : Previous configlets contents
self