--- /dev/null
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Dave Tucker, Flavio Fernandes
+ */
+package org.opendaylight.ovsdb.openstack.netvirt;
+
+import org.opendaylight.controller.networkconfig.neutron.INeutronRouterAware;
+import org.opendaylight.controller.networkconfig.neutron.NeutronRouter;
+import org.opendaylight.controller.networkconfig.neutron.NeutronRouter_Interface;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
+import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.HttpURLConnection;
+
+/**
+ * Handle requests for Neutron Router.
+ */
+public class RouterHandler extends AbstractHandler
+ implements INeutronRouterAware {
+
+ /**
+ * Logger instance.
+ */
+ static final Logger logger = LoggerFactory.getLogger(RouterHandler.class);
+
+ private volatile OvsdbConfigurationService ovsdbConfigurationService;
+ private volatile OvsdbConnectionService connectionService;
+ private volatile OvsdbInventoryListener ovsdbInventoryListener;
+
+ /**
+ * Services provide this interface method to indicate if the specified router can be created
+ *
+ * @param router
+ * instance of proposed new Neutron Router object
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the create operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ @Override
+ public int canCreateRouter(NeutronRouter router) {
+ return HttpURLConnection.HTTP_OK;
+ }
+
+ /**
+ * Services provide this interface method for taking action after a router has been created
+ *
+ * @param router
+ * instance of new Neutron Router object
+ */
+ @Override
+ public void neutronRouterCreated(NeutronRouter router) {
+ logger.debug(" Router created {}, uuid {}", router.getName(), router.getRouterUUID());
+ }
+
+ /**
+ * Services provide this interface method to indicate if the specified router can be changed using the specified
+ * delta
+ *
+ * @param delta
+ * updates to the router object using patch semantics
+ * @param router
+ * instance of the Neutron Router object to be updated
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the update operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ @Override
+ public int canUpdateRouter(NeutronRouter delta, NeutronRouter original) {
+ return HttpURLConnection.HTTP_OK;
+ }
+
+ /**
+ * Services provide this interface method for taking action after a router has been updated
+ *
+ * @param router
+ * instance of modified Neutron Router object
+ */
+ @Override
+ public void neutronRouterUpdated(NeutronRouter router) {
+ logger.debug(" Router updated {}", router.getName());
+ }
+
+ /**
+ * Services provide this interface method to indicate if the specified router can be deleted
+ *
+ * @param router
+ * instance of the Neutron Router object to be deleted
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the delete operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ @Override
+ public int canDeleteRouter(NeutronRouter router) {
+ return HttpURLConnection.HTTP_OK;
+ }
+
+ /**
+ * Services provide this interface method for taking action after a router has been deleted
+ *
+ * @param router
+ * instance of deleted Router Network object
+ */
+ @Override
+ public void neutronRouterDeleted(NeutronRouter router) {
+ logger.debug(" Router deleted {}, uuid {}", router.getName(), router.getRouterUUID());
+ }
+
+ /**
+ * Services provide this interface method to indicate if the specified interface can be attached to the specified
+ * route
+ *
+ * @param router
+ * instance of the base Neutron Router object
+ * @param routerInterface
+ * instance of the NeutronRouter_Interface to be attached to the router
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the attach operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ @Override
+ public int canAttachInterface(NeutronRouter router, NeutronRouter_Interface routerInterface) {
+ logger.debug(" Router {} asked if it can attach interface {}. Subnet {}",
+ router.getName(),
+ routerInterface.getPortUUID(),
+ routerInterface.getSubnetUUID());
+ return HttpURLConnection.HTTP_OK;
+ }
+
+ /**
+ * Services provide this interface method for taking action after an interface has been added to a router
+ *
+ * @param router
+ * instance of the base Neutron Router object
+ * @param routerInterface
+ * instance of the NeutronRouter_Interface being attached to the router
+ */
+ @Override
+ public void neutronRouterInterfaceAttached(NeutronRouter router, NeutronRouter_Interface routerInterface) {
+ logger.debug(" Router {} interface {} attached. Subnet {}", router.getName(), routerInterface.getPortUUID(),
+ routerInterface.getSubnetUUID());
+ }
+
+ /**
+ * Services provide this interface method to indicate if the specified interface can be detached from the specified
+ * router
+ *
+ * @param router
+ * instance of the base Neutron Router object
+ * @param routerInterface
+ * instance of the NeutronRouter_Interface to be detached to the router
+ * @return integer
+ * the return value is understood to be a HTTP status code. A return value outside of 200 through 299
+ * results in the detach operation being interrupted and the returned status value reflected in the
+ * HTTP response.
+ */
+ @Override
+ public int canDetachInterface(NeutronRouter router, NeutronRouter_Interface routerInterface) {
+ logger.debug(" Router {} asked if it can detach interface {}. Subnet {}",
+ router.getName(),
+ routerInterface.getPortUUID(),
+ routerInterface.getSubnetUUID());
+
+ return HttpURLConnection.HTTP_OK;
+ }
+
+ /**
+ * Services provide this interface method for taking action after an interface has been removed from a router
+ *
+ * @param router
+ * instance of the base Neutron Router object
+ * @param routerInterface
+ * instance of the NeutronRouter_Interface being detached from the router
+ */
+ @Override
+ public void neutronRouterInterfaceDetached(NeutronRouter router, NeutronRouter_Interface routerInterface) {
+ logger.debug(" Router {} interface {} detached. Subnet {}", router.getName(), routerInterface.getPortUUID(),
+ routerInterface.getSubnetUUID());
+ }
+}
"9d37dcb1-e1e6-9fae-01ea-cc30aeb874a6",
"78eb34fc-1933-c019-bf7f-fdae9652f9cd",
"94c4ed8e-8e48-2384-38b0-5497fe05ba7a",
+ "83af7fdb-53b2-3818-006e-bb52b8304e6a",
"ef3c7339-ba4d-124d-7e1f-67d9ab638277"
],
"collection_name": "Neutron-v2.0-API-Examples",
"collection_id": "bd9b142f-e3ad-452d-f088-eed1b741b937"
+ },
+ {
+ "id": "f080abc2-2590-5b74-dd6d-3acc19090bce",
+ "name": "Neutron Router, CRUD",
+ "description": "",
+ "order": [
+ "a209e7b3-9d00-bd9a-b920-39fd577b52c6",
+ "828984bd-db02-aec4-d154-cd8e7f2b559b",
+ "ec4ca40c-be6e-d76b-81a3-8fd328180132",
+ "9e7c7b50-1580-c7e2-70a0-445b42e218b1",
+ "84b71139-7a9a-2f27-d0f6-745b8dbe876f",
+ "41940ad7-cec0-99c5-204a-eceab3aa7b78",
+ "e6b74bbb-cf2f-9eec-e530-537f1c065f8e",
+ "7370da7f-234e-3f7a-ed12-e384131d886d"
+ ],
+ "collection_name": "Neutron-v2.0-API-Examples",
+ "collection_id": "bd9b142f-e3ad-452d-f088-eed1b741b937"
}
],
"timestamp": 1394529177458,
"responses": [],
"synced": false
},
+ {
+ "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+ "id": "41940ad7-cec0-99c5-204a-eceab3aa7b78",
+ "name": "Delete Neutron Router ",
+ "description": "Delete Neutron Router",
+ "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/routers/8604a0de-7f6b-409a-a47c-a1cc7bc77b2e/",
+ "method": "DELETE",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+ "data": "",
+ "dataMode": "raw",
+ "timestamp": 0,
+ "version": 2,
+ "time": 1407866898433,
+ "synced": false
+ },
{
"id": "4ecb4af3-e10b-6710-bbcf-af2b80a8887f",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
"responses": [],
"synced": false
},
+ {
+ "id": "7370da7f-234e-3f7a-ed12-e384131d886d",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+ "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/routers/8604a0de-7f6b-409a-a47c-a1cc7bc77b2e/remove_router_interface",
+ "preRequestScript": "",
+ "pathVariables": {},
+ "method": "PUT",
+ "data": "{\n \"subnet_id\": \"3b80198d-4f7b-4f77-9ef5-774d54e17126\",\n \"port_id\": \"65c0ee9f-d634-4522-8954-51021b570b0d\"\n}",
+ "dataMode": "raw",
+ "version": 2,
+ "tests": "",
+ "time": 1407894647769,
+ "name": "Post Remove Neutron Router Interface",
+ "description": "Remove Neutron Router Interface",
+ "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+ "synced": false
+ },
{
"id": "747f9a54-e64f-57f6-ce6d-8ad358817696",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
{
"id": "78eb34fc-1933-c019-bf7f-fdae9652f9cd",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
- "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/ports/",
+ "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/subnets/",
+ "preRequestScript": "",
"pathVariables": {},
"method": "GET",
"data": [],
"dataMode": "params",
"version": 2,
"tests": "",
- "time": 1401139136358,
+ "time": 1407893656841,
"name": "Get Neutron Subnets",
"description": "Return a list of Neutron v2.0 API Subnets.",
"collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
"responses": [],
"synced": false
},
+ {
+ "id": "828984bd-db02-aec4-d154-cd8e7f2b559b",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+ "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/routers",
+ "preRequestScript": "",
+ "pathVariables": {},
+ "method": "POST",
+ "data": "{\n \"router\": {\n \"status\": \"ACTIVE\",\n \"external_gateway_info\": {\n \"network_id\": \"e9330b1f-a2ef-4160-a991-169e56ab17f6\"\n },\n \"name\": \"another_router\",\n \"admin_state_up\": true,\n \"tenant_id\": \"60cd4f6dbc5f499982a284e7b83b5be3\",\n \"id\": \"8604a0de-7f6b-409a-a47c-a1cc7bc77b2e\"\n }\n}",
+ "dataMode": "raw",
+ "version": 2,
+ "tests": "",
+ "time": 1407882177180,
+ "name": "Post Add Neutron Router",
+ "description": "Example posting of a Neutron v2.0 Neutron Router.",
+ "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+ "synced": false
+ },
+ {
+ "id": "83af7fdb-53b2-3818-006e-bb52b8304e6a",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+ "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/ports/65c0ee9f-d634-4522-8954-51021b570b0d",
+ "preRequestScript": "",
+ "pathVariables": {},
+ "method": "DELETE",
+ "data": "",
+ "dataMode": "raw",
+ "version": 2,
+ "tests": "",
+ "time": 1407893936097,
+ "name": "Post Delete Neutron Port",
+ "description": "Post a list of Neutron v2.0 Subnets",
+ "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+ "responses": [],
+ "synced": false
+ },
+ {
+ "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+ "id": "84b71139-7a9a-2f27-d0f6-745b8dbe876f",
+ "name": "Put Update Neutron Router ",
+ "description": "Update Neutron Router",
+ "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/routers/8604a0de-7f6b-409a-a47c-a1cc7bc77b2e/",
+ "method": "PUT",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+ "data": "{\n \"router\": {\n \"external_gateway_info\": {\n \"network_id\": \"e9330b1f-a2ef-4160-a991-169e56ab17f6\"\n },\n \"name\": \"another_router_renamed\",\n \"admin_state_up\": false\n }\n}",
+ "dataMode": "raw",
+ "timestamp": 0,
+ "version": 2,
+ "time": 1407866749069,
+ "synced": false
+ },
{
"id": "8c4d8a07-64c5-f821-4799-d528f01e88cc",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
"preRequestScript": "",
"pathVariables": {},
"method": "POST",
- "data": "{\n \"port\": {\n \"status\": \"DOWN\",\n \"binding:host_id\": \"\",\n \"name\": \"private-port\",\n \"allowed_address_pairs\": [\n ],\n \"admin_state_up\": true,\n \"network_id\": \"e9330b1f-a2ef-4160-a991-169e56ab17f5\",\n \"tenant_id\": \"d6700c0c9ffa4f1cb322cd4a1f3906fa\",\n \"binding:vif_details\": {\n },\n \"binding:vnic_type\": \"normal\",\n \"binding:vif_type\": \"unbound\",\n \"device_owner\": \"\",\n \"mac_address\": \"fa:16:3e:c9:cb:f0\",\n \"binding:profile\": {\n },\n \"fixed_ips\": [\n {\n \"subnet_id\": \"3b80198d-4f7b-4f77-9ef5-774d54e17126\",\n \"ip_address\": \"192.168.199.20\"\n }\n ],\n \"id\": \"65c0ee9f-d634-4522-8954-51021b570b0d\",\n \"security_groups\": [\n \"f0ac4394-7e4a-4409-9701-ba8be283dbc3\"\n ],\n \"device_id\": \"\"\n }\n}",
+ "data": "{\n \"port\": {\n \"status\": \"DOWN\",\n \"binding:host_id\": \"\",\n \"name\": \"private-port\",\n \"allowed_address_pairs\": [\n ],\n \"admin_state_up\": true,\n \"network_id\": \"e9330b1f-a2ef-4160-a991-169e56ab17f5\",\n \"tenant_id\": \"d6700c0c9ffa4f1cb322cd4a1f3906fa\",\n \"binding:vif_details\": {\n },\n \"binding:vnic_type\": \"normal\",\n \"binding:vif_type\": \"unbound\",\n \"mac_address\": \"fa:16:3e:c9:cb:f0\",\n \"binding:profile\": {\n },\n \"fixed_ips\": [\n {\n \"subnet_id\": \"3b80198d-4f7b-4f77-9ef5-774d54e17126\",\n \"ip_address\": \"192.168.199.1\"\n }\n ],\n \"id\": \"65c0ee9f-d634-4522-8954-51021b570b0d\",\n \"security_groups\": [\n \"f0ac4394-7e4a-4409-9701-ba8be283dbc3\"\n ]\n }\n}",
"dataMode": "raw",
"version": 2,
"tests": "",
- "time": 1407877834476,
+ "time": 1407897276098,
"name": "Post Add Neutron Ports",
"description": "Post a list of Neutron v2.0 Subnets",
"collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
"responses": [],
"synced": false
},
+ {
+ "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+ "id": "9e7c7b50-1580-c7e2-70a0-445b42e218b1",
+ "name": "Get Neutron Router",
+ "description": "Get Neutron Router, based on id",
+ "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/routers/8604a0de-7f6b-409a-a47c-a1cc7bc77b2e",
+ "method": "GET",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+ "data": "{\n \"router\": {\n \"status\": \"ACTIVE\",\n \"external_gateway_info\": {\n \"network_id\": \"e9330b1f-a2ef-4160-a991-169e56ab17f6\"\n },\n \"name\": \"another_router\",\n \"admin_state_up\": true,\n \"tenant_id\": \"60cd4f6dbc5f499982a284e7b83b5be3\",\n \"id\": \"8604a0de-7f6b-409a-a47c-a1cc7bc77b2e\"\n }\n}",
+ "dataMode": "raw",
+ "timestamp": 0,
+ "version": 2,
+ "time": 1407866340804,
+ "synced": false
+ },
{
"id": "9fe0d840-dcd3-6d3e-d410-e88538858e3a",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
"responses": [],
"synced": false
},
+ {
+ "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+ "id": "a209e7b3-9d00-bd9a-b920-39fd577b52c6",
+ "name": "Post Add Neutron External Network",
+ "description": "Post add Neutron v2.0 External Network",
+ "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/networks/",
+ "method": "POST",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+ "data": "{\n \"networks\":[\n {\n \"status\":\"ACTIVE\",\n \"subnets\":[\n ],\n \"name\":\"sample_network_90\",\n \"provider:physical_network\":null,\n \"admin_state_up\":false,\n \"tenant_id\":\"60cd4f6dbc5f499982a284e7b83b5be3\",\n \"provider:network_type\":\"local\",\n \"router:external\":true,\n \"shared\":false,\n \"id\":\"e9330b1f-a2ef-4160-a991-169e56ab17f6\",\n \"provider:segmentation_id\":90\n}\n ]\n}",
+ "dataMode": "raw",
+ "timestamp": 0,
+ "version": 2,
+ "time": 1407865757248,
+ "synced": false,
+ "isFromCollection": true,
+ "collectionRequestId": "cac027e1-bbc9-f147-5142-5b48a4f02863"
+ },
{
"id": "a483b6c9-2f07-f59e-effa-883591fee938",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
"responses": [],
"synced": false
},
+ {
+ "id": "e6b74bbb-cf2f-9eec-e530-537f1c065f8e",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+ "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/routers/8604a0de-7f6b-409a-a47c-a1cc7bc77b2e/add_router_interface",
+ "preRequestScript": "",
+ "pathVariables": {},
+ "method": "PUT",
+ "data": "{\n \"subnet_id\": \"3b80198d-4f7b-4f77-9ef5-774d54e17126\",\n \"port_id\": \"65c0ee9f-d634-4522-8954-51021b570b0d\"\n}",
+ "dataMode": "raw",
+ "version": 2,
+ "tests": "",
+ "time": 1407894571634,
+ "name": "Post Add Neutron Router Interface",
+ "description": "Add Neutron Router Interface",
+ "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+ "synced": false
+ },
{
"id": "eb1baf45-cdb2-7f50-a6aa-6fe934c1a355",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
"responses": [],
"synced": false
},
+ {
+ "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+ "id": "ec4ca40c-be6e-d76b-81a3-8fd328180132",
+ "name": "Get Neutron Routers",
+ "description": "Get Neutron Routers",
+ "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/routers",
+ "method": "GET",
+ "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+ "data": "{\n \"firewall\": {\n \"admin_state_up\": true,\n \"description\": \"Example Neutron v2.0 Firewall Creation\",\n \"firewall_policy_id\": \"c69933c1-b472-44f9-8226-30dc4ffd454c\",\n \"id\": \"3b0ef8f4-82c7-44d4-a4fb-6177f9a21977\",\n \"name\": \"Example FWaaS Firewall\",\n \"status\": \"PENDING_CREATE\",\n \"tenant_id\": \"45977fa2dbd7482098dd68d0d8970117\"\n }\n}",
+ "dataMode": "raw",
+ "timestamp": 0,
+ "version": 2,
+ "time": 1407854898874,
+ "synced": false
+ },
{
"id": "ed8face9-6585-8a9b-9e09-870e3a5e5546",
"headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",