Refactored the 'os security group create' command to use the SDK
when neutron is enabled, but continue to use the nova client
when nova network is enabled.
Added a release note for the change in security group rules output
due to Network v2. The tenant_id column name was fixed to align
with the 'os security group show' command.
Change-Id: Ib29df42edcddcc73a123fff6a64743a6bfcb7fbf
Partial-Bug: #1519511
Implements: blueprint neutron-client
Refactored the 'os security group show' command to use the SDK
when neutron is enabled, but continue to use the nova client
when nova network is enabled.
Added a release note for the change in security group rules output
due to Network v2. The column names remain unchanged to maintain
backwards compatibility.
Change-Id: I25233ddb8115d18b8b88affb3de13346084a339d
Partial-Bug: #1519511
Implements: blueprint neutron-client
In unit tests, all real methods are faked. They should not
do any real operations in the tests. So, FakeFlavorResource
is not necessary. Just fake get_keys(), set_keys and unset_keys()
in FakeResource would be enough.
Change-Id: Icc3473ba9c77f4817d0edddb7ff3e1bd2946fac7
"server image create"
"server rebuild"
"server resize"
Above 3 commands are not covered by unit test.
So add some unit tests.
Meanwhile, fix bug. Now that image name is an optional argument,
we'd better record error messages with positional arguments
instead of optional argument. So, record server name.
Change-Id: I41bc025d4824dc46f63a3213d82e1528bacbbe12
Refactored the 'os security group list' command to use the SDK
when neutron is enabled, but continue to use the nova client
when nova network is enabled.
This refactor also removes the logic for displaying project names
instead of project IDs when the --all-projects option is specified.
This logic was removed because it is inconsistent with the other
network commands.
Since neutron will always display security groups across all
projects for an admin, the --all-projects option is now hidden
when neutron is enabled and the Project column is always
displayed.
Change-Id: I934a1f5084ef3c5f929d0ffd38ebf5064d799941
Partial-Bug: #1519511
Related-to: blueprint neutron-client
take_action() in commands inheriting from Command returns nothing.
So we should assert the return is None in the unit tests of
these commands.
Change-Id: I953480ecff3b5beb12255d866d0e1df45f130efd
Partial-Bug: #1550636
Add some test cases that test 'server list' command when specifying flavor or image.
Because I add some attribution to fake.py, I have to change some code
in create server test. Despite all this, I think it's good for testing.
Change-Id: I714deac1f6f940b790a3c20af5f7ffa724ac44d1
_keys is defined as a class attribute in FakeFlavorResource. So when
we call set_keys() to update it, it changes. And this change may bring
trouble to the other tests afterward.
So define and initialize it in __init__() as an object attribute.
Change-Id: Ib18c03877b67e1b7c2e107f598076b928a58e4fb
Closes-bug: #1548378
"network show" command is not implemented in nova network.
This patch implements it.
Change-Id: I1fadd890fe36c4e3ac5c9ed389b20c5b2fff8aca
partial-Bug: 1543672
"network list" command is not implemented in nova network.
This patch implements it.
The Network object in novaclient is quite different from
the one in sdk. And the output of "network list" using
Nova network is also quite different from using Neutron.
It is like this:
# openstack network list
+--------------------------------------+---------+-------------+
| ID | Name | Subnet |
+--------------------------------------+---------+-------------+
| 96a98ec4-31f6-45f6-99e6-9384569b3bb5 | private | 10.0.0.0/24 |
+--------------------------------------+---------+-------------+
--long and --external options have not been implemented because
the attrs in Network object in novaclient is too much different.
This patch also introduces a new FakeNetwork class in compute/v2/fake.py
to fake nova network.
Change-Id: Id1fdf81fb2fa8b39f2c76b7bae37ac4fecafd0f7
Depends-On: I1b59264cd40aaf1062f4e8db233ccb7fd0e95f0e
partial-Bug: 1543672
"ip floating list" command is not available for Neutron now because
the implementation is incorrect.
The FloatingIP objects returned from Nova and Neutron network are
quite different. So they need different FakeFloatingIP class to
do the tests.
This patch copies class FakeFloatingIP in tests/network to tests/compute
for Nova network tests.
Will fix the problem in "ip floating list" command and change FakeFloatingIP
in tests/network to fit Neutron network tests.
Change-Id: Ia29d257868e0f1dc6cd7cfe3819875e5913f76ec
Partial-Bug: 1519502
Partially implements: blueprint neutron-client
In some test cases, try/except is used to check if an exception
has been raised. We should use assertRaises() instead.
Change-Id: I15c8e757dcab77fd6f895feb018184e1eb7e617b
"network delete" command is not implemented in nova network.
This patch implements it.
Change-Id: I5dac1eed6eb8e67298bb446418835a6ab85c859c
Depends-On: I1b59264cd40aaf1062f4e8db233ccb7fd0e95f0e
partial-Bug: 1543672
This patch implements "ip floating delete" command for
both compute and network. Also includes unit tests.
Change-Id: Ie61f0faad65ec90f9d9956ae463412be8d963d05
partial-Bug: 1519502
Related-to: blueprint neutron-client
Co-Authored-By: Tang Chen <chen.tang@easystack.cn>
Refactored the 'os security group rule delete' command to use the
SDK when neutron is enabled, but continue to use the nova client
when nova network is enabled.
This patch set also introduces new FakeSecurityGroupRule classes
for testing network and compute security group rules. And fixes
were made to the network FakeSecurityGroup class.
Change-Id: I8d0917925aa464e8255defae95a2a2adfb6cfb75
Partial-Bug: #1519512
Related-to: blueprint neutron-client
As Richard <rtheis@us.ibm.com> has pointed out, "abstractmethod"
should be "abstract method". This is a small typo I have made
when I fix DisplayCommandBase comment bug.
Change-Id: I84f1a3158896257686a0a7efa1123eef1b85139f
Partial-bug: #1477199
As bug #1477199 describes, the wrong comment below is all over the
unit test code of OSC.
# DisplayCommandBase.take_action() returns two tuples
There is no such class named DisplayCommandBase in OSC. It is in cliff.
All OSC command classes inherit from the base classes in cliff,
class Command, class Lister and class ShowOne. It is like this:
Object
|--> Command
|--> DisplayCommandBase
|--> Lister
|--> ShowOne
take_action() is an abstract method of class Command, and generally is
overwritten by subclasses.
* Command.take_action() returns nothing.
* Lister.take_action() returns a tuple which contains a tuple of
columns and a generator used to generate the data.
* ShowOne.take_action() returns an iterator which contains a tuple
of columns and a tuple of data
So, this problem should be fixed in 3 steps:
1. Remove all DisplayCommandBase comments for tests of classes
inheriting from class Command in cliff as it returns nothing.
2. Fix all DisplayCommandBase comments for tests of classes
inheriting from class Lister in cliff. Lister.take_action()
returns a tuple and a generator.
3. Fix all DisplayCommandBase comments for tests of classes
inheriting from class ShowOne in cliff. ShowOne.take_action()
returns two tuples.
This patch finishes step 3 in compute tests.
Change-Id: I4df224ec82b5d82a3d6d3f366c0f68a7ea0d87cd
Partial-bug: #1477199
As bug #1477199 describes, the wrong comment below is all over the
unit test code of OSC.
# DisplayCommandBase.take_action() returns two tuples
There is no such class named DisplayCommandBase in OSC. It is in cliff.
All OSC command classes inherit from the base classes in cliff,
class Command, class Lister and class ShowOne. It is like this:
Object
|--> Command
|--> DisplayCommandBase
|--> Lister
|--> ShowOne
take_action() is an abstract method of class Command, and generally is
overwritten by subclasses.
* Command.take_action() returns nothing.
* Lister.take_action() returns a tuple which contains a tuple of
columns and a generator used to generate the data.
* ShowOne.take_action() returns an iterator which contains a tuple
of columns and a tuple of data
So, this problem should be fixed in 3 steps:
1. Remove all DisplayCommandBase comments for tests of classes
inheriting from class Command in cliff as it returns nothing.
2. Fix all DisplayCommandBase comments for tests of classes
inheriting from class Lister in cliff. Lister.take_action()
returns a tuple and a generator.
3. Fix all DisplayCommandBase comments for tests of classes
inheriting from class ShowOne in cliff. ShowOne.take_action()
returns two tuples.
This patch finishes step 2 in compute tests.
Change-Id: Idc54ad21eaa1371ebd601327b8d962c7039f2de0
Partial-bug: #1477199
As bug #1477199 describes, the wrong comment below is all over the
unit test code of OSC.
# DisplayCommandBase.take_action() returns two tuples
There is no such class named DisplayCommandBase in OSC. It is in cliff.
All OSC command classes inherit from the base classes in cliff,
class Command, class Lister and class ShowOne. It is like this:
Object
|--> Command
|--> DisplayCommandBase
|--> Lister
|--> ShowOne
take_action() is an abstract method of class Command, and generally is
overwritten by subclasses.
* Command.take_action() returns nothing.
* Lister.take_action() returns a tuple which contains a tuple of
columns and a generator used to generate the data.
* ShowOne.take_action() returns an iterator which contains a tuple
of columns and a tuple of data
So, this problem should be fixed in 3 steps:
1. Remove all DisplayCommandBase comments for tests of classes
inheriting from class Command in cliff as it returns nothing.
2. Fix all DisplayCommandBase comments for tests of classes
inheriting from class Lister in cliff. Lister.take_action()
returns a tuple and a generator.
3. Fix all DisplayCommandBase comments for tests of classes
inheriting from class ShowOne in cliff. ShowOne.take_action()
returns two tuples.
This patch finishes step 1 in compute tests.
Change-Id: I99ab42a7de69af0e5de802a1bb5aac647245a200
Partial-bug: #1477199
projects mock has been defined in FakeIdentityv2Client as
tenants, and in FakeIdentityv3Client as projects. No need
to define them again.
Change-Id: Ieb97b32d7be6bd95c8621092b218ebfd8bc5b78d