Commit Graph

58 Commits

Author SHA1 Message Date
Erik Olof Gunnar Andersson 57f2e367bf Restructure testing
- Moved all functional tests to dedicated folder.
- Updated a few tests to use faster oslo tests.
- Renamed fixtures.py to base_fixtures.py.

Change-Id: Ie8c5591dd12a91350173bec2b418b6c9ddea79fe
2024-01-05 15:09:29 -08:00
kpdev 8733f8f85b Add new API for zone move
The new API would be v2/zones/<zone_id>/tasks/move
Only POST would be allowed on this API.
This move zone from existing pool and add it in new pool. After zone
pool_id field will be updated in DB, clone-zone will be created on
target pool backend servers. The zone transfer(AXFR/IXFR) will happen
and the zone on target pool gets synced with the Designate DB.
This command serve as replacement to "zone export + zone delete + zone
import" procedure.

Added following things in pool move operation:
  - Add/Update NS servers of new pool in the zone

Implements: blueprint zone-move
Change-Id: I5307de429114b20efd9785c3c0cdb33977418423
2023-12-15 22:31:27 +00:00
Erik Olof Gunnar Andersson cc0431ba62 Standardize all configuration loading
There was a large config refactor many releases ago, but
we never standardized on the new pattern. This will also
help ensure that config is always loaded in the right order.

- Standardize how config is setup throughout designate.
- Removed unecessary import_opt.


Change-Id: I8913d2569f174208740a76c474c73316f6c1d89e
2023-11-03 11:19:11 +00:00
Erik Olof Gunnar Andersson 68fc28527a pyupgrade changes for Python3.8+
Result of running

$ pyupgrade --py38-plus $(git ls-files | grep ".py$")

This was inspired by Nova [1] and Octavia [2]

Fixed PEP8 errors introduced by pyupgrade by running:

$ autopep8 --select=E127,E128,E501 --max-line-length 79 -r \
  --in-place designate

and manual updates.

[1]: https://review.opendev.org/c/openstack/nova/+/896986
[2]: https://review.opendev.org/c/openstack/octavia/+/899263

Change-Id: Idfa757d7ba238012db116fdb3e98cc7c5ff4b169
2023-11-03 11:19:07 +00:00
Erik Olof Gunnar Andersson 69515a8df7 Use TEST-NET-1 for most unit testing
Change-Id: I3707f263dca8ddfef7db9b765e6071220259b4bc
2023-06-04 20:28:00 -07:00
Michael Johnson c2e51939b4 Update designate for RBAC "direction change"
The RBAC goal has changed[1] and system scope is no longer going to be
used. This patch updates Designate to align to this change in direction
by removing the system scope from the policies.
It also updates the functional tests to be ready for the switch to using
the new keystone roles by default.

[1] https://governance.openstack.org/tc/goals/selected/consistent-and-secure-rbac.html#direction-change

Depends-On: https://review.opendev.org/c/openstack/designate-tempest-plugin/+/879111
Change-Id: I1937e215dbd072b0a095df659c75f17a3f48c937
2023-03-31 00:38:50 +00:00
Erik Olof Gunnar Andersson 8050680948 Removed RPC calls from MDNS and moved them to the Worker
This patch moved the remaining RPC calls away from the
MDNS service to the Worker and re-worked them to better
match the patterns used in the Worker. This means that
the MDNS service now only handles incoming DNS queries.

In addition the metrics backend has been removed as it was
only used by the MDNS RPC implementation and the monascastatsd
implementation no longer serves a purpose.

Closes-Bug: #1978742
Closes-Bug: #1978743
Change-Id: I5ef106717546a201fd62a51adacd43495c148cd4
2022-06-23 23:31:41 +00:00
dekehn 6ac659d241 Minimum TTL value allowed is zero
According to ITEF https://tools.ietf.org/html/rfc2181#section-8
the definition of the ttl value is unsigned integer and can have a
minimum value of 0. This patch changes the minimum value of 1 to allow
for 0. Unit test have also been modified accordingly.

Closes-Bug: #1926429
Change-Id: I7876b4c1e2c800b654ca750211ee2e58f3ea4309
2022-05-03 19:28:52 +00:00
Michael Johnson 0e16095a80 Enable H306 check and fix import ordering
To better align with other OpenStack projects and to reduce the
ongoing problem with duplicate imports, this patch re-enables the
H306 check for proper module import order.

Change-Id: Iced92590829f6d9177d64ad4868aebe6eafd6a8a
2021-11-18 00:30:05 +00:00
Sean McGinnis 4b2c732df7
Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I4bd0de2f553c43a805670a424c44455d691891ac
2020-05-29 11:35:40 -05:00
Nguyen Van Trung 274c2cb82c Migrate object to OVO (4)
This commit will migrate:
- Pool and PoolList
- Related objects

Co-authored-By: Dai Dang Van <daidv@vn.fujitsu.com>

Change-Id: I59da0628a9dc23efe8d8665bbf3359e652eaa8c9
Implements: blueprint designate-rolling-upgrade
2018-02-25 16:07:38 +00:00
Thomas Herve 92598a62f1 Fix remaining API tests under python3
This fixes the address_name method to return text, as the to_text
method from dnspython returns bytes, and make 3 new test modules pass.

Change-Id: I5d0e75bd9acdd517ed4a94b1959783a2437cf5a5
2017-05-30 21:53:55 +02:00
gecong1973 9862084b04 Remove unused LOG
delete unused LOG in some files

Change-Id: Ib4fe45c16bae75069a6cf427c24a705b6f1f58bc
2016-07-20 12:09:32 +08:00
Graham Hayes 00c90a3208 Fix _find_masters + unit tests
Change-Id: Icf968e51d86683c2ca92f10261e0d22f1cbde0a3
2016-03-11 18:05:28 +00:00
Federico Ceratto a0ff7859a7 Hide zones flagged for deletion in API v1
Add docstrings and improve testing
Related to https://bugs.launchpad.net/designate/+bug/1506757

Change-Id: Iaf4c2b28c7f62985c2b4abc0f7d791c91760bfa5
2015-11-18 17:17:42 +00:00
Graham Hayes c5949ccb28 Rename all references of Domain to Zone
This is a pretty invasive change :)

A non complete list of changes:

* Database Tables
* Database Columns
* Designate Objects and fields on Objects
* Designate Objects Adaptors stop doing some of the renames
* All RPCAPI versions are bumped - totally backward
  incompatable (function names have changed)

Change-Id: Ib99e918998a3909fa4aa92bf1ee0475f8a519196
2015-11-17 15:22:16 +00:00
sonu.kumar 94f18defa0 Fixes Output for zone type filter
Closes-Bug: #1506742

Change-Id: Ifd6269fef1061da3fdc5ececd103a79789b9473f
2015-10-21 09:49:26 +05:30
Endre Karlson 366b12f5f2 Add zone type specific validators
Closes-bug: #1498121

Change-Id: Ie42c64ee8f00c8fb130e7c6494d9e8b2c290beaf
2015-09-22 20:13:34 +02:00
Endre Karlson 516360e769 [zm] Periodic Secondary zone refresh task
Change-Id: Ia619153e63da27f4555fb9a719214e54dfb5a26a
Closes-Bug: 1432850
2015-09-16 17:00:37 +02:00
Graham Hayes ea4b054ac6 Add DomainMaster Object to designate objects
Change-Id: I60dbe23be0d6f2ea6b6f3f9d7bd26ce2e2f7686f
2015-08-13 14:40:39 +01:00
Jenkins 6e710423a5 Merge "Reject invalid filters" 2015-07-28 10:42:15 +00:00
mimi8890 01b170db9f Reject invalid filters
Returns an error when a call is made with a filter that is not
supported. Added unit tests.

Change-Id: Ic712f8d145cd6059d9e8af4df3efaa113acb7e08
Closes-bug: 1468452
2015-07-27 15:08:50 +00:00
Pradeep Kumar Singh 7b70b2ac93 Add some UTs to test_zones.py
Change-Id: Ie02690c55b3fc7062ef77ba3d5f8507dddf8703a
2015-07-17 06:44:48 +05:30
mimi8890 95ce4507dc Add zone filter for TTL, description, & status
-Can now filter on zones by TTL and description, and on recordsets by description.
-Updated the doc with the changes.
-Added unit tests for zone filtering and recordset filtering

Change-Id: I3da024c2a7f99446512574cb126a568c6027e99c
Closes-Bug: 1466545
2015-07-01 15:44:59 +00:00
Graham Hayes 1cb65e2516 Fix the v2 XFR task API
* Fixed the call to non existent function
* Added unit tests

Change-Id: I8c88fc1ea353e99b7a0b5bb0aa5c8d7e2bf92328
Closes-Bug: 1459487
2015-05-28 17:57:02 +01:00
Doug Hellmann f9c55abbff Drop use of 'oslo' namespace package
The Oslo libraries have moved all of their code out of the 'oslo'
namespace package into per-library packages. The namespace package was
retained during kilo for backwards compatibility, but will be removed by
the liberty-2 milestone. This change removes the use of the namespace
package, replacing it with the new package names.

The patches in the libraries will be put on hold until application
patches have landed, or L2, whichever comes first. At that point, new
versions of the libraries without namespace packages will be released as
a major version update.

Please merge this patch, or an equivalent, before L2 to avoid problems
with those library releases.

Blueprint: remove-namespace-packages
https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages

Change-Id: Ia21c15e8eca6bf456f7cfe13f815f5ce068601e7
2015-05-06 20:36:49 +00:00
Doug Hellmann 1ff8469ef7 Drop use of 'oslo' namespace package
The Oslo libraries have moved all of their code out of the 'oslo'
namespace package into per-library packages. The namespace package was
retained during kilo for backwards compatibility, but will be removed by
the liberty-2 milestone. This change removes the use of the namespace
package, replacing it with the new package names.

The patches in the libraries will be put on hold until application
patches have landed, or L2, whichever comes first. At that point, new
versions of the libraries without namespace packages will be released as
a major version update.

Please merge this patch, or an equivalent, before L2 to avoid problems
with those library releases.

Blueprint: remove-namespace-packages
https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages

Change-Id: Iae62b48993eef3b31420f8cc245a55f5e303c4fc
2015-04-28 18:32:15 +00:00
Graham Hayes 807c89229b Add the /v2/zones/<id>/nameservers endpoint back
APIImpact
Closes-Bug: #1447683

Change-Id: I80b51e4e04fc7395d8d1f32a3b3d34f09520c75c
2015-04-23 16:54:04 +01:00
Graham Hayes aba646b94f Move Zone Import / Export to /admin API
* Moves zonefile import/export to admin API due to issues with non
  async action of import / export
* Added policy checks to allow restriction of usage
* Fixed 500 Error on invalid Content-Type when using body_dict()
Closes-Bug: #1443366
Change-Id: Iea0f2077f24da9bb1a93d5ac9aadced402343405
APIImpact: Move zone import / export to /admin
2015-04-14 12:39:05 +02:00
Graham Hayes 129b00e819 Replace API_v2 views with Adapters
* Copied old base view into /admin/
* Removed all v2/ views
* Controllers moved to Adapters
* Validation Error Middleware now in use for validation errors
* Updated tests to remove wrapper object
* Updated Docs to remove wrapper
* Moved Quota Docs to /admin/

Change-Id: I345552bb271222d41321523acc9c4100cbe4878e
Partially-Implements: blueprint validation-cleanup
APIImpact: Removes wrapping object on APIv2 single resource gets
(i.e. get zone by id moves from {zone:{<zone_info>}} to {<zone_info>})
2015-03-30 11:20:29 +01:00
Jenkins 4f9018f52f Merge "Don't allow updates to zones that are being deleted" 2015-03-24 12:56:46 +00:00
Kiall Mac Innes e0dc0e77b4 Move Pool NS Records to their own table
The provides part 1 of the Pools API changes discussed at the
mid cycle. Th majority of the remaining changes are new code/
objects rather than refactoring - so this change has been
split into it's own review.

Change-Id: I2291d76d36e8fcdeb8dffca855e7292d8cb22bfb
2015-03-20 12:05:05 +00:00
Tim Simmons 117a857e70 Don't allow updates to zones that are being deleted
*Disallows zone updates, record creates/updates/deletes to zones
that have an action of 'DELETE'
*Once someone hits delete on a zone, that should be it for that zone,
allowing updates could keep it alive in a broken state

Change-Id: If76de6dbc8c244552033256d8c758acda35526ea
Partial-Bug: 1434189
2015-03-19 21:35:31 +00:00
Endre Karlson d801098b0f Support secondary zones
Change-Id: If9fd6351087fcfd1873cb9adb2bcf753ce42700d
2015-03-16 21:26:15 +01:00
Jenkins 54726e9e36 Merge "Get on an abandon zone returns 405" 2015-02-18 16:53:04 +00:00
Vinod Mangalpally c4666a8cca Get on an abandon zone returns 405
Only a POST is valid on an abandon zone endpoint
(v2/zones/<zone_id>/tasks/abandon). All the other
operations including a get return 405

Change-Id: I0a812ad96b3c0da133dc506d2c4df7557bc3d5fd
Closes-Bug: 1421416
2015-02-17 10:42:36 -06:00
Vinod Mangalpally 2dac606a3a Deleting a recordset returns 202
* Update the recordset's status correctly before deleting it.
* Deleting a zone now returns 202 with the zone, showing
the status and action
* Deleting a recordset now returns 202 with the recordset,
showing the status and action

One issue still remains (needs a different fix):
Deleting a recordset without any records returns 202,
but the recordset returned shows a status of 'ACTIVE'
and not 'PENDING'. This is because recordset does
not have a status field.

Change-Id: Id7bf645adbbf8eadc509781a4ab16bef51f0536f
Closes-Bug: 1420359
2015-02-16 14:43:16 -06:00
Vinod Mangalpally c3afc3f4bb Add a new API for abandoning a zone from storage
Add a new API for abandoning of zones from storage.
The new API would be v2/zones/<zone_id>/tasks/abandon
Only POST would be allowed on this API.
This just removes it from storage and does not take
any action on the backends.
Recordsets would not have this feature. By default this is
restricted by policy to admins.

Deleting a zone returns 202. Abandoning returns 204.
Zone now displays action too.

Change-Id: I213b567d1b609670b7c659f6e9780bdac240c89b
Closes-Bug: 1413024
2015-01-28 13:39:31 -06:00
Endre Karlson 7eefb71b8b Switch to oslo.log
Change-Id: I08386ed2c8a2d9e16c57776413a612b8bf8323f7
2015-01-21 21:39:16 +01:00
Betsy Luzader 3ab3853c2f Migrate Server table
This migrates the data in the server table to
  the pool_attributes table. In addition, this
  makes all the changes for the code to use the
  nameserver pool_attribute in the default pool
  instead of a server.

  Paritally-implements: blueprint server-pools-storage

  What's left to do:
  - Remove the old server table and rest of the
    server api code

Change-Id: I7e93ab53966cf71d7c8ced38fce55f76aec12e71
2015-01-08 08:33:31 -06:00
rjrjr 4e75f5b54c Pool Manager Integration with Central
Full integration of Pool Manager with Central (no longer using the proxy
backend driver.)

This patch fixes:

- Fix concurrent requests that cause lockup issue (bug #1392762)
- Fixed bug where creating a domain fails the first time in mdns
- Fixed bug where records in recordsets do not have the correct
  status/action/serial
- Changed 'ADD' to 'CREATE' for ACTION column
- Ported Fake backend to pools
- Removed transitional pool_manager_proxy backend

Change-Id: Icb40448f760ff2a573d08a04bb4dec1f550119bb
Closes-Bug: 1392762
2014-12-15 18:48:51 +00:00
Jordan Cazamias 778bd9dd4b Add metadata, totalcount fields to zones/recordsets collections
*Adds a metadata field to API calls if there is metadata
*Adds objects.base.PagedListObjectMixin to hold metadata fields
*Adds a count_x call to domains/recordsets _find_x to get data
*Unit tests for metadata/total_count

Change-Id: I6929e933afad1570603e9276ccf33cf45bb349d3
Implements: blueprint zones-and-record-totalcount
2014-12-01 21:33:08 +00:00
Betsy Luzader fdb9611824 Expose SOA and NS records
Designate currently generates and hides
each zones NS and SOA records, this
can be confusing for users who expect all
records to be visible in the API.

Change-Id: Ib23f3eb0ae196553c92a28b054ec3cc63333ecef
Implements:blueprint expose-soa-ns
2014-08-30 11:05:27 -05:00
Vinod Mangalpally 3ceb1111a3 Specify minimum and maximum correctly in schemas
The v2 schemas specify min and max.  Changed this to minimum and
maximum as required by the validators.
readOnly does not seem to be validated.  But I changed some of the
places in v2 to be consistent across v2.

Change-Id: Ica9b5dfe6860640ab8a2ef6978fb6d1eec1a1d25
Closes-Bug: 1334933
2014-06-27 11:09:56 -05:00
Jordan Cazamias 50295fb39e Fix style errors H305 and H307
H305: Imports not grouped correctly
H307: Like imports should be grouped together

Change-Id: Ic63d253e015298c7b952121a4b3634d2b1bdaf92
Implements: blueprint new-hacking-style-rules
2014-06-18 17:35:43 -05:00
Endre Karlson 0d3a4427d9 Switch to oslo.messaging
Change-Id: Ie223ca4c6384902ec006380c68911f57d0ed501e
2014-04-10 13:16:26 +02:00
Vinod Mangalpally a19e434cba Ensure that request body in v2 contains valid fields
Currently 'id' and other fields like 'created_at' and 'updated_at' can
be set in the request body.  Some of these fields are ignored and
some like 'id' can actual set the id.
With this change - remove 'id' from the list of valid keys and ensure
that only valid keys are present in the request body.
Closes-Bug: #1291518

Change-Id: I99f3f106c0004fa5521869e46da85f1053241eb5
2014-03-12 17:11:35 -05:00
Vinod Mangalpally 2d1babed86 Ensure that URL is valid while validating UUID
utils.validate_uuid() assumes that any URL after a valid first level
(like zones) is correct.  Consequently it calls the function with
incorrect number of arguments.
We now check that the URL is correct by validating the number of
arguments the function expects against the number of arguments provided.

Get, patch and delete go through this code and return a 404.  For the
same URL, POST however returns a 405.  The 405 is returned by Pecan.

Change-Id: I004c8af2ae0af3c8467f4140c5855ea75966d0e7
Closes-Bug: 1288834
2014-03-06 14:13:02 -06:00
Endre Karlson 2636e2c5cd Ensure that wanted API calls returns exceptions
* Previous checks only checked status and not content.
* One method to use across all V2 tests.
* Switch existing _assert_* methods to use this.

Closes-Bug: #1283527

Change-Id: If49460965b08789286df4287862a0c96d2d8b44d
2014-03-03 18:43:07 +00:00
Endre Karlson 20bef4e133 UUID changes to api / utils
* Remove uuidutils as noted and move the is_valid_like into designate.utils.
* Add UUID validation to the V2 API endpoints

Closes-Bug: #1282672

Change-Id: Ib30a4c2657323145c8500fae503f75871281675f
2014-03-03 19:42:32 +01:00