Ejemplo n.º 1
0
    def VerifyStaticNatForPublicIp(self, ipaddressid, natrulestatus):
        """ List public IP and verify that NAT rule status for the IP is as desired """

        publiciplist = PublicIPAddress.list(self.apiclient, id=ipaddressid, listall=True)
        self.assertEqual(validateList(publiciplist)[0], PASS, "Public IP list validation failed")
        self.assertEqual(publiciplist[0].isstaticnat, natrulestatus, "isstaticnat should be %s, it is %s" %
                (natrulestatus, publiciplist[0].isstaticnat))

        return
Ejemplo n.º 2
0
def is_public_ip_in_correct_state(apiclient, ipaddressid, state):
    """ Check if the given IP is in the correct state (given)
    and return True/False accordingly"""
    retriesCount = 10
    while True:
        portableips = PublicIPAddress.list(apiclient, id=ipaddressid)
        assert validateList(portableips)[0] == PASS, "IPs list validation failed"
        if str(portableips[0].state).lower() == state:
            break
        elif retriesCount == 0:
           return False
        else:
            retriesCount -= 1
            time.sleep(60)
            continue
    return True
Ejemplo n.º 3
0
def is_public_ip_in_correct_state(apiclient, ipaddressid, state):
    """ Check if the given IP is in the correct state (given)
    and return True/False accordingly"""
    retriesCount = 10
    while True:
        portableips = PublicIPAddress.list(apiclient, id=ipaddressid)
        assert validateList(
            portableips)[0] == PASS, "IPs list validation failed"
        if str(portableips[0].state).lower() == state:
            break
        elif retriesCount == 0:
            return False
        else:
            retriesCount -= 1
            time.sleep(60)
            continue
    return True