diff --git a/sdx_controller/app.py b/sdx_controller/app.py index 87df16d..c93d4b9 100644 --- a/sdx_controller/app.py +++ b/sdx_controller/app.py @@ -26,7 +26,7 @@ @app.route("/", methods=["GET"]) def index(): - return redirect("/SDX-Controller/1.0.0/ui/") + return redirect("/SDX-Controller/ui/") @atexit.register diff --git a/sdx_controller/swagger/swagger.yaml b/sdx_controller/swagger/swagger.yaml index e186240..671dd2a 100644 --- a/sdx_controller/swagger/swagger.yaml +++ b/sdx_controller/swagger/swagger.yaml @@ -17,7 +17,7 @@ externalDocs: description: Find out more about Swagger url: http://swagger.io servers: -- url: https://virtserver.swaggerhub.com/SDX-Controller/1.0.0 +- url: https://virtserver.swaggerhub.com/SDX-Controller/ description: SwaggerHub API Auto Mocking - url: https://0.0.0.0:8080/v2 description: Localhost @@ -133,7 +133,7 @@ paths: "404": description: Link not found x-openapi-router-controller: sdx_controller.controllers.link_controller - /l2vpn: + /l2vpn/1.0: get: tags: - l2vpn @@ -178,7 +178,7 @@ paths: "400": description: Invalid Connection x-openapi-router-controller: sdx_controller.controllers.l2vpn_controller - /l2vpn/{service_id}: + /l2vpn/1.0/{service_id}: get: tags: - l2vpn diff --git a/sdx_controller/test/test_l2vpn_controller.py b/sdx_controller/test/test_l2vpn_controller.py index 1daf30d..97b565b 100644 --- a/sdx_controller/test/test_l2vpn_controller.py +++ b/sdx_controller/test/test_l2vpn_controller.py @@ -14,7 +14,7 @@ from sdx_controller.models.l2vpn_body import L2vpnBody # noqa: E501 from sdx_controller.test import BaseTestCase, TestData -BASE_PATH = "/SDX-Controller/1.0.0" +BASE_PATH = "/SDX-Controller" class TestL2vpnController(BaseTestCase): @@ -28,7 +28,7 @@ def test_delete_connection_no_setup(self): """ connection_id = 2 response = self.client.open( - f"{BASE_PATH}/l2vpn/{connection_id}", + f"{BASE_PATH}/l2vpn/1.0/{connection_id}", method="DELETE", ) self.assert404(response, f"Response body is : {response.data.decode('utf-8')}") @@ -53,7 +53,7 @@ def test_delete_connection_with_setup(self): Test case for delete_connection() Set up a connection request, get the connection ID from the - response, and then do `DELETE /l2vpn/:connection_id` + response, and then do `DELETE /l2vpn/1.0/:connection_id` """ # set up temanager connection first self.__add_the_three_topologies() @@ -61,7 +61,7 @@ def test_delete_connection_with_setup(self): request_body = TestData.CONNECTION_REQ.read_text() connection_response = self.client.open( - f"{BASE_PATH}/l2vpn", + f"{BASE_PATH}/l2vpn/1.0", method="POST", data=request_body, content_type="application/json", @@ -75,7 +75,7 @@ def test_delete_connection_with_setup(self): print(f"Deleting request_id: {connection_id}") delete_response = self.client.open( - f"{BASE_PATH}/l2vpn/{connection_id}", + f"{BASE_PATH}/l2vpn/1.0/{connection_id}", method="DELETE", ) @@ -92,7 +92,7 @@ def test_getconnection_by_id(self): """ connection_id = 10 response = self.client.open( - f"{BASE_PATH}/l2vpn/{connection_id}", + f"{BASE_PATH}/l2vpn/1.0/{connection_id}", method="GET", ) @@ -110,7 +110,7 @@ def test_place_connection_no_topology(self): body = Connection() response = self.client.open( - f"{BASE_PATH}/l2vpn", + f"{BASE_PATH}/l2vpn/1.0", method="POST", data=json.dumps(body), content_type="application/json", @@ -131,7 +131,7 @@ def test_place_connection_v2_no_topology(self): body = ConnectionV2() response = self.client.open( - f"{BASE_PATH}/l2vpn", + f"{BASE_PATH}/l2vpn/1.0", method="POST", data=json.dumps(body), content_type="application/json", @@ -153,7 +153,7 @@ def __test_with_one_topology(self, topology_file): request = TestData.CONNECTION_REQ.read_text() response = self.client.open( - f"{BASE_PATH}/l2vpn", + f"{BASE_PATH}/l2vpn/1.0", method="POST", data=request, content_type="application/json", @@ -195,7 +195,7 @@ def test_place_connection_no_id(self): print(f"request: {request} {type(request)}") response = self.client.open( - f"{BASE_PATH}/l2vpn", + f"{BASE_PATH}/l2vpn/1.0", method="POST", data=request, content_type="application/json", @@ -232,7 +232,7 @@ def test_place_connection_with_three_topologies(self): request = TestData.CONNECTION_REQ.read_text() response = self.client.open( - f"{BASE_PATH}/l2vpn", + f"{BASE_PATH}/l2vpn/1.0", method="POST", data=request, content_type="application/json", @@ -265,7 +265,7 @@ def test_place_connection_with_three_topologies_added_in_sequence(self): request = TestData.CONNECTION_REQ.read_text() response = self.client.open( - f"{BASE_PATH}/l2vpn", + f"{BASE_PATH}/l2vpn/1.0", method="POST", data=request, content_type="application/json", @@ -303,7 +303,7 @@ def test_place_connection_v2_with_three_topologies_400_response(self): print(f"new_request: {new_request}") response = self.client.open( - f"{BASE_PATH}/l2vpn", + f"{BASE_PATH}/l2vpn/1.0", method="POST", data=new_request, content_type="application/json", @@ -346,7 +346,7 @@ def test_place_connection_v2_with_three_topologies_200_response(self): print(f"new_request: {new_request}") response = self.client.open( - f"{BASE_PATH}/l2vpn", + f"{BASE_PATH}/l2vpn/1.0", method="POST", data=new_request, content_type="application/json", @@ -378,7 +378,7 @@ def test_z100_getconnection_by_id_expect_404(self): # Generate a random ID. connection_id = uuid.uuid4() response = self.client.open( - f"{BASE_PATH}/l2vpn/{connection_id}", + f"{BASE_PATH}/l2vpn/1.0/{connection_id}", method="GET", ) @@ -396,7 +396,7 @@ def test_z100_getconnection_by_id_expect_200(self): request_body = TestData.CONNECTION_REQ.read_text() post_response = self.client.open( - f"{BASE_PATH}/l2vpn", + f"{BASE_PATH}/l2vpn/1.0", method="POST", data=request_body, content_type="application/json", @@ -409,9 +409,9 @@ def test_z100_getconnection_by_id_expect_200(self): connection_id = post_response.get_json().get("service_id") print(f"Got connection_id: {connection_id}") - # Now try `GET /l2vpn/{connection_id}` + # Now try `GET /l2vpn/1.0/{connection_id}` get_response = self.client.open( - f"{BASE_PATH}/l2vpn/{connection_id}", + f"{BASE_PATH}/l2vpn/1.0/{connection_id}", method="GET", ) @@ -424,7 +424,7 @@ def test_z105_getconnections_fail(self, mock_get_all_entries): """Test case for getconnections.""" mock_get_all_entries.return_value = {} response = self.client.open( - f"{BASE_PATH}/l2vpn", + f"{BASE_PATH}/l2vpn/1.0", method="GET", ) self.assertStatus(response, 404) @@ -432,7 +432,7 @@ def test_z105_getconnections_fail(self, mock_get_all_entries): def test_z105_getconnections_success(self): """Test case for getconnections.""" response = self.client.open( - f"{BASE_PATH}/l2vpn", + f"{BASE_PATH}/l2vpn/1.0", method="GET", ) diff --git a/sdx_controller/test/test_link_controller.py b/sdx_controller/test/test_link_controller.py index b1621eb..88335e0 100644 --- a/sdx_controller/test/test_link_controller.py +++ b/sdx_controller/test/test_link_controller.py @@ -13,7 +13,7 @@ def test_get_link(self): get an existing link """ - response = self.client.open("/SDX-Controller/1.0.0/link", method="GET") + response = self.client.open("/SDX-Controller/link", method="GET") self.assert200(response, "Response body is : " + response.data.decode("utf-8")) diff --git a/sdx_controller/test/test_node_controller.py b/sdx_controller/test/test_node_controller.py index d9597b4..c94a805 100644 --- a/sdx_controller/test/test_node_controller.py +++ b/sdx_controller/test/test_node_controller.py @@ -13,7 +13,7 @@ def test_get_node(self): get an existing node """ - response = self.client.open("/SDX-Controller/1.0.0/node", method="GET") + response = self.client.open("/SDX-Controller/node", method="GET") self.assert200(response, "Response body is : " + response.data.decode("utf-8")) diff --git a/sdx_controller/test/test_topology_controller.py b/sdx_controller/test/test_topology_controller.py index d2c5986..265f607 100644 --- a/sdx_controller/test/test_topology_controller.py +++ b/sdx_controller/test/test_topology_controller.py @@ -13,7 +13,7 @@ def test_get_topology(self): get an existing topology """ - response = self.client.open("/SDX-Controller/1.0.0/topology", method="GET") + response = self.client.open("/SDX-Controller/topology", method="GET") # There's nothing corresponding to `latest_topo` in DB at this # point, so we get a 204 No Content response. We should # probably get a 404 Not Found response though. See @@ -27,7 +27,7 @@ def test_get_topologyby_version(self): """ query_string = [("topology_id", 789)] response = self.client.open( - "/SDX-Controller/1.0.0/topology/{version}".format(version=789), + "/SDX-Controller/topology/{version}".format(version=789), method="GET", query_string=query_string, ) @@ -41,7 +41,7 @@ def test_topology_version(self): """ query_string = [("topology_id", "test:topology:test_topology.net")] response = self.client.open( - "/SDX-Controller/1.0.0/topology/version", + "/SDX-Controller/topology/version", method="GET", query_string=query_string, ) diff --git a/sdx_controller/test/test_user_controller.py b/sdx_controller/test/test_user_controller.py index 4b1d81b..456a798 100644 --- a/sdx_controller/test/test_user_controller.py +++ b/sdx_controller/test/test_user_controller.py @@ -18,7 +18,7 @@ def test_create_user(self): """ body = User() response = self.client.open( - "/SDX-Controller/1.0.0/user", + "/SDX-Controller/user", method="POST", data=json.dumps(body), content_type="application/json", @@ -32,7 +32,7 @@ def test_create_users_with_array_input(self): """ body = [User()] response = self.client.open( - "/SDX-Controller/1.0.0/user/createWithArray", + "/SDX-Controller/user/createWithArray", method="POST", data=json.dumps(body), content_type="application/json", @@ -46,7 +46,7 @@ def test_create_users_with_list_input(self): """ body = [User()] response = self.client.open( - "/SDX-Controller/1.0.0/user/createWithList", + "/SDX-Controller/user/createWithList", method="POST", data=json.dumps(body), content_type="application/json", @@ -59,7 +59,7 @@ def test_delete_user(self): Delete user """ response = self.client.open( - "/SDX-Controller/1.0.0/user/{username}".format(username="username_example"), + "/SDX-Controller/user/{username}".format(username="username_example"), method="DELETE", ) self.assert200(response, "Response body is : " + response.data.decode("utf-8")) @@ -70,7 +70,7 @@ def test_get_user_by_name(self): Get user by user name """ response = self.client.open( - "/SDX-Controller/1.0.0/user/{username}".format(username="username_example"), + "/SDX-Controller/user/{username}".format(username="username_example"), method="GET", ) self.assert200(response, "Response body is : " + response.data.decode("utf-8")) @@ -85,7 +85,7 @@ def test_login_user(self): ("password", "password_example"), ] response = self.client.open( - "/SDX-Controller/1.0.0/user/login", method="GET", query_string=query_string + "/SDX-Controller/user/login", method="GET", query_string=query_string ) self.assert200(response, "Response body is : " + response.data.decode("utf-8")) @@ -94,7 +94,7 @@ def test_logout_user(self): Logs out current logged in user session """ - response = self.client.open("/SDX-Controller/1.0.0/user/logout", method="GET") + response = self.client.open("/SDX-Controller/user/logout", method="GET") self.assert200(response, "Response body is : " + response.data.decode("utf-8")) def test_update_user(self): @@ -104,7 +104,7 @@ def test_update_user(self): """ body = User() response = self.client.open( - "/SDX-Controller/1.0.0/user/{username}".format(username="username_example"), + "/SDX-Controller/user/{username}".format(username="username_example"), method="PUT", data=json.dumps(body), content_type="application/json",