def del_openstack_deployment(deployment_id):
    delete_task(deployment_id)
    headers = {'content-type': 'application/json'}
    command = {}
    command["name"] = "openstack-" + deployment_id + "-policy"
    text, status_code = razor("/api/commands/delete-policy", "post", pay_load=json.dumps(command), headers=headers)
    command = {}
    command["name"] = "openstack-" + deployment_id + "-tag"
    text, status_code = razor("/api/commands/delete-tag", "post", pay_load=json.dumps(command), headers=headers)
    text, status_code = node_assigner("/deployment/%s" % deployment_id, "delete")
    text, status_code = process_controller("/openstack/deployments/%s" % deployment_id, "delete")

    nodes, status_info = razor("/api/collections/nodes", "get")
    nodes = nodes["items"]
    for node in nodes:
        node_name = node["name"]
        one_node_info, status_code = razor("/api/collections/nodes/%s" % (node_name), "get")

        if "metadata" in one_node_info and "deployment_name" in one_node_info["metadata"].keys() and one_node_info["metadata"]["deployment_name"] == deployment_id:
            command = {}
            command["node"] = one_node_info["name"]
            command["key"] = "deployment_name"
            text, status_code = razor("/api/commands/remove-node-metadata", "post", pay_load=json.dumps(command), headers=headers)
            command["key"] = "id_macaddress"
            text, status_code = razor("/api/commands/remove-node-metadata", "post", pay_load=json.dumps(command), headers=headers)
            command["key"] = "to_allocate_hostname"
            text, status_code = razor("/api/commands/remove-node-metadata", "post", pay_load=json.dumps(command), headers=headers)
            command["key"] = "to_allocate_ip"
            text, status_code = razor("/api/commands/remove-node-metadata", "post", pay_load=json.dumps(command), headers=headers)

    return "Deleted"
def __clear_task(server_id):
    delete_task(server_id)
    __clear_razor_policy(server_id)
    __clear_razor_tag(server_id)