def __init__(self, password):
     rf_string = String()    # RF Library
     self.time = int(time.time())
     self.company_code = 1300
     self.status = 1
     self.enable_e_carrier = 1
     self.country_code = 'TW'
     self.gender = 'M'
     self.gogoro_guid = str(uuid.uuid4())
     self.first_name = rf_string.generate_random_string(5, '[UPPER]')
     self.last_name = 'PASW' + rf_string.generate_random_string(5, '[UPPER]')
     self.display_name = self.last_name + self.first_name
     # self.email = 'pasw.verify+{}@gogoro.com'.format(self.time)   #this account have a lot of scooters, the invoice setting cannot be change by userself
     self.email = 'pasw.verify.{}@yopmail.com'.format(self.time)
     self.emailv1 = 'pasw.verify-{}@yopmail.com'.format(self.time)
     self.mobile = '09' + rf_string.generate_random_string(8, '[NUMBERS]')
     # self.mobile = '886' + '09' + rf_string.generate_random_string(8, '[NUMBERS]')
     self.encode_password = password
     # Since myaccount user should over 20 ages. Therefore, the birthday is use current date -7500 days.
     self.birthday = (date.fromtimestamp(time.time()) + timedelta(days=-7500)).isoformat()
     self.contact_city = '臺北市'
     self.contact_district = '松山區'
     self.contact_zipcode = '10552'
     self.contact_address = '長安東路二段225號C棟11樓'
     self.phone = self.mobile
     # self.phone = self.mobile.replace('09', '+8869')
     # self.phone_number = self.phone.replace('+886', '')
     # print(self.phone)
     self.occupation = '1'
     self.invoice_city = '臺北市'
     self.invoice_district = '松山區'
     self.invoice_zipcode = '10552'
     self.invoice_address = '長安東路二段225號C棟11樓'
     
Exemple #2
0
 def __init__(self, login_user, battery_sn):
     rf_string = String()  # RF Library
     self.time = int(time.time() * 1000)
     self.login_user = '******'.format(login_user)
     self.battery_sn = 'SWQA' + battery_sn
     self.cmd_id = rf_string.generate_random_string(8, '[NUMBERS]')
     self.cmd_val = rf_string.generate_random_string(8, '[UPPER]')
     self.log_path = '/log_' + time.strftime("%Y_%m_%d") + '.zip'
     self.description = rf_string.generate_random_string(8, '[UPPER]')
 def __init__(self):
     self._builtin = BuiltIn()
     self._string = String()
     self._builtin.import_library('SSHLibrary')
     self._sshlibrary = self._builtin.get_library_instance('SSHLibrary')
     self._default_user = {}
     self._prompt = ':prompt:'
     self._local_infra_int_ip_ipv4 = ''
     self._key_exists = False
Exemple #4
0
 def __init__(self):
     rf_string = String()  # RF Library
     self.battery_guid = str(uuid.uuid4())
     self.charge_cycles = '0'
     self.manufacture_date = time.strftime("%Y-%m-%d")
     self.pn = rf_string.generate_random_string(2, '[NUMBERS]')
     self.sn = rf_string.generate_random_string(7, '[UPPER][NUMBERS]')
     self.pn = 'QA_TEST_' + self.pn
     self.battery_sn = 'TWSWQA' + self.sn
     self.state = '1'
Exemple #5
0
 def __init__(self, status=1):
     rf_string = String()  # RF Library
     self.hub_code = rf_string.generate_random_string(8, '[NUMBERS]')
     self.name = rf_string.generate_random_string(8, '[NUMBERS]')
     self.type = 123
     self.country_code = "TW"
     self.address = "長安東路二段225號C棟11樓"
     self.city = "Taipei"
     self.zip = 10552
     self.status = status
     self.remark = "remark"
Exemple #6
0
    def __init__(self, order_no=None):
        rf_string = String()  # RF Library

        self.order_id = None
        self.owner_id = None

        if order_no is None:
            self.order_no = 'P0' + \
                rf_string.generate_random_string(8, '[NUMBERS]')
        else:
            self.order_no = order_no
Exemple #7
0
 def __init__(self, company_code, scooter_model):
     rf_string = String()  # RF Library
     self.scooter_id = None
     self.atmel_key = 'ED554638AD91C64694A39262CA1A3C14663B8ACBDF8E074E98BBD965EA1969C8'
     self.atmel_sn = '0123F61FCBFED2A0B1'
     self.company_code = company_code
     self.ecu_mac = 'rpNx83uY'
     self.ecu_sn = 'MABBQUFCBBIwABYzRQBkEA=='
     self.ecu_status = '1'
     self.es_state = '13'
     self.file_name = rf_string.generate_random_string(
         8, '[LETTERS][NUMBERS]')
     self.guid = str(uuid.uuid4())
     self.keyfobs_id = rf_string.generate_random_string(3, '[NUMBERS]')
     self.keyfobs_status = '1'
     self.manufacture_date = time.strftime("%Y-%m-%d")
     self.matnr = 'PI' + scooter_model + '-160-ORI'
     self.motor_num = self.matnr
     self.plate_first = rf_string.generate_random_string(3, '[UPPER]')
     self.plate_second = rf_string.generate_random_string(4, '[NUMBERS]')
     self.plate = self.plate_first + '-' + self.plate_second
     self.state = '9'
     self.plate_date = int(time.time())
     self.vin = 'SWQA' + \
         rf_string.generate_random_string(13, '[UPPER][NUMBERS]')
     self.warranty_start = int(time.time())
     self.warranty_end = int(time.time() + 10)
    def generate_bank_code1():
        total = 0
        enterprise_code = '8765'
        rf_string = String()
        random_code = rf_string.generate_random_string(11, '[NUMBERS]')
        bank_code_prefix = enterprise_code + random_code

        for i in range(len(bank_code_prefix)):
            if i % 2 == 0:
                total = int(bank_code_prefix[i:i + 1]) * 3 + total
            else:
                total = int(bank_code_prefix[i:i + 1]) * 1 + total

        if total % 10 == 0:
            bank_code_1 = bank_code_prefix + '0'
        else:
            bank_code_1 = bank_code_prefix + str(10 - (total % 10))

        return bank_code_1
Exemple #9
0
 def __init__(self):
     timestamp = int(round(time.time() * 1000))
     rf_string = String()  # RF Library
     self.department_id = None
     self.department_code = "DH_" + '{}'.format(timestamp)
     self.department_name = "DH_" + '{}'.format(timestamp)
     self.department_type = 1
     self.owner_company_id = None
     self.contract_start_date = timestamp
     self.contract_expiration_date = timestamp + 30 * 60 * 1000
     self.contact_address = '長安東路二段225號C棟11樓'
     self.contact_zip = '10552'
     self.contact_person = 'SWQA' + \
         rf_string.generate_random_string(5, '[UPPER]')
     self.contact_email = '{}@gogoro.com'.format(timestamp)
     self.contact_phone1 = rf_string.generate_random_string(8, '[NUMBERS]')
     self.contact_phone2 = rf_string.generate_random_string(8, '[NUMBERS]')
     self.country_code = 'TW'
     self.status = 1
Exemple #10
0
 def __init__(self, password='******'):
     rf_string = String()  # RF Library
     self.time = int(time.time() * 1000)
     self.emp_code = 'SWQA_{}'.format(self.time)
     self.contact_address = '長安東路二段225號C棟11樓'
     self.contact_zip = '10552'
     self.encode_password = LibAppCipher().encode_password_get(
         password).text
     self.first_name = rf_string.generate_random_string(5, '[UPPER]')
     self.middle_name = rf_string.generate_random_string(5, '[UPPER]')
     self.last_name = rf_string.generate_random_string(5, '[UPPER]')
     self.legal_first_name = rf_string.generate_random_string(5, '[UPPER]')
     self.legal_middle_name = rf_string.generate_random_string(5, '[UPPER]')
     self.legal_last_name = rf_string.generate_random_string(5, '[UPPER]')
     self.gender = 'M'
     self.mobile = '09' + rf_string.generate_random_string(8, '[NUMBERS]')
     self.phone = self.mobile
     self.email = 'sw.verify+{}@gogoro.com'.format(self.time)
     self.profile_id = 'E1' + \
         rf_string.generate_random_string(8, '[NUMBERS]')
Exemple #11
0
 def __init__(self, password='******'):
     rf_string = String()  # RF Library
     self.user_id = None
     self.contract_owner_id = None
     self.birthday = time.strftime("%Y-%m-%d")
     self.company_code = 1300
     self.contact_address = '長安東路二段225號C棟11樓'
     self.contact_city = '臺北市'
     self.contact_district = '松山區'
     self.contact_zip = '10552'
     self.country_code = 'TW'
     self.enable_e_carrier = 1
     self.encode_password = LibAppCipher().encode_password_get(
         password).text
     self.first_name = rf_string.generate_random_string(5, '[UPPER]')
     self.last_name = rf_string.generate_random_string(5, '[UPPER]')
     self.gender = 'M'
     self.gogoro_guid = str(uuid.uuid4())
     self.invoice_address = '長安東路二段225號C棟11樓'
     self.invoice_city = '臺北市'
     self.invoice_district = '松山區'
     self.invoice_zip = '10552'
     self.mobile = '09' + rf_string.generate_random_string(8, '[NUMBERS]')
     self.occupation = '1'
     self.phone = self.mobile
     self.login_phone = self.mobile
     self.status = 1
     self.time = int(time.time() * 1000)
     self.display_name = self.last_name + self.first_name
     self.email = 'pasw.verify+{}@gogoro.com'.format(self.time)
     self.profile_id = 'E1' + \
         rf_string.generate_random_string(8, '[NUMBERS]')
 def __init__(self, user_type, password):
     if user_type == 'new_user':
         rf_string = String()  # RF Library
         self.time = int(time.time())
         self.company_code = 1300
         self.status = 1
         self.enable_e_carrier = 1
         self.country_code = 'TW'
         self.gender = 'M'
         self.gogoro_guid = str(uuid.uuid4())
         self.first_name = rf_string.generate_random_string(5, '[UPPER]')
         self.last_name = rf_string.generate_random_string(5, '[UPPER]')
         self.display_name = self.last_name + self.first_name
         self.email = 'pasw.verify-{}@yopmail.com'.format(self.time)
         self.mobile = '09' + rf_string.generate_random_string(
             8, '[NUMBERS]')
         self.profile_id = 'A1' + rf_string.generate_random_string(
             8, '[NUMBERS]')
         self.encode_password = password
         self.birthday = time.strftime("%Y-%m-%d")
         self.contact_city = '臺北市'
         self.contact_district = '松山區'
         self.contact_zipcode = '10552'
         self.contact_address = '長安東路二段225號C棟11樓'
         self.phone = self.mobile
         self.occupation = '1'
         self.invoice_city = '臺北市'
         self.invoice_district = '松山區'
         self.invoice_zipcode = '10552'
         self.invoice_address = '長安東路二段225號C棟11樓'
     else:
         self.variable = LibVar()
         self.encode_password = password
         self.email = self.variable.get_var('PAYMENT_GATEWAY_ACCOUNT')
         self.gogoro_guid = self.variable.get_var('PAYMENT_GATEWAY_GUID')
    def scooteroutbound_post(self,
                             date,
                             vin,
                             order_no,
                             department_code,
                             key,
                             scooter_model='GSBH2-000-CF',
                             account=None):
        """
        Add scooter into outbound on DMS with vin
        Arguments:
        :param date: string type, format with YYYY/mm/dd,
        :param order_no: string type, dms_order_no
        :param vin: string type, scooter_vin
        :param key: string type, encrypted information, default use key in setting.py
        Examples:
        | Scooteroutbound Post | PAYLOAD |
        """
        rf_string = String()
        purchase_order = rf_string.generate_random_string(10, '[NUMBERS]')
        delivery_note = rf_string.generate_random_string(8, '[NUMBERS]')

        self.init.authHeader(account)
        data = {
            "key":
            key,
            "data": [{
                "g01": purchase_order,
                "g02": delivery_note,
                "g03": date,
                "g04": scooter_model,
                "g05": vin,
                "g06": order_no,
                "g07": department_code,
                "g08": date
            }]
        }
        resp = self.init.request('post', "/scooteroutbound", json=data)
        return resp
class ControllerWithCellInfo(object):
    content_types = [getattr(ContentType, i) for i in dir(ContentType) if not i.startswith('__') ]
    cell_types = [getattr(CellType, i) for i in dir(CellType) if not i.startswith('__') ]

    def __init__(self):
        self._string = String()

    def get_cell_info(self, row, column):
        return CellInfo(CellContent(self._get(self.content_types), self._get_data(), None),
                        CellPosition(self._get(self.cell_types), None))

    def _get(self, items):
        return items[random.randint(0, len(items)-1)]

    def _get_data(self):
        if random.randint(0, 5) == 0:
            return "data with some ${variable} in there"
        return self._string.generate_random_string(50)
Exemple #15
0
 def __init__(self, status):
     rf_string = String()  # RF Library
     self.company_name = 'SWQA' + \
         rf_string.generate_random_string(5, '[UPPER]')
     self.company_code = 'SWQA' + \
         rf_string.generate_random_string(5, '[NUMBERS]')
     self.company_type = 11
     self.company_sub_type = 11
     self.company_group_id = None
     self.brand_name = 'SWQA'
     self.address = '長安東路二段225號C棟11樓'
     self.zip_code = '10552'
     self.country_code = 'TW'
     self.contact_person_firstname = rf_string.generate_random_string(
         5, '[UPPER]')
     self.contact_person_lastname = rf_string.generate_random_string(
         5, '[UPPER]')
     self.contact_email = 'sw.verify+{}@gogoro.com'.format(int(time.time()))
     self.contact_phone1 = '09' + \
         rf_string.generate_random_string(8, '[NUMBERS]')
     self.contact_phone2 = '09' + \
         rf_string.generate_random_string(8, '[NUMBERS]')
     self.status = status
class ControllerWithCellInfo(object):
    content_types = [
        getattr(ContentType, i) for i in dir(ContentType)
        if not i.startswith('__')
    ]
    cell_types = [
        getattr(CellType, i) for i in dir(CellType) if not i.startswith('__')
    ]

    def __init__(self):
        self._string = String()

    def get_cell_info(self, row, column):
        return CellInfo(
            CellContent(self._get(self.content_types), self._get_data(), None),
            CellPosition(self._get(self.cell_types), None))

    def _get(self, items):
        return items[random.randint(0, len(items) - 1)]

    def _get_data(self):
        if random.randint(0, 5) == 0:
            return "data with some ${variable} in there"
        return self._string.generate_random_string(50)
 def __init__(self, scooter_model):
     rf_string = String()    # RF Library
     self.company_code = '1500'
     self.country = 'TW'
     self.keyfobs_id = rf_string.generate_random_string(3, '[NUMBERS]')
     self.vin = rf_string.generate_random_string(13, '[UPPER][NUMBERS]')
     self.plate = rf_string.generate_random_string(3, '[UPPER][NUMBERS]')+'-'+rf_string.generate_random_string(4, '[UPPER][NUMBERS]')
     self.scooter_guid = str(uuid.uuid4())
     self.matnr = scooter_model
     self.motor_num = self.matnr
     self.scooter_vin = 'SWQA' + self.vin
     self.atmel_key = 'ED554638AD91C64694A39262CA1A3C14663B8ACBDF8E074E98BBD965EA1969C8'
     self.atmel_sn = '0123F61FCBFED2A0B1'
     self.manufacture_date = time.strftime("%Y-%m-%d")
     self.state = '1'
     self.es_state = '13'
     self.ecu_mac = 'rpNx83uY'
     self.ecu_sn = 'MABBQUFCBBIwABYzRQBkEA=='
     self.ecu_status = '1'
     self.keyfobs_status = '1'
     self.keyfobs_id = '321'
Exemple #18
0
 def __init__(self, part_category_type, names=None, prices=None):
     rf_string = String()  # RF Library
     self.sequence_id = 'SWQA' + \
         rf_string.generate_random_string(6, '[NUMBERS]')
     self.part_code = 'SWQA' + \
         rf_string.generate_random_string(6, '[NUMBERS]')
     self.part_category_type = part_category_type
     self.part_category_sub_type = 0
     self.part_category_id = None
     self.brand_company_code = None
     self.names = names
     self.production_start_time = int(time.time())
     self.production_end_time = int(time.time())
     self.sale_status = 1
     self.sale_suspend_time = int(time.time())
     self.warranty_period = 12
     self.warranty_distance = rf_string.generate_random_string(
         4, '[NUMBERS]')
     self.endurance_period = 12
     self.endurance_distance = rf_string.generate_random_string(
         4, '[NUMBERS]')
     self.prices = prices
Exemple #19
0
import sys
import os.path
from robot.libraries.String import String
_here = os.path.dirname(__file__)
string = String()
_here = string.fetch_from_left(_here, "drivers")
sys.path.insert(0, os.path.abspath(os.path.join(_here)))

import platform


class Paths(object):
    def __init__(self):
        self.platform = None

    def get_path_of(self, browser: str = 'chrome'):
        if browser.lower() == 'chrome':
            return Chrome().PATH
        elif browser.lower() == 'firefox':
            return Firefox().PATH


class Platform:
    @staticmethod
    def get_platform() -> str:
        if platform.system().lower() == 'darwin':
            return "macos"
        elif platform.system().lower() == 'windows':
            return "windows"
        elif platform.system().lower() == 'linux' or platform.system().lower(
        ) == 'linux2':
 def __init__(self):
     self._string = String()
 def __init__(self):
     self._string = String()
Exemple #22
0
import sys
import os.path
from robot.libraries.String import String
_here = os.path.dirname(__file__)
string = String()
_here = string.fetch_from_left(_here, "globals")
sys.path.insert(0, os.path.abspath(os.path.join(_here)))

from drivers.paths import Paths
from selenium import webdriver


class Config(object):

    def __init__(self):
        self.path = Paths()
        self.driver = None

    def get_browser(self, browser: str = 'chrome'):
        if browser.lower() == 'chrome':
            self.driver = webdriver.Chrome(_here + self.path.get_path_of(browser.lower()))
        elif browser.lower() == 'firefox':
            self.driver = webdriver.Firefox(executable_path=_here + self.path.get_path_of(browser.lower()))
        else:
            raise Exception('This browser is not yet supported in this platform')

        return self.driver


if __name__ == '__main__':
    c = Config()
Exemple #23
0
import sys
import os.path
from robot.libraries.String import String
_here = os.path.dirname(__file__)
string = String()
_here = string.fetch_from_left(_here, "pagefactory")
sys.path.insert(0, os.path.abspath(os.path.join(_here)))

import random


class Loginpage(object):

    user_name = "*****@*****.**"
    password = "******"

    lbl_login = "******"
    txt_user = "******"
    lnk_register = "//a[@href='/en/registration']"
    panel_language = "//div[@id='react-language-list-container']"

    lnk_privacy = "//a[contains(., 'Privacy Policy')]"
    lnk_service = "//a[contains(., 'Service agreements')]"
    lnk_safe_usage = "//a[contains(., 'Recommendations for the safe usage')]"

    btn_login = "******"

    lbl_user_name = "//div[@class='row user-identifier-row']/div/strong"

    img_avatar = "//img[@alt='avatar']"
import sys
import os.path
import json
from robot.libraries.String import String
_here = os.path.dirname(__file__)
string = String()
_here = string.fetch_from_left(_here, "mv_skill_test")
sys.path.insert(0, os.path.abspath(os.path.join(_here)))

from PageObjectLibrary import PageObject


class Helpers(PageObject):

    def input_data(self, locator, data):
        self.se2lib.input_text(locator, data)

    def click_button(self, locator):
        self.se2lib.click_element(locator)

Exemple #25
0
import sys, os
import json
from robot.libraries.String import String
_here = os.path.dirname(__file__)
_string = String()
_here = _string.fetch_from_left(_here, "assurity")
sys.path.insert(0, os.path.abspath(os.path.join(_here)))


class TestLibUtils(object):
    def __init__(self):
        self.data = self.load_json()

    def get_base_url(self, app=None):
        return self.data['base_url'][app]

    def get_endpoints(self, endpoint=None):
        return self.data['endpoints'][endpoint]

    def get_expected_val(self, value=None):
        return self.data['expected_value'][value]

    def load_json(self):
        script_dir = os.path.dirname(__file__)
        file_path = os.path.join(script_dir, '../resources/test_data.json')
        data = json.load(open(file_path))
        return data

    #assertions
    def assert_equal(self, actual_val, expected_val):
        log = 'Actual Value = ' + str(
Exemple #26
0
import sys
import os.path
from robot.libraries.String import String
_here = os.path.dirname(__file__)
string = String()
_here = string.fetch_from_left(_here, "tests")
sys.path.insert(0, os.path.abspath(os.path.join(_here)))

from globals import config
from pagefactory.homepage import Loginpage as elem
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.common.by import By

from globals.functions import Functions
import random
import time


class Loginpage(object):

    def __init__(self, browser='chrome'):
        self.browser = browser
        self.driver = None
        self.wait = WebDriverWait(self.driver, 10)
        self.func = Functions(self.driver)
        self.choice = None
        self.selected_category = None
        self.random_category_text = None

        self.login_url = "https://bank.paysera.com/en/login"
class execute_command:  # pylint: disable=old-style-class
    def __init__(self):
        self._builtin = BuiltIn()
        self._string = String()
        self._builtin.import_library('SSHLibrary')
        self._sshlibrary = self._builtin.get_library_instance('SSHLibrary')
        self._default_user = {}
        self._prompt = ':prompt:'
        self._local_infra_int_ip_ipv4 = ''
        self._key_exists = False

    def get_ssh_library_instance(self):
        return self._sshlibrary

    def get_default_user(self):
        return self._default_user

    @robot_log
    def open_connection_and_log_in(self,
                                   host,
                                   user,
                                   private_key=None,
                                   timeout="90s"):
        self._sshlibrary.open_connection(host=host, timeout=timeout)
        login_output = ''
        wait_until = datetime.now() + timedelta(seconds=60)
        while datetime.now() < wait_until:
            time.sleep(1)
            try:
                if private_key is None:
                    login_output = self._sshlibrary.login(
                        user['username'], user['password'])
                else:
                    login_output = self._sshlibrary.login_with_public_key(
                        user['username'], private_key, user['password'])
            except Exception:
                logger.warn("Login was unsuccessful, trying again.")
                continue
            if check_if_login_was_successful(login_output):
                self._configure_prompt()
                logger.info("Login was successful.")
                break
        return login_output

    @robot_log
    def set_basic_connection(self, user, private_key=None):
        self._default_user = user
        stack_infos = self._builtin.get_library_instance('stack_infos')
        self.open_connection_and_log_in(stack_infos.get_floating_ip(), user,
                                        private_key)
        self._local_infra_int_ip_ipv4 = self.get_interface_ipv4_address(
            stack_infos.get_crf_nodes())
        self._key_exists = self.check_id_rsa_exists()
        self.stop_auditd_service()

    @robot_log
    def _configure_prompt(self):
        self._sshlibrary.write('export PS1=' + self._prompt)
        self._sshlibrary.read_until_regexp('(?m)^' + self._prompt + '.*')

    @robot_log
    def su_as(self, user):
        def check_if_su_was_succesful(login_output):
            if 'incorrect password' in login_output or 'Authentication failure' in login_output:
                return False
            return True

        self._sshlibrary.write('su ' + user['username'])
        self._sshlibrary.read_until('Password:'******'password'])
        output = self._sshlibrary.read_until(self._prompt)
        if not check_if_su_was_succesful(output):
            raise Exception(output)

    @robot_log
    def sudo_as_root(self):
        self._sshlibrary.write('sudo -s')
        self._sshlibrary.read_until(self._prompt)

    @robot_log
    def exit_from_user(self):
        self._sshlibrary.write('exit')
        self._sshlibrary.read_until(self._prompt)

    @robot_log
    def execute_unix_command(self,
                             command,
                             fail_on_non_zero_rc=True,
                             delay="90s",
                             skip_prompt_in_command_output=False,
                             user={}):
        """
        This method executes a linux command via the SSHlibrary connection.
        The user account which issues the command, is the same as which the connection has opened for (by default)
        The command can be also executed by switching (su) to another user (e.g. parameter usage: user = "******")

        :param command:
        :param fail_on_non_zero_rc: the command will fail if return code is nonzero
        :param delay:
        :param skip_prompt_in_command_output:
        :param user: switch to user, by default the command is executed with the current user
        for which the ssh connection was opened

        :return: stdout: command output is returned
        """
        user_changed = False
        self._sshlibrary.set_client_configuration(timeout=delay)
        if user == root:
            self.sudo_as_root()
            user_changed = True
        elif bool(user) and user != self._default_user:
            self.su_as(user)
            user_changed = True

        self._sshlibrary.write(command)
        try:
            if skip_prompt_in_command_output:
                stdout = self._sshlibrary.read_until_regexp("(^|\n| )" +
                                                            self._prompt + "$")
            else:
                stdout = self._sshlibrary.read_until(prompt)
        except Exception as err:
            stdout = unicode(err)
            ctrl_c = self._builtin.evaluate('chr(int(3))')
            self._sshlibrary.write_bare(ctrl_c)
            self._sshlibrary.read_until(prompt)
        stdout = re.sub(prompt + '$', '', stdout).strip()
        self._sshlibrary.write('echo error code: $?')
        error_code = self._sshlibrary.read_until(prompt)
        logger.trace("Error code variable value (befor processing)=" +
                     error_code)
        error_code = self._string.get_lines_matching_regexp(
            error_code, pattern='error code: \\d+').split(':')[1].strip()
        logger.trace("Error code variable value (after processing)=" +
                     error_code)
        self._sshlibrary.set_client_configuration(timeout="60s")
        if user_changed:
            self.exit_from_user()
        fail_on_non_zero_rc = self._builtin.convert_to_boolean(
            fail_on_non_zero_rc)
        if fail_on_non_zero_rc:
            if error_code != '0':
                raise Exception('command: ' + command + '\nreturn code: ' +
                                error_code + '\noutput: ' + stdout)
            return stdout
        else:
            return [stdout, error_code]

    @robot_log
    def execute_unix_command_as_root(self,
                                     command,
                                     fail_on_non_zero_rc=True,
                                     delay="90s",
                                     skip_prompt_in_command_output=False):
        return self.execute_unix_command(command, fail_on_non_zero_rc, delay,
                                         skip_prompt_in_command_output, root)

    @robot_log
    def ssh_to_another_node(self, host, user):
        self._sshlibrary.write('ssh ' + user['username'] + '@' + host +
                               ' -o "StrictHostKeyChecking no"')
        if not self._key_exists:
            logger.info("Login with password")
            self._sshlibrary.read_until("'s password:"******"\[{0}@.*$|authentication failure|name or service not known|permission denied"
            .format(user["username"]), re.IGNORECASE)
        stdout = self._sshlibrary.read_until_regexp(ssh_regexp)
        if not check_if_login_was_successful(stdout):
            raise Exception("Login to another node FAILED")
        self._configure_prompt()

    @robot_log
    def execute_unix_command_on_remote_as_root(
            self,
            command,
            host,
            user={},
            fail_on_non_zero_rc=True,
            delay="90s",
            skip_prompt_in_command_output=False):
        if self._local_infra_int_ip_ipv4 != host:
            if not user:
                user = self._default_user
            self.ssh_to_another_node(host, user)
            output = self.execute_unix_command_as_root(
                command, fail_on_non_zero_rc, delay,
                skip_prompt_in_command_output)
            self._sshlibrary.write('exit')
            self._sshlibrary.read_until(self._prompt)
        else:
            output = self.execute_unix_command_as_root(
                command, fail_on_non_zero_rc, delay,
                skip_prompt_in_command_output)
        return output

    @robot_log
    def execute_unix_command_on_remote_as_user(
            self,
            command,
            host,
            user={},
            fail_on_non_zero_rc=True,
            delay="90s",
            skip_prompt_in_command_output=False):
        if not user:
            user = self._default_user
        if self._local_infra_int_ip_ipv4 != host:
            self.ssh_to_another_node(host, user)
            output = self.execute_unix_command(command,
                                               fail_on_non_zero_rc,
                                               delay,
                                               skip_prompt_in_command_output,
                                               user=user)
            self._sshlibrary.write('exit')
            self._sshlibrary.read_until(self._prompt)
        else:
            output = self.execute_unix_command(command,
                                               fail_on_non_zero_rc,
                                               delay,
                                               skip_prompt_in_command_output,
                                               user=user)
        return output

    @robot_log
    def get_interface_ipv4_address(self, nodes):
        for key in nodes:
            if self.execute_unix_command("ip a | grep " + nodes[key] +
                                         " | wc -l") == "1":
                return nodes[key]
        return None

    @robot_log
    def get_interface_ipv6_address(self, interface):
        return self.execute_unix_command_as_root(
            'ip addr list ' + interface +
            ' | grep --color=no -o -P "(?<=inet6 ).*(?=/.*)"')

    @robot_log
    def check_id_rsa_exists(self):
        _, err_code = self.execute_unix_command(
            "ls /home/{0}/.ssh/id_rsa".format(self._default_user["username"]),
            fail_on_non_zero_rc=False)
        return err_code == '0'

    @robot_log
    def stop_auditd_service(self):
        stack_infos = self._builtin.get_library_instance('stack_infos')
        if stack_infos.get_virtual_env():
            all_nodes = stack_infos.get_all_nodes()
            if not all_nodes:
                logger.info("Nodes dictionary is empty, nothing to check.")
                return
            for node in all_nodes.itervalues():
                command = "sed -i \"s#RefuseManualStop=yes#RefuseManualStop=no#g\" " \
                          "/usr/lib/systemd/system/auditd.service"
                self.execute_unix_command_on_remote_as_root(command, node)
                command = "systemctl daemon-reload"
                self.execute_unix_command_on_remote_as_root(command, node)
                command = "systemctl stop auditd.service"
                self.execute_unix_command_on_remote_as_root(command, node)