Adjusted conditional statements to use instanceof when
comparing variables. Instanceof supports inheritance type
checking better than type.
Change-Id: I4ee0004934dc2322d43ef07e797a6811e39a812c
Closes-Bug: 1548530
Implement the openstack client subnet show command using SDK
calls. This shows the details of a specific subnet.
Co-Authored-By: Terry Howe <terrylhowe@gmail.com>
Partially implements: blueprint neutron-client
Closes-Bug: #1542359
Change-Id: Iaf18b9e44af35ca0cd61033b468e0c60cd3b05d6
_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
`dict.get()` returns `None` by default, if a key wasn't found.
Removing `None` as second argument to avoid redundancy.
Change-Id: Ia82f7469cd019509bbeccbfe54b15eeedc7bb6ea
The tests for v2 "volume" commands are quite similar to v1.
This patch also map 'metadata' to 'properties', 'volume_type' to 'type'
to align to the v1 output.
Change-Id: Icf2c5463b186fc78c890ccd96453090c4a2c2eb6
Partial-bug: #1519503
OpenStack SDK will translate "project_id" into "tenant_id" automatically
when referring to "tenant_id" attribute with the name "project_id". So
when faking an object returned fron SDK, we need to fake this behavior.
The original way is ugly. This patch turns it into a consistent style,
and give better comments.
Change-Id: I0dfb1f7552fc28eb4e7ebf5c614c9f3bde79ad80
Python’s default arguments are evaluated once when the function is defined,
not each time the function is called. This means that if you use a mutable
default argument (like list and dict) and mutate it, you will and have mutated
that object for all future calls to the function as well.
more details about this wrong usage here:
http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments
Change-Id: If187f16bfb305ac4fe6e4177e498a06c49c3f946
File names under doc/source/command-objects/ are words connected
with "-". So rename subnet_pool.rst to subnet-pool.rst to keep
the consistence.
Also use "display" instead of "show" in the comment to keep the
consistence.
Change-Id: If486f6cec34b4572a8245af865267b063c1e877d
There are files containing string format arguments inside logging messages.
Using logging function parameters should be preferred.
Change-Id: I15b405bf4d4715263fe1e1262982467b3d4bc1f4
Closes-Bug: #1321274
Make scope check optional for the "token issue" command as unscoped token is
a valid Keystone V2/V3 API.
Change-Id: Ie1cded4dbfdafd3a78c0ebdf89e3f66762509930
Closes-Bug: #1543214
Class mock.Mock does not exist method "called_once_with()", it just
exists method "assert_called_once_with()". "called_once_with()" does
nothing because it's a mock object.
In OSC, only one place is still using "called_once_with()". Fix it.
Change-Id: Ib890e95d775c3fc43df80fa05c82d726e78cdac8
Partial Bug: 1544522
The implementation of "ip floating list" in the commit below
is incorrect:
Change-Id: I253f66f6bc64470e1a18ffea506048eb53f67d5c
This is because the FloatingIP objects returned from Nova and
Neutron network are different. They need different handling.
This patch fixes this problem.
The output for Neutron network would be:
+--------------------------------------+---------------------+------------------+------+
| ID | Floating IP Address | Fixed IP Address | Port |
+--------------------------------------+---------------------+------------------+------+
| 1976df86-e66a-4f96-81bd-c6ffee6407f1 | 172.24.4.3 | None | None |
+--------------------------------------+---------------------+------------------+------+
The output for Neutron network would be:
+----+---------------------+------------------+-----------+--------+
| ID | Floating IP Address | Fixed IP Address | Server ID | Pool |
+----+---------------------+------------------+-----------+--------+
| 1 | 172.24.4.1 | None | None | public |
+----+---------------------+------------------+-----------+--------+
Change-Id: I1295e922df695414511d9a07ca4a8e2428040064
Partial-Bug: 1519502
Related-to: blueprint neutron-client
"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
'openstack --help' can display the basic information, even if
openstack command does not have permission to read clouds.yaml.
Change-Id: I7d5255c5ce3bd60af77fc70f433ca78dc011a79f
Closes-Bug: #1541047
In other commands, the name or ID of an object is just the name
of the object. For example, name or ID of a server is "server",
router is "router". So, do not use "identifier" in network commands.
Also, the parameter in doc file network.rst is not "identifier",
but "network".
Change-Id: I1ec3beefbb878a207bca280b994ca176ef04ee2d
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>