From c628bc1992f81df983e74dd137450d5470b7fa71 Mon Sep 17 00:00:00 2001 From: Erik Reid <erik.reid@geant.org> Date: Mon, 11 Feb 2019 16:10:30 +0100 Subject: [PATCH] removed routes for returning router addresses --- inventory_provider/routes/classifier.py | 30 --------------- test/test_classifier_routes.py | 49 ------------------------- 2 files changed, 79 deletions(-) diff --git a/inventory_provider/routes/classifier.py b/inventory_provider/routes/classifier.py index 43c8b35a..51d41131 100644 --- a/inventory_provider/routes/classifier.py +++ b/inventory_provider/routes/classifier.py @@ -7,36 +7,6 @@ from inventory_provider.routes import common routes = Blueprint("inventory-data-classifier-support-routes", __name__) -@routes.route("/infinera-dna-addresses", methods=['GET', 'POST']) -@common.require_accepts_json -def infinera_addresses(): - infinera_config = current_app.config[ - "INVENTORY_PROVIDER_CONFIG"]["infinera-dna"] - return jsonify([dna['address'] for dna in infinera_config]) - - -@routes.route("/coriant-tnms-addresses", methods=['GET', 'POST']) -@common.require_accepts_json -def coriant_addresses(): - coriant_config = current_app.config[ - "INVENTORY_PROVIDER_CONFIG"]["coriant-tnms"] - return jsonify([tnms['address'] for tnms in coriant_config]) - - -@routes.route("/juniper-server-addresses", methods=['GET', 'POST']) -@common.require_accepts_json -def juniper_addresses(): - # TODO: this route (and corant, infinera routes) can be removed - r = common.get_redis() - routers = [] - for k in r.keys('junosspace:*'): - info = r.get(k.decode('utf-8')) - assert info # sanity: value shouldn't be empty - info = json.loads(info.decode('utf-8')) - routers.append(info['address']) - return jsonify(routers) - - @routes.route("/trap-metadata/<source_equipment>/<path:interface>", methods=['GET', 'POST']) @common.require_accepts_json diff --git a/test/test_classifier_routes.py b/test/test_classifier_routes.py index 7ea6f6c8..6b68221d 100644 --- a/test/test_classifier_routes.py +++ b/test/test_classifier_routes.py @@ -7,55 +7,6 @@ DEFAULT_REQUEST_HEADERS = { } -def test_infinera_addresses(client): - response_schema = { - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "array", - "items": {"type": "string"} - } - - rv = client.post( - "/classifier/infinera-dna-addresses", - headers=DEFAULT_REQUEST_HEADERS) - assert rv.status_code == 200 - jsonschema.validate( - json.loads(rv.data.decode("utf-8")), - response_schema) - - -def test_coriant_addresses(client): - response_schema = { - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "array", - "items": {"type": "string"} - } - - rv = client.post( - "/classifier/coriant-tnms-addresses", - headers=DEFAULT_REQUEST_HEADERS) - assert rv.status_code == 200 - jsonschema.validate( - json.loads(rv.data.decode("utf-8")), - response_schema) - - -def test_juniper_addresses(mocker, client): - - response_schema = { - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "array", - "items": {"type": "string"} - } - - rv = client.post( - "/classifier/juniper-server-addresses", - headers=DEFAULT_REQUEST_HEADERS) - assert rv.status_code == 200 - response_data = json.loads(rv.data.decode('utf-8')) - jsonschema.validate(response_data, response_schema) - assert len(response_data) > 0 # test data is not empty - - def test_trap_metadata(client_with_mocked_data): response_schema = { "$schema": "http://json-schema.org/draft-07/schema#", -- GitLab