-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RE-211 - Update IPAM #18
Conversation
- Extend basic to accept params (to match interface with requests and twisted) - Extend all three transports to accept 2xx - Extend all three transports to accept empty responses - Update Scopegroups object with updted API - Add Scopes and Reservations - Add high level helpers for Scopes and Reservations - Remove loadScopeGroupbyName - Rename loadScopeGroupbyID to loadScopeGroup - Add Address.reserve and Scopegroup.reserve - Add Scopegroup.reservations - Add Scope and Reservation - Add tests for Scopes and Reservations - Update tests for Scopegroups
- Updated dhcp_option functions - Add tests for options and scopes - Remove hardcoded test value
- Remove loadScopeGroupbyName - Add createReservation, loadReservation, createScope and loadScope - Add Scopes.retrieve - Add test for Scopes.retrieve - Make Scopes.create actually return data - Add Scopegroup.scope and Scopegroups.create_scope - Add Scope object - Use scopegroup instead of scope_group
@@ -299,27 +299,16 @@ def createAddress(self, prefix, type, network_id, callback=None, errback=None, * | |||
address = ns1.ipam.Address(self.config, prefix=prefix, type=type, network=network) | |||
return address.create(callback=callback, errback=errback, **kwargs) | |||
|
|||
def loadScopeGroupbyID(self, id, callback=None, errback=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to loadScopeGroup
|
||
:param int id: id of an existing ScopeGroup | ||
""" | ||
import ns1.ipam | ||
scope_group = ns1.ipam.Scopegroup(self.config, id=id) | ||
return scope_group.load(callback=callback, errback=errback) | ||
|
||
def loadScopeGroupbyName(self, name, service_group_id, callback=None, errback=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed, this is no longer consistent since name is not globally unique and service group ID is not returned.
@@ -347,14 +365,7 @@ def success(result, *args): | |||
return self | |||
|
|||
if self.id is None: | |||
if self.dhcp4 is None or self.dhcp6 is None or self.name is None or self.service_group_id is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed possibility of searching by name, ID is the only viable search criteria.
resp, | ||
body) | ||
# TODO make sure json is valid if there is a body | ||
if body: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required to allow 204
status code
@@ -26,7 +26,7 @@ def __init__(self, config): | |||
TransportBase.__init__(self, config, self.__module__) | |||
self._timeout = self._config.get('timeout', socket._GLOBAL_DEFAULT_TIMEOUT) | |||
|
|||
def send(self, method, url, headers=None, data=None, files=None, | |||
def send(self, method, url, headers=None, data=None, files=None, params=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required to make basic match requests and twisted interfaces
@@ -37,7 +37,8 @@ def send(self, method, url, headers=None, data=None, params=None, files=None, | |||
self._logHeaders(headers) | |||
resp = self.REQ_MAP[method](url, headers=headers, verify=self._verify, | |||
data=data, files=files, params=params, timeout=self._timeout) | |||
if resp.status_code != 200: | |||
|
|||
if resp.status_code < 200 or resp.status_code >= 300: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow 2xx
resp.text) | ||
|
||
# TODO make sure json is valid if a body is returned | ||
if resp.text: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required to allow 204
@@ -110,7 +110,7 @@ def _onBody(self, body, response, user_callback, data, headers): | |||
response.request.absoluteURI, | |||
response.code, | |||
data)) | |||
if response.code != 200: | |||
if response.code < 200 or response.code >= 300: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow 2xx
response, | ||
body) | ||
|
||
if body: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required to allow 204
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is 🔥, loving the test coverage. LGTM
Add Scopes, Scope, tests and top level helpers
Add Reservations, Reservation, tests and top level helpers
Add DHCP Option manipulators to Addresses (and tests)
Added create_scope, scopes, reserve and reservations to Scopegroups
Added reserve to Address
Use new API routes and update tests
Allow 204 responses for all transport options