Browse Source

"floating ip set/unset port" for OSC

Implements Neutron feature of floating ip associate/disassociate
into OpenStack Client.

Previously, network.find_ip() function only supported to
search floating ip by UUID. Hence, _find_floating_ip()
function is used in floating_ip.py, to search fip both by UUID
and ip_address. [1] adds the ability to find fip object using both UUID
and ip_address. This functionality however, won't be available until
the SDK is released. Hence, we continue to use _find_floating_ip()
method, which was cleaned up by [2] to remove the use of ip_cache.
Once, the SDK is released, we will remove all the usage of
_find_floating_ip() method and instead only use network.find_ip().

[1] https://review.openstack.org/#/c/449879/2
[2] https://review.openstack.org/#/c/447938/

Change-Id: I6c5222287c46ca42365917d2deae70bdb626347
Co-Authored-By: Reedip<reedip.banerjee@nectechnologies.in>
Co-Authored-By: RuiChen<chenrui.momo@gmail.com>
Closes-Bug: #1560297
tags/3.10.0
Sindhu Devale 2 years ago
parent
commit
763c8c5670

+ 47
- 0
doc/source/command-objects/floating-ip.rst View File

@@ -143,6 +143,32 @@ List floating IP(s)
143 143
 
144 144
     *Network version 2 only*
145 145
 
146
+floating ip set
147
+---------------
148
+
149
+Set floating IP properties
150
+
151
+.. program:: floating ip set
152
+.. code:: bash
153
+
154
+    openstack floating ip set
155
+        --port <port>
156
+        [--fixed-ip-address <ip-address>]
157
+        <floating-ip>
158
+
159
+.. option:: --port <port>
160
+
161
+    Assocaite the floating IP with port (name or ID)
162
+
163
+.. option:: --fixed-ip-address <ip-address>
164
+
165
+    Fixed IP of the port (required only if port has multiple IPs)
166
+
167
+.. _floating_ip_set-floating-ip:
168
+.. describe:: <floating-ip>
169
+
170
+    Floating IP to associate (IP address or ID)
171
+
146 172
 floating ip show
147 173
 ----------------
148 174
 
@@ -156,3 +182,24 @@ Display floating IP details
156 182
 .. describe:: <floating-ip>
157 183
 
158 184
     Floating IP to display (IP address or ID)
185
+
186
+floating ip unset
187
+-----------------
188
+
189
+Unset floating IP Properties
190
+
191
+.. program:: floating ip unset
192
+.. code:: bash
193
+
194
+    openstack floating ip unset
195
+        --port
196
+        <floating-ip>
197
+
198
+.. option:: --port
199
+
200
+    Disassociate any port associated with the floating IP
201
+
202
+.. _floating_ip_unset-floating-ip:
203
+.. describe:: <floating-ip>
204
+
205
+    Floating IP to disassociate (IP address or ID)

+ 75
- 1
openstackclient/network/v2/floating_ip.py View File

@@ -17,6 +17,7 @@ import logging
17 17
 
18 18
 from openstack import exceptions as sdk_exceptions
19 19
 from openstack.network.v2 import floating_ip as _floating_ip
20
+from osc_lib.command import command
20 21
 from osc_lib import utils
21 22
 
22 23
 from openstackclient.i18n import _
@@ -164,7 +165,7 @@ class CreateFloatingIP(common.NetworkAndComputeShowOne):
164 165
         )
165 166
         parser.add_argument(
166 167
             '--fixed-ip-address',
167
-            metavar='<fixed-ip-address>',
168
+            metavar='<ip-address>',
168 169
             dest='fixed_ip_address',
169 170
             help=_("Fixed IP address mapped to the floating IP")
170 171
         )
@@ -446,6 +447,47 @@ class ListIPFloating(ListFloatingIP):
446 447
             client, parsed_args)
447 448
 
448 449
 
450
+class SetFloatingIP(command.Command):
451
+    _description = _("Set floating IP Properties")
452
+
453
+    def get_parser(self, prog_name):
454
+        parser = super(SetFloatingIP, self).get_parser(prog_name)
455
+        parser.add_argument(
456
+            'floating_ip',
457
+            metavar='<floating-ip>',
458
+            help=_("Floating IP to associate (IP address or ID)"))
459
+        parser.add_argument(
460
+            '--port',
461
+            metavar='<port>',
462
+            required=True,
463
+            help=_("Assocaite the floating IP with port (name or ID)")),
464
+        parser.add_argument(
465
+            '--fixed-ip-address',
466
+            metavar='<ip-address>',
467
+            dest='fixed_ip_address',
468
+            help=_("Fixed IP of the port "
469
+                   "(required only if port has multiple IPs)")
470
+        )
471
+        return parser
472
+
473
+    def take_action(self, parsed_args):
474
+        client = self.app.client_manager.network
475
+        attrs = {}
476
+        # TODO(sindhu) Use client.find_ip() once SDK 0.9.15 is released
477
+        obj = _find_floating_ip(
478
+            self.app.client_manager.sdk_connection.session,
479
+            parsed_args.floating_ip,
480
+            ignore_missing=False,
481
+        )
482
+        port = client.find_port(parsed_args.port,
483
+                                ignore_missing=False)
484
+        attrs['port_id'] = port.id
485
+        if parsed_args.fixed_ip_address:
486
+            attrs['fixed_ip_address'] = parsed_args.fixed_ip_address
487
+
488
+        client.update_ip(obj, **attrs)
489
+
490
+
449 491
 class ShowFloatingIP(common.NetworkAndComputeShowOne):
450 492
     _description = _("Display floating IP details")
451 493
 
@@ -499,3 +541,35 @@ class ShowIPFloating(ShowFloatingIP):
499 541
                            'Please use "floating ip show" instead.'))
500 542
         return super(ShowIPFloating, self).take_action_compute(
501 543
             client, parsed_args)
544
+
545
+
546
+class UnsetFloatingIP(command.Command):
547
+    _description = _("Unset floating IP Properties")
548
+
549
+    def get_parser(self, prog_name):
550
+        parser = super(UnsetFloatingIP, self).get_parser(prog_name)
551
+        parser.add_argument(
552
+            'floating_ip',
553
+            metavar='<floating-ip>',
554
+            help=_("Floating IP to disassociate (IP address or ID)"))
555
+        parser.add_argument(
556
+            '--port',
557
+            action='store_true',
558
+            default=False,
559
+            help=_("Disassociate any port associated with the floating IP")
560
+        )
561
+        return parser
562
+
563
+    def take_action(self, parsed_args):
564
+        client = self.app.client_manager.network
565
+        # TODO(sindhu) Use client.find_ip() once SDK  0.9.15 is released
566
+        obj = _find_floating_ip(
567
+            self.app.client_manager.sdk_connection.session,
568
+            parsed_args.floating_ip,
569
+            ignore_missing=False,
570
+        )
571
+        if parsed_args.port:
572
+            attrs = {
573
+                'port_id': None,
574
+            }
575
+            client.update_ip(obj, **attrs)

+ 76
- 0
openstackclient/tests/functional/network/v2/test_floating_ip.py View File

@@ -21,6 +21,10 @@ class FloatingIpTests(base.TestCase):
21 21
     """Functional tests for floating ip"""
22 22
     SUBNET_NAME = uuid.uuid4().hex
23 23
     NETWORK_NAME = uuid.uuid4().hex
24
+    PRIVATE_NETWORK_NAME = uuid.uuid4().hex
25
+    PRIVATE_SUBNET_NAME = uuid.uuid4().hex
26
+    ROUTER = uuid.uuid4().hex
27
+    PORT_NAME = uuid.uuid4().hex
24 28
 
25 29
     @classmethod
26 30
     def setUpClass(cls):
@@ -30,6 +34,8 @@ class FloatingIpTests(base.TestCase):
30 34
         cls.re_fixed_ip = re.compile("fixed_ip_address\s+\|\s+(\S+)")
31 35
         cls.re_description = re.compile("description\s+\|\s+([^|]+?)\s+\|")
32 36
         cls.re_network_id = re.compile("floating_network_id\s+\|\s+(\S+)")
37
+        cls.re_port_id = re.compile("\s+id\s+\|\s+(\S+)")
38
+        cls.re_fp_port_id = re.compile("\s+port_id\s+\|\s+(\S+)")
33 39
 
34 40
         # Create a network for the floating ip
35 41
         raw_output = cls.openstack(
@@ -37,6 +43,12 @@ class FloatingIpTests(base.TestCase):
37 43
         )
38 44
         cls.network_id = re.search(cls.re_id, raw_output).group(1)
39 45
 
46
+        # Create a private network for the port
47
+        raw_output = cls.openstack(
48
+            'network create ' + cls.PRIVATE_NETWORK_NAME
49
+        )
50
+        cls.private_network_id = re.search(cls.re_id, raw_output).group(1)
51
+
40 52
         # Try random subnet range for subnet creating
41 53
         # Because we can not determine ahead of time what subnets are already
42 54
         # in use, possibly by another test running in parallel, try 4 times
@@ -46,6 +58,10 @@ class FloatingIpTests(base.TestCase):
46 58
                 str,
47 59
                 (random.randint(0, 223) for _ in range(3))
48 60
             )) + ".0/26"
61
+            cls.private_subnet = ".".join(map(
62
+                str,
63
+                (random.randint(0, 223) for _ in range(3))
64
+            )) + ".0/26"
49 65
             try:
50 66
                 # Create a subnet for the network
51 67
                 raw_output = cls.openstack(
@@ -54,6 +70,13 @@ class FloatingIpTests(base.TestCase):
54 70
                     '--subnet-range ' + cls.subnet + ' ' +
55 71
                     cls.SUBNET_NAME
56 72
                 )
73
+                # Create a subnet for the private network
74
+                priv_raw_output = cls.openstack(
75
+                    'subnet create ' +
76
+                    '--network ' + cls.PRIVATE_NETWORK_NAME + ' ' +
77
+                    '--subnet-range ' + cls.private_subnet + ' ' +
78
+                    cls.PRIVATE_SUBNET_NAME
79
+                )
57 80
             except Exception:
58 81
                 if (i == 3):
59 82
                     # raise the exception at the last time
@@ -64,13 +87,19 @@ class FloatingIpTests(base.TestCase):
64 87
                 break
65 88
 
66 89
         cls.subnet_id = re.search(cls.re_id, raw_output).group(1)
90
+        cls.private_subnet_id = re.search(cls.re_id, priv_raw_output).group(1)
67 91
 
68 92
     @classmethod
69 93
     def tearDownClass(cls):
70 94
         raw_output = cls.openstack('subnet delete ' + cls.SUBNET_NAME)
71 95
         cls.assertOutput('', raw_output)
96
+        raw_output = cls.openstack('subnet delete ' + cls.PRIVATE_SUBNET_NAME)
97
+        cls.assertOutput('', raw_output)
72 98
         raw_output = cls.openstack('network delete ' + cls.NETWORK_NAME)
73 99
         cls.assertOutput('', raw_output)
100
+        raw_output = cls.openstack(
101
+            'network delete ' + cls.PRIVATE_NETWORK_NAME)
102
+        cls.assertOutput('', raw_output)
74 103
 
75 104
     def test_floating_ip_delete(self):
76 105
         """Test create, delete multiple"""
@@ -168,3 +197,50 @@ class FloatingIpTests(base.TestCase):
168 197
         #     re.search(self.re_floating_ip, raw_output).group(1),
169 198
         # )
170 199
         self.assertIsNotNone(re.search(self.re_network_id, raw_output))
200
+
201
+    def test_floating_ip_set_and_unset_port(self):
202
+        """Test Floating IP Set and Unset port"""
203
+        raw_output = self.openstack(
204
+            'floating ip create ' +
205
+            '--description shosho ' +
206
+            self.NETWORK_NAME
207
+        )
208
+        re_ip = re.search(self.re_floating_ip, raw_output)
209
+        fp_ip = re_ip.group(1)
210
+        self.addCleanup(self.openstack, 'floating ip delete ' + fp_ip)
211
+        self.assertIsNotNone(fp_ip)
212
+
213
+        raw_output1 = self.openstack(
214
+            'port create --network ' + self.PRIVATE_NETWORK_NAME
215
+            + ' --fixed-ip subnet=' + self.PRIVATE_SUBNET_NAME +
216
+            ' ' + self.PORT_NAME
217
+        )
218
+        re_port_id = re.search(self.re_port_id, raw_output1)
219
+        self.assertIsNotNone(re_port_id)
220
+        port_id = re_port_id.group(1)
221
+
222
+        router = self.openstack('router create ' + self.ROUTER)
223
+        self.assertIsNotNone(router)
224
+        self.addCleanup(self.openstack, 'router delete ' + self.ROUTER)
225
+
226
+        self.openstack('router add port ' + self.ROUTER +
227
+                       ' ' + port_id)
228
+        self.openstack('router set --external-gateway ' + self.NETWORK_NAME +
229
+                       ' ' + self.ROUTER)
230
+
231
+        self.addCleanup(self.openstack, 'router unset --external-gateway '
232
+                        + self.ROUTER)
233
+        self.addCleanup(self.openstack, 'router remove port ' + self.ROUTER
234
+                        + ' ' + port_id)
235
+
236
+        raw_output = self.openstack(
237
+            'floating ip set ' +
238
+            fp_ip + ' --port ' + port_id)
239
+        self.addCleanup(self.openstack, 'floating ip unset --port ' + fp_ip)
240
+
241
+        show_output = self.openstack(
242
+            'floating ip show ' + fp_ip)
243
+
244
+        self.assertEqual(
245
+            port_id,
246
+            re.search(self.re_fp_port_id, show_output).group(1))

+ 161
- 25
openstackclient/tests/unit/network/v2/test_floating_ip.py View File

@@ -16,7 +16,7 @@ from mock import call
16 16
 
17 17
 from osc_lib import exceptions
18 18
 
19
-from openstackclient.network.v2 import floating_ip
19
+from openstackclient.network.v2 import floating_ip as fip
20 20
 from openstackclient.tests.unit.compute.v2 import fakes as compute_fakes
21 21
 from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes_v3
22 22
 from openstackclient.tests.unit.network.v2 import fakes as network_fakes
@@ -92,7 +92,7 @@ class TestCreateFloatingIPNetwork(TestFloatingIPNetwork):
92 92
         self.network.find_port = mock.Mock(return_value=self.port)
93 93
 
94 94
         # Get the command object to test
95
-        self.cmd = floating_ip.CreateFloatingIP(self.app, self.namespace)
95
+        self.cmd = fip.CreateFloatingIP(self.app, self.namespace)
96 96
 
97 97
     def test_create_no_options(self):
98 98
         arglist = []
@@ -210,12 +210,9 @@ class TestDeleteFloatingIPNetwork(TestFloatingIPNetwork):
210 210
         self.network.delete_ip = mock.Mock(return_value=None)
211 211
 
212 212
         # Get the command object to test
213
-        self.cmd = floating_ip.DeleteFloatingIP(self.app, self.namespace)
213
+        self.cmd = fip.DeleteFloatingIP(self.app, self.namespace)
214 214
 
215
-    @mock.patch(
216
-        "openstackclient.tests.unit.network.v2.test_floating_ip." +
217
-        "floating_ip._find_floating_ip"
218
-    )
215
+    @mock.patch.object(fip, '_find_floating_ip')
219 216
     def test_floating_ip_delete(self, find_floating_ip_mock):
220 217
         find_floating_ip_mock.side_effect = [
221 218
             self.floating_ips[0],
@@ -239,10 +236,7 @@ class TestDeleteFloatingIPNetwork(TestFloatingIPNetwork):
239 236
         self.network.delete_ip.assert_called_once_with(self.floating_ips[0])
240 237
         self.assertIsNone(result)
241 238
 
242
-    @mock.patch(
243
-        "openstackclient.tests.unit.network.v2.test_floating_ip." +
244
-        "floating_ip._find_floating_ip"
245
-    )
239
+    @mock.patch.object(fip, '_find_floating_ip')
246 240
     def test_floating_ip_delete_multi(self, find_floating_ip_mock):
247 241
         find_floating_ip_mock.side_effect = [
248 242
             self.floating_ips[0],
@@ -280,10 +274,7 @@ class TestDeleteFloatingIPNetwork(TestFloatingIPNetwork):
280 274
         self.network.delete_ip.assert_has_calls(calls)
281 275
         self.assertIsNone(result)
282 276
 
283
-    @mock.patch(
284
-        "openstackclient.tests.unit.network.v2.test_floating_ip." +
285
-        "floating_ip._find_floating_ip"
286
-    )
277
+    @mock.patch.object(fip, '_find_floating_ip')
287 278
     def test_floating_ip_delete_multi_exception(self, find_floating_ip_mock):
288 279
         find_floating_ip_mock.side_effect = [
289 280
             self.floating_ips[0],
@@ -380,7 +371,7 @@ class TestListFloatingIPNetwork(TestFloatingIPNetwork):
380 371
         self.network.find_router = mock.Mock(return_value=self.fake_router)
381 372
 
382 373
         # Get the command object to test
383
-        self.cmd = floating_ip.ListFloatingIP(self.app, self.namespace)
374
+        self.cmd = fip.ListFloatingIP(self.app, self.namespace)
384 375
 
385 376
     def test_floating_ip_list(self):
386 377
         arglist = []
@@ -572,12 +563,9 @@ class TestShowFloatingIPNetwork(TestFloatingIPNetwork):
572 563
         self.network.find_ip = mock.Mock(return_value=self.floating_ip)
573 564
 
574 565
         # Get the command object to test
575
-        self.cmd = floating_ip.ShowFloatingIP(self.app, self.namespace)
566
+        self.cmd = fip.ShowFloatingIP(self.app, self.namespace)
576 567
 
577
-    @mock.patch(
578
-        "openstackclient.tests.unit.network.v2.test_floating_ip." +
579
-        "floating_ip._find_floating_ip"
580
-    )
568
+    @mock.patch.object(fip, '_find_floating_ip')
581 569
     def test_floating_ip_show(self, find_floating_ip_mock):
582 570
         find_floating_ip_mock.return_value = self.floating_ip
583 571
         arglist = [
@@ -599,6 +587,154 @@ class TestShowFloatingIPNetwork(TestFloatingIPNetwork):
599 587
         self.assertEqual(self.data, data)
600 588
 
601 589
 
590
+class TestSetFloatingIP(TestFloatingIPNetwork):
591
+
592
+    # Fake data for option tests.
593
+    floating_network = network_fakes.FakeNetwork.create_one_network()
594
+    subnet = network_fakes.FakeSubnet.create_one_subnet()
595
+    port = network_fakes.FakePort.create_one_port()
596
+
597
+    # The floating ip to be deleted.
598
+    floating_ip = network_fakes.FakeFloatingIP.create_one_floating_ip(
599
+        attrs={
600
+            'floating_network_id': floating_network.id,
601
+            'port_id': port.id,
602
+        }
603
+    )
604
+
605
+    def setUp(self):
606
+        super(TestSetFloatingIP, self).setUp()
607
+        self.network.find_ip = mock.Mock(return_value=self.floating_ip)
608
+        self.network.find_port = mock.Mock(return_value=self.port)
609
+        self.network.update_ip = mock.Mock(return_value=None)
610
+
611
+        # Get the command object to test
612
+        self.cmd = fip.SetFloatingIP(self.app, self.namespace)
613
+
614
+    @mock.patch(
615
+        "openstackclient.tests.unit.network.v2.test_floating_ip." +
616
+        "fip._find_floating_ip"
617
+    )
618
+    def test_port_option(self, find_floating_ip_mock):
619
+        find_floating_ip_mock.side_effect = [
620
+            self.floating_ip,
621
+        ]
622
+        arglist = [
623
+            self.floating_ip.id,
624
+            '--port', self.floating_ip.port_id,
625
+        ]
626
+        verifylist = [
627
+            ('floating_ip', self.floating_ip.id),
628
+            ('port', self.floating_ip.port_id),
629
+        ]
630
+        parsed_args = self.check_parser(self.cmd, arglist, verifylist)
631
+
632
+        self.cmd.take_action(parsed_args)
633
+
634
+        attrs = {
635
+            'port_id': self.floating_ip.port_id,
636
+        }
637
+
638
+        find_floating_ip_mock.assert_called_once_with(
639
+            mock.ANY,
640
+            self.floating_ip.id,
641
+            ignore_missing=False,
642
+        )
643
+
644
+        self.network.update_ip.assert_called_once_with(
645
+            self.floating_ip, **attrs)
646
+
647
+    @mock.patch(
648
+        "openstackclient.tests.unit.network.v2.test_floating_ip." +
649
+        "fip._find_floating_ip"
650
+    )
651
+    def test_fixed_ip_option(self, find_floating_ip_mock):
652
+        find_floating_ip_mock.side_effect = [
653
+            self.floating_ip,
654
+        ]
655
+        arglist = [
656
+            self.floating_ip.id,
657
+            '--port', self.floating_ip.port_id,
658
+            "--fixed-ip-address", self.floating_ip.fixed_ip_address,
659
+        ]
660
+        verifylist = [
661
+            ('floating_ip', self.floating_ip.id),
662
+            ('port', self.floating_ip.port_id),
663
+            ('fixed_ip_address', self.floating_ip.fixed_ip_address),
664
+        ]
665
+        parsed_args = self.check_parser(self.cmd, arglist, verifylist)
666
+
667
+        self.cmd.take_action(parsed_args)
668
+
669
+        attrs = {
670
+            'port_id': self.floating_ip.port_id,
671
+            'fixed_ip_address': self.floating_ip.fixed_ip_address,
672
+        }
673
+        find_floating_ip_mock.assert_called_once_with(
674
+            mock.ANY,
675
+            self.floating_ip.id,
676
+            ignore_missing=False,
677
+        )
678
+        self.network.update_ip.assert_called_once_with(
679
+            self.floating_ip, **attrs)
680
+
681
+
682
+class TestUnsetFloatingIP(TestFloatingIPNetwork):
683
+
684
+    floating_network = network_fakes.FakeNetwork.create_one_network()
685
+    subnet = network_fakes.FakeSubnet.create_one_subnet()
686
+    port = network_fakes.FakePort.create_one_port()
687
+
688
+    # The floating ip to be deleted.
689
+    floating_ip = network_fakes.FakeFloatingIP.create_one_floating_ip(
690
+        attrs={
691
+            'floating_network_id': floating_network.id,
692
+            'port_id': port.id,
693
+        }
694
+    )
695
+
696
+    def setUp(self):
697
+        super(TestUnsetFloatingIP, self).setUp()
698
+        self.network.find_ip = mock.Mock(return_value=self.floating_ip)
699
+        self.network.update_ip = mock.Mock(return_value=None)
700
+
701
+        # Get the command object to test
702
+        self.cmd = fip.UnsetFloatingIP(self.app, self.namespace)
703
+
704
+    @mock.patch(
705
+        "openstackclient.tests.unit.network.v2.test_floating_ip." +
706
+        "fip._find_floating_ip"
707
+    )
708
+    def test_floating_ip_unset_port(self, find_floating_ip_mock):
709
+        find_floating_ip_mock.side_effect = [
710
+            self.floating_ip,
711
+        ]
712
+        arglist = [
713
+            self.floating_ip.id,
714
+            "--port",
715
+        ]
716
+        verifylist = [
717
+            ('floating_ip', self.floating_ip.id),
718
+            ('port', True),
719
+        ]
720
+        parsed_args = self.check_parser(self.cmd, arglist, verifylist)
721
+
722
+        result = self.cmd.take_action(parsed_args)
723
+
724
+        attrs = {
725
+            'port_id': None,
726
+        }
727
+        find_floating_ip_mock.assert_called_once_with(
728
+            mock.ANY,
729
+            self.floating_ip.id,
730
+            ignore_missing=False,
731
+        )
732
+        self.network.update_ip.assert_called_once_with(
733
+            self.floating_ip, **attrs)
734
+
735
+        self.assertIsNone(result)
736
+
737
+
602 738
 # Tests for Nova network
603 739
 #
604 740
 class TestFloatingIPCompute(compute_fakes.TestComputev2):
@@ -639,7 +775,7 @@ class TestCreateFloatingIPCompute(TestFloatingIPCompute):
639 775
         self.compute.floating_ips.create.return_value = self.floating_ip
640 776
 
641 777
         # Get the command object to test
642
-        self.cmd = floating_ip.CreateFloatingIP(self.app, None)
778
+        self.cmd = fip.CreateFloatingIP(self.app, None)
643 779
 
644 780
     def test_create_no_options(self):
645 781
         arglist = []
@@ -682,7 +818,7 @@ class TestDeleteFloatingIPCompute(TestFloatingIPCompute):
682 818
             compute_fakes.FakeFloatingIP.get_floating_ips(self.floating_ips))
683 819
 
684 820
         # Get the command object to test
685
-        self.cmd = floating_ip.DeleteFloatingIP(self.app, None)
821
+        self.cmd = fip.DeleteFloatingIP(self.app, None)
686 822
 
687 823
     def test_floating_ip_delete(self):
688 824
         arglist = [
@@ -782,7 +918,7 @@ class TestListFloatingIPCompute(TestFloatingIPCompute):
782 918
         self.compute.floating_ips.list.return_value = self.floating_ips
783 919
 
784 920
         # Get the command object to test
785
-        self.cmd = floating_ip.ListFloatingIP(self.app, None)
921
+        self.cmd = fip.ListFloatingIP(self.app, None)
786 922
 
787 923
     def test_floating_ip_list(self):
788 924
         arglist = []
@@ -826,7 +962,7 @@ class TestShowFloatingIPCompute(TestFloatingIPCompute):
826 962
         self.compute.floating_ips.get.return_value = self.floating_ip
827 963
 
828 964
         # Get the command object to test
829
-        self.cmd = floating_ip.ShowFloatingIP(self.app, None)
965
+        self.cmd = fip.ShowFloatingIP(self.app, None)
830 966
 
831 967
     def test_floating_ip_show(self):
832 968
         arglist = [

+ 5
- 0
releasenotes/notes/floating-ip-set-unset-port-28e33875937b69cf.yaml View File

@@ -0,0 +1,5 @@
1
+---
2
+features:
3
+  - |
4
+    Add ``floating ip set`` and ``floating ip unset`` commands.
5
+    [:lpbug:`1560297`]

+ 2
- 0
setup.cfg View File

@@ -347,7 +347,9 @@ openstack.network.v2 =
347 347
     floating_ip_create = openstackclient.network.v2.floating_ip:CreateFloatingIP
348 348
     floating_ip_delete = openstackclient.network.v2.floating_ip:DeleteFloatingIP
349 349
     floating_ip_list = openstackclient.network.v2.floating_ip:ListFloatingIP
350
+    floating_ip_set = openstackclient.network.v2.floating_ip:SetFloatingIP
350 351
     floating_ip_show = openstackclient.network.v2.floating_ip:ShowFloatingIP
352
+    floating_ip_unset = openstackclient.network.v2.floating_ip:UnsetFloatingIP
351 353
 
352 354
     floating_ip_pool_list = openstackclient.network.v2.floating_ip_pool:ListFloatingIPPool
353 355
 

Loading…
Cancel
Save