[ONOS-7470] Add swagger API doc of openstack networking module
Change-Id: Iaf7e3f6f5df027897aed496ebbf58d21b6a915e3
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackFloatingIpWebResource.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackFloatingIpWebResource.java
index 0341aea..0132d35 100644
--- a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackFloatingIpWebResource.java
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackFloatingIpWebResource.java
@@ -66,6 +66,7 @@
* @param input floating ip JSON input stream
* @return 201 CREATED if the JSON is correct, 400 BAD_REQUEST if the JSON
* is invalid or duplicated floating ip already exists
+ * @onos.rsModel NeutronFloatingIp
*/
@POST
@Consumes(MediaType.APPLICATION_JSON)
@@ -90,6 +91,7 @@
* @param input floating ip JSON input stream
* @return 200 OK with the updated floating ip, 400 BAD_REQUEST if the requested
* floating ip does not exist
+ * @onos.rsModel NeutronFloatingIp
*/
@PUT
@Path("{id}")
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackNetworkWebResource.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackNetworkWebResource.java
index 1691234..6f0b4cf 100644
--- a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackNetworkWebResource.java
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackNetworkWebResource.java
@@ -65,6 +65,7 @@
* @param input network JSON input stream
* @return 201 CREATED if the JSON is correct, 400 BAD_REQUEST if the JSON
* is invalid or duplicated network already exists
+ * @onos.rsModel NeutronNetwork
*/
@POST
@Consumes(MediaType.APPLICATION_JSON)
@@ -89,6 +90,7 @@
* @param input network JSON input stream
* @return 200 OK with the updated network, 400 BAD_REQUEST if the requested
* network does not exist
+ * @onos.rsModel NeutronNetwork
*/
@PUT
@Path("{id}")
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackPortWebResource.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackPortWebResource.java
index a1c5e7c..e657d4b 100644
--- a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackPortWebResource.java
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackPortWebResource.java
@@ -65,6 +65,7 @@
* @param input port JSON input stream
* @return 201 CREATED if the JSON is correct, 400 BAD_REQUEST if the JSON
* is invalid or duplicated port already exists
+ * @onos.rsModel NeutronPort
*/
@POST
@Consumes(MediaType.APPLICATION_JSON)
@@ -88,6 +89,7 @@
* @param input port JSON input stream
* @return 200 OK with the updated port, 400 BAD_REQUEST if the requested
* port does not exist
+ * @onos.rsModel NeutronPort
*/
@PUT
@Path("{id}")
diff --git a/apps/openstacknetworking/src/main/resources/definitions/NeutronFloatingIp.json b/apps/openstacknetworking/src/main/resources/definitions/NeutronFloatingIp.json
new file mode 100644
index 0000000..7976ffe
--- /dev/null
+++ b/apps/openstacknetworking/src/main/resources/definitions/NeutronFloatingIp.json
@@ -0,0 +1,58 @@
+{
+ "type": "object",
+ "required": [
+ "floatingip"
+ ],
+ "properties": {
+ "floatingip": {
+ "type": "object",
+ "description": "A floatingip object.",
+ "required": [
+ "id",
+ "router_id",
+ "tenant_id",
+ "floating_network_id",
+ "floating_ip_address",
+ "fixed_ip_address",
+ "port_id"
+ ],
+ "properties": {
+ "id": {
+ "type": "string",
+ "example": "2f245a7b-796b-4f26-9cf9-9e82d248fda7",
+ "description": "The ID of the floating IP address."
+ },
+ "router_id": {
+ "type": "string",
+ "example": "d23abc8d-2991-4a55-ba98-2aaea84cc72",
+ "description": "The ID of the router for the floating IP."
+ },
+ "tenant_id": {
+ "type": "string",
+ "example": "4969c491a3c74ee4af974e6d800c62de",
+ "description": "The ID of the project."
+ },
+ "floating_network_id": {
+ "type": "string",
+ "example": "376da547-b977-4cfe-9cba-275c80debf57",
+ "description": "The ID of the network associated with the floating IP."
+ },
+ "floating_ip_address": {
+ "type": "string",
+ "example": "172.24.4.228",
+ "description": "The floating IP address."
+ },
+ "fixed_ip_address": {
+ "type": "string",
+ "example": "10.0.0.3",
+ "description": "The fixed IP address that is associated with the floating IP address."
+ },
+ "port_id": {
+ "type": "string",
+ "example": "ce705c24-c1ef-408a-bda3-7bbd946164ab",
+ "description": "The ID of a port associated with the floating IP."
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/openstacknetworking/src/main/resources/definitions/NeutronNetwork.json b/apps/openstacknetworking/src/main/resources/definitions/NeutronNetwork.json
new file mode 100644
index 0000000..ecc86d8
--- /dev/null
+++ b/apps/openstacknetworking/src/main/resources/definitions/NeutronNetwork.json
@@ -0,0 +1,86 @@
+
+{
+ "type": "object",
+ "required": [
+ "network"
+ ],
+ "properties": {
+ "network": {
+ "type": "object",
+ "description": "A network object.",
+ "required": [
+ "id",
+ "subnets",
+ "provider:physical_network",
+ "admin_state_up",
+ "tenant_id",
+ "provider:network_type",
+ "router:external",
+ "provider:segmentation_id",
+ "availability_zone_hints",
+ "availability_zones"
+ ],
+ "properties": {
+ "id": {
+ "type": "string",
+ "example": "396f12f8-521e-4b91-8e21-2e003500433a",
+ "description": "The ID of the network."
+ },
+ "subnets": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "example": "10.10.0.0/24",
+ "description": "The associated subnets."
+ }
+ },
+ "provider:physical_network": {
+ "type": "string",
+ "example": "physnet1",
+ "description": "The physical network where this network is implemented."
+ },
+ "admin_state_up": {
+ "type": "boolean",
+ "example": true,
+ "description": "The administrative state of the network, which is up (true) or down (false)."
+ },
+ "tenant_id": {
+ "type": "string",
+ "example": "20bd52ff3e1b40039c312395b04683cf",
+ "description": "The ID of the project."
+ },
+ "provider:network_type": {
+ "type": "string",
+ "example": "vlan",
+ "description": "The type of physical network that this network is mapped to."
+ },
+ "router:external": {
+ "type": "boolean",
+ "example": true,
+ "description": "Indicates whether the network has an external routing facility that’s not managed by the networking service."
+ },
+ "provider:segmentation_id": {
+ "type": "string",
+ "example": "1002",
+ "description": "The ID of the isolated segment on the physical network."
+ },
+ "availability_zone_hints": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "example": "1",
+ "description": "The availability zone candidate for the network."
+ }
+ },
+ "availability_zones": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "example": "nova",
+ "description": "The availability zone for the network."
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/apps/openstacknetworking/src/main/resources/definitions/NeutronPort.json b/apps/openstacknetworking/src/main/resources/definitions/NeutronPort.json
new file mode 100644
index 0000000..5a833bf
--- /dev/null
+++ b/apps/openstacknetworking/src/main/resources/definitions/NeutronPort.json
@@ -0,0 +1,190 @@
+{
+ "type": "object",
+ "required": [
+ "port"
+ ],
+ "properties": {
+ "port": {
+ "type": "object",
+ "description": "A port object.",
+ "required": [
+ "id",
+ "admin_state_up",
+ "device_id",
+ "device_owner",
+ "fixed_ips",
+ "allowed_address_pairs",
+ "mac_address",
+ "network_id",
+ "state",
+ "tenant_id",
+ "security_groups",
+ "extra_dhcp_opts",
+ "port_security_enabled",
+ "binding:host_id",
+ "binding:vif_type",
+ "binding:vif_details",
+ "binding:vnic_type",
+ "binding:profile"
+
+ ],
+ "properties": {
+ "id": {
+ "type": "string",
+ "example": "65c0ee9f-d634-4522-8954-51021b570b0d",
+ "description": "The ID of the resource."
+ },
+ "admin_state_up": {
+ "type": "boolean",
+ "example": true,
+ "description": "The administrative state of the resource, which is up (true) or down (false)."
+ },
+ "device_id": {
+ "type": "string",
+ "example": "1",
+ "description": "The ID of the device that uses this port. For example, a server instance or a logical router."
+ },
+ "device_owner": {
+ "type": "string",
+ "example": "compute:nova",
+ "description": "The entity type that uses this port. For example, compute:nova (server instance)."
+ },
+ "fixed_ips": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "title": "fixed_ips",
+ "description": "The IP addresses for the port. If the port has multiple IP addresses, this field has multiple entries.",
+ "required": [
+ "ip_address",
+ "subnet_id"
+ ],
+ "properties": {
+ "ip_address": {
+ "type": "string",
+ "example": "10.0.0.2",
+ "description": "The IP address of the port."
+ },
+ "subnet_id": {
+ "type": "string",
+ "example": "a0304c3a-4f08-4c43-88af-d796509c97d2",
+ "description": "The ID of the subnet."
+ }
+ }
+ }
+ },
+ "allowed_address_pairs": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "title": "allowed_address_pairs",
+ "description": "A set of zero or more allowed address pair objects each where address pair object contains an ip_address and mac_address.",
+ "required": [
+ "ip_address",
+ "mac_address"
+ ],
+ "properties": {
+ "ip_address": {
+ "type": "string",
+ "example": "12.12.11.12",
+ "description": "The IP address of the port."
+ },
+ "mac_address": {
+ "type": "string",
+ "example": "fa:14:2a:b3:cb:f0",
+ "description": "The MAC address of the port."
+ }
+ }
+ }
+ },
+ "mac_address": {
+ "type": "string",
+ "example": "fa:16:3e:c9:cb:f0",
+ "description": "The MAC address of the port."
+ },
+ "network_id": {
+ "type": "string",
+ "example": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
+ "description": "The ID of the attached network."
+ },
+ "status": {
+ "type": "string",
+ "example": "ACTIVE",
+ "description": "The port status. Values are ACTIVE, DOWN, BUILD and ERROR."
+ },
+ "tenant_id": {
+ "type": "string",
+ "example": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
+ "description": "The ID of the project."
+ },
+ "security_groups": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "example": "f0ac4394-7e4a-4409-9701-ba8be283dbc3",
+ "description": "The IDs of security groups applied to the port."
+ }
+ },
+ "extra_dhcp_opts": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "title": "extra_dhcp_opts",
+ "description": "A set of zero or more extra DHCP option pairs. An option pair consists of an option value and name.",
+ "required": [
+ "opt_value",
+ "opt_name"
+ ],
+ "properties": {
+ "opt_value": {
+ "type": "string",
+ "example": "pxelinux.0",
+ "description": "A value of option pair."
+ },
+ "opt_name": {
+ "type": "string",
+ "example": "bootfile-name",
+ "description": "A name of option pair."
+ }
+ }
+ }
+ },
+ "port_security_enabled": {
+ "type": "boolean",
+ "example": true,
+ "description": "The port security status. A valid value is enabled (true) or disabled (false)."
+ },
+ "binding:host_id": {
+ "type": "string",
+ "example": "4df8d9ff-6f6f-438f-90a1-ef660d4586ad",
+ "description": "The ID of the host where the port resides."
+ },
+ "binding:vif_type": {
+ "type": "string",
+ "example": "unbound",
+ "description": "The type of which mechanism is used for the port."
+ },
+ "binding:vif_details": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string",
+ "example": "",
+ "description": "A dictionary which contains additional information on the port."
+ }
+ },
+ "binding:vnic_type": {
+ "type": "string",
+ "example": "other",
+ "description": "The type of vNIC which this port should be attached to. This is used to determine which mechanism driver(s) to be used to bind the port."
+ },
+ "binding:profile": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string",
+ "description": "A dictionary that enables the application running on the specific host to pass and receive vif port information specific to the networking back-end."
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file