Ejemplo n.º 1
0
def create_remote_temp_folder(cmd):
    cmd.send_cmd('mktemp -d', delay=1)
    temp_folder = '/tmp/tmp{0}/'.format(
        PExpectWrapper.get_text_after_value(cmd.cli, '/tmp/tmp'))
    cmd.send_cmd('cd {0}'.format(temp_folder), delay=1)

    return temp_folder
    def get_current_load_levels(self, protection_profile):
        show_queue_depth = 'show configuration policy protection-profile {0} advanced-settings ingress-load-level ' \
                           '| details'.format(protection_profile)
        self.send_cmd(show_queue_depth, show_queue_depth)

        queue_depth = {
            '0':
            '0',
            '1':
            PExpectWrapper.get_text_after_value(self.cli,
                                                'level-1').strip(';'),
            '2':
            PExpectWrapper.get_text_after_value(self.cli,
                                                'level-2').strip(';'),
            '3':
            PExpectWrapper.get_text_after_value(self.cli,
                                                'level-3').strip(';'),
            '4':
            PExpectWrapper.get_text_after_value(self.cli,
                                                'level-4').strip(';'),
            '5':
            PExpectWrapper.get_text_after_value(self.cli,
                                                'level-5').strip(';'),
            '6':
            PExpectWrapper.get_text_after_value(self.cli,
                                                'level-6').strip(';'),
            '7':
            PExpectWrapper.get_text_after_value(self.cli,
                                                'level-7').strip(';'),
            '8':
            '-1'
        }

        return queue_depth
    def _get_current_version(self, device_ip):
        connection_details = ConfigLoader.get_general_config(
            'DeviceConnectionDetails')
        user = UserWrapper(connection_details["User"],
                           connection_details["Password"], None)

        with ActionsProvisionalCLI(user, device_ip) as device_pcli_action:
            device_pcli_action.send_cmd('show version')
            device_version = PExpectWrapper.get_text_after_value(
                device_pcli_action.cli, 'Application Version : ')

        return Version(device_version)