示例#1
0
    def select_encryption_type(cls, encryption):
        # Allowed encryption types
        Page.check(cls.xpaths["user_choose_encryption"])

        # Choose encryption type
        if encryption.upper() == "KMIP":
            cls.set_kmip()

        elif encryption.upper() == "DEFAULT":
            Page.uncheck(cls.xpaths["user_choose_random"])
            Page.uncheck(cls.xpaths["user_choose_pkey"])
            Page.check(cls.xpaths["user_choose_default"])
            # Page.delayed_click((cls.xpaths["user_choose_default"]), sleep_time=2)
        elif encryption.upper() == "RANDOM":
            Page.uncheck(cls.xpaths["user_choose_default"])
            Page.uncheck(cls.xpaths["user_choose_pkey"])
            Page.check(cls.xpaths["user_choose_random"])
            # Page.delayed_click((cls.xpaths["user_choose_random"]), sleep_time=2)
            Page.delayed_click((cls.xpaths["allow_export_both"]), sleep_time=2)
        elif encryption.upper() == "PKEY":
            Page.uncheck(cls.xpaths["user_choose_default"])
            Page.uncheck(cls.xpaths["user_choose_random"])
            Page.check(cls.xpaths["user_choose_pkey"])
            # Page.delayed_click((cls.xpaths["user_choose_pkey"]), sleep_time=2)
            Page.delayed_click((cls.xpaths["allow_export_pkey"]), sleep_time=2)
        elif encryption.upper() == "CKEY":
            ckey = GLOBAL_CONFIG.get('CKEY')
            Page.delayed_click((cls.xpaths["user_choose_ckey"]), sleep_time=2)
            Page.clear(cls.xpaths['ckey_url'])
            Page.locate_element(cls.xpaths['ckey_url']).send_keys(ckey)
        else:
            assert "ERROR: Please check if you use the correct encryption type in [default, pkey, random, ckey, kmip]."
示例#2
0
    def set_kmip(cls):
        kms_server = GLOBAL_CONFIG.get('KMIP').get('SERVERADDRESS')
        kms_port = GLOBAL_CONFIG.get('KMIP').get('SERVERPORT')
        kms_naeport = GLOBAL_CONFIG.get('KMIP').get('NAE-PORT')
        kms_issuer = GLOBAL_CONFIG.get('KMIP').get('ISSUER')
        kms_group = GLOBAL_CONFIG.get('KMIP').get('GROUP')

        Page.delayed_click((cls.xpaths["user_choose_kmip"]), sleep_time=2)

        # Clear existing kmip setting
        Page.clear(cls.xpaths['kmip_address'])
        Page.clear(cls.xpaths['kmip_port'])
        Page.clear(cls.xpaths['kmip_naeport'])
        Page.clear(cls.xpaths['kmip_cert_issuer'])
        Page.clear(cls.xpaths['kmip_group'])

        # Set kmip setting
        Page.locate_element(cls.xpaths['kmip_address']).send_keys(kms_server)
        Page.locate_element(cls.xpaths['kmip_port']).send_keys(kms_port)
        Page.locate_element(cls.xpaths['kmip_naeport']).send_keys(kms_naeport)
        Page.locate_element(cls.xpaths['kmip_cert_issuer']).send_keys(kms_issuer)
        Page.locate_element(cls.xpaths['kmip_group']).send_keys(kms_group)