diff --git a/codegenerator/openapi/neutron.py b/codegenerator/openapi/neutron.py index cc990c0..62bba02 100644 --- a/codegenerator/openapi/neutron.py +++ b/codegenerator/openapi/neutron.py @@ -12,27 +12,26 @@ # import copy import logging -from multiprocessing import Process, Manager -from pathlib import Path import re import tempfile +from multiprocessing import Manager, Process +from pathlib import Path from typing import Any +import sqlalchemy from routes.base import Route from ruamel.yaml.scalarstring import LiteralScalarString -import sqlalchemy - -from codegenerator.common.schema import ParameterSchema -from codegenerator.common.schema import PathSchema -from codegenerator.common.schema import SpecSchema -from codegenerator.common.schema import TypeSchema -from codegenerator.openapi.base import OpenStackServerSourceBase -from codegenerator.openapi.base import VERSION_RE +from codegenerator.common.schema import ( + ParameterSchema, + PathSchema, + SpecSchema, + TypeSchema, +) from codegenerator.openapi import neutron_schemas +from codegenerator.openapi.base import VERSION_RE, OpenStackServerSourceBase from codegenerator.openapi.utils import merge_api_ref_doc - PASTE_CONFIG = """ [composite:neutron] use = egg:Paste#urlmap @@ -89,7 +88,6 @@ class NeutronGenerator(OpenStackServerSourceBase): # Create the default configurations from neutron.common import config as neutron_config from neutron.conf.plugins.ml2 import config as ml2_config - from neutron.db import models # noqa from neutron_lib import fixture from oslo_config import cfg @@ -191,12 +189,11 @@ class NeutronGenerator(OpenStackServerSourceBase): def process_neutron_with_vpnaas(self, work_dir, processed_routes, args): """Setup base Neutron with enabled vpnaas""" logging.info("Processing Neutron with VPNaaS") + from neutron import manager # noqa from neutron.common import config as neutron_config from neutron.conf.plugins.ml2 import config as ml2_config - from neutron.db import models # noqa from neutron_lib import fixture - from neutron import manager # noqa from oslo_config import cfg from oslo_db import options as db_options @@ -1155,11 +1152,11 @@ class NeutronGenerator(OpenStackServerSourceBase): }, "remote_address_group_id": { "type": "string", - "description": "The remote address group UUID that is associated with this\nsecurity group rule.", + "description": "The remote address group UUID that is associated with this security group rule.", }, "belongs_to_default_sg": { "type": ["string", "boolean", "null"], - "description": "Indicates if the security group rule belongs to the default security\ngroup of the project or not.", + "description": "Indicates if the security group rule belongs to the default security group of the project or not.", }, }, }, @@ -1167,6 +1164,60 @@ class NeutronGenerator(OpenStackServerSourceBase): ) elif resource_key == "subnetpool" and field == "ip_version": js_schema.update({"type": "integer"}) + elif resource_key == "policy" and field == "rules": + # QOS Policy rules + js_schema.update( + { + "description": "A set of zero or more policy rules.", + "type": "array", + "items": { + "type": "object", + "properties": { + "direction": { + "description": "The direction of the traffic to which the QoS rule is applied, as seen from the point of view of the port. Valid values are `egress` and `ingress`. Default value is `egress`.", + "type": "string", + }, + "dscp_mark": {"type": "string"}, + "id": { + "description": "The rule ID", + "type": "string", + }, + "max_burst_kbps": { + "description": "The maximum burst size (in kilobits).", + "minimum": 0, + "type": "integer", + }, + "max_burst_kpps": { + "description": "The max burst kpps (kilo packets per second) value.", + "minimum": 0, + "type": "integer", + }, + "max_kbps": { + "description": "The maximum KBPS (kilobits per second) value. If you specify this value, must be greater than 0 otherwise max_kbps will have no value", + "minimum": 0, + "type": "integer", + }, + "max_kpps": { + "description": "The max kpps (kilo packets per second) value.", + "minimum": 0, + "type": "integer", + }, + "min_kbps": { + "description": "The minimum KBPS (kilobits per second) value which should be available for port.", + "minimum": 0, + "type": "integer", + }, + "min_kpps": { + "description": "The minimum kilo (1000) packets per second (kpps) value.", + "minimum": 0, + "type": "integer", + }, + "type": {"type": "string"}, + "qos_policy_id": {"type": "string"}, + }, + }, + } + ) elif resource_key == "agent" and field == "configurations": js_schema.update({"type": "object"}) elif field == "l2_adjacency":