Skip to content
Snippets Groups Projects
Verified Commit 5331a499 authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

make proxy more generic

parent 690ef195
No related branches found
No related tags found
1 merge request!12Add sites, and add integration of IPtrunks and routers with LSO deployment
......@@ -16,7 +16,7 @@ from gso.products.product_types.device import DeviceProvisioning
logger = logging.getLogger(__name__)
def _send_request(parameters: dict, process_id: UUIDstr):
def _send_request(endpoint: str, parameters: dict, process_id: UUIDstr):
oss = settings.load_oss_params()
pp_params = oss.PROVISIONING_PROXY
assert pp_params
......@@ -28,23 +28,30 @@ def _send_request(parameters: dict, process_id: UUIDstr):
parameters.update({'callback': callback_url})
post_request = requests.post(
f'{pp_params.scheme}://{pp_params.api_base}/api/device',
f'{pp_params.scheme}://{pp_params.api_base}/api/{endpoint}',
json=parameters)
if post_request.status_code != 200:
raise AssertionError(post_request.text)
def provision_service(
def _provision_service(
endpoint: str,
subscription: SubscriptionModel,
process_id: UUIDstr,
dry_run: bool = True):
dry_run: bool):
parameters = {
'dry_run': dry_run,
'subscription': json.loads(json_dumps(subscription))
}
_send_request(parameters, process_id)
_send_request(endpoint, parameters, process_id)
def provision_device(subscription: SubscriptionModel,
process_id: UUIDstr,
dry_run: bool = True):
_provision_service('device', subscription, process_id, dry_run)
@inputstep('Await provisioning proxy results', assignee=Assignee('SYSTEM'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment