def test_crud_floating_ip(self):
        gw = helpers.get_test_gateway(self.provider)

        def create_fip(label):
            fip = gw.floating_ips.create()
            return fip

        def cleanup_fip(fip):
            if fip:
                gw.floating_ips.delete(fip.id)

        with helpers.cleanup_action(lambda: helpers.delete_test_gateway(gw)):
            sit.check_crud(self,
                           gw.floating_ips,
                           FloatingIP,
                           "cb-crudfip",
                           create_fip,
                           cleanup_fip,
                           skip_name_check=True)
    def test_crud_floating_ip(self):
        net, gw = helpers.get_test_gateway(
            self.provider, 'cb_crudfipgw-{0}'.format(helpers.get_uuid()))

        def create_fip(name):
            fip = gw.floating_ips.create()
            return fip

        def cleanup_fip(fip):
            gw.floating_ips.delete(fip.id)

        with helpers.cleanup_action(
                lambda: helpers.delete_test_gateway(net, gw)):
            sit.check_crud(self,
                           gw.floating_ips,
                           FloatingIP,
                           "cb_crudfip",
                           create_fip,
                           cleanup_fip,
                           skip_name_check=True)
 def test_floating_ip_properties(self):
     # Check floating IP address
     gw = helpers.get_test_gateway(self.provider)
     fip = gw.floating_ips.create()
     with helpers.cleanup_action(lambda: helpers.delete_test_gateway(gw)):
         with helpers.cleanup_action(lambda: fip.delete()):
             fipl = list(gw.floating_ips)
             self.assertIn(fip, fipl)
             # 2016-08: address filtering not implemented in moto
             # empty_ipl = self.provider.network.floating_ips('dummy-net')
             # self.assertFalse(
             #     empty_ipl,
             #     "Bogus network should not have any floating IPs: {0}"
             #     .format(empty_ipl))
             self.assertFalse(
                 fip.private_ip,
                 "Floating IP should not have a private IP value ({0}).".
                 format(fip.private_ip))
             self.assertFalse(
                 fip.in_use,
                 "Newly created floating IP address should not be in use.")