[ONOS-7470] Add swagger API doc of openstack networking module #2

Change-Id: I494fc58d39822e17ef152fb0fcc3445bc4bfeb2e
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackRouterWebResource.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackRouterWebResource.java
index eff151d..5959101 100644
--- a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackRouterWebResource.java
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackRouterWebResource.java
@@ -68,6 +68,7 @@
      * @param input router JSON input stream
      * @return 201 CREATED if the JSON is correct, 400 BAD_REQUEST if the JSON
      * is invalid or duplicated router already exists
+     * @onos.rsModel NeutronRouter
      */
     @POST
     @Consumes(MediaType.APPLICATION_JSON)
@@ -92,6 +93,7 @@
      * @param input router JSON input stream
      * @return 200 OK with the updated router, 400 BAD_REQUEST if the requested
      * router does not exist
+     * @onos.rsModel NeutronRouter
      */
     @PUT
     @Path("{id}")
@@ -114,6 +116,7 @@
      * @param input router interface JSON input stream
      * @return 200 OK with the updated router interface, 400 BAD_REQUEST if the
      * requested router does not exist
+     * @onos.rsModel NeutronRouterInterface
      */
     @PUT
     @Path("{id}/add_router_interface")
@@ -135,6 +138,7 @@
      * @param input router interface JSON input stream
      * @return 200 OK with the updated router interface, 400 BAD_REQUEST if the
      * requested router does not exist
+     * @onos.rsModel NeutronRouterInterface
      */
     @PUT
     @Path("{id}/remove_router_interface")
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackSecurityGroupRuleWebResource.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackSecurityGroupRuleWebResource.java
index e778a4f..669a3ad 100644
--- a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackSecurityGroupRuleWebResource.java
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackSecurityGroupRuleWebResource.java
@@ -63,6 +63,7 @@
      * @param input security group 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 NeutronSecurityGroupRule
      */
     @POST
     @Consumes(MediaType.APPLICATION_JSON)
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackSecurityGroupWebResource.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackSecurityGroupWebResource.java
index 244b984..7ba4538 100644
--- a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackSecurityGroupWebResource.java
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackSecurityGroupWebResource.java
@@ -64,6 +64,7 @@
      * @param input security group 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 NeutronSecurityGroup
      */
     @POST
     @Consumes(MediaType.APPLICATION_JSON)
@@ -86,6 +87,7 @@
      * @param input security group 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 NeutronSecurityGroup
      */
     @PUT
     @Consumes(MediaType.APPLICATION_JSON)
diff --git a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackSubnetWebResource.java b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackSubnetWebResource.java
index a3e2368..fb6192c 100644
--- a/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackSubnetWebResource.java
+++ b/apps/openstacknetworking/src/main/java/org/onosproject/openstacknetworking/web/OpenstackSubnetWebResource.java
@@ -66,6 +66,7 @@
      * @param input subnet JSON input stream
      * @return 201 CREATED if the JSON is correct, 400 BAD_REQUEST if the JSON
      * is invalid or duplicated subnet already exists
+     * @onos.rsModel NeutronSubnet
      */
     @POST
     @Consumes(MediaType.APPLICATION_JSON)
@@ -90,6 +91,7 @@
      * @param input subnet JSON input stream
      * @return 200 OK with the updated subnet, 400 BAD_REQUEST if the requested
      * subnet does not exist
+     * @onos.rsModel NeutronSubnet
      */
     @PUT
     @Path("{id}")
diff --git a/apps/openstacknetworking/src/main/resources/definitions/NeutronRouter.json b/apps/openstacknetworking/src/main/resources/definitions/NeutronRouter.json
new file mode 100644
index 0000000..47d0f41
--- /dev/null
+++ b/apps/openstacknetworking/src/main/resources/definitions/NeutronRouter.json
@@ -0,0 +1,96 @@
+{
+  "type": "object",
+  "required": [
+    "router"
+  ],
+  "properties": {
+    "router": {
+      "type": "object",
+      "description": "A router object.",
+      "required": [
+        "id",
+        "name",
+        "status",
+        "external_gateway_info",
+        "admin_state_up",
+        "tenant_id",
+        "routes",
+        "distributed"
+      ],
+      "properties": {
+        "id": {
+          "type": "string",
+          "example": "f49a1319-423a-4ee6-ba54-1d95a4f6cc68",
+          "description": "The ID of the router."
+        },
+        "name": {
+          "type": "string",
+          "example": "router1",
+          "description": "Human-readable name of the resource."
+        },
+        "status": {
+          "type": "string",
+          "example": "ACTIVE",
+          "description": "The router status."
+        },
+        "external_gateway_info": {
+          "type": "object",
+          "description": "The external gateway information of the router.",
+          "required": [
+            "network_id",
+            "enable_snat"
+          ],
+          "properties": {
+            "network_id": {
+              "type": "string",
+              "example": "a87cc70a-3e15-4acf-8205-9b711a3531b7",
+              "description": "Network ID which the router gateway is connected to."
+            },
+            "enable_snat": {
+              "type": "boolean",
+              "example": false,
+              "description": "Enable Source NAT (SNAT) attribute. true means Network Address Translation (NAT) is enabled."
+            }
+          }
+        },
+        "admin_state_up": {
+          "type": "boolean",
+          "example": true,
+          "description": "The administrative state of the resource, which is up (true) or down (false)."
+        },
+        "tenant_id": {
+          "type": "string",
+          "example": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
+          "description": "The ID of the project."
+        },
+        "routes": {
+          "type": "array",
+          "description": "The extra routes configuration for L3 router. A list of dictionaries with destination and nexthop parameters.",
+          "items": {
+            "type": "object",
+            "title": "route",
+            "required": [
+              "destination",
+              "nexthop"
+            ],
+            "properties": {
+              "destination": {
+                "type": "string",
+                "description": "The destination CIDR."
+              },
+              "nexthop": {
+                "type": "string",
+                "description": "The IP address of the next hop for the corresponding destination."
+              }
+            }
+          }
+        },
+        "distributed": {
+          "type": "boolean",
+          "example": false,
+          "description": "true indicates a distributed router. It is available when dvr extension is enabled."
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/apps/openstacknetworking/src/main/resources/definitions/NeutronRouterInterface.json b/apps/openstacknetworking/src/main/resources/definitions/NeutronRouterInterface.json
new file mode 100644
index 0000000..59ae058
--- /dev/null
+++ b/apps/openstacknetworking/src/main/resources/definitions/NeutronRouterInterface.json
@@ -0,0 +1,32 @@
+{
+  "type": "object",
+  "description": "A router interface object.",
+  "required": [
+    "id",
+    "tenant_id",
+    "subnet_id",
+    "port_id"
+  ],
+  "properties": {
+    "id": {
+      "type": "string",
+      "example": "f49a1319-423a-4ee6-ba54-1d95a4f6cc68",
+      "description": "The ID of the router interface."
+    },
+    "tenant_id": {
+      "type": "string",
+      "example": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
+      "description": "The ID of the project."
+    },
+    "subnet_id": {
+      "type": "string",
+      "example": "a0304c3a-4f08-4c43-88af-d796509c97d2",
+      "description": "The subnet ID on which you want to create the floating IP."
+    },
+    "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/NeutronSecurityGroup.json b/apps/openstacknetworking/src/main/resources/definitions/NeutronSecurityGroup.json
new file mode 100644
index 0000000..6859b59
--- /dev/null
+++ b/apps/openstacknetworking/src/main/resources/definitions/NeutronSecurityGroup.json
@@ -0,0 +1,115 @@
+{
+  "type": "object",
+  "description": "A security_group object.",
+  "required": [
+    "security_group"
+  ],
+  "properties": {
+    "security_group": {
+      "type": "object",
+      "required": [
+        "id",
+        "tenant_id",
+        "description",
+        "name",
+        "security_group_rules"
+      ],
+      "properties": {
+        "id": {
+          "type": "string",
+          "example": "2076db17-a522-4506-91de-c6dd8e837028",
+          "description": "The ID of the security group."
+        },
+        "tenant_id": {
+          "type": "string",
+          "example": "e4f50856753b4dc6afee5fa6b9b6c550",
+          "description": "The ID of the project."
+        },
+        "description": {
+          "type": "string",
+          "example": "security group for webservers",
+          "description": "A human-readable description for the resource."
+        },
+        "name": {
+          "type": "string",
+          "example": "new-webservers",
+          "description": "Human-readable name of the resource."
+        },
+        "security_group_rules": {
+          "type": "array",
+          "description": "A list of security_group_rule objects.",
+          "items": {
+            "type": "object",
+            "description": "A security group rule object.",
+            "required": [
+              "id",
+              "tenant_id",
+              "security_group_id",
+              "direction",
+              "ethertype",
+              "port_range_max",
+              "port_range_min",
+              "protocol",
+              "remote_ip_prefix",
+              "remote_group_id"
+            ],
+            "properties": {
+              "id": {
+                "type": "string",
+                "example": "2bc0accf-312e-429a-956e-e4407625eb62",
+                "description": "The ID of this security group rule."
+              },
+              "tenant_id": {
+                "type": "string",
+                "example": "e4f50856753b4dc6afee5fa6b9b6c550",
+                "description": "The ID of the project."
+              },
+              "security_group_id": {
+                "type": "string",
+                "example": "a7734e61-b545-452d-a3cd-0189cbd9747a",
+                "description": "The security group ID to associate with this security group rule."
+              },
+              "direction": {
+                "type": "string",
+                "example": "ingress",
+                "description": "Ingress or egress, which is the direction in which the metering rule is applied."
+              },
+              "ethertype": {
+                "type": "string",
+                "example": "IPv4",
+                "description": "Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress or egress rules."
+              },
+              "port_range_max": {
+                "type": "integer",
+                "format": "int32",
+                "example": 80,
+                "description": "The maximum port number in the range that is matched by the security group rule."
+              },
+              "port_range_min": {
+                "type": "integer",
+                "format": "int32",
+                "example": 80,
+                "description": "The minimum port number in the range that is matched by the security group rule."
+              },
+              "protocol": {
+                "type": "string",
+                "example": "tcp",
+                "description": "The IP protocol can be represented by a string, an integer, or null."
+              },
+              "remote_ip_prefix": {
+                "type": "string",
+                "example": "",
+                "description": "The remote IP prefix to associate with this metering rule packet."
+              },
+              "remote_group_id": {
+                "type": "string",
+                "example": "85cc3048-abc3-43cc-89b3-377341426ac5",
+                "description": "The remote group UUID to associate with this security group rule."
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/apps/openstacknetworking/src/main/resources/definitions/NeutronSecurityGroupRule.json b/apps/openstacknetworking/src/main/resources/definitions/NeutronSecurityGroupRule.json
new file mode 100644
index 0000000..d68ea46
--- /dev/null
+++ b/apps/openstacknetworking/src/main/resources/definitions/NeutronSecurityGroupRule.json
@@ -0,0 +1,78 @@
+{
+  "type": "object",
+  "description": "",
+  "required": [
+    "security_group_rule"
+  ],
+  "properties": {
+    "security_group_rule": {
+      "type": "object",
+      "required": [
+        "id",
+        "tenant_id",
+        "security_group_id",
+        "direction",
+        "ethertype",
+        "port_range_max",
+        "port_range_min",
+        "protocol",
+        "remote_ip_prefix",
+        "remote_group_id"
+      ],
+      "properties": {
+        "id": {
+          "type": "string",
+          "example": "2bc0accf-312e-429a-956e-e4407625eb62",
+          "description": "The ID of this security group rule."
+        },
+        "tenant_id": {
+          "type": "string",
+          "example": "e4f50856753b4dc6afee5fa6b9b6c550",
+          "description": "The ID of the project."
+        },
+        "security_group_id": {
+          "type": "string",
+          "example": "a7734e61-b545-452d-a3cd-0189cbd9747a",
+          "description": "The security group ID to associate with this security group rule."
+        },
+        "direction": {
+          "type": "string",
+          "example": "ingress",
+          "description": "Ingress or egress, which is the direction in which the metering rule is applied."
+        },
+        "ethertype": {
+          "type": "string",
+          "example": "IPv4",
+          "description": "Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress or egress rules."
+        },
+        "port_range_max": {
+          "type": "integer",
+          "format": "int32",
+          "example": 80,
+          "description": "The maximum port number in the range that is matched by the security group rule."
+        },
+        "port_range_min": {
+          "type": "integer",
+          "format": "int32",
+          "example": 80,
+          "description": "The minimum port number in the range that is matched by the security group rule."
+        },
+        "protocol": {
+          "type": "string",
+          "example": "tcp",
+          "description": "The IP protocol can be represented by a string, an integer, or null."
+        },
+        "remote_ip_prefix": {
+          "type": "string",
+          "example": "",
+          "description": "The remote IP prefix to associate with this metering rule packet."
+        },
+        "remote_group_id": {
+          "type": "string",
+          "example": "85cc3048-abc3-43cc-89b3-377341426ac5",
+          "description": "The remote group UUID to associate with this security group rule."
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/apps/openstacknetworking/src/main/resources/definitions/NeutronSubnet.json b/apps/openstacknetworking/src/main/resources/definitions/NeutronSubnet.json
new file mode 100644
index 0000000..3a44ff4
--- /dev/null
+++ b/apps/openstacknetworking/src/main/resources/definitions/NeutronSubnet.json
@@ -0,0 +1,114 @@
+{
+  "type": "object",
+  "description": "A subnet object.",
+  "required": [
+    "subnets"
+  ],
+  "properties": {
+    "subnets": {
+      "type": "object",
+      "required": [
+        "enable_dhcp",
+        "network_id",
+        "tenant_id",
+        "dns_nameservers",
+        "allocation_pools",
+        "host_routes",
+        "ip_version",
+        "gateway_ip",
+        "ipv6_address_mode",
+        "ipv6_ra_mode"
+      ],
+      "properties": {
+        "enable_dhcp": {
+          "type": "boolean",
+          "example": true,
+          "description": "Indicates whether dhcp is enabled or disabled for the subnet."
+        },
+        "network_id": {
+          "type": "string",
+          "example": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
+          "description": "The ID of the network to which the subnet belongs."
+        },
+        "tenant_id": {
+          "type": "string",
+          "example": "4fd44f30292945e481c7b8a0c8908869",
+          "description": "The ID of the project."
+        },
+        "dns_nameservers": {
+          "type": "array",
+          "description": "List of dns name servers associated with the subnet.",
+          "items": {
+            "type": "string",
+            "description": "A dns name server instance."
+          }
+        },
+        "allocation_pools": {
+          "type": "array",
+          "description": "Allocation pools with start and end IP addresses for this subnet.",
+          "items": {
+            "type": "object",
+            "description": "An allocation pool.",
+            "required": [
+              "start",
+              "end"
+            ],
+            "properties": {
+              "start": {
+                "type": "string",
+                "example": "192.168.199.2",
+                "description": "A start IP address for this subnet."
+              },
+              "end": {
+                "type": "string",
+                "example": "10.10.10.254",
+                "description": "An end IP address for this subnet."
+              }
+            }
+          }
+        },
+        "host_routes": {
+          "type": "array",
+          "description": "Additional routes for the subnet. A list of dictionaries with destination and nexthop parameters.",
+          "items": {
+            "type": "object",
+            "description": "A route for the subnet.",
+            "required": [
+              "destination",
+              "nexthop"
+            ],
+            "properties": {
+              "destination": {
+                "type": "string",
+                "description": "The destination CIDR."
+              },
+              "nexthop": {
+                "type": "string",
+                "description": "The IP address of the next hop for the corresponding destination."
+              }
+            }
+          }
+        },
+        "ip_version": {
+          "type": "integer",
+          "format": "int32",
+          "example": 4,
+          "description": "The IP protocol version. Value is 4 or 6."
+        },
+        "gateway_ip": {
+          "type": "string",
+          "example": "192.168.199.1",
+          "description": "Gateway IP of this subnet. If the value is null that implies no gateway is associated with the subnet."
+        },
+        "ipv6_address_mode": {
+          "type": "string",
+          "description": "The IPv6 address modes specifies mechanisms for assigning IP addresses."
+        },
+        "ipv6_ra_mode": {
+          "type": "string",
+          "description": "The IPv6 router advertisement specifies whether the networking service should transmit ICMPv6 packets, for a subnet."
+        }
+      }
+    }
+  }
+}
\ No newline at end of file