Esempio n. 1
0
 def state_wait_gone(self, lfunction, final_set, valid_set):
     if not isinstance(final_set, set):
         final_set = set((final_set,))
     final_set |= self.gone_set
     lfunction = self.get_lfunction_gone(lfunction)
     state = state_wait(lfunction, final_set, valid_set)
     self.assertIn(state, valid_set | self.gone_set)
     return state
Esempio n. 2
0
 def state_wait_gone(self, lfunction, final_set, valid_set):
     if not isinstance(final_set, set):
         final_set = set((final_set, ))
     final_set |= self.gone_set
     lfunction = self.get_lfunction_gone(lfunction)
     state = state_wait(lfunction, final_set, valid_set)
     self.assertIn(state, valid_set | self.gone_set)
     return state
Esempio n. 3
0
    def assertAddressReleasedWait(self, address):
        def _address_delete():
            # NOTE(afazekas): the filter gives back IP
            # even if it is not associated to my tenant
            if address.public_ip not in map(lambda a: a.public_ip, self.ec2_client.get_all_addresses()):
                return "DELETED"
            return "NOTDELETED"

        state = state_wait(_address_delete, "DELETED")
        self.assertEqual(state, "DELETED")
Esempio n. 4
0
    def assertAddressReleasedWait(self, address):
        def _address_delete():
            # NOTE(afazekas): the filter gives back IP
            # even if it is not associated to my tenant
            if (address.public_ip
                    not in map(lambda a: a.public_ip,
                               self.ec2_client.get_all_addresses())):
                return "DELETED"
            return "NOTDELETED"

        state = state_wait(_address_delete, "DELETED")
        self.assertEqual(state, "DELETED")
Esempio n. 5
0
    def assertAddressDissasociatedWait(self, address):
        def _disassociate():
            cli = self.ec2_client
            addresses = cli.get_all_addresses(addresses=(address.public_ip,))
            if len(addresses) != 1:
                return "INVALID"
            if addresses[0].instance_id:
                LOG.info("%s associated to %s", address.public_ip, addresses[0].instance_id)
                return "ASSOCIATED"
            return "DISASSOCIATED"

        state = state_wait(_disassociate, "DISASSOCIATED", set(("ASSOCIATED", "DISASSOCIATED")))
        self.assertEqual(state, "DISASSOCIATED")
Esempio n. 6
0
    def assertAddressDissasociatedWait(self, address):
        def _disassociate():
            cli = self.ec2_client
            addresses = cli.get_all_addresses(addresses=(address.public_ip, ))
            if len(addresses) != 1:
                return "INVALID"
            if addresses[0].instance_id:
                LOG.info("%s associated to %s", address.public_ip,
                         addresses[0].instance_id)
                return "ASSOCIATED"
            return "DISASSOCIATED"

        state = state_wait(_disassociate, "DISASSOCIATED",
                           set(("ASSOCIATED", "DISASSOCIATED")))
        self.assertEqual(state, "DISASSOCIATED")