tf.import_test("vpn_profile", "test_profile1")
    log.debug("     Importing VPN profile 2...")
    tf.import_test("vpn_profile", "test_profile2")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug("     switchAction: Updating rules for allow/deny policy...")
    tf.update_test("switchAction")
    log.debug("     switchPort: Updating ruless' allowed/denied port...")
    tf.update_test("switchPort")
    log.debug(
        "     switchProtocol: Updating rules' allowed/denied protocol...")
    tf.update_test("switchProtocol")
    log.debug("     switchTarget: Updating rules' target IP/CIDR...")
    tf.update_test("switchTarget")
    log.debug("     removeUser: Detach user from VPN profile...")
    tf.update_test("removeUser")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit(1)
else:
Example #2
0
log.info("      create_verify(): PASS\n")

try:
    log.info("Verifying import functionality...")
    tf.import_test("fqdn", "fqdn_tag_1")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug("     switchDomains: Updating the FQDN Domain filter name...")
    tf.update_test("switchDomains")
    log.debug(
        "     switchPorts: Updating port #s of the various Egress rules...")
    tf.update_test("switchPorts")
    log.debug(
        "     switchProtocols: Updating the protocols of the various Egress rules..."
    )
    tf.update_test("switchProtocols")
    log.debug(
        "     switchMode: Updating the mode from whitelist to blacklist...")
    tf.update_test("switchMode")
    log.debug("     switchStatus: Disabling the Egress filtering...")
    tf.update_test("switchStatus")
    log.debug(
        "     switchGW: Detaching and attaching the FQDN tag to another gateway..."
    )
log.info("      create_verify(): PASS\n")

try:
    log.info("Verifying import functionality...")
    tf.import_test("spoke_gateway", "test_spoke_gateway_arm")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug("     disableSingleAZHA: Disabling single AZHA feature...")
    tf.update_test("disableSingleAZHA")
    log.debug("     enableHA: Enabling HA gateway...")
    tf.update_test("enableHA")
    log.debug("     updateGWSize: Updating spoke gateway's size...")
    tf.update_test("updateGWSize")
    log.debug("     updateHAGWSize: Updating HA spoke gateway's size...")
    tf.update_test("updateHAGWSize")
    log.debug("Sleeping for 2 minutes to wait for infrastructure to be up...")
    time.sleep(120)
    log.debug(
        "     attachTransitGW: Attaching spoke gateway to transit gateway...")
    tf.update_test("attachTransitGW")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit()
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      import_test(): PASS\n")


try:
    log.info("Verifying update functionality...")
    log.debug("Sleeping for 2 minutes to wait for infrastructure to be up...")
    time.sleep(120)
    log.debug("     updateTransitGW: Updating to switch transit gateway to attach to the spoke...")
    tf.update_test("updateTransitGW")
    log.debug("     detachActive: (Mantis 13210) detach spoke and disable Active Mesh in one step...")
    tf.update_test("detachActive")
    log.debug("     updateTransitGW: Re-attaching spoke to transit with correct Active Mesh setting...")
    tf.update_test("updateTransitGW")
    log.debug("     updateGWSize: Updating spoke gateway's size...")
    tf.update_test("updateGWSize")
    log.debug("     updateHAGWSize: Updating HA spoke gateway's size...")
    tf.update_test("updateHAGWSize")
    log.debug("     enableDNSServer: Enabling feature to remove the default DNS server, in favor of VPC DNS server configured in VPC DHCP option...")
    tf.update_test("enableDNSServer")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit(1)
    log.info("Verifying import functionality...")
    log.debug("     Importing the OCI gateway...")
    tf.import_test("gateway", "oci_vpn_gateway")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug(
        "     updateVPNCIDR: Updating the VPN CIDR for uses of accidental overlap with home network..."
    )
    tf.update_test("updateVPNCIDR")
    log.debug(
        "     updateSearchDomain: Updating list of domain names that will use the NameServers when specific name not in destination..."
    )
    tf.update_test("updateSearchDomain")
    log.debug(
        "     updateCIDRs: Updating list of destination CIDR ranges that will also go through the VPN tunnel..."
    )
    tf.update_test("updateCIDRs")
    log.debug(
        "     updateNameServers: Updating the list of DNS servers that VPN gateway will use to resolve domain names..."
    )
    tf.update_test("updateNameServers")
    log.debug(
        "     disableSingleAZHA: Disabling Single AZ HA option of the gateway..."
    )
Example #6
0
try:
    log.info("Verifying import functionality...")
    tf.import_test("transit_gateway", "azure_transit_gw")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug("     enableSingleAZHA: Enabling single AZHA feature...")
    tf.update_test("enableSingleAZHA")
    log.debug(
        "     switchConnectedTransit: Disabling spokes from running traffic to other spokes via transit gateway..."
    )
    tf.update_test("switchConnectedTransit")
    log.debug("     updateGWSize: Updating gateway's size...")
    tf.update_test("updateGWSize")
    log.debug("     updateHAGWSize: Updating HA gateway's size...")
    tf.update_test("updateHAGWSize")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
try:
    log.info("Verifying import functionality...")
    tf.import_test("gateway", "aws_gw_test_1")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    return_result("import_test", False)
    sys.exit(1)
else:
    return_result("import_test", True)


try:
    log.info("Verifying update functionality...")
    log.debug("     disableSNAT: Disabling single IP SNAT...")
    tf.update_test("disableSNAT")
    log.debug("     updateTagList: Updating gateway's tags...")
    tf.update_test("updateTagList")
    log.debug("     updateGWSize: Updating gateway's size...")
    tf.update_test("updateGWSize")
    log.debug("     updateHAGWSize: Updating HA gateway's size...")
    tf.update_test("updateHAGWSize")
    log.debug("     enableDNSServer: Enabling feature to remove the default DNS server, in favor of VPC DNS server configured in VPC DHCP option...")
    tf.update_test("enableDNSServer")
    log.debug("     updatePingInterval: Updating ping interval for gateway periodic ping...")
    tf.update_test("updatePingInterval")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    return_result("update_test", False)
    sys.exit(1)
else:
    tf.import_test("account", "gcp_access_account_1", varfile=cred_path)
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug(
        "      switchProj_cred: Switching GCP credentials to another GCP account..."
    )
    tf.update_test(varfile=cred_path2)
    log.debug(
        "     gcloud_acc_cred: Switching GCP credentials back to original...")
    tf.update_test(varfile=cred_path)
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      update_test(): PASS\n")

try:
    log.info("Verifying destroy functionality...")
    tf.destroy_test(varfile=cred_path)
Example #9
0
    tf.import_test("gateway", "design_gw")
    log.debug("     Importing the Azure Designated gateway...")
    tf.import_test("gateway", "design_arm_gw")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug(
        "     updateCIDRs: Updating which CIDRs will be included to be handled internally instead of through entries on the route table..."
    )
    tf.update_test("updateCIDRs")
    log.debug("     updateDNAT: Updating DNAT policies...")
    tf.update_test("updateDNAT")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
log.info("      update_test(): PASS\n")

try:
    log.info("Verifying destroy functionality...")
    tf.destroy_test()
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     destroy_test(): FAIL\n")
    log.debug("     Importing the AWS Encrypted transit gateway...")
    tf.import_test("transit_gateway", "aws_ebs_encrypt_transit")
    log.debug("     Importing the AWS Encrypted spoke gateway...")
    tf.import_test("spoke_gateway", "aws_ebs_encrypt_spoke")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug(
        "     disableKey: Disabling the key used to encrypt the EBS volume...")
    tf.update_test("disableKey")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
log.info("      update_test(): PASS\n")

try:
    log.info("Verifying destroy functionality...")
    log.debug(
        "     Targeting destroy on the VPCs (and dependent resources), avoiding removing the aws_kms_key..."
    )
    log.debug("     destroy_target(): spoke_encrypt_vpc")
    tf.destroy_target("vpc", "spoke_encrypt_vpc")
    log.debug("     destroy_target(): transit_encrypt_vpc")
    log.debug("     FQDN PassThru: testing FQDN pass through resource...")
    tf.import_test("fqdn_pass_through", "fqdn_ignore")

except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug("     switchDomains: Updating the FQDN Domain filter name...")
    tf.update_test("switchDomains")
    log.debug(
        "     switchPorts: Updating port #s of the various Egress rules...")
    tf.update_test("switchPorts")
    log.debug(
        "     switchProtocols: Updating the protocols of the various Egress rules..."
    )
    tf.update_test("switchProtocols")
    log.debug("     switchActions: Updating the policy actions...")
    tf.update_test("switchActions")
    log.debug(
        "     switchMode: Updating the mode from whitelist to blacklist...")
    tf.update_test("switchMode")
    log.debug("     switchStatus: Disabling the Egress filtering...")
    tf.update_test("switchStatus")
    log.debug(
log.info("      create_verify(): PASS\n")

try:
    log.info("Verifying import functionality...")
    tf.import_test("transit_gateway", "insane_transit_gw")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug("     enableSingleAZHA: Enabling single AZHA feature...")
    tf.update_test("enableSingleAZHA")
    log.debug(
        "     switchConnectedTransit: Disabling spokes from running traffic to other spokes via transit gateway..."
    )
    tf.update_test("switchConnectedTransit")
    log.debug(
        "     disableHybrid: Disabling transit gateway from being used in AWS TGW solution..."
    )
    tf.update_test("disableHybrid")
    log.debug("     updateGWSize: Updating gateway's size...")
    tf.update_test("updateGWSize")
    log.debug("     updateHAGWSize: Updating HA gateway's size...")
    tf.update_test("updateHAGWSize")
    log.debug(
        "     enableDNSServer: Enabling feature to remove the default DNS server, in favor of VPC DNS server configured in VPC DHCP option..."
    )
Example #13
0
    tf.import_test("spoke_gateway", "oci_spoke_gateway")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug("Sleeping for 2 minutes to wait for infrastructure to be up...")
    time.sleep(120)
    log.debug(
        "     updateTransitGW: Updating to switch transit gateway to attach to the spoke..."
    )
    tf.update_test("updateTransitGW")
    log.debug("     updateGWSize: Updating spoke gateway's size...")
    tf.update_test("updateGWSize")
    log.debug("     updateHAGWSize: Updating HA spoke gateway's size...")
    tf.update_test("updateHAGWSize")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
log.info("      update_test(): PASS\n")

try:
    log.info("Verifying destroy functionality...")
    tf.destroy_test()
except:
    log.debug("     Importing the AWS (Okta) gateway...")
    tf.import_test("gateway", "aws_okta_gw")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      import_test(): PASS\n")


try:
    log.info("Verifying update functionality...")
    log.debug("     updateURL: Updating the Okta URL...")
    tf.update_test("updateURL")
    log.debug("     updateToken: Updating the Okta Token...")
    tf.update_test("updateToken")
    log.debug("     updateUsernameSuffix: Updating the Okta username suffix...")
    tf.update_test("updateUsernameSuffix")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      update_test(): PASS\n")


for i in range(3):
    tf.import_test("aws_tgw_directconnect", "aws_tgw_dc")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug(
        "     updatePrefix: Update list of CIDRs for DxGW to advertise to remote (on-prem)..."
    )
    tf.update_test("updatePrefix")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      update_test(): PASS\n")

try:
    log.info("Verifying destroy functionality...")
    tf.destroy_test()
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
Example #16
0
    log.debug("     Importing the GCP gateway...")
    tf.import_test("gateway", "gcloud_gw")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      import_test(): PASS\n")


try:
    log.info("Verifying update functionality...")
    log.debug("     enableHA: Enabling and creating HA gateway...")
    tf.update_test("enableHA")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      update_test(): PASS\n")


try:
    log.info("Verifying destroy functionality...")
    tf.destroy_test()
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
Example #17
0
try:
    log.info("Verifying destroy functionality for Unmapped...")
    tf.destroy_target("site2cloud", "s2c_test")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     destroy_target(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
log.info("      destroy_target(): PASS\n")


log.info("Continuing to site2cloud: Mapped...")
try:
    log.debug("Enabling custom algorithms and creating new S2C connections as Mapped...")
    tf.update_test("enableCustomAlg")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
log.info("      update_test(): PASS\n")


try:
    log.info("Verifying import functionality...")
    log.debug("     Importing S2C mapped configuration...")
    tf.import_test("site2cloud", "s2c_test2", "enableCustomAlg")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
try:
    log.info("Verifying import functionality...")
    tf.import_test("vgw_conn", "test_vgw_conn")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
log.info("      import_test(): PASS\n")


try:
    log.info("Verifying update functionality...")
    log.debug("     toggleCIDRAdvert: Enabling advertising of transit CIDR...")
    tf.update_test("toggleCIDRAdvert")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
log.info("      update_test(): PASS\n")


try:
    log.info("Verifying destroy functionality...")
    tf.destroy_test()
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     destroy_test(): FAIL\n")
    sys.exit()
    log.info("Verifying import functionality...")
    tf.import_test("transit_gateway", "gcp_transit_gateway")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      import_test(): PASS\n")


try:
    log.info("Verifying update functionality...")
    log.debug("     enableSingleAZHA: Enabling single AZHA feature...")
    tf.update_test("enableSingleAZHA")
    log.debug("     disableSNAT: Disable single IP SNAT...")
    tf.update_test("disableSNAT")
    log.debug("     disableConnectedTransit: Disabling spokes from running traffic to other spokes via transit gateway...")
    tf.update_test("disableConnectedTransit")
    log.debug("     enableActiveMesh: Enabling Active Mesh, so both primary and backup gateway forward packets in ECMP and active/active state...")
    tf.update_test("enableActiveMesh")
    log.debug("     updateGWSize: Updating gateway's size...")
    tf.update_test("updateGWSize")
    log.debug("     updateHAGWSize: Updating HA gateway's size...")
    tf.update_test("updateHAGWSize")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit(1)
Example #20
0
try:
    log.info("Verifying import functionality...")
    tf.import_test("controller_config", "test_controller_config")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug("     enableHTTP: Enabling HTTP access to controller...")
    tf.update_test("enableHTTP")
    log.debug("     disableFQDN: Disabling FQDN Exception rule...")
    tf.update_test("disableFQDN")
    log.debug("     disableSG: Disabling Security Group Management...")
    tf.update_test("disableSG")
    log.debug(
        "     enableHTTP: Re-enabling HTTP access (to undo all previous changes)"
    )
    tf.update_test("enableHTTP")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
Example #21
0
    log.debug("     Importing TGW...")
    tf.import_test("aws_tgw", "test_aws_tgw")
    log.debug("     Importing TGW Transit Gateway Attachment...")
    tf.import_test("aws_tgw_transit_gateway_attachment", "tgw_transit_att")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    return_result("import_test", False)
    sys.exit(1)
else:
    return_result("import_test", True)


try:
    log.info("Verifying update functionality...")
    log.debug("     switchConnectDomain: Switching around which domains to be connected within the TGW...")
    tf.update_test("switchConnectDomain")
    log.debug("     switchVPC: Updating which VPCs to be attached to the TGW...")
    tf.update_test("switchVPC")
    # log.debug("     updateCustomRoutes: Updating customized Spoke VPC routes...")
    # tf.update_test("updateCustomRoutes") # (17448)
    log.debug("     enableLocalRouteProp: Enabling admin to propagate the VPC CIDR to the security domain/TGW route table that it is being attached to...")
    tf.update_test("enableLocalRouteProp")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    return_result("update_test", False)
    sys.exit(1)
else:
    return_result("update_test", True)


log.info(str(os.path.split(os.getcwd())[1]).upper() + " will not be destroyed until aws_tgw_vpn_conn concludes...")
    tf.import_test("firewall", "stress_firewall")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug(
        "      icmpEmpty: Update one of the rule's protocol to ICMP and changing port value to empty..."
    )
    tf.update_test("icmpEmpty")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      update_test(): PASS\n")

try:
    log.info("Verifying destroy functionality...")
    tf.destroy_test()
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
Example #23
0
    log.info("Verifying import functionality...")
    log.debug("     Importing firewall tag and policies...")
    tf.import_test("firewall_tag", "fw_tag_test")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug("      updateCIDR: Updating one of the tag rule's CIDR...")
    tf.update_test("updateCIDR")
    log.debug("     updateCIDRTagName: Updating the tag rule's name...")
    tf.update_test("updateCIDRTagName")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      update_test(): PASS\n")

try:
    log.info("Verifying destroy functionality...")
    tf.destroy_test()
except tf.subprocess.CalledProcessError as err:
    log.info("Verifying import functionality...")
    tf.import_test("gateway", "azure_gw")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      import_test(): PASS\n")


try:
    log.info("Verifying update functionality...")
    log.debug("     disableVPNNAT: Disables VPN connection from using NAT when traffic leaves the gateway...")
    tf.update_test("disableVPNNAT")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      update_test(): PASS\n")


try:
    log.info("Verifying destroy functionality...")
    log.debug("     destroy_target() the ELB gateway first...") # Mantis (13255)
    tf.destroy_target("gateway", "azure_gw")
    log.debug("Sleeping for 2 minutes to wait for gateway clean-up...")
try:
    log.info("Verifying import functionality...")
    log.debug("     Importing the GCP gateway...")
    tf.import_test("gateway", "gcloud_gw")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug("     updateHAGWSize: Enabling and creating HA gateway...")
    tf.update_test("updateHAGWSize")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
log.info("      update_test(): PASS\n")

try:
    log.info("Verifying destroy functionality...")
    tf.destroy_test()
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     destroy_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
Example #26
0
try:
    log.info("Verifying import functionality...")
    tf.import_test("aws_tgw", "test_aws_tgw")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug(
        "     switchConnectDomain: Switching around which domains to be connected within the TGW..."
    )
    tf.update_test("switchConnectDomain")
    log.debug(
        "     switchVPC: Updating which VPCs to be attached to the TGW...")
    tf.update_test("switchVPC")
    log.debug(
        "     updateCustomRoutes: Updating customized Spoke VPC routes...")
    tf.update_test("updateCustomRoutes")
    log.debug(
        "     enableLocalRouteProp: Enabling admin to propagate the VPC CIDR to the security domain/TGW route table that it is being attached to..."
    )
    tf.update_test("enableLocalRouteProp")
except:
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit()
log.info("-------------------- RESULT --------------------")
Example #27
0
    log.info("Verifying import functionality...")
    log.debug("     Importing the AWS (LDAP, Duo) gateway...")
    tf.import_test("gateway", "aws_ldap_duo_gw")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug("     duoUpdateIntKey: Updating the Duo Integration Key...")
    tf.update_test("duoUpdateIntKey")
    log.debug("     duoUpdateSecretKey: Updating the Duo Secret Key...")
    tf.update_test("duoUpdateSecretKey")
    log.debug("     duoUpdatePushMode: Updating the Duo Push Mode...")
    tf.update_test("duoUpdatePushMode")
    log.debug("     ldapUpdateServer: Updating the LDAP Server...")
    tf.update_test("ldapUpdateServer")
    log.debug("     ldapUpdateBindDN: Updating the LDAP Bind DN...")
    tf.update_test("ldapUpdateBindDN")
    log.debug("     ldapUpdatePassword: Updating the LDAP Password...")
    tf.update_test("ldapUpdatePassword")
    log.debug("     ldapUpdateBaseDN: Updating the LDAP Base DN...")
    tf.update_test("ldapUpdateBaseDN")
    log.debug("     ldapUpdateUsername: Updating the LDAP Username...")
    tf.update_test("ldapUpdateUsername")
except tf.subprocess.CalledProcessError as err:
try:
    log.info("Verifying import functionality...")
    tf.import_test(resource, name, varfile)
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    tf.update_test(varfile)
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      update_test(): PASS\n")

try:
    log.info("Verifying destroy functionality...")
    tf.destroy_test()
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.debug("     Importing Geo VPN user...")
    tf.import_test("vpn_user", "geo_vpn_user")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    return_result("import_test", False)
    sys.exit(1)
else:
    return_result("import_test", True)


log.info(str(os.path.split(os.getcwd())[1]).upper() + " does not support update functionality...")
log.info("Testing support of update functionality of ELB/ GeoVPN settings - Mantis (13570)... ")
for i in range(3):
    try:
        log.debug("     updateVPN: Updating the ELB/ GeoVPN settings by updating all ELB's VPN settings simultaneously...")
        tf.update_test("updateVPN")
    except tf.subprocess.CalledProcessError as err:
        log.exception(err.stderr.decode())
        time.sleep(60 + 60*i)
        if i == 2:
            return_result("update_test", False)
            sys.exit(1)
    else:
        return_result("update_test", True)
        break


log.info("Verifying destroy functionality...")
for i in range(3):
    try:
        log.debug("     destroy_target() one of the ELB gateway first...") # Mantis (13255)
    tf.import_test("gateway_dnat", "custom_dnat_aws")
    log.debug("     Importing spoke gateway (ARM)'s DNAT policies...")
    tf.import_test("gateway_dnat", "custom_dnat_arm")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     import_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      import_test(): PASS\n")

try:
    log.info("Verifying update functionality...")
    log.debug("     updateSNAT: Updating custom SNAT policies...")
    tf.update_test("updateSNAT")
    log.debug("     updateDNAT: Updating custom DNAT policies...")
    tf.update_test("updateDNAT")
except tf.subprocess.CalledProcessError as err:
    log.exception(err.stderr.decode())
    log.info("-------------------- RESULT --------------------")
    log.error("     update_test(): FAIL\n")
    sys.exit(1)
else:
    log.info("-------------------- RESULT --------------------")
    log.info("      update_test(): PASS\n")

try:
    log.info("Verifying destroy functionality...")
    tf.destroy_test()
except tf.subprocess.CalledProcessError as err: