Change POST nodefilter Input

- Changed the expected input from site_design to design_ref.
- Converts the design_ref json/dict into a SiteDesign object.

Change-Id: Ie1f6738fec64749cde9d2843d9373175006794c0
This commit is contained in:
Aaron Sheffield 2018-05-08 10:32:26 -05:00
parent d052664f74
commit 8af92eaf29
4 changed files with 10 additions and 9 deletions

View File

@ -54,8 +54,8 @@ nodefilter API
POST nodefilter
^^^^^^^^^^^^^^^
The Nodes API will provide a list of node names based on site_design. This API
requires site_design in the POST body with an optional node_filter to return the node
The Nodes API will provide a list of node names based on design_ref. This API
requires design_ref in the POST body with an optional node_filter to return the node
names.
bootdata

View File

@ -102,15 +102,16 @@ class NodeFilterResource(StatefulResource):
try:
json_data = self.req_json(req)
node_filter = json_data.get('node_filter', None)
site_design = json_data.get('site_design', None)
if site_design is None:
self.info(req.context, 'Missing required input value: site_design')
design_ref = json_data.get('design_ref', None)
if design_ref is None:
self.info(req.context, 'Missing required input value: design_ref')
self.return_error(
resp,
falcon.HTTP_400,
message='Missing input required value: site_design',
message='Missing input required value: design_ref',
retry=False)
return
_, site_design = self.orchestrator.get_effective_site(design_ref)
nodes = self.orchestrator.process_node_filter(node_filter=node_filter,
site_design=site_design)
resp_list = [n.name for n in nodes if nodes]

View File

@ -44,12 +44,12 @@ class DrydockClient(object):
:param SiteDesign design_ref: A SiteDesign object.
:param NodeFilter node_filter (optional): A NodeFilter object.
:return: A list of node names based on the node_filter and site_design.
:return: A list of node names based on the node_filter and design_ref.
"""
endpoint = 'v1.0/nodefilter'
body = {
'node_filter': node_filter,
'site_design': design_ref
'design_ref': design_ref
}
resp = self.session.post(endpoint, data=body)

View File

@ -38,7 +38,7 @@ class TestNodesApiUnit(object):
hdr = self.get_standard_header()
body = {
'node_filter': 'filters',
'site_design': design_ref,
'design_ref': design_ref,
}
result = falcontest.simulate_post(