neutron-lib-2.3.0/0000775000175000017500000000000013641427200013773 5ustar zuulzuul00000000000000neutron-lib-2.3.0/.coveragerc0000664000175000017500000000014313641427107016120 0ustar zuulzuul00000000000000[run] branch = True source = neutron_lib omit = neutron_lib/tests/* [report] ignore_errors = True neutron-lib-2.3.0/AUTHORS0000664000175000017500000001440513641427177015064 0ustar zuulzuul00000000000000Abhishek Raut Adit Sarfaty Aditya Reddy Nagaram Akihiro Motoki Akihiro Motoki Allain Legacy Andreas Jaeger Andreas Scheuring Andrey Shestakov Anh Tran Anindita Das Ann Taraday Antoni Segura Puimedon Armando Migliaccio Bence Romsics Bence Romsics Bertrand Lallau Boden R Brandon Logan Brian Haley Cao Xuan Hoang Carl Baldwin Carlos Goncalves ChangBo Guo(gcb) Corey Bryant Cédric Savignan Daniel Bengtsson Dariusz Smigiel Darla Ahlert Deepthi V V Dirk Mueller Dongcan Ye Doug Hellmann Doug Wiegley Doug Wiegley Doug Wiegley Dustin Lundquist Felipe Monteiro Flavio Percoco Frank Wang Gal Sagie Gary Kotton Gergely Csatari German Eichberger Graham Hayes Gregoire Mahe Guillaume Giamarchi Ha Van Tu Hamdy Khader Harald Jensas Harald Jensås Harshada Mangesh Kakad Henry Gessau Henry Gessau Hirofumi Ichihara Hongbin Lu Hongbin Lu Hunt Xu Igor Malinovskiy Ihar Hrachyshka Isaku Yamahata Jakub Libosvar Jan Gutter Jens Harbott Juan Antonio Osorio Robles Kailun Qin Kevin Benton Kobi Samoray Kyle Mestery LIU Yulong Lajos Katona Li Ma Li-zhigang Luong Anh Tuan Maciej Józefczyk Maksim Malchuk Manjeet Singh Bhatia Margaret Frances Martin Roy Matt Riedemann Matt Welch Matthias Lisin Michael Johnson Michal Kelner Mishali Miguel Lavalle Miguel Lavalle Miguel Lavalle Mohit Malik Monty Taylor Moshe Levi Mykola Yakovliev Nakul Dahiwade Nam Nguyen Hoai Nate Johnston Nate Johnston Ngo Quoc Cuong Nguyen Hai Truong Nguyen Phuong An Omer Anson OpenStack Release Bot Pablo Iranzo Gómez Paul Carver Paul Michali Pavel Gluschak Pawel Suder QunyingRan RYAN D. MOATS Reedip Reedip Reedip Rodolfo Alonso Hernandez Rodolfo Alonso Hernandez Ryan Tidwell Sean Dague Shashank Kumar Shankar Slawek Kaplonski Steve Kowalik Swaminathan Vasudevan Swapnil Kulkarni (coolsvap) Sławek Kapłoński Takashi NATSUME Thomas Morin Thomas Morin Tony Breeds Tony Xu Trevor McCasland Van Hung Pham Vlad Gridin Vu Cong Tuan YAMAMOTO Takashi Yang Li Yang Youseok Yushiro FURUKAWA Zeus Arias Lucero ZhaoBo ZhongShengping ashish.billore chen chenxiangui chenxing csatari elajkat huangtianhua leiyashuai lidong lijunjie lilintan longqianzhao melissaml nanaboat nicky nizam pandatt pedro reedip shubhendu venkata anil yanpuqing ycx ythomas1 zhangboye zhanghao zhangmeng zhangzs zhaorenming@inspur.com zhufl zhulingjie neutron-lib-2.3.0/ChangeLog0000664000175000017500000011205313641427177015564 0ustar zuulzuul00000000000000CHANGES ======= 2.3.0 ----- * Switch to hacking 2.0 * Use "unittest.mock" library and drop "mock" installation * Add SubnetInUseByIPsecSiteConnection in vpnaas exception 2.2.0 ----- * Revert "Remove warning message when using old and new engine facade" * Remove warning message when using old and new engine facade * Fix definition of the fip\_pf\_description api extension * Add is\_sort\_key for vpnaas attribute maps * Remove TooManyExternalNetworks exception class * Introduce rbac-subnetpool api extension * Introduce rbac-address-scope api extension * Update the minversion parameter 2.1.0 ----- * Extend qos DriverBase with validate\_rule\_for\_port() * [Api-Ref][Docs] Change dns\_assignment parameter to be list * Remove library "six" 2.0.0 ----- * Fix new parameter added in "qos\_port\_network\_policy" API * Stop testing Python 2 * Extension for tagging ports during bulk creation 1.31.0 ------ * Handle generation conflicts caused by concurrent updates * Pass on missing implementation while filtering * Add "qos\_network\_policy\_id" field to "port" definition 1.30.0 ------ * add "stateful-security-group" api extension * Change the requirements for the subnet\_dns\_publish\_fixed\_ip extension * Add description field in port forwarding API * Remove 'interconnection' API extension definition (neutron-interconnection) * Stop configuring install\_command in tox * Remove fwaas\_v1 exceptions and definitions * Allow , , and as DNS label * Fix rendering of api-ref main page * install neutron\_lib international messages * Add retry and debug logs to NoAuthClient of placement client * Add missing DHCP port numbers * Update master for stable/train * Remove Neutron LBaaS * PDF documentation build 1.29.1 ------ * Introduce new member actions additively 1.29.0 ------ * New api-def: extraroute-atomic * Ensure that extended ethertypes still work by name * Update api-ref location * Mention that list of e.g. IDs is supported in GET requests * Update api-ref location / version * Add ethertype validator for custom ethertype validation * Fix - L3 Conntrack Helper validator * Filter placement API endpoint by type too * Only have one number to name mapping for IPv6 ICMP * Add shim extension admin\_state\_down\_before\_update * Add Python 3 Train unit tests 1.28.0 ------ * make sql fixtures public * Update flake8 style enforcement * Introduce NetworkAddressScopeAffinityError * Loopback address routing should be invalid * Add new vif\_details parameters * Fix subnet\_dns\_publish\_fixed\_ip extension * Add 'dns\_publish\_fixed\_ip' attribute to Subnet * Add rarp protocol for neutron constants * Add conntrack helper to parent resource mapping * placement client: fix routed prov networks working * [api-ref] Update info about internal\_ip\_address in FIP port forwarding * [api-ref] Add short warning about ANY IP address in allowed address pair * fix doc periodic log url 1.27.0 ------ * sync sql fixtures from neutron * Cap sphinx for py2 to match global requirements * Update Python 3 test runtimes for Train * Add sort\_keys retrieving function * Blacklist bandit 1.6.0 due to directory exclusion bug * use once rather than always for filterwarnings * Use AssociationProxyInstance instead of AssociationProxy * Update hacking version * Replace git.openstack.org URLs with opendev.org URLs * OpenDev Migration Patch * Remove "tags" listed in Create port POST api-ref 1.26.0 ------ * update db fixtures for consumption testing * Add noauth option for placement client * Dropping the py35 testing * L3 Conntrack Helper Extension * remove use of legacy modules * fix WarningsFixture for public consumption * Rehome provider\_network\_attribute\_updates\_supported to API definition * Adds PORT\_FORWARDING\_FLOATINGIP\_KEY * rehome neutron.objects.common\_types * Change exception types in network\_segment\_range * rehome neutron.objects.logapi.event\_types * Fix a typo * Add 'IP' and 'HOPOPT' protocols to constants * rehome neutron.objects.extensions.standardattributes * rehome neutron.db.standard\_attr * rehome model\_query function * Update master for stable/stein * standard-attr for network-segment-range api-ref * Add methods for network segment range support * rehome subnet service types extension * api-ref: remove 'external\_network\_bridge' from agent * Allow filtering/sorting by the 'mtu' field * rehome used neutron.tests.tools 1.25.0 ------ * rehome sqlalchemytypes * Introduce subnet pool prefix operations extension * Add exception to prevent overlapped segment ranges * Add NETWORK\_SEGMENT\_RANGE plugin constant * Remove ml2's accidental dependency on l3 * 'interconnection' API extension definition (neutron-interconnection) * rehome trunk service constants * Catch only MessageDeliveryFailure exceptions * Add security-group as parameter to RBAC api * Rehome base upgrade checks class * Remove neutron\_lib.db from db profiling projects * Add policy module to neutron-lib * Add setproctitle support to the workers module * add python 3.7 unit test job * Bump lower version of oslo.db to one that includes jitter argument * rehome remaining common constants 1.24.0 ------ * Add traffic control constants * Exceptions for: Drive binding by placement allocation * rehome trunk related callback resource names * Delete floating IPs on network turned internal * Increase tempest-full jobs timeout to 3h * Fix exception logging formatting 1.23.0 ------ * Fix pep8 E126 * Add missing ws seperator between words * Extend methods for network segment range support * doc neutron-lib current * Remove unnecessary attributes and specs from subnet\_onboard API * New agent attribute: resources\_synced * Use oslo.db jitter in our db retries * Move network segment range types to lib constants * Rehome constant: DHCPV6\_CLIENT\_PORT 1.22.0 ------ * Add smartnic port type to VNIC\_TYPES * api-ref: document network-segment-range extension * Fix the misspelling of "interface" * Modify the judgment method of CIDR and Add utests * Add network-segment-range extension API definition * sync neutron.common.exceptions into neutron-lib * Add a new configuration parameter rpc\_response\_max\_timeout * rehome db api orm event listener functions * Revert "Add function helpers.compare\_dict" * Add traffic control exceptions * api-ref: document uplink status propagation * Handle ValueError in canonical address convertion * Update devel info: mailing list * Add RouterNotFoundInRouterFactory exception * Change openstack-dev to openstack-discuss * Add function helpers.compare\_dict 1.21.0 ------ * Fix QoS alias api definition * Fix default value of subnet attribute for subnet onboard * context: Warn on mixed uses of old and new db methods * Support fetching specific db column in OVO * Placement client: improve Placement 4xx exceptions * Placement client: do not swallow exceptions * Placement client: clean up docstrings * rehome get\_updatable\_fields into object utils * Add ipv6 canonical address converter to API * Check if a port can be bound to a virtual bridge * fix DBResourceExtendFixture fixture * Update min tox version to 2.3.2 * Adapt to changed resource class names * Add shim extension l3-port-ip-change-not-allowed 1.20.0 ------ * Disable port number 0 for floating IP port\_forwarding * Support custom filters in OVO * rehome the resource\_extend db module * Fix random\_mac\_generator to make proper EUI64s * Allow advsvc role to create port in foreign tenant * Add api-ref for qos-rules-alias extension * Use QoS constants definitions * Define qos-rules-alias extension * Use authorize instead of enforce in policy * build universal wheels * PlacementAPIClient.update\_resource\_class client call missing argument * Let Neutron enforce rule on create\_subnet with segment\_id [neutron-lib part] 1.19.0 ------ * Fix port\_range\_max attribute definition * policy-in-code support in neutron-lib * Switch to oslo\_messaging.ConfFixture.transport\_url * Use templates for cover and lower-constraints * Fix placement\_client max microversion * Show is\_default as a valid parameter for subnet pool creation * Fix the mistake of lbaas api-ref * add lib-forward-testing-python3 test job * add python 3.6 unit test job * switch documentation job to new PTI * import zuul job settings from project-config * api-ref: Add port-resource-request extension * Add is\_filter to network\_ip\_availability * Introduce Port resource request extension * Mechanism driver API: resource\_provider\_uuid5\_namespace * Placement: utils * Placement: constants * Placement client: move to neutron\_lib.placement * Placement client: optional RP generations * Placement client: ensure\_resource\_provider * Placement client: always return body * Update list of skipped bandit plugins * api-ref: document floating ip pools endpoint * Add 'project\_default' attribute to Network * Update the segment api extension * Make the DB retry mechanism more robust * api-ref, fwaas-v2: Remove 'status' from request * Adds qos-gateway-ip extension api definition * Add 'is\_filter' and 'is\_sort\_key' to fip pf attributes * api-ref for floating IPs port forwardings * Add keyword 'is\_filter' to binding extended * Update reno for stable/rocky * Mac learning extension description * Add is\_filter to port\_mac\_address\_regenerate * net\_utils: Add a random mac generator * Ingress direction for min bandwidth rule 1.18.0 ------ * Rehome get\_port\_binding\_by\_status\_and\_host * Add shim extension filter-validation * rehome rpc and related plumbing * Add shim extension sort-key-validation * Extend port\_forwardings field in Floatingip response * Mechanism driver API: responsible\_for\_rsc\_provider * Add two fields to NeutronDbObjectDuplicateEntry 1.17.0 ------ * Shim extension - segments peer subnet host routes, and api-ref * Add a shim extension availability\_zone\_filter * Add the two missing 'is\_filter' keyword * Add support to regenerate port mac\_address * Add release notes link to README * Cleanup unused key-value in the attribute of l3 * Add bandit to pep8 gate * remove CORE and L3 from neutron\_lib.constants * rehome port-security-groups-filtering api extension * Modify the type of subnet in the api-ref 1.16.0 ------ * Fix badly formatted log when adding extension * Add the floatingip pools extension * fix tox python3 overrides * tell flake8 to ignore unicode * Add attribute propagate\_uplink\_status to port * Documenting DHCP agent scheduler * Remove os-testr from lower-constraints * Remove os-testr from test-requirements * Add a shim extension standard-attr-segment * api-ref: add availability\_zone extension 1.15.0 ------ * Fix list\_resource\_providers filters * Switch to stestr * Add DHCP\_OPT\_CLIENT\_ID\_NUM * bgpvpn API definition: add API\_PREFIX * Annotate sort\_key parameters for all resources * Annotate filter parameters for all resources * Update api-ref to reflect update allowed for subnet segment\_id * api-ref: document sorting parameters for address scope * api-ref: add 'project\_id' as sort\_key * Add API extensions to advertise support of std attributes for BGPVPN * Adding tags to responses for relevant resources * Documenting L3 agent scheduler * api-ref: add filter parameters to agents * api-ref: add filter parameters to resource management * api-ref: several fixes on security group rules * Adding qos policy to the different port and network operations * Introduce API definition of Floating IP Port Forwarding * Add empty-string-filtering API extension * Documenting L3 External gateway mode * Add timestamp attributes to standard resources * api-ref: add filter parameters to rbac * api-ref: document sorting for resource management * Add port bindings to RPC topics resources * 'sfc' and 'flowclassifier' API extension definitions (networking-sfc) * Add documentation for callback priority 1.14.0 ------ * Document L3 HA extension * api-ref: document the address scope extension * fix docs/links for 1.14.0 release * fix vpnaas subnet\_list\_or\_none type * api-ref: document sorting for qos resources * api-ref: document sorting for log management * api-ref: document sorting parameters for l2 * Fix requirements for api-ref * Trivial: Update pypi url to new url * Add API extension fip-port-details * rehome model\_query and its dependencies * api-ref: several fixups on the rbac policies * api-ref: some fixes on metering labels and rules * Add placement calls for bandwith resource provider * api-ref: document sorting parameters for security * Document QoS bandwidth limit direction extension * Fix placement calls in placement client * api-ref: add the missing samples in floatingips * API attribute processing: allow to populate dict attribute default values * API attribute processing: add 'default\_overrides\_none' * Rehome unstable\_test decorator * rehome db api * remove debtcollector from requirements * rehome get\_deployment\_physnet\_mtu into plugin utils * fix tox release note generation * Documenting l3\_flavors extn in api-ref * api-ref: document sorting parameters for l3 * versioned object plugin registry * Fix pep8 errors * Documenting subnet\_allocation extension * Annotate network parameters for sort\_key * Annotate all the filter parameters for networks * Documenting Router service type ID * Remove the ensure\_dir * remove the unused neutron\_lib.api.utils module * rehome qos bw limit direction api def * ut updates for extending sub-resources * api-ref: document sorting parameters for networks * fix lower constraints to match requirements * Remove LABEL from API definitions * Add the missing response parameters to network * rehome used db utils * Follow the new PTI for document build * Updated from global requirements * fix typos in parameters.yaml * add lower-constraints job * callback: priority to specify calling order * rehome create functions from plugin utils * api-ref: add filter parameters to trunk * api-ref: add filter parameters to qos * api-ref: add filter parameters to segment * api-ref: add filter parameters to SG and rules * api-ref: add filter parameters to log * Updated from global requirements * api-ref: correct the list of taggable resources * Fix binding:profile parameter type in API reference * Subnet segment\_id writable extension * Updated from global requirements * Add prefixlen to subnet api-ref for create actions * Updated from global requirements * Remove tools/tox\_install.sh * Reorder and capitalize the list of extensions in ports, networks and routers * Fix the description of some parameters * api-ref, bgpvpn API extension: update status * Imported Translations from Zanata * Add new Resource Provider functions to placement client * api-ref: add filter parameters to router * api-ref: add filter parameters to floatingip * api-ref: add filter parameters to subnetpool * api-ref: add filter parameters to subnet resource * api-ref: add filter parameters to port resource * api-ref: add filter parameters to networks * Updated from global requirements * Remove repeated parameter from floatingip * Documenting L2 adjacency extension * Update url links in README.rst * Document the error code on conditional update/delete * Documenting QoS default policy extension * Change name of test file * Change some parameters in path to be required * Documenting ip\_allocation extension in api-ref * Mark neutron-lbaas as deprecated * Document extra\_dhcp\_opt extension in api-ref * Adding DVR extension docs in routers api-ref * Documenting network\_availability\_zone extension * Document subnet\_service\_types extension in api-ref * [Api-ref] Cleanup parameters.yaml * Migrate neutron-vpnaas API definitions to neutron-lib * Imported Translations from Zanata * Update status of VPNaaS in neutron * Update reno for stable/queens * Updated from global requirements * Don't override oslo.db tweaks for connection pool in tests 1.13.0 ------ * Imported Translations from Zanata * Add events and resources for L3 flavors * Adopted to new oslo.context code to remove deprecation warnings * Updated from global requirements * Remove unreferenced protocol parameters * Update security group rule protocol parameter text * rehome plugin utils * Fix openstackdocstheme options for api-ref * Documenting Router AZ extension in routers api-ref * rehome shared constant * rehome revisionifmatch api def * Updated from global requirements * fix typos * rehome common topics into neutron-lib * rehome segement api def * DVR: Move DVR agent related constants to neutron-lib * Fix one small typo in api-ref 1.12.0 ------ * Add the IP substring filter extension * Adds Remote Firewall Groups to FWaaS V2 Rules * rehome router service type api def * rehome the qos rule type details api def * rehome sorting api def * fix linkcheck tox target * Rehome placement client to neutron-lib * Remove periods at the end of validator and converter messages * update releasing doc links for zuul v3 * Fix port comparison in port range validation * Updated from global requirements * Add default value as none for vni attribute in bgpvpn resource * add api ref for auto allocated topology * Add support to Create/Update subnets in subnet\_onboard * rehome service type api def * rehome vlantransparent api def * rehome dhcpagentscheduler api def * finish qos\_rule\_type\_details extension api-ref * rehome the qos default api def * add description in api-ref for external net extension * class methods and sub resources in base api ext * Remove setting of version/release from releasenotes * Updated from global requirements * Updated from global requirements * fix up dvr api def exceptions * Adds IPinIP protocol * docs: Subscribing events using registry decorator * Add empty BGPVPN Route Target to unit test * Check that duplicate Segmentation IDs 0 get caught * add api ref for agents * rehome multi provider net extension api definition * docs: Add primary\_key attribute key * Modify the validator for segmentation\_id 0 * Remove pep8 from test-requirements * Fix RBAC POST parameter of api-ref * Add new resource for port bindings * Remove rbac-policy callback into lib * add DCCP, SCTP and UDP-Lite to validated protos for port ranges * Add a new method ha\_state\_change to L3 agent extension * complete api-ref for addr pairs and port security * Updated from global requirements * net\_utils: Speed up mac address generation * Fix typos and address formatting issues * Add headers for sections in LBaaS v2.0 API docs 1.11.0 ------ * Updated from global requirements * revert get\_random\_mac behavior from review 400408 * Fix comment in context.py * Remove a bogus leftover string * bgpvpn-vni api extension * add PROVISIONAL\_IPV6\_PD\_PREFIX to constants * fix doc links * add api ref and doc link validation to release * sync plugin common constants * Update links in CONTRIBUTING.rst * Revert "Withdraw doc for bgpvpn-routes-control API extension" * Don't allow an empty-string Route Target * rehome flavor extension API definition * api ref for quota details extension * finish routes api ref * Fix value of pool\_id-request required attribute 1.10.0 ------ * Add the default-subnetpools extension to api-ref * Fix unit test failures due to switch to testr changes * rehome dvr extension api def * rehome l3 flavors extension api definition * api-ref for inherit trunk segmentation type * rehome l3 ext ha mode extension api definition * Fix some typos * Add exception when a synthetic field is invalid * Update links in README * Remove vestigate HUDSON\_PUBLISH\_DOCS reference * Rehome net-mtu-enh extension definition * Document the new net-mtu-writable extension * rehome ip allocation extension API definition * complete api ref for std attr revisions * api ref for standard-attr-tag extension * rehome l3 ext gw mode extension api definition * sync ml2 plugin api * Updated from global requirements * api ref for dns integration * rehome project id api definition * rehome network availability zone extension api definition * rehome qos api definition * Updated from global requirements * Parameter modifications of edit-constraints * rehome router availability zone extension api def * rehome pagination api definition * rehome network ip availability extension api definition * Add API Definition for Subnet Onboard * rehome metering extension api definition * Fix API Doc LBaaS v2 When a Listener and pool are created the parameter protocol\_port is optional according to the official documentation, but in reality it is required * rehome l2 adjacency extension API definition * rehome extraroute api definition * rehome external net api definition * Security Groups: Fix rule docs regarding protocols * Add description about QoS minimum bandwidth rules API * rehome allowedaddresspairs API definition * rehome default subnet pools API def * Add missing library into requirements.txt * rehome availability zone API def * Add description of API call to get QoS rule type details * Updated from global requirements * Update reno for stable/pike * Introduce API for port bindings extended * Removing LBaaS v1 API reference * Fix spaces in Firewall's error messages * Add 'convert\_to\_string' and apply for firewall-rule 1.9.1 ----- * Revert "hardware offload support for openvswitch" * Update the documentation link for doc migration * Fix typo in release note for import path 1.9.0 ----- * Add backward compatible alias * Change comment to match new constant name * rehome neutron's auto-allocated-topology extension API definition * rehome neutron's address-scope extension API definition * Updated from global requirements * rectify the definition of API timestamp for trunk\_details * Add interface to add a constraint to context * Add Agilio OVS VIF and virtio-forwarder VNIC type * Rehome FAULT\_MAP from the neutron API * Fix N536 - Use assertIsNone regex * Updated api-ref with more details on net-mtu extension * Moved net-mtu extension definition * rehome neutron's agent extension API definition * Remove unnecessary variables in UT * Add headers for QoS sections in api-ref * Add info about direction in QoS bandwidth limit rule * Withdraw doc for bgpvpn-routes-control API extension * Move Firewall Exceptions to neutron-lib * bgpvpn\_routes\_control: API definition fixes * hardware offload support for openvswitch 1.8.0 ----- * Use flake8-import-order plugin * Enable module reference * rearrange content to fit the new standard layout * Enable warning-is-error in doc build * Introduce logging api extension * Switch from oslosphinx to openstackdocstheme * api-ref: Introduce logging api reference * api-ref: RBAC policies api reference * Add missing LOG.debug to hacking rule * remove deprecated N523 hacking check * Define dns-domain-ports extension * Updated from global requirements * rehome consumed neutron.common.constants * rehome ml2 driver\_api * rehome ovo exceptions * Rehome dns-integration extension * bgpvpn-routes-control extension * Add OVS\_DATAPATH\_TYPE in portbindings constants * Add sanity check to receives decorator * rehome qos service DriverBase class * Make port\_range validator accept an integer * Replace assertTrue(isinstance()) with assertIsInstance() * Fix html\_last\_updated\_fmt for Python3 * Updated from global requirements * enforce maximum length for name and tenant\_id fields * Add validators package * Fix rst heading while reading * Repair link in Neutron documentation * Updated from global requirements * Fix API ref with regards to OR queries * APIDefinitionFixture bugfix * sync callbacks: Eliminate SUBNET\_GATEWAY resource * rehome utils: synchronized decorator and load\_class\_by\_alias\_or\_classname 1.7.0 ----- * Trivial fix typos * Add AFTER\_SPAWN event to callbacks * Remove duplicated "set of" * Add VIF\_TYPE\_TAP constant to portbindings * Updated from global requirements * make extra\_dhcp\_opt vars public * rehome NETWORK\_ID ml2 constant * use constants rather than static strings 1.6.0 ----- 1.5.0 ----- * Rehome neutron.api.v2.attributes * rehome extra\_dhcp\_opt api-def * Patch \_get\_callback\_manager for callback fixture * sync callbacks with neutron * Add new protocols in Firewalls * rehome core resource api-defs * api-ref: Add a few type checks for consistency * Updated from global requirements * Add CIDR for canonical format conversion * [FWaaS] Migrate Public attribute to Shared * Enforce log messages not being translated * rehome is\_port\_trusted util function * Updated from global requirements 1.4.0 ----- * Add flush\_on\_subtransaction=True to engine config * rehome plugin common constants * Updated from global requirements * Add ACTION\_STATUS to dummy of API definition * Add bgpvpn to list of known extensions * Handle tenant\_name and project\_name more equally * Stop enforcing non-debug log translations * extensions: Tweak docstring for get\_required\_extensions * API extension updates and fixture * api-ref: provider and multiple provider are allowed to update * Downgrade callback abortable event log to debug 1.3.0 ----- * Updated from global requirements * rehome NeutronWorker class * Indicating the location tests directory in oslo\_debug\_helper * Clarify pep8 inclusion in periodic job * api-ref: some quota APIs don't return 404 * API definition and reference for data plane status extension * Change dashboard for periodic jobs * Formalize base service classes * rehome port security api-def * rehome ml2 MechanismDriver class * Sync neutron callbacks into lib * Updated from global requirements * boilerplate extension descriptor for api-def * Use a single hacking check factory * Tweak trunk extension to support Ironic use case * api-ref: Cleanup quotas API * api-ref: Fix using examples of API * api-ref: Add QoS rule types list API * api-ref: Remove tags for neutron-in-tree-api-ref from LBaaSv1 * Add a note about the current status of FWaaS v1 * api-ref: Correcting QoS policies in API extension 1.2.0 ----- * Move networking-bgpvpn API reference into neutron-lib * Drop dictionary construction on get\_plugin * Move BGPVPN API definition into neutron-lib * Add is\_extension\_supported to neutron\_lib * rehome l3 api-def exceptions * add exceptions package * Only log IDs of callbacks in debug message * fix broken link in review guidelines * Updated from global requirements * Validate API sample JSON files * Remove tag-obtain-response.json in the top directory * Remove support for py34 * Update api-ref for enhanced tag mechanism * Remove trailing whitespaces from VPN api doc * Add a space after comma * Add FIP64 extension from networking-midonet * Add router-interface-fip extension from networking-midonet * Migrate logging-resource extension from networking-midonet * api: Fix firewall aliases * api-ref: Add 'qos\_policy\_id' parameter to PUT * api-ref: Correct port binding extension * api-ref: Improve network IP availability extension * api-ref: Fix api-ref for ports * Stop creating a context manager during db.\_api module import * api-ref: add description to ports * api-ref: add pools to loadbalancer response * api-ref: add description to security groups * api-ref: add description to security group rules * api-ref: add description to subnets * api-ref: fix description for subnetpools * api-ref: fix description for floating IPs * api-ref: add description to routers * api-ref: add description to networks * Support empty list as api-def default * api-ref: Refactoring parameters in Networks APIs * Correctly set project\_name * Remove devref modindex ref * api-ref: Fix LBaaS v1 API reference * Fix api-ref errors * bugfix: l3 api-def router constant * Update reno for stable/ocata * Remove support for py33 * Add action map for neutron-fwaas API definition * Fix api-ref for tags * Use assertIsNone instead of assertEqual(None, \*) 1.1.0 ----- * Rehome providernet api-def * Rehome portbindings api-def into neutron-lib * Rehome l3 API definitions into neutron-lib * api-ref: Fix api-ref for vpnaas * Rehome ServicePluginBase * api-ref: Fix descriptions of sec-grp parameters * Follow-up review comments * FWaaS v2 API reference * Migrate neutron-fwaas API definitions to neutron-lib * Capture wider list of extension aliases * Revisit exported policy module * Make neutron context available in neutron-lib * Add dummy API definitions for extension subresources * Expose/Improve callback notification interface * Add validators/converters needed by neutron-fwaas * Improve floatingip api-ref * api-ref: Fix api-ref for metering * Add fixture for plugin directory * Updated from global requirements * Removed incorrect docstring for Context * Add FQDN\_FIELD\_SIZE constant * api-ref: Adding request parameter for sec-grp-rule * Remove discover from test-requirements * Directory: fix concurreny issue * Removes unnecessary utf-8 encoding * Sync up bare minimum from neutron.db.api into lib * api-ref: project\_id in req/resp body should be "body" * Fix the status parameters in api-ref * Modify API response information in API documents * [api-ref] Add max number of characters for tag * Migrate neutron agent extensions to neutron-lib * Add validator to check for IP or subnet or none * Use new checks in hacking 0.12 * Correcting Floating IPs * Use constranits for api-ref target * Policy: reuse common code * Updated from global requirements * Separate hacking check factories * Provide dummy API definition for documentation purposes * Add converter to convert IPv6 addresses to canonical format * Sync latest neutron context into lib * Remove README from docs build * Explain how to use the latest neutron-lib dashboard * api-ref: Fix api-ref for fwaas * Add alembic branch constants * Typo in ExtensionDescriptor.get\_request\_extensions() * [doc]Add sha256, sha384 and sha512 auth algorithms * Show team and repo badges on README * Make the get\_random\_mac more versatile * Correcting Networking API v2.0 flavor extension * Revise status of VPNaaS in neutron * Update contributing doc * Updated from global requirements * Replace six.iteritems() with .items() * api-ref: Fix api-ref for lbaas-v2 * Add is\_bsd() to neutron-lib * Use api/attributes.py instead of api/utils.py * Doc olso config option approach * Revert "Move wait\_until\_true to neutron-lib" * Move wait\_until\_true to neutron-lib * api-ref: Fix api-ref for subnetpools * Sync latest neutron callbacks into lib * Move get\_random\_mac into neutron-lib * api-ref: Correcting Network v2.0 API extensions * Add missing is\_loaded() method on directory's interface * TrivialFix: Perfect the unit test in test\_utils * Fix typo for comparision => comparison * Updated from global requirements * Add section headings to Neutron API Reference 1.0.0 ----- * Updates to API report tooling * Updated from global requirements * Add ExtensionDescriptor to neutron-lib * api-ref: Fix api-ref for subnets * Add release note for plugin directory * Introduce Plugin Directory for Neutron * Updated from global requirements * Fix doc build if git is absent * Updated from global requirements * Initial seed for neutron-lib release notes * Updated from global requirements * Revise coverage guidelines * Add release notes target * api-ref: Fix api-ref for service-providers * Enable fatal exceptions during tests * Introduce API definition for trunk/trunk\_details extensions * Updated from global requirements * [doc] Allow creating loadbalancer with network\_id * Change wording around router:external * Add segments to v2 API reference * Enhance valid\_values to use \_\_contains\_\_ * Add missing tenant\_id/project\_id request parameter * Add unit test for test\_exceptions * [api-ref] Corrected the redirect URL to Openstack Identity Service * api-ref: Update to current state of Keystone V3 support * Rehome populate\_project\_info() from neutron * api-ref: remove notion of supported xml format * Add unit test for test\_helpers * Simplify method convert\_to\_boolean with strutils.bool\_from\_string * Deprecate method ensure\_dir * Trivial: Remove 'MANIFEST.in' * Config logABug feature for Neutron-lib api-ref * Fix typo: remove redundant 'the' * api-ref: Update local\_id configuration * Updated from global requirements * Do not make project depends on Babel by default * Correct test\_tenant\_id\_attribute * Updated from global requirements * Updated from global requirements * Add support for upper-constraints.txt for all tox targets * api-ref: Add Networking v2.0 API versions response parameters * Updated from global requirements * Add info about API method to get default quotas * [api-ref] Remove temporary block * Fix regression in validate\_uuid\_list() * Add docstrings for api.validators * Fix confusion between Neutron and FWaaS versions * Add eventlet hacking check UT * api-ref: added a note to lbaasv1 about its removal in N+ * Move valuable API info from neutron-specs repo * api-ref: introduced a stub sub-page to cover general info * Updated from global requirements 0.4.0 ----- * Remove new checks from hacking factory() * Trivial DevRef Spelling corrections * Correcting information in configuration * api-ref: Correcting parameters type * Updated from global requirements * Add docstrings for utils.net * Add docstrings for utils.host * Add docstrings for utils.helpers * Add docstrings for utils.file * Add docstrings for hacking.translation\_checks * Add docstrings for hacking.checks * Updated from global requirements * Add docstrings for db.utils * Get ready for os-api-ref sphinx theme change * Add docstrings for policy * Base DB: rehome model\_base * Start migration of utility methods * Add docstrings for exceptions * Add docstrings for converters * Enhance pyir tooling CLI * Support copy() in Sentinel * Don't run api-report during pep8 * Add a hacking rule for string interpolation at logging * Correcting 'extention' parameter on Networking API v2.0 * Remove invalid depreaction warning * Generate API report tooling * Updated from global requirements * Add DeviceNotFoundError to neutron\_lib exceptions * Revert "Update hacking check consumption" * Enable DeprecationWarning in test environments * Update the home-page in setup.cfg * Add Python 3.5 classifier and venv * Updated from global requirements * Don't pass argument sqlite\_db in method set\_defaults * api-ref: Fix api-ref for routers * Updated from global requirements * api-ref: Rename file names for consistency * api-ref: Move sample JSON files under v2 directory * api-ref: Merge v2 and v2-ext into one directory * Sync neutron callbacks into lib * Forbid eventlet hacking check * api-ref: Split LBaaS API reference into v1 and v2 * Update hacking check consumption * translation\_checks: Exclude rally plugins * Add Neutron context module and some policy methods * Updated from global requirements 0.3.0 ----- * Add DEVICE\_OWNER\_BAREMETAL\_PREFIX const * Remove discover from test-requirements * Add validator to test integers * Deprecate N523 check that forbids oslo.\* imports * devref for public API docstring * Fix api-ref response code formatting * Migration report: validate that bc is installed * add tags to api-ref files for the content verification phase * Add tool to track migration to neutron-lib * Document release steps for neutron-lib * Expand the API reference Table of Content * Updated from global requirements * Fix simple typo * Tweak validation logic for subport validator * Updated from global requirements * Update documents to address some issues * Updated from global requirements * Rehome IPV6\_MODES constants * Update validator accessors * Forbid eventlet based code * Make the constant Sentinel() class public * 100% unit test coverage for hacking/checks.py * Localized exception message hacking check * Updated from global requirements * WADL to RST migration * Add translation validations to the hacking policy * Updated from global requirements * Fix E128 hacking errors and enable it * TrivialFix: Fix a bad indentation in a doc file * Enable local hacking rule in neutron-lib * Hacking: update iteritems hacking message * Add Neutron L3 agent types * Fix exception for invalid type * Add subport validator for vlan-aware-vms * Updated from global requirements * Remove unused oslo.service requirement 0.2.0 ----- * Updated from global requirements * Add IPv6\_LLA\_PREFIX constant * Remove ICMPV6\_ALLOWED\_TYPES * Maintain ATTR\_NOT\_SPECIFIED constant with deepcopy * Add constants for additional ICMPv6 types * Fixed type:dict validator passes unexpected keys * Define legacy ICMPv6 protocol name 'icmpv6' for backward compaty 0.1.0 ----- * Updated from global requirements * Remove config module * Updated from global requirements * Revert "Add Collector Agent type string" * Remove fake\_consume\_in\_threads dummy method * Updated from global requirements 0.0.3 ----- * Add pagination helpers * New device owner flag for HA router interface * Fix 'import neutron' hacking check * Add in missing constants * Remove unused pngmath Sphinx extension 0.0.2 ----- * Updated from global requirements * Callbacks: add precommit support * Add constants for macvtap agent * Callbacks: add in missing callback resources * Add Collector Agent type string * Add a hacking check against importing neutron * Lib specific hacking rules * Move some common test and framework goo into neutron-lib * Update translation setup * API validators and converters * Replace deprecated library function os.popen() with subprocess * Add popular IP protocols for security group 0.0.1 ----- * Improvements to tox envs * Adding callback mechanism * Setup for translation * Add neutron/plugin/common/constants.py module to neutron-lib * Setup for devref documentation * Initial list of constants * Use assertRaises instead of try-except in unit tests * Initial shared exceptions * Remove pypy as tox env * Insert references to debtcollector in review guidelines * Cleanup .gitignore * Beginning of lib review guidelines * Initial cookiecutter commit * Added .gitreview neutron-lib-2.3.0/test-requirements.txt0000664000175000017500000000112713641427107020243 0ustar zuulzuul00000000000000# The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. hacking>=2.0.0,<2.1 # Apache-2.0 bandit!=1.6.0,>=1.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD flake8-import-order==0.12 # LGPLv3 python-subunit>=1.0.0 # Apache-2.0/BSD oslotest>=3.2.0 # Apache-2.0 reno>=2.5.0 # Apache-2.0 stestr>=1.0.0 # Apache-2.0 testresources>=2.0.0 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD testtools>=2.2.0 # MIT neutron-lib-2.3.0/neutron_lib/0000775000175000017500000000000013641427200016313 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/placement/0000775000175000017500000000000013641427200020263 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/placement/constants.py0000664000175000017500000000220213641427107022653 0ustar zuulzuul00000000000000# Copyright 2018 Ericsson # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # trait prefixes to be used after CUSTOM_ TRAIT_PREFIX_VNIC_TYPE = 'VNIC_TYPE_' TRAIT_PREFIX_PHYSNET = 'PHYSNET_' # resource classes CLASS_NET_BW_EGRESS_KBPS = 'NET_BW_EGR_KILOBIT_PER_SEC' CLASS_NET_BW_INGRESS_KBPS = 'NET_BW_IGR_KILOBIT_PER_SEC' # Optionally reported inventory parameters. Mandatory parameters like 'total' # are left out intentionally. See also: # https://docs.openstack.org/api-ref/placement # /#update-resource-provider-inventory INVENTORY_OPTIONS = set([ 'allocation_ratio', 'max_unit', 'min_unit', 'reserved', 'step_size', ]) neutron-lib-2.3.0/neutron_lib/placement/client.py0000664000175000017500000007573413641427107022141 0ustar zuulzuul00000000000000# Copyright (c) 2016 IBM # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import functools import re import time from urllib import parse import uuid import requests from keystoneauth1 import exceptions as ks_exc from keystoneauth1 import loading as keystone from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_utils import versionutils from neutron_lib._i18n import _ from neutron_lib.exceptions import placement as n_exc LOG = logging.getLogger(__name__) API_VERSION_REQUEST_HEADER = 'OpenStack-API-Version' PLACEMENT_API_WITH_MEMBER_OF = 'placement 1.3' PLACEMENT_API_WITH_NESTED_RESOURCES = 'placement 1.14' PLACEMENT_API_RETURN_PROVIDER_BODY = 'placement 1.20' PLACEMENT_API_ERROR_CODE = 'placement 1.23' PLACEMENT_API_LATEST_SUPPORTED = PLACEMENT_API_ERROR_CODE GENERATION_CONFLICT_RETRIES = 10 def _check_placement_api_available(f): """Check if the placement API is available. :param f: Function to execute. :returns: The returned value of the function f. """ @functools.wraps(f) def wrapper(self, *a, **k): try: if not self._client: self._client = self._create_client() return f(self, *a, **k) except ks_exc.http.HttpError as exc: if 400 <= exc.http_status <= 499: # NOTE(bence romsics): Placement has inconsistently formatted # error messages. Some error response bodies are JSON # formatted, seemingly machine readible objects. While others # are free format text. We have to keep the whole thing # to avoid losing information. raise n_exc.PlacementClientError( msg=exc.response.text.replace('\n', ' ')) else: raise return wrapper def _get_version(openstack_api_version): match = re.search(r"placement (?P\d+\.\d+)", openstack_api_version) return versionutils.convert_version_to_tuple(match.group('api_version')) class UUIDEncoder(jsonutils.JSONEncoder): def default(self, o): if isinstance(o, uuid.UUID): return str(o) return super(UUIDEncoder, self).default(o) class NoAuthClient(object): """Placement NoAuthClient for fullstack testing""" def __init__(self, url): self.url = url # TODO(lajoskatona): use perhaps http_connect_timeout from # keystone_authtoken group self.timeout = 5 self.retries = 2 def request(self, url, method, body=None, headers=None, **kwargs): headers = headers or {} headers.setdefault('Accept', 'application/json') # Note(lajoskatona): placement report plugin fills uuid fields with # UUID objects, and that is good for keystone, but requests goes mad # with that if we use json=body as it can't serialize UUID. # To make things worse if we give a serialized json, it will do the # jsonification again, so better to create the json here and give it # to requests with the data parameter. body = jsonutils.dumps(body, cls=UUIDEncoder) for i in range(self.retries): try: resp = requests.request( method, url, data=body, headers=headers, verify=False, timeout=self.timeout, **kwargs) return resp except requests.Timeout: LOG.exception('requests Timeout, let\'s retry it...') except requests.ConnectionError: LOG.exception('Connection Error appeared') except requests.RequestException: LOG.exception('Some really weird thing happened, let\'s ' 'retry it') time.sleep(self.timeout) # Note(lajoskatona): requests raise ConnectionError, but # PlacementReportPlugin expects keystonauth1 HttpError. raise ks_exc.HttpError def get(self, url, endpoint_filter, **kwargs): return self.request('%s%s' % (self.url, url), 'GET', **kwargs) def post(self, url, json, endpoint_filter, **kwargs): return self.request('%s%s' % (self.url, url), 'POST', body=json, **kwargs) def put(self, url, json, endpoint_filter, **kwargs): resp = self.request('%s%s' % (self.url, url), 'PUT', body=json, **kwargs) return resp def delete(self, url, endpoint_filter, **kwargs): return self.request('%s%s' % (self.url, url), 'DELETE', **kwargs) class PlacementAPIClient(object): """Client class for placement ReST API.""" def __init__(self, conf, openstack_api_version=PLACEMENT_API_LATEST_SUPPORTED): self._openstack_api_version = openstack_api_version self._target_version = _get_version(openstack_api_version) self._conf = conf self._ks_filter = {'service_type': 'placement', 'region_name': self._conf.placement.region_name, 'interface': self._conf.placement.endpoint_type} self._api_version_header = {API_VERSION_REQUEST_HEADER: self._openstack_api_version} self._client = None def _create_client(self): """Create the HTTP session accessing the placement service.""" # Flush _resource_providers and aggregates so we start from a # clean slate. self._resource_providers = {} self._provider_aggregate_map = {} # TODO(lajoskatona): perhaps not the best to override config options, # actually the abused keystoneauth1 options are: # auth_type (used for deciding for NoAuthClient) and auth_section # (used for communicating the url for the NoAuthClient) if self._conf.placement.auth_type == 'noauth': return NoAuthClient(self._conf.placement.auth_section) else: auth_plugin = keystone.load_auth_from_conf_options( self._conf, 'placement') return keystone.load_session_from_conf_options( self._conf, 'placement', auth=auth_plugin, additional_headers={'accept': 'application/json'}) def _extend_header_with_api_version(self, **kwargs): headers = kwargs.get('headers', {}) if API_VERSION_REQUEST_HEADER not in headers: if 'headers' not in kwargs: kwargs['headers'] = self._api_version_header else: kwargs['headers'].update(self._api_version_header) return kwargs def _get(self, url, **kwargs): kwargs = self._extend_header_with_api_version(**kwargs) return self._client.get(url, endpoint_filter=self._ks_filter, **kwargs) def _post(self, url, data, **kwargs): kwargs = self._extend_header_with_api_version(**kwargs) return self._client.post(url, json=data, endpoint_filter=self._ks_filter, **kwargs) def _put(self, url, data, **kwargs): kwargs = self._extend_header_with_api_version(**kwargs) return self._client.put(url, json=data, endpoint_filter=self._ks_filter, **kwargs) def _put_with_retry_for_generation_conflict( self, url, body, resource_provider_uuid, resource_provider_generation=None): if resource_provider_generation is None: # If the client's user did not supply a generation to us we dare to # retry without handing the control back to our caller. max_tries = GENERATION_CONFLICT_RETRIES else: # If the client's user supplied a generation to us we don't dare to # retry on her behalf since we don't know her intention. max_tries = 1 body['resource_provider_generation'] = resource_provider_generation for i in range(max_tries): if resource_provider_generation is None: # In the bodies of # PUT /resource_providers/{uuid}/traits # PUT /resource_providers/{uuid}/inventories # PUT /resource_providers/{uuid}/inventories/{resource_class} # resource_provider_generation happens to be at the same place. body['resource_provider_generation'] = \ self.get_resource_provider( resource_provider_uuid=resource_provider_uuid)[ 'generation'] try: return self._put(url, body).json() except ks_exc.Conflict as e: if e.response.json()[ 'errors'][0]['code'] == 'placement.concurrent_update': continue else: raise raise n_exc.PlacementResourceProviderGenerationConflict( resource_provider=resource_provider_uuid, generation=body['resource_provider_generation']) def _delete(self, url, **kwargs): kwargs = self._extend_header_with_api_version(**kwargs) return self._client.delete(url, endpoint_filter=self._ks_filter, **kwargs) @_check_placement_api_available def create_resource_provider(self, resource_provider): """Create a resource provider. :param resource_provider: The resource provider. A dict with the uuid (required), the name (required) and the parent_provider_uuid (optional). :returns: The resource provider created. """ url = '/resource_providers' rsp = self._post(url, resource_provider) if (self._target_version < _get_version(PLACEMENT_API_RETURN_PROVIDER_BODY)): return else: return rsp.json() @_check_placement_api_available def update_resource_provider(self, resource_provider): """Update the resource provider identified by uuid. :param resource_provider: The resource provider. A dict with the uuid (required), the name (required) and the parent_provider_uuid (optional). :raises PlacementResourceProviderNotFound: No such resource provider. :raises PlacementResourceProviderNameNotUnique: Conflict with another resource provider with the same name. :returns: The updated resource provider. """ url = '/resource_providers/%s' % resource_provider['uuid'] # update does not tolerate if the uuid is repeated in the body update_body = resource_provider.copy() update_body.pop('uuid') try: return self._put(url, update_body).json() except ks_exc.NotFound: raise n_exc.PlacementResourceProviderNotFound( resource_provider=resource_provider['uuid']) except ks_exc.Conflict: raise n_exc.PlacementResourceProviderNameNotUnique( name=resource_provider['name']) @_check_placement_api_available def ensure_resource_provider(self, resource_provider): """Ensure a resource provider exists by updating or creating it. :param resource_provider: The resource provider. A dict with the uuid (required), the name (required) and the parent_provider_uuid (optional). :returns: The Resource Provider updated or created. Beware, this is not an atomic operation of the API. """ try: return self.update_resource_provider( resource_provider=resource_provider) except n_exc.PlacementResourceProviderNotFound: return self.create_resource_provider(resource_provider) @_check_placement_api_available def delete_resource_provider(self, resource_provider_uuid): """Delete a resource provider. :param resource_provider_uuid: UUID of the resource provider. """ url = '/resource_providers/%s' % resource_provider_uuid self._delete(url) @_check_placement_api_available def get_resource_provider(self, resource_provider_uuid): """Get resource provider by UUID. :param resource_provider_uuid: UUID of the resource provider. :raises PlacementResourceProviderNotFound: For failure to find resource :returns: The Resource Provider matching the UUID. """ url = '/resource_providers/%s' % resource_provider_uuid try: return self._get(url).json() except ks_exc.NotFound: raise n_exc.PlacementResourceProviderNotFound( resource_provider=resource_provider_uuid) @_check_placement_api_available def list_resource_providers(self, name=None, member_of=None, resources=None, in_tree=None, uuid=None): """Get a list of resource providers. :param name: Name of the resource providers. :param member_of: List of aggregate UUID to get those resource providers that are associated with. NOTE: placement 1.3 needed. :param resources: Dictionary of resource classes and requested values. :param in_tree: UUID of a resource provider that the caller wants to limit the returned providers to those within its 'provider tree'. The returned list will contain only resource providers with the root_provider_id of the resource provider with UUID == tree_uuid. NOTE: placement 1.14 needed. :param uuid: UUID of the resource provider. :raises PlacementAPIVersionIncorrect: If placement API target version is too low :returns: A list of Resource Provider matching the filters. """ url = '/resource_providers' filters = {} if name: filters['name'] = name if member_of: needed_version = _get_version(PLACEMENT_API_WITH_MEMBER_OF) if self._target_version < needed_version: raise n_exc.PlacementAPIVersionIncorrect( current_version=self._target_version, needed_version=needed_version) filters['member_of'] = member_of if resources: filters['resources'] = resources if in_tree: needed_version = _get_version( PLACEMENT_API_WITH_NESTED_RESOURCES) if self._target_version < needed_version: raise n_exc.PlacementAPIVersionIncorrect( current_version=self._target_version, needed_version=needed_version) filters['in_tree'] = in_tree if uuid: filters['uuid'] = uuid url = '%s?%s' % (url, parse.urlencode(filters)) return self._get(url).json() @_check_placement_api_available def update_resource_provider_inventories( self, resource_provider_uuid, inventories, resource_provider_generation=None): """Replaces the set of inventory records for a resource provider. :param resource_provider_uuid: UUID of the resource provider. :param inventories: The inventories. A dict in the format (see: Placement API ref: https://goo.gl/F22mtk) {resource_class(required): {allocation_ratio(required): total(required): max_unit(required): min_unit(required): reserved(required): step_size(required): }} :param resource_provider_generation: The generation of the resource provider. Optional. :raises PlacementResourceProviderNotFound: if the resource provider is not found. :raises PlacementResourceProviderGenerationConflict: if the generation of the resource provider does not match with the server side. :returns: The updated set of inventory records. """ url = '/resource_providers/%s/inventories' % resource_provider_uuid body = { 'resource_provider_generation': resource_provider_generation, 'inventories': inventories } try: return self._put_with_retry_for_generation_conflict( url, body, resource_provider_uuid, resource_provider_generation) except ks_exc.NotFound: raise n_exc.PlacementResourceProviderNotFound( resource_provider=resource_provider_uuid) @_check_placement_api_available def delete_resource_provider_inventories(self, resource_provider_uuid): """Delete all inventory records for the resource provider. :param resource_provider_uuid: UUID of the resource provider. :raises PlacementResourceProviderNotFound: If the resource provider is not found. :returns: None. """ url = '/resource_providers/%s/inventories' % ( resource_provider_uuid) try: self._delete(url) except ks_exc.NotFound as e: if "No resource provider with uuid" in e.details: raise n_exc.PlacementResourceProviderNotFound( resource_provider=resource_provider_uuid) else: raise @_check_placement_api_available def delete_resource_provider_inventory(self, resource_provider_uuid, resource_class): """Delete inventory of the resource class for a resource provider. :param resource_provider_uuid: UUID of the resource provider. :param resource_class: The name of the resource class :raises PlacementResourceProviderNotFound: If the resource provider is not found. :raises PlacementInventoryNotFound: No inventory of class. :returns: None. """ url = '/resource_providers/%s/inventories/%s' % ( resource_provider_uuid, resource_class) try: self._delete(url) except ks_exc.NotFound as e: if "No resource provider with uuid" in e.details: raise n_exc.PlacementResourceProviderNotFound( resource_provider=resource_provider_uuid) elif "No inventory of class" in e.details: raise n_exc.PlacementInventoryNotFound( resource_provider=resource_provider_uuid, resource_class=resource_class) else: raise @_check_placement_api_available def get_inventory(self, resource_provider_uuid, resource_class): """Get resource provider inventory. :param resource_provider_uuid: UUID of the resource provider. :param resource_class: Resource class name of the inventory to be returned. :raises PlacementResourceProviderNotFound: If the resource provider is not found. :raises PlacementInventoryNotFound: For failure to find inventory for a resource provider. :returns: The inventory of the resource class as a dict. """ url = '/resource_providers/%s/inventories/%s' % ( resource_provider_uuid, resource_class) try: return self._get(url).json() except ks_exc.NotFound as e: if "No resource provider with uuid" in e.details: raise n_exc.PlacementResourceProviderNotFound( resource_provider=resource_provider_uuid) elif _("No inventory of class") in e.details: raise n_exc.PlacementInventoryNotFound( resource_provider=resource_provider_uuid, resource_class=resource_class) else: raise @_check_placement_api_available def update_resource_provider_inventory( self, resource_provider_uuid, inventory, resource_class, resource_provider_generation=None): """Update resource provider inventory. :param resource_provider_uuid: UUID of the resource provider. :param inventory: The inventory to be updated for the resource class. :param resource_class: The name of the resource class. :param resource_provider_generation: The generation of the resource provider. Optional. :raises PlacementResourceNotFound: If the resource provider or the resource class is not found. :raises PlacementResourceProviderGenerationConflict: If the resource provider generation does not match with the server side. :returns: The updated inventory of the resource class as a dict. """ url = '/resource_providers/%s/inventories/%s' % ( resource_provider_uuid, resource_class) body = inventory try: return self._put_with_retry_for_generation_conflict( url, body, resource_provider_uuid, resource_provider_generation) except ks_exc.NotFound as e: raise n_exc.PlacementResourceNotFound(url=e.url) @_check_placement_api_available def associate_aggregates(self, resource_provider_uuid, aggregates): """Associate a list of aggregates with a resource provider. :param resource_provider_uuid: UUID of the resource provider. :param aggregates: aggregates to be associated to the resource provider. :returns: All aggregates associated with the resource provider. """ url = '/resource_providers/%s/aggregates' % resource_provider_uuid return self._put(url, aggregates).json() @_check_placement_api_available def list_aggregates(self, resource_provider_uuid): """List resource provider aggregates. :param resource_provider_uuid: UUID of the resource provider. :raises PlacementAggregateNotFound: For failure to the aggregates of a resource provider. :returns: The list of aggregates together with the resource provider generation. """ url = '/resource_providers/%s/aggregates' % resource_provider_uuid try: return self._get(url).json() except ks_exc.NotFound: raise n_exc.PlacementAggregateNotFound( resource_provider=resource_provider_uuid) @_check_placement_api_available def list_traits(self): """List all traits.""" url = '/traits' return self._get(url).json() @_check_placement_api_available def get_trait(self, name): """Check if a given trait exists :param name: name of the trait to check. :raises PlacementTraitNotFound: If the trait name not found. :returns: Evaluates to True if the trait exists. """ url = '/traits/%s' % name try: return self._get(url) except ks_exc.NotFound: raise n_exc.PlacementTraitNotFound(trait=name) @_check_placement_api_available def update_trait(self, name): """Insert a single custom trait. :param name: name of the trait to create. :returns: The Response object so you may access response headers. """ url = '/traits/%s' % (name) return self._put(url, None) @_check_placement_api_available def delete_trait(self, name): """Delete the specified trait. :param name: the name of the trait to be deleted. :raises PlacementTraitNotFound: If the trait did not exist. :returns: None. """ url = '/traits/%s' % (name) try: self._delete(url) except ks_exc.NotFound: raise n_exc.PlacementTraitNotFound(trait=name) @_check_placement_api_available def update_resource_provider_traits( self, resource_provider_uuid, traits, resource_provider_generation=None): """Replace all associated traits of a resource provider. :param resource_provider_uuid: UUID of the resource provider for which to set the traits :param traits: a list of traits. :param resource_provider_generation: The generation of the resource provider. Optional. If not supplied by the caller, handle potential generation conflict by retrying the call. If supplied we assume the caller handles generation conflict. :raises PlacementResourceProviderNotFound: If the resource provider is not found. :raises PlacementTraitNotFound: If any of the specified traits are not valid. :raises PlacementResourceProviderGenerationConflict: For concurrent conflicting updates detected. :returns: The new traits of the resource provider together with the resource provider generation. """ url = '/resource_providers/%s/traits' % (resource_provider_uuid) body = { 'resource_provider_generation': resource_provider_generation, 'traits': traits } try: return self._put_with_retry_for_generation_conflict( url, body, resource_provider_uuid, resource_provider_generation) except ks_exc.NotFound: raise n_exc.PlacementResourceProviderNotFound( resource_provider=resource_provider_uuid) except ks_exc.BadRequest: raise n_exc.PlacementTraitNotFound(trait=traits) @_check_placement_api_available def list_resource_provider_traits(self, resource_provider_uuid): """List all traits associated with a resource provider :param resource_provider_uuid: UUID of the resource provider for which the traits will be listed :raises PlacementResourceProviderNotFound: If the resource provider is not found. :returns: The associated traits of the resource provider together with the resource provider generation. """ url = '/resource_providers/%s/traits' % (resource_provider_uuid) try: return self._get(url).json() except ks_exc.NotFound: raise n_exc.PlacementResourceProviderNotFound( resource_provider=resource_provider_uuid) @_check_placement_api_available def delete_resource_provider_traits(self, resource_provider_uuid): """Delete resource provider traits. :param resource_provider_uuid: The UUID of the resource provider for which to delete all the traits. :raises PlacementResourceProviderNotFound: If the resource provider is not found. :returns: None. """ url = '/resource_providers/%s/traits' % (resource_provider_uuid) try: self._delete(url) except ks_exc.NotFound: raise n_exc.PlacementResourceProviderNotFound( resource_provider=resource_provider_uuid) @_check_placement_api_available def list_resource_classes(self): """List resource classes""" url = '/resource_classes' return self._get(url).json() @_check_placement_api_available def get_resource_class(self, name): """Show resource class. :param name: The name of the resource class to show :raises PlacementResourceClassNotFound: If the resource class is not found. :returns: The name of resource class and its set of links. """ url = '/resource_classes/%s' % (name) try: return self._get(url).json() except ks_exc.NotFound: raise n_exc.PlacementResourceClassNotFound(resource_class=name) @_check_placement_api_available def create_resource_class(self, name): """Create a custom resource class :param name: the name of the resource class :returns: None. """ url = '/resource_classes' body = {'name': name} self._post(url, body) @_check_placement_api_available def update_resource_class(self, name): """Create or validate the existence of the resource custom class. :param name: the name of the resource class to be updated or validated :returns: None. """ url = '/resource_classes/%s' % name self._put(url, None) @_check_placement_api_available def delete_resource_class(self, name): """Delete a custom resource class. :param name: The name of the resource class to be deleted. :raises PlacementResourceClassNotFound: If the resource class is not found. :returns: None. """ url = '/resource_classes/%s' % (name) try: self._delete(url) except ks_exc.NotFound: raise n_exc.PlacementResourceClassNotFound(resource_class=name) neutron-lib-2.3.0/neutron_lib/placement/utils.py0000664000175000017500000002120013641427107021776 0ustar zuulzuul00000000000000# Copyright 2018 Ericsson # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import uuid import os_traits from oslo_log import log as logging from neutron_lib._i18n import _ from neutron_lib import constants as const from neutron_lib.placement import constants as place_const LOG = logging.getLogger(__name__) def physnet_trait(physnet): """A Placement trait name to represent being connected to a physnet. :param physnet: The physnet name. :returns: The trait name representing the physnet. """ return os_traits.normalize_name('%s%s' % ( place_const.TRAIT_PREFIX_PHYSNET, physnet)) def vnic_type_trait(vnic_type): """A Placement trait name to represent support for a vnic_type. :param physnet: The vnic_type. :returns: The trait name representing the vnic_type. """ return os_traits.normalize_name('%s%s' % ( place_const.TRAIT_PREFIX_VNIC_TYPE, vnic_type)) def six_uuid5(namespace, name): """A uuid.uuid5 variant that takes utf-8 'name' both in Python 2 and 3. :param namespace: A UUID object used as a namespace in the generation of a v5 UUID. :param name: Any string (either bytecode or unicode) used as a name in the generation of a v5 UUID. :returns: A v5 UUID object. """ # NOTE(bence romsics): # uuid.uuid5() behaves seemingly consistently but still incompatibly # different in cPython 2 and 3. Both expects the 'name' parameter to have # the type of the default string literal in each language version. # That is: # The cPython 2 variant expects a byte string. # The cPython 3 variant expects a unicode string. # Which types are called respectively 'str' and 'str' for the sake of # confusion. But the sha1() hash inside uuid5() always needs a byte string, # so we have to treat the two versions asymmetrically. See also: # # cPython 2.7: # https://github.com/python/cpython/blob # /ea9a0994cd0f4bd37799b045c34097eb21662b3d/Lib/uuid.py#L603 # cPython 3.6: # https://github.com/python/cpython/blob # /e9e2fd75ccbc6e9a5221cf3525e39e9d042d843f/Lib/uuid.py#L628 return uuid.uuid5(namespace=namespace, name=name) # NOTE(bence romsics): The spec said: "Agent resource providers shall # be identified by their already existing Neutron agent UUIDs [...]" # # https://review.opendev.org/#/c/508149/14/specs/rocky # /minimum-bandwidth-allocation-placement-api.rst@465 # # However we forgot that agent UUIDs are not stable through a few # admin operations like after a manual 'openstack network agent # delete'. Here we make up a stable UUID instead. def agent_resource_provider_uuid(namespace, host): """Generate a stable UUID for an agent. :param namespace: A UUID object identifying a mechanism driver (including its agent). :param host: The hostname of the agent. :returns: A unique and stable UUID identifying an agent. """ return six_uuid5(namespace=namespace, name=host) def device_resource_provider_uuid(namespace, host, device, separator=':'): """Generate a stable UUID for a physical network device. :param namespace: A UUID object identifying a mechanism driver (including its agent). :param host: The hostname of the agent. :param device: A host-unique name of the physical network device. :param separator: A string used in assembling a name for uuid5(). Choose one that cannot occur either in 'host' or 'device'. Optional. :returns: A unique and stable UUID identifying a physical network device. """ name = separator.join([host, device]) return six_uuid5(namespace=namespace, name=name) def _parse_bandwidth_value(bw_str): """Parse the config string of a bandwidth value to an integer. :param bw_str: A decimal string represantation of an integer, allowing the empty string. :raises: ValueError on invalid input. :returns: The bandwidth value as an integer or None if not set in config. """ try: bw = None if bw_str: bw = int(bw_str) if bw < 0: raise ValueError() except ValueError: raise ValueError(_( 'Cannot parse resource_provider_bandwidths. ' 'Expected: non-negative integer bandwidth value, got: %s') % bw_str) return bw def parse_rp_bandwidths(bandwidths): """Parse and validate config option: resource_provider_bandwidths. Input in the config: resource_provider_bandwidths = eth0:10000:10000,eth1::10000,eth2::,eth3 Input here: ['eth0:10000:10000', 'eth1::10000', 'eth2::', 'eth3'] Output: { 'eth0': {'egress': 10000, 'ingress': 10000}, 'eth1': {'egress': None, 'ingress': 10000}, 'eth2': {'egress': None, 'ingress': None}, 'eth3': {'egress': None, 'ingress': None}, } :param bandwidths: The list of 'interface:egress:ingress' bandwidth config options as pre-parsed by oslo_config. :raises: ValueError on invalid input. :returns: The fully parsed bandwidth config as a dict of dicts. """ rv = {} for bandwidth in bandwidths: if ':' not in bandwidth: bandwidth += '::' try: device, egress_str, ingress_str = bandwidth.split(':') except ValueError: raise ValueError(_( 'Cannot parse resource_provider_bandwidths. ' 'Expected: DEVICE:EGRESS:INGRESS, got: %s') % bandwidth) if device in rv: raise ValueError(_( 'Cannot parse resource_provider_bandwidths. ' 'Same device listed multiple times: %s') % device) egress = _parse_bandwidth_value(egress_str) ingress = _parse_bandwidth_value(ingress_str) rv[device] = { const.EGRESS_DIRECTION: egress, const.INGRESS_DIRECTION: ingress, } return rv def parse_rp_inventory_defaults(inventory_defaults): """Parse and validate config option: parse_rp_inventory_defaults. Cast the dict values to the proper numerical types. Input in the config: resource_provider_inventory_defaults = allocation_ratio:1.0,min_unit:1 Input here: { 'allocation_ratio': '1.0', 'min_unit': '1', } Output here: { 'allocation_ratio': 1.0, 'min_unit': 1, } :param inventory_defaults: The dict of inventory parameters and values (as strings) as pre-parsed by oslo_config. :raises: ValueError on invalid input. :returns: The fully parsed inventory parameters and values (as numerical values) as a dict. """ unexpected_options = (set(inventory_defaults.keys()) - place_const.INVENTORY_OPTIONS) if unexpected_options: raise ValueError(_( 'Cannot parse inventory_defaults. Unexpected options: %s') % ','.join(unexpected_options)) # allocation_ratio is a float try: if 'allocation_ratio' in inventory_defaults: inventory_defaults['allocation_ratio'] = float( inventory_defaults['allocation_ratio']) if inventory_defaults['allocation_ratio'] < 0: raise ValueError() except ValueError: raise ValueError(_( 'Cannot parse inventory_defaults.allocation_ratio. ' 'Expected: non-negative float, got: %s') % inventory_defaults['allocation_ratio']) # the others are ints for key in ('min_unit', 'max_unit', 'reserved', 'step_size'): try: if key in inventory_defaults: inventory_defaults[key] = int(inventory_defaults[key]) if inventory_defaults[key] < 0: raise ValueError() except ValueError: raise ValueError(_( 'Cannot parse inventory_defaults.%(key)s. ' 'Expected: non-negative int, got: %(got)s') % { 'key': key, 'got': inventory_defaults[key], }) return inventory_defaults neutron-lib-2.3.0/neutron_lib/placement/__init__.py0000664000175000017500000000000013641427107022370 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/plugins/0000775000175000017500000000000013641427200017774 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/plugins/constants.py0000664000175000017500000000216513641427107022374 0ustar zuulzuul00000000000000# All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # Well-known service type constants: FIREWALL = "FIREWALL" VPN = "VPN" METERING = "METERING" FLAVORS = "FLAVORS" QOS = "QOS" CORE = 'CORE' L3 = 'L3_ROUTER_NAT' LOG_API = "LOGGING" PORTFORWARDING = "PORTFORWARDING" FLOATINGIPPOOL = "FLOATINGIPPOOL" NETWORK_SEGMENT_RANGE = "NETWORK_SEGMENT_RANGE" CONNTRACKHELPER = "CONNTRACKHELPER" # TODO(johnsom) Remove after these stop being used. Neutron-LBaaS is now # retired (train) and these should no longer be necessary. LOADBALANCER = "LOADBALANCER" LOADBALANCERV2 = "LOADBALANCERV2" neutron-lib-2.3.0/neutron_lib/plugins/utils.py0000664000175000017500000003500213641427107021514 0ustar zuulzuul00000000000000# Copyright 2013 Cisco Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import collections import contextlib import hashlib from oslo_config import cfg from oslo_log import log as logging from oslo_utils import encodeutils from oslo_utils import excutils from webob import exc as web_exc from neutron_lib._i18n import _ from neutron_lib.api import attributes from neutron_lib.api.definitions import network as net_apidef from neutron_lib.api.definitions import port as port_apidef from neutron_lib.api.definitions import portbindings as pb from neutron_lib.api.definitions import portbindings_extended as pb_ext from neutron_lib.api.definitions import subnet as subnet_apidef from neutron_lib import constants from neutron_lib import exceptions LOG = logging.getLogger(__name__) INTERFACE_HASH_LEN = 6 def _is_valid_range(val, min, max): try: # NOTE: use str value to not permit booleans val = int(str(val)) return min <= val <= max except (ValueError, TypeError): return False def is_valid_vlan_tag(vlan): """Validate a VLAN tag. :param vlan: The VLAN tag to validate. :returns: True if vlan is a number that is a valid VLAN tag. """ return _is_valid_range( vlan, constants.MIN_VLAN_TAG, constants.MAX_VLAN_TAG) def is_valid_gre_id(gre_id): """Validate a GRE ID. :param gre_id: The GRE ID to validate. :returns: True if gre_id is a number that's a valid GRE ID. """ return _is_valid_range( gre_id, constants.MIN_GRE_ID, constants.MAX_GRE_ID) def is_valid_vxlan_vni(vni): """Validate a VXLAN VNI. :param vni: The VNI to validate. :returns: True if vni is a number that's a valid VXLAN VNI. """ return _is_valid_range( vni, constants.MIN_VXLAN_VNI, constants.MAX_VXLAN_VNI) def is_valid_geneve_vni(vni): """Validate a Geneve VNI :param vni: The VNI to validate. :returns: True if vni is a number that's a valid Geneve VNI. """ return _is_valid_range( vni, constants.MIN_GENEVE_VNI, constants.MAX_GENEVE_VNI) _TUNNEL_MAPPINGS = { constants.TYPE_GRE: is_valid_gre_id, constants.TYPE_VXLAN: is_valid_vxlan_vni, constants.TYPE_GENEVE: is_valid_geneve_vni } def verify_tunnel_range(tunnel_range, tunnel_type): """Verify a given tunnel range is valid given it's tunnel type. Existing validation is done for GRE, VXLAN and GENEVE types as per _TUNNEL_MAPPINGS. :param tunnel_range: An iterable who's 0 index is the min tunnel range and who's 1 index is the max tunnel range. :param tunnel_type: The tunnel type of the range. :returns: None if the tunnel_range is valid. :raises: NetworkTunnelRangeError if tunnel_range is invalid. """ if tunnel_type in _TUNNEL_MAPPINGS: for ident in tunnel_range: if not _TUNNEL_MAPPINGS[tunnel_type](ident): raise exceptions.NetworkTunnelRangeError( tunnel_range=tunnel_range, error=_("%(id)s is not a valid %(type)s identifier") % {'id': ident, 'type': tunnel_type}) if tunnel_range[1] < tunnel_range[0]: raise exceptions.NetworkTunnelRangeError( tunnel_range=tunnel_range, error=_("End of tunnel range is less " "than start of tunnel range")) def _raise_invalid_tag(vlan_str, vlan_range): """Raise an exception for invalid tag.""" raise exceptions.NetworkVlanRangeError( vlan_range=vlan_range, error=_("%s is not a valid VLAN tag") % vlan_str) def verify_vlan_range(vlan_range): """Verify a VLAN range is valid. :param vlan_range: An iterable who's 0 index is the min tunnel range and who's 1 index is the max tunnel range. :returns: None if the vlan_range is valid. :raises: NetworkVlanRangeError if vlan_range is not valid. """ for vlan_tag in vlan_range: if not is_valid_vlan_tag(vlan_tag): _raise_invalid_tag(str(vlan_tag), vlan_range) if vlan_range[1] < vlan_range[0]: raise exceptions.NetworkVlanRangeError( vlan_range=vlan_range, error=_("End of VLAN range is less than start of VLAN range")) def parse_network_vlan_range(network_vlan_range): """Parse a well formed network VLAN range string. The network VLAN range string has the format: network[:vlan_begin:vlan_end] :param network_vlan_range: The network VLAN range string to parse. :returns: A tuple who's 1st element is the network name and 2nd element is the VLAN range parsed from network_vlan_range. :raises: NetworkVlanRangeError if network_vlan_range is malformed. PhysicalNetworkNameError if network_vlan_range is missing a network name. """ entry = network_vlan_range.strip() if ':' in entry: if entry.count(':') != 2: raise exceptions.NetworkVlanRangeError( vlan_range=entry, error=_("Need exactly two values for VLAN range")) network, vlan_min, vlan_max = entry.split(':') if not network: raise exceptions.PhysicalNetworkNameError() try: vlan_min = int(vlan_min) except ValueError: _raise_invalid_tag(vlan_min, entry) try: vlan_max = int(vlan_max) except ValueError: _raise_invalid_tag(vlan_max, entry) vlan_range = (vlan_min, vlan_max) verify_vlan_range(vlan_range) return network, vlan_range else: return entry, None def parse_network_vlan_ranges(network_vlan_ranges_cfg_entries): """Parse a list of well formed network VLAN range string. Behaves like parse_network_vlan_range, but parses a list of network VLAN strings into an ordered dict. :param network_vlan_ranges_cfg_entries: The list of network VLAN strings to parse. :returns: An OrderedDict who's keys are network names and values are the list of VLAN ranges parsed. :raises: See parse_network_vlan_range. """ networks = collections.OrderedDict() for entry in network_vlan_ranges_cfg_entries: network, vlan_range = parse_network_vlan_range(entry) if vlan_range: networks.setdefault(network, []).append(vlan_range) else: networks.setdefault(network, []) return networks def in_pending_status(status): """Return True if status is a form of pending""" return status in (constants.PENDING_CREATE, constants.PENDING_UPDATE, constants.PENDING_DELETE) @contextlib.contextmanager def delete_port_on_error(core_plugin, context, port_id): """A decorator that deletes a port upon exception. This decorator can be used to wrap a block of code that should delete a port if an exception is raised during the block's execution. :param core_plugin: The core plugin implementing the delete_port method to call. :param context: The context. :param port_id: The port's ID. :returns: None """ try: yield except Exception: with excutils.save_and_reraise_exception(): try: core_plugin.delete_port(context, port_id, l3_port_check=False) except exceptions.PortNotFound: LOG.debug("Port %s not found", port_id) except Exception: LOG.exception("Failed to delete port: %s", port_id) @contextlib.contextmanager def update_port_on_error(core_plugin, context, port_id, revert_value): """A decorator that updates a port upon exception. This decorator can be used to wrap a block of code that should update a port if an exception is raised during the block's execution. :param core_plugin: The core plugin implementing the update_port method to call. :param context: The context. :param port_id: The port's ID. :param revert_value: The value to revert on the port object. :returns: None """ try: yield except Exception: with excutils.save_and_reraise_exception(): try: core_plugin.update_port(context, port_id, {'port': revert_value}) except Exception: LOG.exception("Failed to update port: %s", port_id) def get_interface_name(name, prefix='', max_len=constants.DEVICE_NAME_MAX_LEN): """Construct an interface name based on the prefix and name. The interface name can not exceed the maximum length passed in. Longer names are hashed to help ensure uniqueness. """ requested_name = prefix + name if len(requested_name) <= max_len: return requested_name # We can't just truncate because interfaces may be distinguished # by an ident at the end. A hash over the name should be unique. # Leave part of the interface name on for easier identification if (len(prefix) + INTERFACE_HASH_LEN) > max_len: raise ValueError(_("Too long prefix provided. New name would exceed " "given length for an interface name.")) namelen = max_len - len(prefix) - INTERFACE_HASH_LEN hashed_name = hashlib.sha1(encodeutils.to_utf8(name)) new_name = ('%(prefix)s%(truncated)s%(hash)s' % {'prefix': prefix, 'truncated': name[0:namelen], 'hash': hashed_name.hexdigest()[0:INTERFACE_HASH_LEN]}) LOG.info("The requested interface name %(requested_name)s exceeds the " "%(limit)d character limitation. It was shortened to " "%(new_name)s to fit.", {'requested_name': requested_name, 'limit': max_len, 'new_name': new_name}) return new_name def _fixup_res_dict(context, attr_name, res_dict, check_allow_post=True): attr_info = attributes.RESOURCES[attr_name] attr_ops = attributes.AttributeInfo(attr_info) try: attr_ops.populate_project_id(context, res_dict, True) attributes.populate_project_info(attr_info) attr_ops.verify_attributes(res_dict) except web_exc.HTTPBadRequest as e: # convert webob exception into ValueError as these functions are # for internal use. webob exception doesn't make sense. raise ValueError(e.detail) attr_ops.fill_post_defaults(res_dict, check_allow_post=check_allow_post) attr_ops.convert_values(res_dict) return res_dict def create_network(core_plugin, context, net, check_allow_post=True): net_data = _fixup_res_dict(context, net_apidef.COLLECTION_NAME, net.get(net_apidef.RESOURCE_NAME, {}), check_allow_post=check_allow_post) return core_plugin.create_network( context, {net_apidef.RESOURCE_NAME: net_data}) def create_subnet(core_plugin, context, subnet, check_allow_post=True): subnet_data = _fixup_res_dict(context, subnet_apidef.COLLECTION_NAME, subnet.get(subnet_apidef.RESOURCE_NAME, {}), check_allow_post=check_allow_post) return core_plugin.create_subnet( context, {subnet_apidef.RESOURCE_NAME: subnet_data}) def create_port(core_plugin, context, port, check_allow_post=True): port_data = _fixup_res_dict(context, port_apidef.COLLECTION_NAME, port.get(port_apidef.RESOURCE_NAME, {}), check_allow_post=check_allow_post) return core_plugin.create_port( context, {port_apidef.RESOURCE_NAME: port_data}) def get_deployment_physnet_mtu(): """Retrieves global physical network MTU setting. Plugins should use this function to retrieve the MTU set by the operator that is equal to or less than the MTU of their nodes' physical interfaces. Note that it is the responsibility of the plugin to deduct the value of any encapsulation overhead required before advertising it to VMs. Note that this function depends on the global_physnet_mtu config option being registered in the global CONF. :returns: The global_physnet_mtu from the global CONF. """ return cfg.CONF.global_physnet_mtu def get_port_binding_by_status_and_host(bindings, status, host='', raise_if_not_found=False, port_id=None): """Returns from an iterable the binding with the specified status and host. The input iterable can contain zero or one binding in status ACTIVE and zero or many bindings in status INACTIVE. As a consequence, to unequivocally retrieve an inactive binding, the caller must specify a non empty value for host. If host is the empty string, the first binding satisfying the specified status will be returned. If no binding is found with the specified status and host, None is returned or PortBindingNotFound is raised if raise_if_not_found is True :param bindings: An iterable containing port bindings :param status: The status of the port binding to return. Possible values are ACTIVE or INACTIVE as defined in :file:`neutron_lib/constants.py`. :param host: str representing the host of the binding to return. :param raise_if_not_found: If a binding is not found and this parameter is True, a PortBindingNotFound exception is raised :param port_id: The id of the binding's port :returns: The searched for port binding or None if it is not found :raises: PortBindingNotFound if the binding is not found and raise_if_not_found is True """ for binding in bindings: if binding[pb_ext.STATUS] == status: if not host or binding[pb_ext.HOST] == host: return binding if raise_if_not_found: raise exceptions.PortBindingNotFound(port_id=port_id, host=host) def can_port_be_bound_to_virtual_bridge(port): """Returns if port can be bound to a virtual bridge (e.g.: LB, OVS) :param port: (dict) A port dictionary. :returns: True if the port VNIC type is 'normal'; False in any other case. """ return port[pb.VNIC_TYPE] == pb.VNIC_NORMAL neutron-lib-2.3.0/neutron_lib/plugins/ml2/0000775000175000017500000000000013641427200020466 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/plugins/ml2/api.py0000664000175000017500000013375413641427107021634 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import abc # The following keys are used in the segment dictionaries passed via # the driver API. ID = 'id' NETWORK_TYPE = 'network_type' PHYSICAL_NETWORK = 'physical_network' SEGMENTATION_ID = 'segmentation_id' MTU = 'mtu' NETWORK_ID = 'network_id' # The following keys are used in the binding level dictionaries # available via the binding_levels and original_binding_levels # PortContext properties. BOUND_DRIVER = 'bound_driver' BOUND_SEGMENT = 'bound_segment' class MechanismDriver(object, metaclass=abc.ABCMeta): """Define stable abstract interface for ML2 mechanism drivers. A mechanism driver is called on the creation, update, and deletion of networks and ports. For every event, there are two methods that get called - one within the database transaction (method suffix of _precommit), one right afterwards (method suffix of _postcommit). Exceptions raised by methods called inside the transaction can rollback, but should not make any blocking calls (for example, REST requests to an outside controller). Methods called after transaction commits can make blocking external calls, though these will block the entire process. Exceptions raised in calls after the transaction commits may cause the associated resource to be deleted. Because rollback outside of the transaction is not done in the update network/port case, all data validation must be done within methods that are part of the database transaction. """ # Used in generating resource provider UUIDs for physical network # interfaces. Each mechanism driver supporting Placement should have its # own UUID v5 namespace (which is a UUID v1 in turn). When set to a # concrete value use a uuid.UUID() object, not the string format. # It will be used when hashing RP UUIDs from: # (mech driver namespace, hostname, physical bridge/interface name) # When needed generate new namespace UUIDs by: # python -c 'import uuid ; print uuid.uuid1()' # See also: # https://tools.ietf.org/html/rfc4122 # https://stackoverflow.com/a/7816117 resource_provider_uuid5_namespace = None @abc.abstractmethod def initialize(self): """Perform driver initialization. Called after all drivers have been loaded and the database has been initialized. No abstract methods defined below will be called prior to this method being called. """ pass def create_network_precommit(self, context): """Allocate resources for a new network. :param context: NetworkContext instance describing the new network. Create a new network, allocating resources as necessary in the database. Called inside transaction context on session. Call cannot block. Raising an exception will result in a rollback of the current transaction. """ pass def create_network_postcommit(self, context): """Create a network. :param context: NetworkContext instance describing the new network. Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will cause the deletion of the resource. """ pass def update_network_precommit(self, context): """Update resources of a network. :param context: NetworkContext instance describing the new state of the network, as well as the original state prior to the update_network call. Update values of a network, updating the associated resources in the database. Called inside transaction context on session. Raising an exception will result in rollback of the transaction. update_network_precommit is called for all changes to the network state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about. """ pass def update_network_postcommit(self, context): """Update a network. :param context: NetworkContext instance describing the new state of the network, as well as the original state prior to the update_network call. Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will cause the deletion of the resource. update_network_postcommit is called for all changes to the network state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about. """ pass def delete_network_precommit(self, context): """Delete resources for a network. :param context: NetworkContext instance describing the current state of the network, prior to the call to delete it. Delete network resources previously allocated by this mechanism driver for a network. Called inside transaction context on session. Runtime errors are not expected, but raising an exception will result in rollback of the transaction. """ pass def delete_network_postcommit(self, context): """Delete a network. :param context: NetworkContext instance describing the current state of the network, prior to the call to delete it. Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Runtime errors are not expected, and will not prevent the resource from being deleted. """ pass def create_subnet_precommit(self, context): """Allocate resources for a new subnet. :param context: SubnetContext instance describing the new subnet. Create a new subnet, allocating resources as necessary in the database. Called inside transaction context on session. Call cannot block. Raising an exception will result in a rollback of the current transaction. """ pass def create_subnet_postcommit(self, context): """Create a subnet. :param context: SubnetContext instance describing the new subnet. Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will cause the deletion of the resource. """ pass def update_subnet_precommit(self, context): """Update resources of a subnet. :param context: SubnetContext instance describing the new state of the subnet, as well as the original state prior to the update_subnet call. Update values of a subnet, updating the associated resources in the database. Called inside transaction context on session. Raising an exception will result in rollback of the transaction. update_subnet_precommit is called for all changes to the subnet state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about. """ pass def update_subnet_postcommit(self, context): """Update a subnet. :param context: SubnetContext instance describing the new state of the subnet, as well as the original state prior to the update_subnet call. Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will cause the deletion of the resource. update_subnet_postcommit is called for all changes to the subnet state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about. """ pass def delete_subnet_precommit(self, context): """Delete resources for a subnet. :param context: SubnetContext instance describing the current state of the subnet, prior to the call to delete it. Delete subnet resources previously allocated by this mechanism driver for a subnet. Called inside transaction context on session. Runtime errors are not expected, but raising an exception will result in rollback of the transaction. """ pass def delete_subnet_postcommit(self, context): """Delete a subnet. :param context: SubnetContext instance describing the current state of the subnet, prior to the call to delete it. Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Runtime errors are not expected, and will not prevent the resource from being deleted. """ pass def create_port_precommit(self, context): """Allocate resources for a new port. :param context: PortContext instance describing the port. Create a new port, allocating resources as necessary in the database. Called inside transaction context on session. Call cannot block. Raising an exception will result in a rollback of the current transaction. """ pass def create_port_postcommit(self, context): """Create a port. :param context: PortContext instance describing the port. Called after the transaction completes. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will result in the deletion of the resource. """ pass def update_port_precommit(self, context): """Update resources of a port. :param context: PortContext instance describing the new state of the port, as well as the original state prior to the update_port call. Called inside transaction context on session to complete a port update as defined by this mechanism driver. Raising an exception will result in rollback of the transaction. update_port_precommit is called for all changes to the port state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about. """ pass def update_port_postcommit(self, context): """Update a port. :param context: PortContext instance describing the new state of the port, as well as the original state prior to the update_port call. Called after the transaction completes. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will result in the deletion of the resource. update_port_postcommit is called for all changes to the port state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about. """ pass def delete_port_precommit(self, context): """Delete resources of a port. :param context: PortContext instance describing the current state of the port, prior to the call to delete it. Called inside transaction context on session. Runtime errors are not expected, but raising an exception will result in rollback of the transaction. """ pass def delete_port_postcommit(self, context): """Delete a port. :param context: PortContext instance describing the current state of the port, prior to the call to delete it. Called after the transaction completes. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Runtime errors are not expected, and will not prevent the resource from being deleted. """ pass def bind_port(self, context): """Attempt to bind a port. :param context: PortContext instance describing the port This method is called outside any transaction to attempt to establish a port binding using this mechanism driver. Bindings may be created at each of multiple levels of a hierarchical network, and are established from the top level downward. At each level, the mechanism driver determines whether it can bind to any of the network segments in the context.segments_to_bind property, based on the value of the context.host property, any relevant port or network attributes, and its own knowledge of the network topology. At the top level, context.segments_to_bind contains the static segments of the port's network. At each lower level of binding, it contains static or dynamic segments supplied by the driver that bound at the level above. If the driver is able to complete the binding of the port to any segment in context.segments_to_bind, it must call context.set_binding with the binding details. If it can partially bind the port, it must call context.continue_binding with the network segments to be used to bind at the next lower level. If the binding results are committed after bind_port returns, they will be seen by all mechanism drivers as update_port_precommit and update_port_postcommit calls. But if some other thread or process concurrently binds or updates the port, these binding results will not be committed, and update_port_precommit and update_port_postcommit will not be called on the mechanism drivers with these results. Because binding results can be discarded rather than committed, drivers should avoid making persistent state changes in bind_port, or else must ensure that such state changes are eventually cleaned up. Implementing this method explicitly declares the mechanism driver as having the intention to bind ports. This is inspected by the QoS service to identify the available QoS rules you can use with ports. """ pass @property def _supports_port_binding(self): return self.__class__.bind_port != MechanismDriver.bind_port def check_vlan_transparency(self, context): """Check if the network supports vlan transparency. :param context: NetworkContext instance describing the network. Check if the network supports vlan transparency or not. """ pass def get_workers(self): """Get any NeutronWorker instances that should have their own process Any driver that needs to run processes separate from the API or RPC workers, can return a sequence of NeutronWorker instances. """ return () @classmethod def is_host_filtering_supported(cls): return (cls.filter_hosts_with_segment_access != MechanismDriver.filter_hosts_with_segment_access) def filter_hosts_with_segment_access( self, context, segments, candidate_hosts, agent_getter): """Filter hosts with access to at least one segment. :returns: a set with a subset of candidate_hosts. A driver can overload this method to return a subset of candidate_hosts with the ones with access to at least one segment. Default implementation returns all hosts to disable filtering (backward compatibility). """ return candidate_hosts def responsible_for_ports_allocation(self, context): """Is responsible for a port's resource provider? :param context: PortContext instance describing the port :returns: True for responsible, False for not responsible For ports having an allocation in Placement (as expressed in the port's binding:profile.allocation) decide while binding if this mechanism driver is responsible for the physical network interface represented by the resource provider in Placement. Find the resource provider UUID in context.current['binding:profile']['allocation']. Drivers wanting to support resource allocations for ports in Placement (eg. wanting to guarantee some minimum bandwidth) must implement this method. Default implementation returns False (backward compatibility). """ return False @staticmethod def provider_network_attribute_updates_supported(): """Returns the provider network attributes that can be updated Possible values: neutron_lib.api.definitions.provider_net.ATTRIBUTES :returns: (list) provider network attributes that can be updated in a live network using this driver. """ return [] class _TypeDriverBase(object, metaclass=abc.ABCMeta): @abc.abstractmethod def get_type(self): """Get driver's network type. :returns: network_type value handled by this driver """ pass @abc.abstractmethod def initialize(self): """Perform driver initialization. Called after all drivers have been loaded and the database has been initialized. No abstract methods defined below will be called prior to this method being called. """ pass @abc.abstractmethod def is_partial_segment(self, segment): """Return True if segment is a partially specified segment. :param segment: segment dictionary :returns: boolean """ @abc.abstractmethod def validate_provider_segment(self, segment): """Validate attributes of a provider network segment. :param segment: segment dictionary using keys defined above :raises: neutron_lib.exceptions.InvalidInput if invalid Called outside transaction context to validate the provider attributes for a provider network segment. Raise InvalidInput if: - any required attribute is missing - any prohibited or unrecognized attribute is present - any attribute value is not valid The network_type attribute is present in segment, but need not be validated. """ pass @abc.abstractmethod def get_mtu(self, physical): """Get driver's network MTU. :returns: mtu maximum transmission unit Returns the mtu for the network based on the config values and the network type. """ pass class TypeDriver(_TypeDriverBase, metaclass=abc.ABCMeta): """Define abstract interface for ML2 type drivers. ML2 type drivers each support a specific network_type for provider and/or tenant network segments. Type drivers must implement this abstract interface, which defines the API by which the plugin uses the driver to manage the persistent type-specific resource allocation state associated with network segments of that type. Network segments are represented by segment dictionaries using the NETWORK_TYPE, PHYSICAL_NETWORK, and SEGMENTATION_ID keys defined above, corresponding to the provider attributes. Future revisions of the TypeDriver API may add additional segment dictionary keys. Attributes not applicable for a particular network_type may either be excluded or stored as None. TypeDriver passes session as argument for: - reserve_provider_segment - allocate_tenant_segment - release_segment - get_allocation """ @abc.abstractmethod def reserve_provider_segment(self, session, segment, filters=None): """Reserve resource associated with a provider network segment. :param session: database session :param segment: segment dictionary :param filters: a dictionary that is used as search criteria :returns: segment dictionary Called inside transaction context on session to reserve the type-specific resource for a provider network segment. The segment dictionary passed in was returned by a previous validate_provider_segment() call. """ pass @abc.abstractmethod def allocate_tenant_segment(self, session, filters=None): """Allocate resource for a new tenant network segment. :param session: database session :param filters: a dictionary that is used as search criteria :returns: segment dictionary using keys defined above Called inside transaction context on session to allocate a new tenant network, typically from a type-specific resource pool. If successful, return a segment dictionary describing the segment. If tenant network segment cannot be allocated (i.e. tenant networks not supported or resource pool is exhausted), return None. """ pass @abc.abstractmethod def release_segment(self, session, segment): """Release network segment. :param session: database session :param segment: segment dictionary using keys defined above Called inside transaction context on session to release a tenant or provider network's type-specific resource. Runtime errors are not expected, but raising an exception will result in rollback of the transaction. """ pass class ML2TypeDriver(_TypeDriverBase, metaclass=abc.ABCMeta): """Define abstract interface for ML2 type drivers. ML2 type drivers each support a specific network_type for provider and/or tenant network segments. Type drivers must implement this abstract interface, which defines the API by which the plugin uses the driver to manage the persistent type-specific resource allocation state associated with network segments of that type. Network segments are represented by segment dictionaries using the NETWORK_TYPE, PHYSICAL_NETWORK, and SEGMENTATION_ID keys defined above, corresponding to the provider attributes. Future revisions of the TypeDriver API may add additional segment dictionary keys. Attributes not applicable for a particular network_type may either be excluded or stored as None. ML2TypeDriver passes context as argument for: - reserve_provider_segment - allocate_tenant_segment - release_segment - get_allocation """ @abc.abstractmethod def reserve_provider_segment(self, context, segment, filters=None): """Reserve resource associated with a provider network segment. :param context: instance of neutron context with DB session :param segment: segment dictionary :param filters: a dictionary that is used as search criteria :returns: segment dictionary Called inside transaction context on session to reserve the type-specific resource for a provider network segment. The segment dictionary passed in was returned by a previous validate_provider_segment() call. """ pass @abc.abstractmethod def allocate_tenant_segment(self, context, filters=None): """Allocate resource for a new tenant network segment. :param context: instance of neutron context with DB session :param filters: a dictionary that is used as search criteria :returns: segment dictionary using keys defined above Called inside transaction context on session to allocate a new tenant network, typically from a type-specific resource pool. If successful, return a segment dictionary describing the segment. If tenant network segment cannot be allocated (i.e. tenant networks not supported or resource pool is exhausted), return None. """ pass @abc.abstractmethod def release_segment(self, context, segment): """Release network segment. :param context: instance of neutron context with DB session :param segment: segment dictionary using keys defined above Called inside transaction context on session to release a tenant or provider network's type-specific resource. Runtime errors are not expected, but raising an exception will result in rollback of the transaction. """ pass @abc.abstractmethod def initialize_network_segment_range_support(self): """Perform driver network segment range initialization. Called during the initialization of the ``network-segment-range`` service plugin if enabled, after all drivers have been loaded and the database has been initialized. This reloads the `default` network segment ranges when Neutron server starts/restarts. """ pass @abc.abstractmethod def update_network_segment_range_allocations(self): """Update driver network segment range allocations. This syncs the driver segment allocations when network segment ranges have been created, updated or deleted. """ pass class NetworkContext(object, metaclass=abc.ABCMeta): """Context passed to MechanismDrivers for changes to network resources. A NetworkContext instance wraps a network resource. It provides helper methods for accessing other relevant information. Results from expensive operations are cached so that other MechanismDrivers can freely access the same information. """ @abc.abstractproperty def current(self): """Return the network in its current configuration. Return the network, as defined by NeutronPluginBaseV2. create_network and all extensions in the ml2 plugin, with all its properties 'current' at the time the context was established. """ pass @abc.abstractproperty def original(self): """Return the network in its original configuration. Return the network, with all its properties set to their original values prior to a call to update_network. Method is only valid within calls to update_network_precommit and update_network_postcommit. """ pass @abc.abstractproperty def network_segments(self): """Return the segments associated with this network resource.""" pass class SubnetContext(object, metaclass=abc.ABCMeta): """Context passed to MechanismDrivers for changes to subnet resources. A SubnetContext instance wraps a subnet resource. It provides helper methods for accessing other relevant information. Results from expensive operations are cached so that other MechanismDrivers can freely access the same information. """ @abc.abstractproperty def current(self): """Return the subnet in its current configuration. Return the subnet, as defined by NeutronPluginBaseV2. create_subnet and all extensions in the ml2 plugin, with all its properties 'current' at the time the context was established. """ pass @abc.abstractproperty def original(self): """Return the subnet in its original configuration. Return the subnet, with all its properties set to their original values prior to a call to update_subnet. Method is only valid within calls to update_subnet_precommit and update_subnet_postcommit. """ pass class PortContext(object, metaclass=abc.ABCMeta): """Context passed to MechanismDrivers for changes to port resources. A PortContext instance wraps a port resource. It provides helper methods for accessing other relevant information. Results from expensive operations are cached so that other MechanismDrivers can freely access the same information. """ @abc.abstractproperty def current(self): """Return the port in its current configuration. Return the port, as defined by NeutronPluginBaseV2. create_port and all extensions in the ml2 plugin, with all its properties 'current' at the time the context was established. """ pass @abc.abstractproperty def original(self): """Return the port in its original configuration. Return the port, with all its properties set to their original values prior to a call to update_port. Method is only valid within calls to update_port_precommit and update_port_postcommit. """ pass @abc.abstractproperty def status(self): """Return the status of the current port.""" pass @abc.abstractproperty def original_status(self): """Return the status of the original port. The method is only valid within calls to update_port_precommit and update_port_postcommit. """ pass @abc.abstractproperty def network(self): """Return the NetworkContext associated with this port.""" pass @abc.abstractproperty def binding_levels(self): """Return dictionaries describing the current binding levels. This property returns a list of dictionaries describing each binding level if the port is bound or partially bound, or None if the port is unbound. Each returned dictionary contains the name of the bound driver under the BOUND_DRIVER key, and the bound segment dictionary under the BOUND_SEGMENT key. The first entry (index 0) describes the top-level binding, which always involves one of the port's network's static segments. In the case of a hierarchical binding, subsequent entries describe the lower-level bindings in descending order, which may involve dynamic segments. Adjacent levels where different drivers bind the same static or dynamic segment are possible. The last entry (index -1) describes the bottom-level binding that supplied the port's binding:vif_type and binding:vif_details attribute values. Within calls to MechanismDriver.bind_port, descriptions of the levels above the level currently being bound are returned. """ pass @abc.abstractproperty def original_binding_levels(self): """Return dictionaries describing the original binding levels. This property returns a list of dictionaries describing each original binding level if the port was previously bound, or None if the port was unbound. The content is as described for the binding_levels property. This property is only valid within calls to update_port_precommit and update_port_postcommit. It returns None otherwise. """ pass @abc.abstractproperty def top_bound_segment(self): """Return the current top-level bound segment dictionary. This property returns the current top-level bound segment dictionary, or None if the port is unbound. For a bound port, top_bound_segment is equivalent to binding_levels[0][BOUND_SEGMENT], and returns one of the port's network's static segments. """ pass @abc.abstractproperty def original_top_bound_segment(self): """Return the original top-level bound segment dictionary. This property returns the original top-level bound segment dictionary, or None if the port was previously unbound. For a previously bound port, original_top_bound_segment is equivalent to original_binding_levels[0][BOUND_SEGMENT], and returns one of the port's network's static segments. This property is only valid within calls to update_port_precommit and update_port_postcommit. It returns None otherwise. """ pass @abc.abstractproperty def bottom_bound_segment(self): """Return the current bottom-level bound segment dictionary. This property returns the current bottom-level bound segment dictionary, or None if the port is unbound. For a bound port, bottom_bound_segment is equivalent to binding_levels[-1][BOUND_SEGMENT], and returns the segment whose binding supplied the port's binding:vif_type and binding:vif_details attribute values. """ pass @abc.abstractproperty def original_bottom_bound_segment(self): """Return the original bottom-level bound segment dictionary. This property returns the original bottom-level bound segment dictionary, or None if the port was previously unbound. For a previously bound port, original_bottom_bound_segment is equivalent to original_binding_levels[-1][BOUND_SEGMENT], and returns the segment whose binding supplied the port's previous binding:vif_type and binding:vif_details attribute values. This property is only valid within calls to update_port_precommit and update_port_postcommit. It returns None otherwise. """ pass @abc.abstractproperty def host(self): """Return the host with which the port is associated. In the context of a host-specific operation on a distributed port, the host property indicates the host for which the port operation is being performed. Otherwise, it is the same value as current['binding:host_id']. """ pass @abc.abstractproperty def original_host(self): """Return the original host with which the port was associated. In the context of a host-specific operation on a distributed port, the original_host property indicates the host for which the port operation is being performed. Otherwise, it is the same value as original['binding:host_id']. This property is only valid within calls to update_port_precommit and update_port_postcommit. It returns None otherwise. """ pass @abc.abstractproperty def vif_type(self): """Return the vif_type indicating the binding state of the port. In the context of a host-specific operation on a distributed port, the vif_type property indicates the binding state for the host for which the port operation is being performed. Otherwise, it is the same value as current['binding:vif_type']. """ pass @abc.abstractproperty def original_vif_type(self): """Return the original vif_type of the port. In the context of a host-specific operation on a distributed port, the original_vif_type property indicates original binding state for the host for which the port operation is being performed. Otherwise, it is the same value as original['binding:vif_type']. This property is only valid within calls to update_port_precommit and update_port_postcommit. It returns None otherwise. """ pass @abc.abstractproperty def vif_details(self): """Return the vif_details describing the binding of the port. In the context of a host-specific operation on a distributed port, the vif_details property describes the binding for the host for which the port operation is being performed. Otherwise, it is the same value as current['binding:vif_details']. """ pass @abc.abstractproperty def original_vif_details(self): """Return the original vif_details of the port. In the context of a host-specific operation on a distributed port, the original_vif_details property describes the original binding for the host for which the port operation is being performed. Otherwise, it is the same value as original['binding:vif_details']. This property is only valid within calls to update_port_precommit and update_port_postcommit. It returns None otherwise. """ pass @abc.abstractproperty def segments_to_bind(self): """Return the list of segments with which to bind the port. This property returns the list of segment dictionaries with which the mechanism driver may bind the port. When establishing a top-level binding, these will be the port's network's static segments. For each subsequent level, these will be the segments passed to continue_binding by the mechanism driver that bound the level above. This property is only valid within calls to MechanismDriver.bind_port. It returns None otherwise. """ pass @abc.abstractmethod def host_agents(self, agent_type): """Get agents of the specified type on port's host. :param agent_type: Agent type identifier :returns: List of neutron.db.models.agent.Agent records """ pass @abc.abstractmethod def set_binding(self, segment_id, vif_type, vif_details, status=None): """Set the bottom-level binding for the port. :param segment_id: Network segment bound for the port. :param vif_type: The VIF type for the bound port. :param vif_details: Dictionary with details for VIF driver. :param status: Port status to set if not None. This method is called by MechanismDriver.bind_port to indicate success and specify binding details to use for port. The segment_id must identify an item in the current value of the segments_to_bind property. """ pass @abc.abstractmethod def continue_binding(self, segment_id, next_segments_to_bind): """Continue binding the port with different segments. :param segment_id: Network segment partially bound for the port. :param next_segments_to_bind: Segments to continue binding with. This method is called by MechanismDriver.bind_port to indicate it was able to partially bind the port, but that one or more additional mechanism drivers are required to complete the binding. The segment_id must identify an item in the current value of the segments_to_bind property. The list of segments IDs passed as next_segments_to_bind identify dynamic (or static) segments of the port's network that will be used to populate segments_to_bind for the next lower level of a hierarchical binding. """ pass @abc.abstractmethod def allocate_dynamic_segment(self, segment): """Allocate a dynamic segment. :param segment: A partially or fully specified segment dictionary Called by the MechanismDriver.bind_port, create_port or update_port to dynamically allocate a segment for the port using the partial segment specified. The segment dictionary can be a fully or partially specified segment. At a minimum it needs the network_type populated to call on the appropriate type driver. """ pass @abc.abstractmethod def release_dynamic_segment(self, segment_id): """Release an allocated dynamic segment. :param segment_id: UUID of the dynamic network segment. Called by the MechanismDriver.delete_port or update_port to release the dynamic segment allocated for this port. """ pass class ExtensionDriver(object, metaclass=abc.ABCMeta): """Define stable abstract interface for ML2 extension drivers. An extension driver extends the core resources implemented by the ML2 plugin with additional attributes. Methods that process create and update operations for these resources validate and persist values for extended attributes supplied through the API. Other methods extend the resource dictionaries returned from the API operations with the values of the extended attributes. """ @abc.abstractmethod def initialize(self): """Perform driver initialization. Called after all drivers have been loaded and the database has been initialized. No abstract methods defined below will be called prior to this method being called. """ pass @property def extension_alias(self): """Supported extension alias. Return the alias identifying the core API extension supported by this driver. Do not declare if API extension handling will be left to a service plugin, and we just need to provide core resource extension and updates. """ pass @property def extension_aliases(self): """List of extension aliases supported by the driver. Return a list of aliases identifying the core API extensions supported by the driver. By default this just returns the extension_alias property for backwards compatibility. """ return [self.extension_alias] def process_create_network(self, plugin_context, data, result): """Process extended attributes for create network. :param plugin_context: plugin request context :param data: dictionary of incoming network data :param result: network dictionary to extend Called inside transaction context on plugin_context.session to validate and persist any extended network attributes defined by this driver. Extended attribute values must also be added to result. """ pass def process_create_subnet(self, plugin_context, data, result): """Process extended attributes for create subnet. :param plugin_context: plugin request context :param data: dictionary of incoming subnet data :param result: subnet dictionary to extend Called inside transaction context on plugin_context.session to validate and persist any extended subnet attributes defined by this driver. Extended attribute values must also be added to result. """ pass def process_create_port(self, plugin_context, data, result): """Process extended attributes for create port. :param plugin_context: plugin request context :param data: dictionary of incoming port data :param result: port dictionary to extend Called inside transaction context on plugin_context.session to validate and persist any extended port attributes defined by this driver. Extended attribute values must also be added to result. """ pass def process_update_network(self, plugin_context, data, result): """Process extended attributes for update network. :param plugin_context: plugin request context :param data: dictionary of incoming network data :param result: network dictionary to extend Called inside transaction context on plugin_context.session to validate and update any extended network attributes defined by this driver. Extended attribute values, whether updated or not, must also be added to result. """ pass def process_update_subnet(self, plugin_context, data, result): """Process extended attributes for update subnet. :param plugin_context: plugin request context :param data: dictionary of incoming subnet data :param result: subnet dictionary to extend Called inside transaction context on plugin_context.session to validate and update any extended subnet attributes defined by this driver. Extended attribute values, whether updated or not, must also be added to result. """ pass def process_update_port(self, plugin_context, data, result): """Process extended attributes for update port. :param plugin_context: plugin request context :param data: dictionary of incoming port data :param result: port dictionary to extend Called inside transaction context on plugin_context.session to validate and update any extended port attributes defined by this driver. Extended attribute values, whether updated or not, must also be added to result. """ pass def extend_network_dict(self, session, base_model, result): """Add extended attributes to network dictionary. :param session: database session :param base_model: network model data :param result: network dictionary to extend Called inside transaction context on session to add any extended attributes defined by this driver to a network dictionary to be used for mechanism driver calls and/or returned as the result of a network operation. """ pass def extend_subnet_dict(self, session, base_model, result): """Add extended attributes to subnet dictionary. :param session: database session :param base_model: subnet model data :param result: subnet dictionary to extend Called inside transaction context on session to add any extended attributes defined by this driver to a subnet dictionary to be used for mechanism driver calls and/or returned as the result of a subnet operation. """ pass def extend_port_dict(self, session, base_model, result): """Add extended attributes to port dictionary. :param session: database session :param base_model: port model data :param result: port dictionary to extend Called inside transaction context on session to add any extended attributes defined by this driver to a port dictionary to be used for mechanism driver calls and/or returned as the result of a port operation. """ pass neutron-lib-2.3.0/neutron_lib/plugins/ml2/__init__.py0000664000175000017500000000000013641427107022573 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/plugins/__init__.py0000664000175000017500000000000013641427107022101 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/plugins/directory.py0000664000175000017500000000543613641427107022370 0ustar zuulzuul00000000000000# All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import weakref from oslo_concurrency import lockutils from neutron_lib.plugins import constants _synchronized = lockutils.synchronized_with_prefix("neutron-") class _PluginDirectory(object): """A directory of activated plugins in a Neutron Deployment. The directory is bootstrapped by a Neutron Manager running in the context of a Neutron Server process. """ def __init__(self): self._plugins = {} def add_plugin(self, alias, plugin): """Add a plugin of type 'alias'.""" self._plugins[alias] = plugin def get_plugin(self, alias): """Get a plugin for a given alias or None if not present.""" p = self._plugins.get(alias) return weakref.proxy(p) if p else None @property def plugins(self): """The mapping alias -> weak reference to the plugin.""" return dict((x, weakref.proxy(y)) for x, y in self._plugins.items()) @property def unique_plugins(self): """A sequence of the unique plugins activated in the environments.""" return tuple(weakref.proxy(x) for x in set(self._plugins.values())) @property def is_loaded(self): """True if the directory is non empty.""" return len(self._plugins) > 0 # Create a singleton plugins directory for the Neutron server instance. # Accessing these methods before a Neutron Manager has had the chance # to load the environment may result in callers handling an empty directory. _PLUGIN_DIRECTORY = None @_synchronized("plugin-directory") def _create_plugin_directory(): global _PLUGIN_DIRECTORY if _PLUGIN_DIRECTORY is None: _PLUGIN_DIRECTORY = _PluginDirectory() return _PLUGIN_DIRECTORY def _get_plugin_directory(): if _PLUGIN_DIRECTORY is None: return _create_plugin_directory() return _PLUGIN_DIRECTORY def add_plugin(alias, plugin): _get_plugin_directory().add_plugin(alias, plugin) def get_plugin(alias=constants.CORE): return _get_plugin_directory().get_plugin(alias) def get_plugins(): return _get_plugin_directory().plugins def get_unique_plugins(): return _get_plugin_directory().unique_plugins def is_loaded(): return _get_plugin_directory().is_loaded neutron-lib-2.3.0/neutron_lib/objects/0000775000175000017500000000000013641427200017744 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/objects/registry.py0000664000175000017500000000360613641427107022201 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.utils import runtime NEUTRON_OBJECT_NAMESPACE = 'neutron.objects' _REGISTRY = runtime.NamespacedPlugins(NEUTRON_OBJECT_NAMESPACE) def load_class(object_class_name): """Return the versioned object for the given class name. :param object_class_name: The class name of the versioned object to get. :returns: A reference to the class for the said object_class_name. """ return _REGISTRY.get_plugin_class(object_class_name) def new_instance(object_class_name, *inst_args, **inst_kwargs): """Create a new instance of a versioned object. :param object_class_name: The name of the versioned object's class to instantiate. :param inst_args: Any args pass onto the constructor of the versioned object when creating it. :param inst_kwargs: Any kwargs to pass onto the constructor of the object when creating it. :returns: A new instance of the versioned object. """ return _REGISTRY.new_plugin_instance( object_class_name, *inst_args, **inst_kwargs) def contains(object_class_name): """Determine if a given versioned object is loaded. :param object_class_name: The class name of the versioned object to check for. :returns: True if the versioned object is loaded, and False otherwise. """ return object_class_name in _REGISTRY.loaded_plugin_names neutron-lib-2.3.0/neutron_lib/objects/logapi/0000775000175000017500000000000013641427200021217 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/objects/logapi/event_types.py0000664000175000017500000000265313641427107024152 0ustar zuulzuul00000000000000# All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from oslo_versionedobjects import fields as obj_fields from neutron_lib._i18n import _ from neutron_lib.services.logapi import constants as log_const class SecurityEvent(obj_fields.String): def __init__(self, valid_values, **kwargs): self._valid_values = valid_values super(SecurityEvent, self).__init__(**kwargs) def coerce(self, obj, attr, value): if value not in self._valid_values: msg = ( _("Field value %(value)s is not in the list " "of valid values: %(values)s") % {'value': value, 'values': self._valid_values} ) raise ValueError(msg) return super(SecurityEvent, self).coerce(obj, attr, value) class SecurityEventField(obj_fields.AutoTypedField): AUTO_TYPE = SecurityEvent(valid_values=log_const.LOG_EVENTS) neutron-lib-2.3.0/neutron_lib/objects/logapi/__init__.py0000664000175000017500000000000013641427107023324 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/objects/utils.py0000664000175000017500000000513613641427107021471 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import abc import copy from neutron_lib import exceptions def convert_filters(**kwargs): result = copy.deepcopy(kwargs) if 'tenant_id' in result: if 'project_id' in result: raise exceptions.TenantIdProjectIdFilterConflict() result['project_id'] = result.pop('tenant_id') return result class FilterObj(object, metaclass=abc.ABCMeta): @abc.abstractmethod def filter(self, column): pass class StringMatchingFilterObj(FilterObj): @property def is_contains(self): return bool(getattr(self, "contains", False)) @property def is_starts(self): return bool(getattr(self, "starts", False)) @property def is_ends(self): return bool(getattr(self, "ends", False)) class StringContains(StringMatchingFilterObj): def __init__(self, matching_string): super(StringContains, self).__init__() self.contains = matching_string def filter(self, column): return column.contains(self.contains) class StringStarts(StringMatchingFilterObj): def __init__(self, matching_string): super(StringStarts, self).__init__() self.starts = matching_string def filter(self, column): return column.startswith(self.starts) class StringEnds(StringMatchingFilterObj): def __init__(self, matching_string): super(StringEnds, self).__init__() self.ends = matching_string def filter(self, column): return column.endswith(self.ends) class NotIn(FilterObj): def __init__(self, value): super(NotIn, self).__init__() self.value = value def filter(self, column): return ~column.in_(self.value) class NotEqual(FilterObj): def __init__(self, value): super(NotEqual, self).__init__() self.value = value def filter(self, column): return column != self.value def get_updatable_fields(cls, fields): fields = fields.copy() for field in cls.fields_no_update: if field in fields: del fields[field] return fields neutron-lib-2.3.0/neutron_lib/objects/__init__.py0000664000175000017500000000000013641427107022051 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/objects/common_types.py0000664000175000017500000002406213641427107023044 0ustar zuulzuul00000000000000# Copyright 2016 OpenStack Foundation # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import itertools import uuid import netaddr from oslo_serialization import jsonutils from oslo_versionedobjects import fields as obj_fields from neutron_lib._i18n import _ from neutron_lib import constants as lib_constants from neutron_lib.db import constants as lib_db_const from neutron_lib.objects import exceptions as o_exc from neutron_lib.utils import net as net_utils class HARouterEnumField(obj_fields.AutoTypedField): AUTO_TYPE = obj_fields.Enum(valid_values=lib_constants.VALID_HA_STATES) class IPV6ModeEnumField(obj_fields.AutoTypedField): AUTO_TYPE = obj_fields.Enum(valid_values=lib_constants.IPV6_MODES) class RangeConstrainedInteger(obj_fields.Integer): def __init__(self, start, end, **kwargs): try: self._start = int(start) self._end = int(end) except (TypeError, ValueError): raise o_exc.NeutronRangeConstrainedIntegerInvalidLimit( start=start, end=end) super(RangeConstrainedInteger, self).__init__(**kwargs) def coerce(self, obj, attr, value): if not isinstance(value, int): msg = _("Field value %s is not an integer") % value raise ValueError(msg) if not self._start <= value <= self._end: msg = _("Field value %s is invalid") % value raise ValueError(msg) return super(RangeConstrainedInteger, self).coerce(obj, attr, value) class IPNetworkPrefixLen(RangeConstrainedInteger): """IP network (CIDR) prefix length custom Enum""" def __init__(self, **kwargs): super(IPNetworkPrefixLen, self).__init__( start=0, end=lib_constants.IPv6_BITS, **kwargs) class IPNetworkPrefixLenField(obj_fields.AutoTypedField): AUTO_TYPE = IPNetworkPrefixLen() class PortRange(RangeConstrainedInteger): def __init__(self, start=lib_constants.PORT_RANGE_MIN, **kwargs): super(PortRange, self).__init__(start=start, end=lib_constants.PORT_RANGE_MAX, **kwargs) class PortRangeField(obj_fields.AutoTypedField): AUTO_TYPE = PortRange() class PortRangeWith0Field(obj_fields.AutoTypedField): AUTO_TYPE = PortRange(start=0) class VlanIdRange(RangeConstrainedInteger): def __init__(self, **kwargs): super(VlanIdRange, self).__init__(start=lib_constants.MIN_VLAN_TAG, end=lib_constants.MAX_VLAN_TAG, **kwargs) class VlanIdRangeField(obj_fields.AutoTypedField): AUTO_TYPE = VlanIdRange() class ListOfIPNetworksField(obj_fields.AutoTypedField): AUTO_TYPE = obj_fields.List(obj_fields.IPNetwork()) class SetOfUUIDsField(obj_fields.AutoTypedField): AUTO_TYPE = obj_fields.Set(obj_fields.UUID()) class DomainName(obj_fields.String): def coerce(self, obj, attr, value): if not isinstance(value, str): msg = _("Field value %s is not a string") % value raise ValueError(msg) if len(value) > lib_db_const.FQDN_FIELD_SIZE: msg = _("Domain name %s is too long") % value raise ValueError(msg) return super(DomainName, self).coerce(obj, attr, value) class DomainNameField(obj_fields.AutoTypedField): AUTO_TYPE = DomainName() class IntegerEnum(obj_fields.Integer): def __init__(self, valid_values=None, **kwargs): if not valid_values: msg = _("No possible values specified") raise ValueError(msg) for value in valid_values: if not isinstance(value, int): msg = _("Possible value %s is not an integer") % value raise ValueError(msg) self._valid_values = valid_values super(IntegerEnum, self).__init__(**kwargs) def coerce(self, obj, attr, value): if not isinstance(value, int): msg = _("Field value %s is not an integer") % value raise ValueError(msg) if value not in self._valid_values: msg = ( _("Field value %(value)s is not in the list " "of valid values: %(values)s") % {'value': value, 'values': self._valid_values} ) raise ValueError(msg) return super(IntegerEnum, self).coerce(obj, attr, value) class IPVersionEnum(IntegerEnum): """IP version integer Enum""" def __init__(self, **kwargs): super(IPVersionEnum, self).__init__( valid_values=lib_constants.IP_ALLOWED_VERSIONS, **kwargs) class IPVersionEnumField(obj_fields.AutoTypedField): AUTO_TYPE = IPVersionEnum() class DscpMark(IntegerEnum): def __init__(self, valid_values=None, **kwargs): super(DscpMark, self).__init__( valid_values=lib_constants.VALID_DSCP_MARKS) class DscpMarkField(obj_fields.AutoTypedField): AUTO_TYPE = DscpMark() class FlowDirectionEnumField(obj_fields.AutoTypedField): AUTO_TYPE = obj_fields.Enum(valid_values=lib_constants.VALID_DIRECTIONS) class IpamAllocationStatusEnumField(obj_fields.AutoTypedField): AUTO_TYPE = obj_fields.Enum( valid_values=lib_constants.VALID_IPAM_ALLOCATION_STATUSES) class EtherTypeEnumField(obj_fields.AutoTypedField): AUTO_TYPE = obj_fields.Enum(valid_values=lib_constants.VALID_ETHERTYPES) class IpProtocolEnum(obj_fields.Enum): """IP protocol number Enum""" def __init__(self, **kwargs): super(IpProtocolEnum, self).__init__( valid_values=list( itertools.chain( lib_constants.IP_PROTOCOL_MAP.keys(), [str(v) for v in range(256)] ) ), **kwargs) class PortBindingStatusEnumField(obj_fields.AutoTypedField): AUTO_TYPE = obj_fields.Enum( valid_values=lib_constants.PORT_BINDING_STATUSES) class IpProtocolEnumField(obj_fields.AutoTypedField): AUTO_TYPE = IpProtocolEnum() class MACAddress(obj_fields.FieldType): """MACAddress custom field. This custom field is different from the one provided by oslo.versionedobjects library: it uses netaddr.EUI type instead of strings. """ def coerce(self, obj, attr, value): if not isinstance(value, netaddr.EUI): msg = _("Field value %s is not a netaddr.EUI") % value raise ValueError(msg) return super(MACAddress, self).coerce(obj, attr, value) @staticmethod def to_primitive(obj, attr, value): return str(value) @staticmethod def from_primitive(obj, attr, value): try: return net_utils.AuthenticEUI(value) except Exception: msg = _("Field value %s is not a netaddr.EUI") % value raise ValueError(msg) class MACAddressField(obj_fields.AutoTypedField): AUTO_TYPE = MACAddress() class DictOfMiscValues(obj_fields.FieldType): """DictOfMiscValues custom field This custom field is handling dictionary with miscellaneous value types, including integer, float, boolean and list and nested dictionaries. """ @staticmethod def coerce(obj, attr, value): if isinstance(value, dict): return value if isinstance(value, str): try: return jsonutils.loads(value) except Exception: msg = _("Field value %s is not stringified JSON") % value raise ValueError(msg) msg = (_("Field value %s is not type of dict or stringified JSON") % value) raise ValueError(msg) @staticmethod def from_primitive(obj, attr, value): return DictOfMiscValues.coerce(obj, attr, value) @staticmethod def to_primitive(obj, attr, value): return jsonutils.dumps(value) @staticmethod def stringify(value): return jsonutils.dumps(value) class DictOfMiscValuesField(obj_fields.AutoTypedField): AUTO_TYPE = DictOfMiscValues class ListOfDictOfMiscValuesField(obj_fields.AutoTypedField): AUTO_TYPE = obj_fields.List(DictOfMiscValuesField()) class IPNetwork(obj_fields.FieldType): """IPNetwork custom field. This custom field is different from the one provided by oslo.versionedobjects library: it does not reset string representation for the field. """ def coerce(self, obj, attr, value): if not isinstance(value, netaddr.IPNetwork): msg = _("Field value %s is not a netaddr.IPNetwork") % value raise ValueError(msg) return super(IPNetwork, self).coerce(obj, attr, value) @staticmethod def to_primitive(obj, attr, value): return str(value) @staticmethod def from_primitive(obj, attr, value): try: return net_utils.AuthenticIPNetwork(value) except Exception: msg = _("Field value %s is not a netaddr.IPNetwork") % value raise ValueError(msg) class IPNetworkField(obj_fields.AutoTypedField): AUTO_TYPE = IPNetwork() class UUID(obj_fields.UUID): def coerce(self, obj, attr, value): uuid.UUID(str(value)) return str(value) class UUIDField(obj_fields.AutoTypedField): AUTO_TYPE = UUID() class FloatingIPStatusEnumField(obj_fields.AutoTypedField): AUTO_TYPE = obj_fields.Enum( valid_values=lib_constants.VALID_FLOATINGIP_STATUS) class RouterStatusEnumField(obj_fields.AutoTypedField): AUTO_TYPE = obj_fields.Enum( valid_values=lib_constants.VALID_ROUTER_STATUS) class NetworkSegmentRangeNetworkTypeEnumField(obj_fields.AutoTypedField): AUTO_TYPE = obj_fields.Enum( valid_values=lib_constants.NETWORK_SEGMENT_RANGE_TYPES) neutron-lib-2.3.0/neutron_lib/objects/extensions/0000775000175000017500000000000013641427200022143 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/objects/extensions/standardattributes.py0000664000175000017500000000354413641427107026440 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from oslo_versionedobjects import fields as obj_fields STANDARD_ATTRIBUTES = { 'revision_number': obj_fields.IntegerField(), 'description': obj_fields.StringField(nullable=True), 'created_at': obj_fields.DateTimeField(nullable=True, tzinfo_aware=False), 'updated_at': obj_fields.DateTimeField(nullable=True, tzinfo_aware=False), } def add_standard_attributes(cls): """Add standard attributes to the said class. :param cls: The class to add standard attributes to. :returns: None. """ # Don't use parent's fields in case child class doesn't create # its own instance of list cls.fields = cls.fields.copy() cls.fields.update(STANDARD_ATTRIBUTES) # those fields are updated by sqlalchemy itself cls.fields_no_update += ('created_at', 'updated_at') # revision numbers are managed by service plugin and are bumped # automatically; consumers should not bump them explicitly cls.fields_no_update.append('revision_number') def add_tag_filter_names(cls): """Add tag filter names to the said class. :param cls: The class to add tag filter names to. :returns: None. """ cls.add_extra_filter_name("tags") cls.add_extra_filter_name("not-tags") cls.add_extra_filter_name("tags-any") cls.add_extra_filter_name("not-tags-any") neutron-lib-2.3.0/neutron_lib/objects/extensions/__init__.py0000664000175000017500000000000013641427107024250 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/objects/exceptions.py0000664000175000017500000000610113641427107022503 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from oslo_utils import reflection from neutron_lib._i18n import _ from neutron_lib import exceptions class NeutronObjectUpdateForbidden(exceptions.NeutronException): message = _("Unable to update the following object fields: %(fields)s") class NeutronDbObjectDuplicateEntry(exceptions.Conflict): """Duplicate entry at unique column error. Raised when made an attempt to write to a unique column the same entry as existing one. :attr: `columns` available on an instance of the exception and could be used at error handling:: try: obj_ref.save() except NeutronDbObjectDuplicateEntry as e: if 'colname' in e.columns: # Handle error. """ message = _("Failed to create a duplicate %(object_type)s: " "for attribute(s) %(attributes)s with value(s) %(values)s") def __init__(self, object_class, db_exception): super(NeutronDbObjectDuplicateEntry, self).__init__( object_type=reflection.get_class_name(object_class, fully_qualified=False), attributes=db_exception.columns, values=db_exception.value) self.columns = db_exception.columns self.value = db_exception.value class NeutronDbObjectNotFoundByModel(exceptions.NotFound): message = _("NeutronDbObject not found by model %(model)s.") class NeutronPrimaryKeyMissing(exceptions.BadRequest): message = _("For class %(object_type)s missing primary keys: " "%(missing_keys)s") def __init__(self, object_class, missing_keys): super(NeutronPrimaryKeyMissing, self).__init__( object_type=reflection.get_class_name(object_class, fully_qualified=False), missing_keys=missing_keys ) class NeutronRangeConstrainedIntegerInvalidLimit(exceptions.NeutronException): message = _("Incorrect range limits specified: " "start = %(start)s, end = %(end)s") class NeutronSyntheticFieldMultipleForeignKeys(exceptions.NeutronException): message = _("Synthetic field %(field)s shouldn't have more than one " "foreign key") class NeutronSyntheticFieldsForeignKeysNotFound(exceptions.NeutronException): message = _("%(child)s does not define a foreign key for %(parent)s") class NeutronObjectValidatorException(exceptions.NeutronException): message = _("Synthetic field(s) %(fields)s undefined, misspelled, or " "otherwise invalid") neutron-lib-2.3.0/neutron_lib/api/0000775000175000017500000000000013641427200017064 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/api/attributes.py0000664000175000017500000003073213641427107021637 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from webob import exc from neutron_lib._i18n import _ from neutron_lib.api.definitions import network from neutron_lib.api.definitions import port from neutron_lib.api.definitions import subnet from neutron_lib.api.definitions import subnetpool from neutron_lib.api import validators from neutron_lib import constants from neutron_lib import exceptions def _validate_privileges(context, res_dict): if ('project_id' in res_dict and res_dict['project_id'] != context.project_id and not (context.is_admin or context.is_advsvc)): msg = _("Specifying 'project_id' or 'tenant_id' other than the " "authenticated project in request requires admin or advsvc " "privileges") raise exc.HTTPBadRequest(msg) def populate_project_info(attributes): """Ensure that both project_id and tenant_id attributes are present. If either project_id or tenant_id is present in attributes then ensure that both are present. If neither are present then attributes is not updated. :param attributes: A dictionary of resource/API attributes or API request/response dict. :returns: attributes (updated with project_id if applicable). :raises: HTTPBadRequest if the attributes project_id and tenant_id don't match. """ if 'tenant_id' in attributes and 'project_id' not in attributes: attributes['project_id'] = attributes['tenant_id'] elif 'project_id' in attributes and 'tenant_id' not in attributes: # Backward compatibility for code still using tenant_id attributes['tenant_id'] = attributes['project_id'] if attributes.get('project_id') != attributes.get('tenant_id'): msg = _("'project_id' and 'tenant_id' do not match") raise exc.HTTPBadRequest(msg) return attributes def _fill_default(res_dict, attr_name, attr_spec): # update res_dict[attr_name] record with the default value # specified in attr_spec, taking into account default_overrides_none if attr_spec.get('default_overrides_none'): if res_dict.get(attr_name) is None: res_dict[attr_name] = attr_spec.get('default') return res_dict[attr_name] = res_dict.get(attr_name, attr_spec.get('default')) def _dict_populate_defaults(attr_value, attr_spec): # attr_value: dict # attr_spec: an attribute specification dict e.g. # { # ... # 'dict_populate_defaults': True, # 'default_overrides_none': , # 'validate': { # 'type:dict': { # 'foo': { # 'default': FOO_DEFAULT, # 'type:values': [42, 43] # }, # 'bar': { # 'default': BAR_DEFAULT, # 'convert_to': converters.convert_to_boolean # } # 'baz': { # 'dict_populate_defaults': True # 'default_overrides_none': True, # 'type:dict': { # 'baz_bar: { # 'default': 77, # 'type:boolean' # }, # 'baz_foo': { # 'default': 88, # 'type:boolean' # } # } # } # } # } # } if not attr_spec.get(constants.DICT_POPULATE_DEFAULTS): return attr_value if attr_value is None or attr_value is constants.ATTR_NOT_SPECIFIED: attr_value = {} for rule_type, rule_content in attr_spec['validate'].items(): # we only recursively apply defaults for dict rules if 'dict' not in rule_type: continue for key, key_validator in rule_content.items(): validator_name, _dummy, validator_params = ( validators._extract_validator(key_validator)) # recurse if required: if 'dict' in validator_name: value = _dict_populate_defaults( attr_value.get(key), { constants.DICT_POPULATE_DEFAULTS: key_validator.get( constants.DICT_POPULATE_DEFAULTS), 'validate': {validator_name: validator_params} } ) if value is not None: attr_value[key] = value _fill_default(attr_value, key, key_validator) return attr_value class AttributeInfo(object): """Provides operations on a resource's attribute map. AttributeInfo wraps an API resource's attribute dict and provides methods for filling defaults, validating, converting, etc. based on the underlying attributes. """ def __init__(self, resource_attrs): """Create a new instance that wraps the given resource attributes. :param resource_attrs: The resource's attributes that can be any of the following types: an instance of AttributeInfo, an API definition that contains a RESOURCE_ATTRIBUTE_MAP attribute or a dict of attributes for the resource. """ if isinstance(resource_attrs, AttributeInfo): resource_attrs = resource_attrs.attributes elif getattr(resource_attrs, 'RESOURCE_ATTRIBUTE_MAP', None) is not None: # handle neutron_lib API definitions resource_attrs = resource_attrs.RESOURCE_ATTRIBUTE_MAP self.attributes = resource_attrs def fill_post_defaults( self, res_dict, exc_cls=lambda m: exceptions.InvalidInput(error_message=m), check_allow_post=True): """Fill in default values for attributes in a POST request. When a POST request is made, the attributes with default values do not need to be specified by the user. This function fills in the values of any unspecified attributes if they have a default value. If an attribute is not specified and it does not have a default value, an exception is raised. If an attribute is specified and it is not allowed in POST requests, an exception is raised. The caller can override this behavior by setting check_allow_post=False (used by some internal admin operations). :param res_dict: The resource attributes from the request. :param exc_cls: Exception to be raised on error that must take a single error message as it's only constructor arg. :param check_allow_post: Raises an exception if a non-POST-able attribute is specified. :raises: exc_cls If check_allow_post is True and this instance of ResourceAttributes doesn't support POST. """ for attr, attr_vals in self.attributes.items(): if attr_vals['allow_post']: value = _dict_populate_defaults( res_dict.get(attr, constants.ATTR_NOT_SPECIFIED), attr_vals) if value is not constants.ATTR_NOT_SPECIFIED: res_dict[attr] = value if 'default' not in attr_vals and attr not in res_dict: msg = _("Failed to parse request. Required " "attribute '%s' not specified") % attr raise exc_cls(msg) _fill_default(res_dict, attr, attr_vals) elif check_allow_post: if attr in res_dict: msg = _("Attribute '%s' not allowed in POST") % attr raise exc_cls(msg) def convert_values( self, res_dict, exc_cls=lambda m: exceptions.InvalidInput(error_message=m)): """Convert and validate attribute values for a request. :param res_dict: The resource attributes from the request. :param exc_cls: Exception to be raised on error that must take a single error message as it's only constructor arg. :raises: exc_cls If any errors occur converting/validating the res_dict. """ for attr, attr_vals in self.attributes.items(): if (attr not in res_dict or res_dict[attr] is constants.ATTR_NOT_SPECIFIED): continue # Convert values if necessary if 'convert_to' in attr_vals: res_dict[attr] = attr_vals['convert_to'](res_dict[attr]) # Check that configured values are correct if 'validate' not in attr_vals: continue for rule in attr_vals['validate']: validator = validators.get_validator(rule) res = validator(res_dict[attr], attr_vals['validate'][rule]) if res: msg_dict = dict(attr=attr, reason=res) msg = _("Invalid input for %(attr)s. " "Reason: %(reason)s.") % msg_dict raise exc_cls(msg) def populate_project_id(self, context, res_dict, is_create): """Populate the owner information in a request body. Ensure both project_id and tenant_id attributes are present. Validate that the requestor has the required privileges. For a create request, copy owner info from context to request body if needed and verify that owner is specified if required. :param context: The request context. :param res_dict: The resource attributes from the request. :param attr_info: The attribute map for the resource. :param is_create: Is this a create request? :raises: HTTPBadRequest If neither the project_id nor tenant_id are specified in the res_dict. """ populate_project_info(res_dict) _validate_privileges(context, res_dict) if is_create and 'project_id' not in res_dict: if context.project_id: res_dict['project_id'] = context.project_id # For backward compatibility res_dict['tenant_id'] = context.project_id elif 'tenant_id' in self.attributes: msg = _("Running without keystone AuthN requires " "that tenant_id is specified") raise exc.HTTPBadRequest(msg) def verify_attributes(self, attrs_to_verify): """Reject unknown attributes. Consumers should ensure the project info is populated in the attrs_to_verify before calling this method. :param attrs_to_verify: The attributes to verify against this resource attributes. :raises: HTTPBadRequest: If attrs_to_verify contains any unrecognized for this resource attributes instance. """ extra_keys = set(attrs_to_verify.keys()) - set(self.attributes.keys()) if extra_keys: msg = _("Unrecognized attribute(s) '%s'") % ', '.join(extra_keys) raise exc.HTTPBadRequest(msg) def _core_resource_attributes(): resources = {} for core_def in [network.RESOURCE_ATTRIBUTE_MAP, port.RESOURCE_ATTRIBUTE_MAP, subnet.RESOURCE_ATTRIBUTE_MAP, subnetpool.RESOURCE_ATTRIBUTE_MAP]: resources.update(core_def) return resources # populate core resources into singleton global RESOURCES = _core_resource_attributes() def retrieve_valid_sort_keys(attr_info): """Retrieve sort keys from `attr_info` dict. Iterate the `attr_info`, filter and return the attributes that are defined with `is_sort_key=True`. :param attr_info: The attribute dict for common neutron resource. :returns: Set of sort keys. """ return set(attr for attr, schema in attr_info.items() if schema.get('is_sort_key', False)) neutron-lib-2.3.0/neutron_lib/api/faults.py0000664000175000017500000000214213641427107020741 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import netaddr from oslo_policy import policy import webob.exc from neutron_lib import exceptions FAULT_MAP = { exceptions.NotFound: webob.exc.HTTPNotFound, exceptions.Conflict: webob.exc.HTTPConflict, exceptions.InUse: webob.exc.HTTPConflict, exceptions.BadRequest: webob.exc.HTTPBadRequest, exceptions.ServiceUnavailable: webob.exc.HTTPServiceUnavailable, exceptions.NotAuthorized: webob.exc.HTTPForbidden, netaddr.AddrFormatError: webob.exc.HTTPBadRequest, policy.PolicyNotAuthorized: webob.exc.HTTPForbidden, } neutron-lib-2.3.0/neutron_lib/api/converters.py0000664000175000017500000002544013641427107021643 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import netaddr from oslo_config import cfg from oslo_utils import strutils from neutron_lib._i18n import _ from neutron_lib.api import validators from neutron_lib import constants from neutron_lib import exceptions as n_exc from neutron_lib.utils import net as net_utils def convert_to_boolean(data): """Convert a data value into a python bool. :param data: The data value to convert to a python bool. This function supports string types, bools, and ints for conversion of representation to python bool. :returns: The bool value of 'data' if it can be coerced. :raises InvalidInput: If the value can't be coerced to a python bool. """ try: return strutils.bool_from_string(data, strict=True) except ValueError: msg = _("'%s' cannot be converted to boolean") % data raise n_exc.InvalidInput(error_message=msg) def convert_to_boolean_if_not_none(data): """Uses convert_to_boolean() on the data if the data is not None. :param data: The data value to convert. :returns: The 'data' returned from convert_to_boolean() if 'data' is not None. None is returned if data is None. """ if data is not None: return convert_to_boolean(data) def convert_to_int(data): """Convert a data value to a python int. :param data: The data value to convert to a python int via python's built-in int() constructor. :returns: The int value of the data. :raises InvalidInput: If the value can't be converted to an int. """ try: return int(data) except (ValueError, TypeError): msg = _("'%s' is not an integer") % data raise n_exc.InvalidInput(error_message=msg) def convert_to_int_if_not_none(data): """Uses convert_to_int() on the data if the data is not None. :param data: The data value to convert. :returns: The 'data' returned from convert_to_int() if 'data' is not None. None is returned if data is None. """ if data is not None: return convert_to_int(data) return data def convert_to_positive_float_or_none(val): """Converts a value to a python float if the value is positive. :param val: The value to convert to a positive python float. :returns: The value as a python float. If the val is None, None is returned. :raises ValueError, InvalidInput: A ValueError is raised if the 'val' is a float, but is negative. InvalidInput is raised if 'val' can't be converted to a python float. """ # NOTE(salv-orlando): This conversion function is currently used by # a vendor specific extension only at the moment It is used for # port's RXTX factor in neutron.plugins.vmware.extensions.qos. # It is deemed however generic enough to be in this module as it # might be used in future for other API attributes. if val is None: return try: val = float(val) if val < 0: raise ValueError() except (ValueError, TypeError): msg = _("'%s' must be a non negative decimal") % val raise n_exc.InvalidInput(error_message=msg) return val def convert_kvp_str_to_list(data): """Convert a value of the form 'key=value' to ['key', 'value']. :param data: The string to parse for a key value pair. :returns: A list where element 0 is the key and element 1 is the value. :raises InvalidInput: If 'data' is not a key value string. """ kvp = [x.strip() for x in data.split('=', 1)] if len(kvp) == 2 and kvp[0]: return kvp msg = _("'%s' is not of the form =[value]") % data raise n_exc.InvalidInput(error_message=msg) def convert_kvp_list_to_dict(kvp_list): """Convert a list of 'key=value' strings to a dict. :param kvp_list: A list of key value pair strings. For more info on the format see; convert_kvp_str_to_list(). :returns: A dict who's key value pairs are populated by parsing 'kvp_list'. :raises InvalidInput: If any of the key value strings are malformed. """ if kvp_list == ['True']: # No values were provided (i.e. '--flag-name') return {} kvp_map = {} for kvp_str in kvp_list: key, value = convert_kvp_str_to_list(kvp_str) kvp_map.setdefault(key, set()) kvp_map[key].add(value) return dict((x, list(y)) for x, y in kvp_map.items()) def convert_none_to_empty_list(value): """Convert value to an empty list if it's None. :param value: The value to convert. :returns: An empty list of 'value' is None, otherwise 'value'. """ return [] if value is None else value def convert_none_to_empty_dict(value): """Convert the value to an empty dict if it's None. :param value: The value to convert. :returns: An empty dict if 'value' is None, otherwise 'value'. """ return {} if value is None else value def convert_none_to_empty_string(value): """Convert the value to an empty string if it's None. :param value: The value to convert. :returns: An empty string if 'value' is None, otherwise 'value'. """ return '' if value is None else value def convert_to_list(data): """Convert a value into a list. :param data: The value to convert. :return: A new list wrapped around 'data' whereupon the list is empty if 'data' is None. """ if data is None: return [] elif hasattr(data, '__iter__') and not isinstance(data, str): return list(data) else: return [data] def convert_ip_to_canonical_format(value): """IP Address is validated and then converted to canonical format. :param value: The IP Address which needs to be checked. :returns: - None if 'value' is None, - 'value' if 'value' is IPv4 address, - 'value' if 'value' is not an IP Address - canonical IPv6 address if 'value' is IPv6 address. """ try: ip = netaddr.IPAddress(value) if ip.version == constants.IP_VERSION_6: return str(ip.format(dialect=netaddr.ipv6_compact)) except (netaddr.core.AddrFormatError, ValueError): pass return value def convert_cidr_to_canonical_format(value): """CIDR is validated and converted to canonical format. :param value: The CIDR which needs to be checked. :returns: - 'value' if 'value' is CIDR with IPv4 address, - CIDR with canonical IPv6 address if 'value' is IPv6 CIDR. :raises: InvalidInput if 'value' is None, not a valid CIDR or invalid IP Format. """ error_message = _("%s is not in a CIDR format") % value try: cidr = netaddr.IPNetwork(value) return str(convert_ip_to_canonical_format( cidr.ip)) + "/" + str(cidr.prefixlen) except netaddr.core.AddrFormatError: raise n_exc.InvalidInput(error_message=error_message) def convert_string_to_case_insensitive(data): """Convert a string value into a lower case string. This effectively makes the string case-insensitive. :param data: The value to convert. :return: The lower-cased string representation of the value, or None is 'data' is None. :raises InvalidInput: If the value is not a string. """ try: return data.lower() except AttributeError: error_message = _("Input value %s must be string type") % data raise n_exc.InvalidInput(error_message=error_message) def convert_to_protocol(data): """Validate that a specified IP protocol is valid. For the authoritative list mapping protocol names to numbers, see the IANA: http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml :param data: The value to verify is an IP protocol. :returns: If data is an int between 0 and 255 or None, return that; if data is a string then return it lower-cased if it matches one of the allowed protocol names. :raises exceptions.InvalidInput: If data is an int < 0, an int > 255, or a string that does not match one of the allowed protocol names. """ if data is None: return val = convert_string_to_case_insensitive(data) if val in constants.IPTABLES_PROTOCOL_MAP: return data error_message = _("IP protocol '%s' is not supported. Only protocol " "names and their integer representation (0 to " "255) are supported") % data try: if validators.validate_range(convert_to_int(data), [0, 255]) is None: return data else: raise n_exc.InvalidInput(error_message=error_message) except n_exc.InvalidInput: raise n_exc.InvalidInput(error_message=error_message) def convert_to_string(data): """Convert a data value into a string. :param data: The data value to convert to a string. :returns: The string value of 'data' if data is not None """ if data is not None: return str(data) def convert_prefix_forced_case(data, prefix): """If is a prefix of data, case insensitive, then force its case This converter forces the case of a given prefix of a string. Example, with prefix="Foo": * 'foobar' converted into 'Foobar' * 'fOozar' converted into 'Foozar' * 'FOObaz' converted into 'Foobaz' :param data: The data to convert :returns: if data is a string starting with in a case insensitive comparison, then the return value is data with this prefix replaced by """ plen = len(prefix) if (isinstance(data, str) and len(data) >= plen and data[0:plen].lower() == prefix.lower()): return prefix + data[plen:] return data def convert_uppercase_ip(data): """Uppercase "ip" if present at start of data case-insensitive Can be used for instance to accept both "ipv4" and "IPv4". :param data: The data to convert :returns: if data is a string starting with "ip" case insensitive, then the return value is data with the first two letter uppercased """ return convert_prefix_forced_case(data, "IP") def convert_to_mac_if_none(data): """Convert to a random mac address if data is None :param data: The data value :return: Random mac address if data is None, else return data. """ if data is None: return net_utils.get_random_mac(cfg.CONF.base_mac.split(':')) return data neutron-lib-2.3.0/neutron_lib/api/extensions.py0000664000175000017500000002301013641427107021637 0ustar zuulzuul00000000000000# Copyright 2011 OpenStack Foundation. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import abc from neutron_lib._i18n import _ from neutron_lib import constants _UNSET = constants.Sentinel() def is_extension_supported(plugin, alias): """Validate that the extension is supported. :param plugin: The plugin class. :param alias: The alias to check. :returns: True if the alias is supported else False. """ return alias in getattr(plugin, "supported_extension_aliases", []) class ExtensionDescriptor(object, metaclass=abc.ABCMeta): """Base class that defines the contract for extensions.""" @abc.abstractmethod def get_name(self): """The name of the extension. e.g. 'Fox In Socks' """ @abc.abstractmethod def get_alias(self): """The alias for the extension. e.g. 'FOXNSOX' """ @abc.abstractmethod def get_description(self): """Friendly description for the extension. e.g. 'The Fox In Socks Extension' """ @abc.abstractmethod def get_updated(self): """The timestamp when the extension was last updated. e.g. '2011-01-22T13:25:27-06:00' """ # NOTE(justinsb): Not sure of the purpose of this is, vs the XML NS def get_resources(self): """List of extensions.ResourceExtension extension objects. Resources define new nouns, and are accessible through URLs. """ return [] def get_actions(self): """List of extensions.ActionExtension extension objects. Actions are verbs callable from the API. """ return [] def get_request_extensions(self): """List of extensions.RequestExtension extension objects. Request extensions are used to handle custom request data. """ return [] def get_extended_resources(self, version): """Retrieve extended resources or attributes for core resources. Extended attributes are implemented by a core plugin similarly to the attributes defined in the core, and can appear in request and response messages. Their names are scoped with the extension's prefix. The core API version is passed to this function, which must return a map[][][] specifying the extended resource attribute properties required by that API version. Extension can add resources and their attr definitions too. The returned map can be integrated into RESOURCE_ATTRIBUTE_MAP. """ return {} def get_plugin_interface(self): """Returns an abstract class which defines contract for the plugin. The abstract class should inherit from neutron_lib.services.base.ServicePluginBase. Methods in this abstract class should be decorated as abstractmethod """ def get_required_extensions(self): """Return list of extensions required for processing this descriptor. Without these extensions present in a neutron deployment, the introduced extension cannot load or function properly. """ return [] def get_optional_extensions(self): """Returns a list of optionally required extensions. Unlike get_required_extensions. This will not fail the loading of the extension if one of these extensions is not present. This is useful for an extension that extends multiple resources across other extensions that should still work for the remaining extensions when one is missing. """ return [] def update_attributes_map(self, extended_attributes, extension_attrs_map=None): """Update attributes map for this extension. This is default method for extending an extension's attributes map. An extension can use this method and supplying its own resource attribute map in extension_attrs_map argument to extend all its attributes that needs to be extended. If an extension does not implement update_attributes_map, the method does nothing and just return. """ if not extension_attrs_map: return for resource, attrs in extension_attrs_map.items(): extended_attrs = extended_attributes.get(resource) if extended_attrs: attrs.update(extended_attrs) def get_pecan_resources(self): """List of PecanResourceExtension extension objects. Resources define new nouns, and are accessible through URLs. The controllers associated with each instance of extensions.ResourceExtension should be a subclass of neutron.pecan_wsgi.controllers.utils.NeutronPecanController. If a resource is defined in both get_resources and get_pecan_resources, the resource defined in get_pecan_resources will take precedence. """ return [] class APIExtensionDescriptor(ExtensionDescriptor): """Base class that defines the contract for extensions. Concrete implementations of API extensions should first provide an API definition in neutron_lib.api.definitions. The API definition module (object reference) can then be specified as a class level attribute on the concrete extension. For example:: from neutron_lib.api.definitions import provider_net from neutron_lib.api import extensions class Providernet(extensions.APIExtensionDescriptor): api_definition = provider_net # nothing else needed if default behavior is acceptable If extension implementations need to override the default behavior of this class they can override the respective method directly. """ api_definition = _UNSET @classmethod def _assert_api_definition(cls, attr=None): if cls.api_definition == _UNSET: raise NotImplementedError( _("Extension module API definition not set.")) if attr and getattr(cls.api_definition, attr, _UNSET) == _UNSET: raise NotImplementedError(_("Extension module API definition " "does not define '%s'") % attr) @classmethod def get_name(cls): """The name of the API definition.""" cls._assert_api_definition('NAME') return cls.api_definition.NAME @classmethod def get_alias(cls): """The alias for the API definition.""" cls._assert_api_definition('ALIAS') return cls.api_definition.ALIAS @classmethod def get_description(cls): """Friendly description for the API definition.""" cls._assert_api_definition('DESCRIPTION') return cls.api_definition.DESCRIPTION @classmethod def get_updated(cls): """The timestamp when the API definition was last updated.""" cls._assert_api_definition('UPDATED_TIMESTAMP') return cls.api_definition.UPDATED_TIMESTAMP @classmethod def get_extended_resources(cls, version): """Retrieve the extended resource map for the API definition. :param version: The API version to retrieve the resource attribute map for. :returns: The extended resource map for the underlying API definition if the version is 2.0. The extended resource map returned includes both the API definition's RESOURCE_ATTRIBUTE_MAP and SUB_RESOURCE_ATTRIBUTE_MAP where applicable. If the version is not 2.0, an empty dict is returned. """ if version == "2.0": cls._assert_api_definition('RESOURCE_ATTRIBUTE_MAP') cls._assert_api_definition('SUB_RESOURCE_ATTRIBUTE_MAP') # support api defs that use None for sub attr map sub_attrs = cls.api_definition.SUB_RESOURCE_ATTRIBUTE_MAP or {} return dict( list(cls.api_definition.RESOURCE_ATTRIBUTE_MAP.items()) + list(sub_attrs.items())) else: return {} @classmethod def get_required_extensions(cls): """Returns the API definition's required extensions.""" cls._assert_api_definition('REQUIRED_EXTENSIONS') return cls.api_definition.REQUIRED_EXTENSIONS @classmethod def get_optional_extensions(cls): """Returns the API definition's optional extensions.""" cls._assert_api_definition('OPTIONAL_EXTENSIONS') return cls.api_definition.OPTIONAL_EXTENSIONS @classmethod def update_attributes_map(cls, attributes, extension_attrs_map=None): """Update attributes map for this extension. Behaves like ExtensionDescriptor.update_attributes_map(), but if extension_attrs_map is not given the dict returned from self.get_extended_resources('2.0') is used. """ if extension_attrs_map is None: extension_attrs_map = cls.get_extended_resources('2.0') super(APIExtensionDescriptor, cls()).update_attributes_map( attributes, extension_attrs_map=extension_attrs_map) neutron-lib-2.3.0/neutron_lib/api/definitions/0000775000175000017500000000000013641427200021377 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/api/definitions/subnetpool.py0000664000175000017500000001164413641427107024157 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib import constants from neutron_lib.db import constants as db_const NAME = 'Neutron L3 Subnet Pool' ALIAS = 'subnetpool' DESCRIPTION = "Layer 3 subnet pool abstraction" UPDATED_TIMESTAMP = "2012-01-01T10:00:00-00:00" RESOURCE_NAME = 'subnetpool' COLLECTION_NAME = 'subnetpools' RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'primary_key': True}, 'name': {'allow_post': True, 'allow_put': True, 'validate': {'type:not_empty_string': None}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'prefixes': {'allow_post': True, 'allow_put': True, 'validate': {'type:subnet_list': None}, 'is_visible': True}, 'default_quota': {'allow_post': True, 'allow_put': True, 'validate': {'type:non_negative': None}, 'convert_to': converters.convert_to_int, 'default': constants.ATTR_NOT_SPECIFIED, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'ip_version': {'allow_post': False, 'allow_put': False, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'default_prefixlen': {'allow_post': True, 'allow_put': True, 'validate': {'type:non_negative': None}, 'convert_to': converters.convert_to_int, 'default': constants.ATTR_NOT_SPECIFIED, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'min_prefixlen': {'allow_post': True, 'allow_put': True, 'default': constants.ATTR_NOT_SPECIFIED, 'validate': {'type:non_negative': None}, 'convert_to': converters.convert_to_int, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'max_prefixlen': {'allow_post': True, 'allow_put': True, 'default': constants.ATTR_NOT_SPECIFIED, 'validate': {'type:non_negative': None}, 'convert_to': converters.convert_to_int, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'is_default': {'allow_post': True, 'allow_put': True, 'default': False, 'convert_to': converters.convert_to_boolean, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'required_by_policy': True, 'enforce_policy': True}, constants.SHARED: { 'allow_post': True, 'allow_put': False, 'default': False, 'convert_to': converters.convert_to_boolean, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'required_by_policy': True, 'enforce_policy': True } } } # This is a core resource so the following are not applicable. IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/network_mtu_writable.py0000664000175000017500000000512613641427107026232 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import network from neutron_lib.api.definitions import network_mtu MTU = 'mtu' # The alias of the extension. ALIAS = 'net-mtu-writable' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Network MTU (writable)' # A prefix for API resources. An empty prefix means that the API is going # to be exposed at the v2/ level as any other core resource. API_PREFIX = '' # The description of the extension. DESCRIPTION = ( "Provides a writable MTU attribute for a network resource.") # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2017-07-12T00:00:00-00:00" RESOURCE_ATTRIBUTE_MAP = { network.COLLECTION_NAME: { MTU: {'allow_post': True, 'allow_put': True, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'validate': {'type:non_negative': None}, 'default': 0, 'convert_to': converters.convert_to_int}, }, } # The subresource attribute map for the extension. It adds child resources # to main extension's resource. The subresource map must have a parent and # a parameters entry. If an extension does not need such a map, None can # be specified (mandatory). SUB_RESOURCE_ATTRIBUTE_MAP = {} # The action map: it associates verbs with methods to be performed on # the API resource. ACTION_MAP = {} # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [network_mtu.ALIAS] # The list of optional extensions. OPTIONAL_EXTENSIONS = [] neutron-lib-2.3.0/neutron_lib/api/definitions/subnet_service_types.py0000664000175000017500000000263113641427107026225 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import subnet as subnet_def from neutron_lib import constants ALIAS = 'subnet-service-types' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Subnet service types' API_PREFIX = '' DESCRIPTION = "Provides ability to set the subnet service_types field" UPDATED_TIMESTAMP = "2016-03-15T18:00:00-00:00" RESOURCE_NAME = 'service_type' COLLECTION_NAME = 'service_types' RESOURCE_ATTRIBUTE_MAP = { subnet_def.COLLECTION_NAME: { COLLECTION_NAME: { 'allow_post': True, 'allow_put': True, 'default': constants.ATTR_NOT_SPECIFIED, 'validate': {'type:list_of_subnet_service_types': None}, 'is_visible': True } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} ACTION_STATUS = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] neutron-lib-2.3.0/neutron_lib/api/definitions/fip_port_details.py0000664000175000017500000000240313641427107025305 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import l3 from neutron_lib import constants PORT_DETAILS = 'port_details' ALIAS = 'fip-port-details' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Floating IP Port Details Extension' DESCRIPTION = 'Add port_details attribute to Floating IP resource' UPDATED_TIMESTAMP = '2018-04-09T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = { l3.FLOATINGIPS: { PORT_DETAILS: { 'allow_post': False, 'allow_put': False, 'default': constants.ATTR_NOT_SPECIFIED, 'is_visible': True } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [l3.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/network_mtu.py0000664000175000017500000000451213641427107024337 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import network MTU = 'mtu' # The alias of the extension. ALIAS = 'net-mtu' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Network MTU' # A prefix for API resources. An empty prefix means that the API is going # to be exposed at the v2/ level as any other core resource. API_PREFIX = '' # The description of the extension. DESCRIPTION = "Provides MTU attribute for a network resource." # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2015-03-25T10:00:00-00:00" RESOURCE_ATTRIBUTE_MAP = { network.COLLECTION_NAME: { MTU: {'allow_post': False, 'allow_put': False, 'is_visible': True, 'is_filter': True, 'is_sort_key': True}, }, } # The subresource attribute map for the extension. It adds child resources # to main extension's resource. The subresource map must have a parent and # a parameters entry. If an extension does not need such a map, None can # be specified (mandatory). SUB_RESOURCE_ATTRIBUTE_MAP = {} # The action map: it associates verbs with methods to be performed on # the API resource. ACTION_MAP = {} # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [] # The list of optional extensions. OPTIONAL_EXTENSIONS = [] neutron-lib-2.3.0/neutron_lib/api/definitions/qos_gateway_ip.py0000664000175000017500000000426613641427107025002 0ustar zuulzuul00000000000000# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import l3 from neutron_lib.api.definitions import l3_ext_gw_mode from neutron_lib.api.definitions import qos from neutron_lib.services.qos import constants as qos_consts ALIAS = 'qos-gateway-ip' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Router gateway IP QoS' API_PREFIX = '' DESCRIPTION = 'The Router gateway IP Quality of Service extension' UPDATED_TIMESTAMP = '2018-02-24T00:00:00-00:00' RESOURCE_NAME = l3.ROUTER COLLECTION_NAME = l3.ROUTERS RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { l3.EXTERNAL_GW_INFO: { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': None, 'enforce_policy': True, 'validate': { 'type:dict_or_nodata': { 'network_id': {'type:uuid': None, 'required': True}, 'enable_snat': {'type:boolean': None, 'required': False, 'convert_to': converters.convert_to_boolean}, 'external_fixed_ips': { 'type:fixed_ips': None, 'required': False }, qos_consts.QOS_POLICY_ID: { 'type:uuid_or_none': None, 'required': False } } } } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [l3.ALIAS, qos.ALIAS, l3_ext_gw_mode.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/external_net.py0000664000175000017500000000315213641427107024450 0ustar zuulzuul00000000000000# Copyright (c) 2013 OpenStack Foundation. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import network # For backward compatibility the 'router' prefix is kept. EXTERNAL = 'router:external' ALIAS = 'external-net' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Neutron external network' API_PREFIX = '' DESCRIPTION = 'Adds external network attribute to network resource.' UPDATED_TIMESTAMP = '2013-01-14T10:00:00-00:00' RESOURCE_NAME = network.RESOURCE_NAME COLLECTION_NAME = network.COLLECTION_NAME RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { EXTERNAL: { 'allow_post': True, 'allow_put': True, 'default': False, 'is_visible': True, 'is_filter': True, 'convert_to': converters.convert_to_boolean, 'enforce_policy': True, 'required_by_policy': True } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/vlantransparent.py0000664000175000017500000000374713641427107025214 0ustar zuulzuul00000000000000# Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import network from neutron_lib.api import validators from neutron_lib import constants VLANTRANSPARENT = 'vlan_transparent' def get_vlan_transparent(network): """Get the value of vlan_transparent from a network if set. :param network: The network dict to retrieve the value of vlan_transparent from. :returns: The value of vlan_transparent from the network dict if set in the dict, otherwise False is returned. """ return (network[VLANTRANSPARENT] if (VLANTRANSPARENT in network and validators.is_attr_set(network[VLANTRANSPARENT])) else False) ALIAS = 'vlan-transparent' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Vlantransparent' API_PREFIX = '' DESCRIPTION = 'Provides Vlan Transparent Networks' UPDATED_TIMESTAMP = '2015-03-23T09:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = { network.COLLECTION_NAME: { VLANTRANSPARENT: { 'allow_post': True, 'allow_put': False, 'convert_to': converters.convert_to_boolean, 'default': constants.ATTR_NOT_SPECIFIED, 'is_visible': True, 'is_filter': True } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/logging.py0000664000175000017500000001104413641427107023405 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.db import constants as db_const # The alias of the extension. ALIAS = 'logging' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Logging API Extension' # A prefix for API resources. An empty prefix means that the API is going # to be exposed at the v2/ level as any other core resource. API_PREFIX = '/log' # The description of the extension. DESCRIPTION = ("Provides a logging API for resources such as " "security group and firewall.") # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2017-01-01T10:00:00-00:00" LOGS = 'logs' LOG_TYPES = 'loggable_resources' ACCEPT_EVENT = 'ACCEPT' DROP_EVENT = 'DROP' ALL_EVENT = 'ALL' LOG_EVENTS = [ACCEPT_EVENT, DROP_EVENT, ALL_EVENT] # Attribute Map RESOURCE_ATTRIBUTE_MAP = { LOGS: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'primary_key': True}, 'project_id': {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'name': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'default': '', 'is_visible': True}, 'resource_type': {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': { 'type:string': db_const.RESOURCE_TYPE_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'resource_id': {'allow_post': True, 'allow_put': False, 'validate': {'type:uuid_or_none': None}, 'is_filter': True, 'is_sort_key': True, 'default': None, 'is_visible': True}, 'event': {'allow_post': True, 'allow_put': False, 'validate': {'type:values': LOG_EVENTS}, 'is_filter': True, 'default': ALL_EVENT, 'is_visible': True}, 'target_id': {'allow_post': True, 'allow_put': False, 'validate': {'type:uuid_or_none': None}, 'is_filter': True, 'is_sort_key': True, 'default': None, 'is_visible': True}, 'enabled': {'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': True, 'is_filter': True, 'is_sort_key': True, 'convert_to': converters.convert_to_boolean}, }, LOG_TYPES: { 'type': {'allow_post': False, 'allow_put': False, 'is_visible': True}}, } # The subresource attribute map for the extension. This extension has only # top level resources, not child resources, so this is set to an empty dict. SUB_RESOURCE_ATTRIBUTE_MAP = {} # The action map. ACTION_MAP = {} # The list of required extensions. REQUIRED_EXTENSIONS = [] # The action status. ACTION_STATUS = {} # The list of optional extensions. OPTIONAL_EXTENSIONS = ['security-group', 'fwaas_v2'] neutron-lib-2.3.0/neutron_lib/api/definitions/multiprovidernet.py0000664000175000017500000000506613641427107025402 0ustar zuulzuul00000000000000# Copyright (c) 2013 OpenStack Foundation. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import network from neutron_lib.api import validators from neutron_lib.api.validators import multiprovidernet as mp_validator from neutron_lib import constants from neutron_lib.exceptions import multiprovidernet as mp_exc def check_duplicate_segments(segments, is_partial_func=None): """Helper function checking duplicate segments. If is_partial_funcs is specified and not None, then SegmentsContainDuplicateEntry is raised if two segments are identical and non partially defined (is_partial_func(segment) == False). Otherwise SegmentsContainDuplicateEntry is raised if two segment are identical. """ if is_partial_func is not None: segments = [s for s in segments if not is_partial_func(s)] fully_specifieds = [tuple(sorted(s.items())) for s in segments] if len(set(fully_specifieds)) != len(fully_specifieds): raise mp_exc.SegmentsContainDuplicateEntry() validators.add_validator( 'network_segments', mp_validator.convert_and_validate_segments) SEGMENTS = 'segments' ALIAS = 'multi-provider' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Multi Provider Network' API_PREFIX = '' DESCRIPTION = ("Expose mapping of virtual networks to multiple physical " "networks") UPDATED_TIMESTAMP = '2013-06-27T10:00:00-00:00' RESOURCE_NAME = network.RESOURCE_NAME COLLECTION_NAME = network.COLLECTION_NAME RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { SEGMENTS: { 'allow_post': True, 'allow_put': True, 'validate': {'type:network_segments': None}, 'convert_list_to': converters.convert_kvp_list_to_dict, 'default': constants.ATTR_NOT_SPECIFIED, 'enforce_policy': True, 'is_visible': True }, } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/subnet.py0000664000175000017500000001507213641427107023264 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib import constants from neutron_lib.db import constants as db_const NAME = 'Neutron L3 Subnet' ALIAS = 'subnet' DESCRIPTION = "Layer 3 subnet abstraction" UPDATED_TIMESTAMP = "2012-01-01T10:00:00-00:00" RESOURCE_NAME = 'subnet' COLLECTION_NAME = 'subnets' RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'primary_key': True}, 'name': {'allow_post': True, 'allow_put': True, 'default': '', 'validate': { 'type:string': db_const.NAME_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'ip_version': {'allow_post': True, 'allow_put': False, 'convert_to': converters.convert_to_int, 'validate': {'type:values': [4, 6]}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'network_id': {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': {'type:uuid': None}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'subnetpool_id': {'allow_post': True, 'allow_put': False, 'default': constants.ATTR_NOT_SPECIFIED, 'required_by_policy': False, 'validate': {'type:subnetpool_id_or_none': None}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'prefixlen': {'allow_post': True, 'allow_put': False, 'validate': {'type:non_negative': None}, 'convert_to': converters.convert_to_int, 'default': constants.ATTR_NOT_SPECIFIED, 'required_by_policy': False, 'is_visible': False}, 'cidr': {'allow_post': True, 'allow_put': False, 'default': constants.ATTR_NOT_SPECIFIED, 'convert_to': converters.convert_cidr_to_canonical_format, 'validate': {'type:subnet_or_none': None}, 'required_by_policy': False, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'gateway_ip': {'allow_post': True, 'allow_put': True, 'default': constants.ATTR_NOT_SPECIFIED, 'convert_to': converters.convert_ip_to_canonical_format, 'validate': {'type:ip_address_or_none': None}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'allocation_pools': { 'allow_post': True, 'allow_put': True, 'default': constants.ATTR_NOT_SPECIFIED, 'convert_to': converters.convert_ip_to_canonical_format, 'validate': {'type:ip_pools': None}, 'is_visible': True}, 'dns_nameservers': {'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_none_to_empty_list, 'default': constants.ATTR_NOT_SPECIFIED, 'validate': {'type:nameservers': None}, 'is_visible': True}, 'host_routes': {'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_none_to_empty_list, 'default': constants.ATTR_NOT_SPECIFIED, 'validate': {'type:hostroutes': None}, 'is_visible': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'enable_dhcp': {'allow_post': True, 'allow_put': True, 'default': True, 'convert_to': converters.convert_to_boolean, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'ipv6_ra_mode': {'allow_post': True, 'allow_put': False, 'default': constants.ATTR_NOT_SPECIFIED, 'validate': { 'type:values': constants.IPV6_MODES}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'ipv6_address_mode': {'allow_post': True, 'allow_put': False, 'default': constants.ATTR_NOT_SPECIFIED, 'validate': { 'type:values': constants.IPV6_MODES}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, constants.SHARED: { 'allow_post': False, 'allow_put': False, 'default': False, 'convert_to': converters.convert_to_boolean, 'is_visible': False, 'is_filter': True, 'required_by_policy': True, 'enforce_policy': True } } } # This is a core resource so the following are not applicable. IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/subnet_segmentid_enforce.py0000664000175000017500000000520113641427107027015 0ustar zuulzuul00000000000000# Copyright 2018 AT&T Corporation. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import copy from neutron_lib.api.definitions import segment from neutron_lib.api.definitions import subnet from neutron_lib.api.definitions import subnet_segmentid_writable # The alias of the extension. ALIAS = 'subnet-segmentid-enforce' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Subnet SegmentID (policy enforced)' # A prefix for API resources. An empty prefix means that the API is going # to be exposed at the v2/ level as any other core resource. API_PREFIX = '' # The description of the extension. DESCRIPTION = "Enforce segment_id policy rule." # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2018-09-04T00:00:00-00:00" segment_id_attr_info = copy.deepcopy( subnet_segmentid_writable.RESOURCE_ATTRIBUTE_MAP[ subnet.COLLECTION_NAME][segment.SEGMENT_ID]) segment_id_attr_info['enforce_policy'] = True RESOURCE_ATTRIBUTE_MAP = { subnet.COLLECTION_NAME: { segment.SEGMENT_ID: segment_id_attr_info } } # The subresource attribute map for the extension. It adds child resources # to main extension's resource. The subresource map must have a parent and # a parameters entry. If an extension does not need such a map, None can # be specified (mandatory). SUB_RESOURCE_ATTRIBUTE_MAP = {} # The action map: it associates verbs with methods to be performed on # the API resource. ACTION_MAP = {} # The action status. ACTION_STATUS = {} # The list of required extensions. REQUIRED_EXTENSIONS = [subnet_segmentid_writable.ALIAS] # The list of optional extensions. OPTIONAL_EXTENSIONS = [] neutron-lib-2.3.0/neutron_lib/api/definitions/segments_peer_subnet_host_routes.py0000664000175000017500000000203013641427107030630 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import segment ALIAS = 'segments-peer-subnet-host-routes' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = False NAME = 'Segments peer-subnet host routes' DESCRIPTION = 'Add host routes to subnets on a routed network (segments)' UPDATED_TIMESTAMP = '2018-06-12T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [segment.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/project_default_networks.py0000664000175000017500000000446413641427107027075 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import network PROJECT_DEFAULT = 'project_default' # The alias of the extension. ALIAS = 'project-default-networks' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Default network for project' # The description of the extension. DESCRIPTION = "Support specifying networks as default networks for projects" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2018-07-03T10:00:00-00:00" # The name of the resource introduced or being extended. RESOURCE_NAME = network.RESOURCE_NAME # The plural for the resource introduced or being extended. COLLECTION_NAME = network.COLLECTION_NAME # The resource attribute map for the extension. RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { PROJECT_DEFAULT: { 'allow_post': True, 'allow_put': True, 'default': False, 'convert_to': converters.convert_to_boolean, 'is_visible': True } } } # The subresource attribute map for the extension. SUB_RESOURCE_ATTRIBUTE_MAP = { } # The action map. ACTION_MAP = { } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [ ] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/qos_rules_alias.py0000664000175000017500000001041313641427107025143 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import qos from neutron_lib.api.definitions import qos_bw_limit_direction from neutron_lib import constants from neutron_lib.db import constants as db_const from neutron_lib.services.qos import constants as q_const BANDWIDTH_LIMIT_RULES_ALIAS = "alias_bandwidth_limit_rules" DSCP_MARKING_RULES_ALIAS = 'alias_dscp_marking_rules' MIN_BANDWIDTH_RULES_ALIAS = 'alias_minimum_bandwidth_rules' _QOS_RULE_COMMON_FIELDS = { 'id': { 'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'primary_key': True }, 'tenant_id': { 'allow_post': False, 'allow_put': False, 'required_by_policy': True, 'is_visible': True } } ALIAS = 'qos-rules-alias' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Quality of Service rules alias API' API_PREFIX = '/' + qos.ALIAS DESCRIPTION = ('API to enable GET, PUT and DELETE operations on QoS policy ' 'rules without specifying policy ID') UPDATED_TIMESTAMP = '2018-10-07T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = { BANDWIDTH_LIMIT_RULES_ALIAS: dict( _QOS_RULE_COMMON_FIELDS, **{q_const.MAX_KBPS: { 'allow_post': False, 'allow_put': True, 'convert_to': converters.convert_to_int, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'validate': { 'type:range': [0, db_const.DB_INTEGER_MAX_VALUE] } }, q_const.DIRECTION: { 'allow_post': False, 'allow_put': True, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'default': constants.EGRESS_DIRECTION, 'validate': { 'type:values': constants.VALID_DIRECTIONS } }, q_const.MAX_BURST: { 'allow_post': False, 'allow_put': True, 'is_visible': True, 'default': 0, 'is_filter': True, 'is_sort_key': True, 'convert_to': converters.convert_to_int, 'validate': { 'type:range': [0, db_const.DB_INTEGER_MAX_VALUE] } }}), DSCP_MARKING_RULES_ALIAS: dict( _QOS_RULE_COMMON_FIELDS, **{q_const.DSCP_MARK: { 'allow_post': False, 'allow_put': True, 'convert_to': converters.convert_to_int, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'validate': { 'type:values': constants.VALID_DSCP_MARKS } }}), MIN_BANDWIDTH_RULES_ALIAS: dict( _QOS_RULE_COMMON_FIELDS, **{q_const.MIN_KBPS: { 'allow_post': False, 'allow_put': True, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'convert_to': converters.convert_to_int, 'validate': { 'type:range': [0, db_const.DB_INTEGER_MAX_VALUE] } }, q_const.DIRECTION: { 'allow_post': False, 'allow_put': True, 'is_visible': True, 'default': constants.EGRESS_DIRECTION, 'is_filter': True, 'is_sort_key': True, 'validate': { 'type:values': constants.VALID_DIRECTIONS } } } ) } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [qos.ALIAS, qos_bw_limit_direction.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/rbac_subnetpool.py0000664000175000017500000000201513641427107025136 0ustar zuulzuul00000000000000# Copyright (c) 2020 Cloudification GmbH. All rights reserved. # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. ALIAS = 'rbac-subnetpool' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = False NAME = 'Add subnetpool type to RBAC' DESCRIPTION = 'Add subnetpool type to RBAC' UPDATED_TIMESTAMP = '2020-02-05T00:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = ['rbac-policies', 'rbac-address-scope'] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/ip_substring_port_filtering.py0000664000175000017500000000340313641427107027576 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # The alias of the extension. ALIAS = 'ip-substring-filtering' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = True # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'IP address substring filtering' # The description of the extension. DESCRIPTION = "Provides IP address substring filtering when listing ports" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2017-11-28T09:00:00-00:00" # The resource attribute map for the extension. RESOURCE_ATTRIBUTE_MAP = { } # The subresource attribute map for the extension. SUB_RESOURCE_ATTRIBUTE_MAP = { } # The action map. ACTION_MAP = { } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [ ] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/fip_pf_description.py0000664000175000017500000000313313641427107025625 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import floating_ip_port_forwarding as pfw from neutron_lib.db import constants as db_const DESCRIPTION_FIELD = "description" ALIAS = 'floating-ip-port-forwarding-description' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Floating IP Port Forwarding new attribute description' DESCRIPTION = 'Add a description field to Port Forwarding rules' UPDATED_TIMESTAMP = '2019-11-01T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = { pfw.COLLECTION_NAME: { 'parameters': { DESCRIPTION_FIELD: { 'allow_post': True, 'allow_put': True, 'validate': { 'type:string': db_const.LONG_DESCRIPTION_FIELD_SIZE}, 'is_visible': True, 'is_sort_key': False, 'is_filter': True, 'default': '' } } } } ACTION_MAP = {} REQUIRED_EXTENSIONS = [pfw.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/qos_rule_type_details.py0000664000175000017500000000246213641427107026362 0ustar zuulzuul00000000000000# Copyright (c) 2017 OVH SAS # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import qos as qos_apidef DRIVERS = 'drivers' ALIAS = 'qos-rule-type-details' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Details of QoS rule types' API_PREFIX = '' DESCRIPTION = ("Expose details about QoS rule types supported by loaded " "backend drivers") UPDATED_TIMESTAMP = '2017-06-22T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = { qos_apidef.RULE_TYPES: { DRIVERS: { 'allow_post': False, 'allow_put': False, 'is_visible': True } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [qos_apidef.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/l3.py0000664000175000017500000001606013641427107022300 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.db import constants # The alias of the extension. ALIAS = 'router' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Neutron L3 Router' # A prefix for API resources. An empty prefix means that the API is going # to be exposed at the v2/ level as any other core resource. API_PREFIX = '' # The description of the extension. DESCRIPTION = ("Router abstraction for basic L3 forwarding " "between L2 Neutron networks and access to external " "networks via a NAT gateway.") # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2012-07-20T10:00:00-00:00" FLOATING_IP_ADDRESS = 'floating_ip_address' FLOATING_NETWORK_ID = 'floating_network_id' FLOATINGIP = 'floatingip' FLOATINGIPS = 'floatingips' ROUTERS = 'routers' ROUTER = 'router' SUBNET_ID = 'subnet_id' ROUTER_ID = 'router_id' PORT_ID = 'port_id' FIXED_IP_ADDRESS = 'fixed_ip_address' EXTERNAL_GW_INFO = 'external_gateway_info' RESOURCE_ATTRIBUTE_MAP = { ROUTERS: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'primary_key': True}, 'name': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': constants.NAME_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True, 'default': ''}, 'admin_state_up': {'allow_post': True, 'allow_put': True, 'default': True, 'convert_to': converters.convert_to_boolean, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'status': {'allow_post': False, 'allow_put': False, 'is_sort_key': True, 'is_visible': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': { 'type:string': constants.PROJECT_ID_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, EXTERNAL_GW_INFO: {'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': None, 'enforce_policy': True, 'validate': { 'type:dict_or_nodata': { 'network_id': {'type:uuid': None, 'required': True}, 'external_fixed_ips': { 'type:fixed_ips': None, 'required': False, } } }} }, FLOATINGIPS: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'primary_key': True}, 'floating_ip_address': {'allow_post': True, 'allow_put': False, 'validate': {'type:ip_address_or_none': None}, 'is_sort_key': True, 'is_filter': True, 'is_visible': True, 'default': None, 'enforce_policy': True}, 'subnet_id': {'allow_post': True, 'allow_put': False, 'validate': {'type:uuid_or_none': None}, 'is_visible': False, # Use False for input only attr 'default': None}, 'floating_network_id': {'allow_post': True, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'router_id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid_or_none': None}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True, 'default': None}, 'port_id': {'allow_post': True, 'allow_put': True, 'validate': {'type:uuid_or_none': None}, 'is_filter': True, 'is_visible': True, 'default': None, 'required_by_policy': True}, 'fixed_ip_address': {'allow_post': True, 'allow_put': True, 'validate': {'type:ip_address_or_none': None}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True, 'default': None}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': { 'type:string': constants.PROJECT_ID_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'status': {'allow_post': False, 'allow_put': False, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, }, } # The subresource attribute map for the extension. It adds child resources # to main extension's resource. The subresource map must have a parent and # a parameters entry. If an extension does not need such a map, None can # be specified (mandatory). SUB_RESOURCE_ATTRIBUTE_MAP = None # The action map: it associates verbs with methods to be performed on # the API resource. ACTION_MAP = { ROUTER: { 'add_router_interface': 'PUT', 'remove_router_interface': 'PUT' } } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [ ] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/pagination.py0000664000175000017500000000164613641427107024117 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. ALIAS = 'pagination' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = False NAME = 'Pagination support' API_PREFIX = '' DESCRIPTION = 'Extension that indicates that pagination is enabled.' UPDATED_TIMESTAMP = '2016-06-12T00:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/availability_zone_filter.py0000664000175000017500000000203413641427107027030 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import availability_zone as az ALIAS = 'availability_zone_filter' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = False NAME = 'Availability Zone Filter Extension' DESCRIPTION = 'Add filter parameters to AvailabilityZone resource' UPDATED_TIMESTAMP = '2018-06-22T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [ az.ALIAS ] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/constants.py0000664000175000017500000000212013641427107023766 0ustar zuulzuul00000000000000# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # neutron-fwaas constants from neutron_lib import constants FIREWALL_GROUPS = 'firewall_groups' FIREWALL_POLICIES = 'firewall_policies' FIREWALL_RULES = 'firewall_rules' FIREWALLS = 'firewalls' FWAAS_ALLOW = "allow" FWAAS_DENY = "deny" FWAAS_REJECT = "reject" FW_VALID_ACTION_VALUES = [FWAAS_ALLOW, FWAAS_DENY, FWAAS_REJECT] # Firewall Protocol List FW_PROTOCOL_VALUES = list(constants.IPTABLES_PROTOCOL_MAP.keys()) + [None] # a default resource, such as auto allocated topology is_default network IS_DEFAULT = 'is_default' neutron-lib-2.3.0/neutron_lib/api/definitions/uplink_status_propagation.py0000664000175000017500000000301313641427107027264 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import port as port_def PROPAGATE_UPLINK_STATUS = 'propagate_uplink_status' ALIAS = 'uplink-status-propagation' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Uplink status propagation extension' API_PREFIX = '' DESCRIPTION = 'Provides ability to propagate port uplink status.' UPDATED_TIMESTAMP = '2018-05-31T18:00:00-00:00' RESOURCE_NAME = port_def.RESOURCE_NAME COLLECTION_NAME = port_def.COLLECTION_NAME RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { PROPAGATE_UPLINK_STATUS: {'allow_post': True, 'allow_put': False, 'default': False, 'convert_to': converters.convert_to_boolean, 'is_visible': True}, }, } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/logging_resource.py0000664000175000017500000001110213641427107025307 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import firewall_v2 from neutron_lib.db import constants as db_const # The alias of the extension. ALIAS = 'logging-resource' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Logging Resource Extension' # A prefix for API resources. An empty prefix means that the API is going # to be exposed at the v2/ level as any other core resource. API_PREFIX = '/logging' # The description of the extension. DESCRIPTION = "The logging resource extension." # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2016-06-06T10:00:00-00:00" # The name of the resource. RESOURCE_NAME = 'logging_resource' # The plural for the resource. COLLECTION_NAME = 'logging_resources' # Attributes ENABLED = 'enabled' # Sub resource FIREWALL_LOGS = 'firewall_logs' LOGGING_RESOURCE_ID = 'logging_resource_id' FW_EVENT = 'fw_event' FIREWALL_ID = 'firewall_id' FW_EVENT_ACCEPT = 'ACCEPT' FW_EVENT_DROP = 'DROP' FW_EVENT_ALL = 'ALL' FW_EVENTS = [FW_EVENT_ACCEPT, FW_EVENT_DROP, FW_EVENT_ALL] LOG_COMMON_FIELDS = { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'primary_key': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'is_visible': True}, LOGGING_RESOURCE_ID: {'allow_post': False, 'allow_put': False, 'is_visible': True} } RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'primary_key': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'is_visible': True}, 'name': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, 'default': '', 'is_visible': True}, 'description': { 'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.LONG_DESCRIPTION_FIELD_SIZE}, 'default': '', 'is_visible': True}, ENABLED: {'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': False, 'convert_to': converters.convert_to_boolean}, FIREWALL_LOGS: {'allow_post': False, 'allow_put': False, 'is_visible': True} } } SUB_RESOURCE_ATTRIBUTE_MAP = { FIREWALL_LOGS: { 'parent': {'collection_name': COLLECTION_NAME, 'member_name': RESOURCE_NAME}, 'parameters': dict((LOG_COMMON_FIELDS), **{ 'description': { 'allow_post': True, 'allow_put': True, 'validate': { 'type:string': db_const.LONG_DESCRIPTION_FIELD_SIZE}, 'default': '', 'is_visible': True}, FIREWALL_ID: { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'validate': {'type:uuid': None}}, FW_EVENT: { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'validate': {'type:values': FW_EVENTS}, 'default': FW_EVENT_ALL} }), }, } # The action map. ACTION_MAP = {} # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [ firewall_v2.ALIAS, ] # The list of optional extensions. OPTIONAL_EXTENSIONS = [] neutron-lib-2.3.0/neutron_lib/api/definitions/tag_ports_during_bulk_creation.py0000664000175000017500000000200013641427107030222 0ustar zuulzuul00000000000000# Copyright (c) 2019 Verizon Media # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. ALIAS = 'tag-ports-during-bulk-creation' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = False NAME = 'Tag Ports During Bulk Creation' DESCRIPTION = 'Allow to tag ports during bulk creation' UPDATED_TIMESTAMP = '2019-12-29T19:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/port_resource_request.py0000664000175000017500000000260013641427107026420 0ustar zuulzuul00000000000000# Copyright (c) 2018 Ericsson # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import port from neutron_lib import constants ALIAS = 'port-resource-request' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Port Resource Request' DESCRIPTION = "Expose resource request to Port" UPDATED_TIMESTAMP = "2018-05-08T10:00:00-00:00" RESOURCE_NAME = port.RESOURCE_NAME COLLECTION_NAME = port.COLLECTION_NAME RESOURCE_REQUEST = 'resource_request' RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { RESOURCE_REQUEST: {'allow_post': False, 'allow_put': False, 'default': constants.ATTR_NOT_SPECIFIED, 'is_visible': True} }, } SUB_RESOURCE_ATTRIBUTE_MAP = None ACTION_MAP = {} ACTION_STATUS = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] neutron-lib-2.3.0/neutron_lib/api/definitions/portbindings_extended.py0000664000175000017500000001035313641427107026343 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import port from neutron_lib.api.definitions import portbindings from neutron_lib import constants from neutron_lib.db import constants as db_const # Plural of the resource COLLECTION_NAME = 'bindings' # Name of the resource RESOURCE_NAME = 'binding' # Parent PARENT_RESOURCE_NAME = port.RESOURCE_NAME PARENT_COLLECTION_NAME = port.COLLECTION_NAME # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # Name of the extension NAME = "Port Bindings Extended" # Extension alias ALIAS = 'binding-extended' # Extension description DESCRIPTION = "Expose port bindings of a virtual port to external application" # Action name for activating a port binding ACTIVATE_BINDING = 'activate' # Timestamp of last update of this extension UPDATED_TIMESTAMP = "2017-07-17T10:00:00-00:00" # Extension attributes HOST = 'host' VIF_TYPE = 'vif_type' VIF_DETAILS = 'vif_details' VNIC_TYPE = 'vnic_type' PROFILE = 'profile' STATUS = 'status' PROJECT_ID = 'project_id' # No attribute map, this extension defines only sub resource RESOURCE_ATTRIBUTE_MAP = {} # Attribute map of bindings SUB_RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'parent': { 'collection_name': PARENT_COLLECTION_NAME, 'member_name': PARENT_RESOURCE_NAME}, 'parameters': { HOST: {'allow_post': True, 'allow_put': True, 'is_visible': True, 'primary_key': True, 'is_filter': True}, VIF_TYPE: {'allow_post': False, 'allow_put': False, 'default': constants.ATTR_NOT_SPECIFIED, 'enforce_policy': True, 'is_visible': True, 'is_filter': True}, VIF_DETAILS: {'allow_post': False, 'allow_put': False, 'default': constants.ATTR_NOT_SPECIFIED, 'enforce_policy': True, 'is_visible': True}, VNIC_TYPE: {'allow_post': True, 'allow_put': True, 'default': portbindings.VNIC_NORMAL, 'is_visible': True, 'is_filter': True, 'validate': {'type:values': portbindings.VNIC_TYPES}, 'enforce_policy': True}, PROFILE: {'allow_post': True, 'allow_put': True, 'default': constants.ATTR_NOT_SPECIFIED, 'enforce_policy': True, 'validate': {'type:dict_or_none': None}, 'is_visible': True}, STATUS: {'allow_post': False, 'allow_put': False, 'is_visible': True, 'is_filter': True}, PROJECT_ID: {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'is_visible': True}, } } } # activate is an action ACTION_MAP = { RESOURCE_NAME: { ACTIVATE_BINDING: 'PUT', }, } # No action statuses are required ACTION_STATUS = { } # The list of required extensions REQUIRED_EXTENSIONS = [ portbindings.ALIAS, ] # The list of optional extensions OPTIONAL_EXTENSIONS = [] neutron-lib-2.3.0/neutron_lib/api/definitions/router_availability_zone.py0000664000175000017500000000270313641427107027066 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from neutron_lib.api.definitions import availability_zone as az from neutron_lib.api.definitions import l3 ALIAS = 'router_availability_zone' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Router Availability Zone' API_PREFIX = '' DESCRIPTION = 'Availability zone support for router.' UPDATED_TIMESTAMP = '2015-01-01T10:00:00-00:00' RESOURCE_NAME = l3.ROUTER COLLECTION_NAME = l3.ROUTERS RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { az.COLLECTION_NAME: { 'allow_post': False, 'allow_put': False, 'is_visible': True }, az.AZ_HINTS: { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'validate': {'type:availability_zone_hint_list': None}, 'default': [] } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [l3.ALIAS, az.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/l3_ext_ha_mode.py0000664000175000017500000000270413641427107024634 0ustar zuulzuul00000000000000# Copyright (C) 2014 eNovance SAS # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import l3 from neutron_lib import constants HA_INFO = 'ha' ALIAS = constants.L3_HA_MODE_EXT_ALIAS IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'HA Router extension' API_PREFIX = '' DESCRIPTION = 'Adds HA capability to routers.' UPDATED_TIMESTAMP = '2014-04-26T00:00:00-00:00' RESOURCE_NAME = l3.ROUTER COLLECTION_NAME = l3.ROUTERS RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { HA_INFO: { 'allow_post': True, 'allow_put': True, 'default': constants.ATTR_NOT_SPECIFIED, 'is_visible': True, 'enforce_policy': True, 'convert_to': converters.convert_to_boolean_if_not_none } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [l3.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/network.py0000664000175000017500000000617713641427107023463 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import subnet from neutron_lib import constants from neutron_lib.db import constants as db_const NAME = 'Neutron L2 Network' ALIAS = 'network' DESCRIPTION = "Layer 2 network abstraction" UPDATED_TIMESTAMP = "2012-01-01T10:00:00-00:00" RESOURCE_NAME = 'network' COLLECTION_NAME = 'networks' # Identify the attribute used by a resource to reference another resource RESOURCE_FOREIGN_KEYS = { COLLECTION_NAME: 'network_id' } RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'primary_key': True}, 'name': {'allow_post': True, 'allow_put': True, 'validate': { 'type:string': db_const.NAME_FIELD_SIZE}, 'default': '', 'is_visible': True, 'is_filter': True, 'is_sort_key': True}, subnet.COLLECTION_NAME: {'allow_post': False, 'allow_put': False, 'default': [], 'is_visible': True}, 'admin_state_up': {'allow_post': True, 'allow_put': True, 'default': True, 'convert_to': converters.convert_to_boolean, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'status': {'allow_post': False, 'allow_put': False, 'is_visible': True, 'is_filter': True, 'is_sort_key': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, constants.SHARED: { 'allow_post': True, 'allow_put': True, 'default': False, 'convert_to': converters.convert_to_boolean, 'is_visible': True, 'is_filter': True, 'required_by_policy': True, 'enforce_policy': True } } } # This is a core resource so the following are not applicable. IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/agent.py0000664000175000017500000000534213641427107023061 0ustar zuulzuul00000000000000# Copyright (c) 2013 OpenStack Foundation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from neutron_lib.api import converters from neutron_lib.db import constants ALIAS = 'agent' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = ALIAS API_PREFIX = '' DESCRIPTION = 'The agent management extension.' UPDATED_TIMESTAMP = '2013-02-03T10:00:00-00:00' RESOURCE_NAME = ALIAS COLLECTION_NAME = ALIAS + 's' RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_filter': True, 'is_visible': True}, 'agent_type': {'allow_post': False, 'allow_put': False, 'is_filter': True, 'is_visible': True}, 'binary': {'allow_post': False, 'allow_put': False, 'is_filter': True, 'is_visible': True}, 'topic': {'allow_post': False, 'allow_put': False, 'is_filter': True, 'is_visible': True}, 'host': {'allow_post': False, 'allow_put': False, 'is_filter': True, 'is_visible': True}, 'admin_state_up': {'allow_post': False, 'allow_put': True, 'convert_to': converters.convert_to_boolean, 'is_filter': True, 'is_visible': True}, 'created_at': {'allow_post': False, 'allow_put': False, 'is_visible': True}, 'started_at': {'allow_post': False, 'allow_put': False, 'is_visible': True}, 'heartbeat_timestamp': {'allow_post': False, 'allow_put': False, 'is_visible': True}, 'alive': {'allow_post': False, 'allow_put': False, 'is_filter': True, 'is_visible': True}, 'configurations': {'allow_post': False, 'allow_put': False, 'is_visible': True}, 'description': { 'allow_post': False, 'allow_put': True, 'is_visible': True, 'is_filter': True, 'validate': { 'type:string_or_none': constants.DESCRIPTION_FIELD_SIZE}}, } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/qos_bw_limit_direction.py0000664000175000017500000000351513641427107026513 0ustar zuulzuul00000000000000# Copyright (c) 2017 OVH SAS # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import qos as qos_apidef from neutron_lib import constants from neutron_lib.services.qos import constants as qos_const ALIAS = 'qos-bw-limit-direction' LABEL = '' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Direction for QoS bandwidth limit rule' API_PREFIX = '' DESCRIPTION = ("Allow to configure QoS bandwidth limit rule with specific " "direction: ingress or egress") UPDATED_TIMESTAMP = '2017-04-10T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = { # NOTE(boden): parameters is required here as BANDWIDTH_LIMIT_RULES is a # sub-resource extension itself qos_apidef.BANDWIDTH_LIMIT_RULES: { 'parameters': { qos_const.DIRECTION: { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'default': constants.EGRESS_DIRECTION, 'validate': { 'type:values': constants.VALID_DIRECTIONS } } } } } ACTION_MAP = {} REQUIRED_EXTENSIONS = [qos_apidef.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/vpn_flavors.py0000664000175000017500000000257213641427107024324 0ustar zuulzuul00000000000000# Copyright 2017 Eayun, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # from neutron_lib.api.definitions import flavors from neutron_lib.api.definitions import vpn FLAVOR_ID = 'flavor_id' ALIAS = 'vpn-flavors' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'VPN Service Falvor Extension' DESCRIPTION = 'Flavor support for vpnservices.' UPDATED_TIMESTAMP = '2017-04-19T00:00:00-00:00' API_PREFIX = '/vpn' RESOURCE_NAME = vpn.VPNSERVICE COLLECTION_NAME = vpn.VPNSERVICES RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { FLAVOR_ID: {'allow_post': True, 'allow_put': False, 'validate': {'type:uuid_or_none': None}, 'is_visible': True, 'default': None} }, } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [vpn.ALIAS] OPTIONAL_EXTENSIONS = [flavors.ALIAS] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/qos_bw_minimum_ingress.py0000664000175000017500000000321313641427107026535 0ustar zuulzuul00000000000000# Copyright (c) 2018 Ericsson # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import qos as qos_apidef from neutron_lib import constants from neutron_lib.services.qos import constants as qos_constants ALIAS = 'qos-bw-minimum-ingress' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Ingress direction for QoS minimum bandwidth rule' DESCRIPTION = ("Allow to configure QoS minumum bandwidth rule with ingress " "direction.") UPDATED_TIMESTAMP = '2018-07-09T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = { qos_apidef.MIN_BANDWIDTH_RULES: { 'parameters': { qos_constants.DIRECTION: { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': constants.EGRESS_DIRECTION, 'is_filter': True, 'is_sort_key': True, 'validate': { 'type:values': constants.VALID_DIRECTIONS } } } } } ACTION_MAP = {} REQUIRED_EXTENSIONS = [qos_apidef.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/bgpvpn.py0000664000175000017500000002002413641427107023251 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import l3 from neutron_lib.db import constants as db_const # Regular expression to validate 32 bits unsigned int UINT32_REGEX = (r'(0|[1-9]\d{0,8}|[1-3]\d{9}|4[01]\d{8}|42[0-8]\d{7}' r'|429[0-3]\d{6}|4294[0-8]\d{5}|42949[0-5]\d{4}' r'|429496[0-6]\d{3}|4294967[0-1]\d{2}|42949672[0-8]\d' r'|429496729[0-5])') # Regular expression to validate 16 bits unsigned int UINT16_REGEX = (r'(0|[1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}' r'|655[0-2]\d|6553[0-5])') # Regular expression to validate 8 bits unsigned int UINT8_REGEX = (r'(0|[1-9]\d{0,1}|1\d{2}|2[0-4]\d|25[0-5])') # Regular expression to validate IPv4 address IP4_REGEX = (r'(%s\.%s\.%s\.%s)') % (UINT8_REGEX, UINT8_REGEX, UINT8_REGEX, UINT8_REGEX) # Regular expression to validate Route Target list format # Support of the Type 0, Type 1 and Type 2, cf. chapter 4.2 in RFC 4364 # Also validates Route Distinguisher list format RTRD_REGEX = (r'^(%s:%s|%s:%s|%s:%s)$') % (UINT16_REGEX, UINT32_REGEX, IP4_REGEX, UINT16_REGEX, UINT32_REGEX, UINT16_REGEX) # The alias of the extension. ALIAS = 'bgpvpn' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'BGPVPN Extension' # The description of the extension. DESCRIPTION = "Provides support for BGP VPN interconnections" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2014-06-10T17:00:00-00:00" API_PREFIX = '/bgpvpn' # The specific resources and/or attributes for the extension (optional). RESOURCE_NAME = 'bgpvpn' COLLECTION_NAME = 'bgpvpns' BGPVPN_L2 = 'l2' BGPVPN_L3 = 'l3' BGPVPN_RES = "bgpvpns" BGPVPN_TYPES = [BGPVPN_L3, BGPVPN_L2] NETWORK_ASSOCIATION = 'network_association' NETWORK_ASSOCIATIONS = 'network_associations' ROUTER_ASSOCIATION = 'router_association' ROUTER_ASSOCIATIONS = 'router_associations' # The resource attribute map for the extension. RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'primary_key': True, 'enforce_policy': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True, 'is_visible': True, 'enforce_policy': True}, 'name': {'allow_post': True, 'allow_put': True, 'default': '', 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, 'is_visible': True, 'enforce_policy': True}, 'type': {'allow_post': True, 'allow_put': False, 'default': BGPVPN_L3, 'validate': {'type:values': BGPVPN_TYPES}, 'is_visible': True, 'enforce_policy': True}, 'route_targets': {'allow_post': True, 'allow_put': True, 'default': [], 'convert_to': converters.convert_to_list, 'validate': {'type:list_of_regex_or_none': RTRD_REGEX}, 'is_visible': True, 'enforce_policy': True}, 'import_targets': {'allow_post': True, 'allow_put': True, 'default': [], 'convert_to': converters.convert_to_list, 'validate': {'type:list_of_regex_or_none': RTRD_REGEX}, 'is_visible': True, 'enforce_policy': True}, 'export_targets': {'allow_post': True, 'allow_put': True, 'default': [], 'convert_to': converters.convert_to_list, 'validate': {'type:list_of_regex_or_none': RTRD_REGEX}, 'is_visible': True, 'enforce_policy': True}, 'route_distinguishers': {'allow_post': True, 'allow_put': True, 'default': [], 'convert_to': converters.convert_to_list, 'validate': {'type:list_of_regex_or_none': RTRD_REGEX}, 'is_visible': True, 'enforce_policy': True}, 'networks': {'allow_post': False, 'allow_put': False, 'is_visible': True, 'enforce_policy': True}, 'routers': {'allow_post': False, 'allow_put': False, 'is_visible': True, 'enforce_policy': True} }, } SUB_RESOURCE_ATTRIBUTE_MAP = { NETWORK_ASSOCIATIONS: { 'parent': {'collection_name': COLLECTION_NAME, 'member_name': RESOURCE_NAME}, 'parameters': { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'primary_key': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True, 'is_visible': True, 'enforce_policy': True}, 'network_id': {'allow_post': True, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'enforce_policy': True} } }, ROUTER_ASSOCIATIONS: { 'parent': {'collection_name': COLLECTION_NAME, 'member_name': RESOURCE_NAME}, 'parameters': { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'primary_key': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True, 'is_visible': True, 'enforce_policy': True}, 'router_id': {'allow_post': True, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'enforce_policy': True} } } } ACTION_MAP = { } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [l3.ALIAS] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/ip_allocation.py0000664000175000017500000000272013641427107024575 0ustar zuulzuul00000000000000# Copyright (c) 2016 Hewlett Packard Enterprise Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import port IP_ALLOCATION = 'ip_allocation' IP_ALLOCATION_IMMEDIATE = 'immediate' IP_ALLOCATION_DEFERRED = 'deferred' IP_ALLOCATION_NONE = 'none' ALIAS = 'ip_allocation' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'IP Allocation' API_PREFIX = '' DESCRIPTION = 'IP allocation extension.' UPDATED_TIMESTAMP = '2016-06-10T23:00:00-00:00' RESOURCE_NAME = port.RESOURCE_NAME COLLECTION_NAME = port.COLLECTION_NAME RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { IP_ALLOCATION: { 'allow_post': False, 'allow_put': False, 'is_filter': True, 'is_sort_key': True, 'is_visible': True } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/flavors.py0000664000175000017500000001411513641427107023435 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.db import constants as db_const FLAVOR = 'flavor' FLAVORS = FLAVOR + 's' SERVICE_PROFILES = 'service_profiles' NEXT_PROVIDERS = 'next_providers' ALIAS = FLAVORS IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Neutron Service Flavors' API_PREFIX = '' DESCRIPTION = 'Flavor specification for Neutron advanced services.' UPDATED_TIMESTAMP = '2015-09-17T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = { FLAVORS: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'primary_key': True}, 'name': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True, 'default': ''}, 'description': {'allow_post': True, 'allow_put': True, 'validate': {'type:string_or_none': db_const.LONG_DESCRIPTION_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True, 'default': ''}, 'service_type': {'allow_post': True, 'allow_put': False, 'validate': {'type:service_plugin_type': None}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'is_visible': True}, 'service_profiles': {'allow_post': True, 'allow_put': True, 'validate': {'type:uuid_list': None}, 'is_visible': True, 'default': []}, 'enabled': {'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_to_boolean_if_not_none, 'default': True, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, }, SERVICE_PROFILES: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'primary_key': True}, 'description': {'allow_post': True, 'allow_put': True, 'validate': {'type:string_or_none': db_const.LONG_DESCRIPTION_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True, 'default': ''}, 'driver': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.LONG_DESCRIPTION_FIELD_SIZE}, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'default': ''}, 'metainfo': {'allow_post': True, 'allow_put': True, 'is_visible': True, 'is_sort_key': True, 'default': ''}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'is_visible': True}, 'enabled': {'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_to_boolean_if_not_none, 'is_filter': True, 'is_sort_key': True, 'is_visible': True, 'default': True}, }, } SUB_RESOURCE_ATTRIBUTE_MAP = { NEXT_PROVIDERS: { 'parent': {'collection_name': FLAVORS, 'member_name': FLAVOR}, 'parameters': {'provider': {'allow_post': False, 'allow_put': False, 'is_visible': True}, 'driver': {'allow_post': False, 'allow_put': False, 'is_visible': True}, 'metainfo': {'allow_post': False, 'allow_put': False, 'is_visible': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'is_visible': True}} }, SERVICE_PROFILES: { 'parent': {'collection_name': FLAVORS, 'member_name': FLAVOR}, 'parameters': {'id': {'allow_post': True, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'is_visible': True}} } } ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/port.py0000664000175000017500000001047313641427107022750 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib import constants from neutron_lib.db import constants as db_const NAME = 'Neutron Port' ALIAS = 'port' DESCRIPTION = "Network port abstraction" UPDATED_TIMESTAMP = "2012-01-01T10:00:00-00:00" RESOURCE_NAME = 'port' COLLECTION_NAME = 'ports' PORT_MAC_ADDRESS = 'mac_address' RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True, 'primary_key': True}, 'name': {'allow_post': True, 'allow_put': True, 'default': '', 'validate': { 'type:string': db_const.NAME_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'network_id': {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': {'type:uuid': None}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'admin_state_up': {'allow_post': True, 'allow_put': True, 'default': True, 'convert_to': converters.convert_to_boolean, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, PORT_MAC_ADDRESS: {'allow_post': True, 'allow_put': True, 'default': constants.ATTR_NOT_SPECIFIED, 'validate': {'type:mac_address': None}, 'enforce_policy': True, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'fixed_ips': {'allow_post': True, 'allow_put': True, 'default': constants.ATTR_NOT_SPECIFIED, 'convert_list_to': converters.convert_kvp_list_to_dict, 'validate': {'type:fixed_ips': None}, 'enforce_policy': True, 'is_filter': True, 'is_visible': True}, 'device_id': {'allow_post': True, 'allow_put': True, 'validate': { 'type:string': db_const.DEVICE_ID_FIELD_SIZE}, 'default': '', 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'device_owner': {'allow_post': True, 'allow_put': True, 'validate': { 'type:string': db_const.DEVICE_OWNER_FIELD_SIZE}, 'default': '', 'enforce_policy': True, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'status': {'allow_post': False, 'allow_put': False, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, } } # This is a core resource so the following are not applicable. IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/l3_flavors.py0000664000175000017500000000250213641427107024030 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import l3 from neutron_lib import constants FLAVOR_ID = 'flavor_id' ALIAS = 'l3-flavors' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Router Flavor Extension' API_PREFIX = '' DESCRIPTION = 'Flavor support for routers.' UPDATED_TIMESTAMP = '2016-05-17T00:00:00-00:00' RESOURCE_NAME = l3.ROUTER COLLECTION_NAME = l3.ROUTERS RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { FLAVOR_ID: { 'allow_post': True, 'allow_put': False, 'default': constants.ATTR_NOT_SPECIFIED, 'is_sort_key': True, 'is_visible': True, 'enforce_policy': True } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = ['flavors', l3.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/router_interface_fip.py0000664000175000017500000000357313641427107026165 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import l3 # The alias of the extension. ALIAS = 'router-interface-fip' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = True # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Router interface FIP Extension' # The description of the extension. DESCRIPTION = "Router interface FIP Extension" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2015-11-11T10:00:00-00:00" # The resource attribute map for the extension. It is effectively the # bulk of the API contract alongside ACTION_MAP RESOURCE_ATTRIBUTE_MAP = {} # The subresource attribute map for the extension. SUB_RESOURCE_ATTRIBUTE_MAP = None # The action map. ACTION_MAP = {} # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [ l3.ALIAS, ] # The list of optional extensions. OPTIONAL_EXTENSIONS = [] neutron-lib-2.3.0/neutron_lib/api/definitions/vpn.py0000664000175000017500000004037613641427107022574 0ustar zuulzuul00000000000000# (c) Copyright 2013 Hewlett-Packard Development Company, L.P. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import l3 from neutron_lib.api import validators from neutron_lib.db import constants as db_const # Resource constants VPNSERVICE = 'vpnservice' VPNSERVICES = 'vpnservices' IPSEC_SITE_CONNECTION = 'ipsec_site_connection' IPSEC_SITE_CONNECTIONS = 'ipsec_site_connections' IPSEC_POLICY = 'ipsecpolicy' IPSEC_POLICIES = 'ipsecpolicies' IKE_POLICY = 'ikepolicy' IKE_POLICIES = 'ikepolicies' # VPN initiator constants VPN_INITIATOR_BI_DIRECTIONAL = 'bi-directional' VPN_INITIATOR_RESPONSE_ONLY = 'response-only' VPN_SUPPORTED_INITIATORS = [ VPN_INITIATOR_BI_DIRECTIONAL, VPN_INITIATOR_RESPONSE_ONLY, ] # VPN encryption algorithm constants VPN_ENCRYPTION_ALGORITHM_3DES = '3des' VPN_ENCRYPTION_ALGORITHM_AES_128 = 'aes-128' VPN_ENCRYPTION_ALGORITHM_AES_192 = 'aes-192' VPN_ENCRYPTION_ALGORITHM_AES_256 = 'aes-256' VPN_SUPPORTED_ENCRYPTION_ALGORITHMS = [ VPN_ENCRYPTION_ALGORITHM_3DES, VPN_ENCRYPTION_ALGORITHM_AES_128, VPN_ENCRYPTION_ALGORITHM_AES_192, VPN_ENCRYPTION_ALGORITHM_AES_256, ] # VPN DPD action constants VPN_DPD_ACTION_CLEAR = 'clear' VPN_DPD_ACTION_DISABLED = 'disabled' VPN_DPD_ACTION_HOLD = 'hold' VPN_DPD_ACTION_RESTART = 'restart' VPN_DPD_ACTION_RESTART_BY_PEER = 'restart-by-peer' VPN_SUPPORTED_DPD_ACTIONS = [ VPN_DPD_ACTION_CLEAR, VPN_DPD_ACTION_DISABLED, VPN_DPD_ACTION_HOLD, VPN_DPD_ACTION_RESTART, VPN_DPD_ACTION_RESTART_BY_PEER, ] # VPN transform protocol constants VPN_TRANSFORM_PROTOCOL_AH = 'ah' VPN_TRANSFORM_PROTOCOL_AH_ESP = 'ah-esp' VPN_TRANSFORM_PROTOCOL_ESP = 'esp' VPN_SUPPORTED_TRANSFORM_PROTOCOLS = [ VPN_TRANSFORM_PROTOCOL_AH, VPN_TRANSFORM_PROTOCOL_AH_ESP, VPN_TRANSFORM_PROTOCOL_ESP, ] # VPN encapsulation mode constants VPN_ENCAPSULATION_MODE_TRANSPORT = 'transport' VPN_ENCAPSULATION_MODE_TUNNEL = 'tunnel' VPN_SUPPORTED_ENCAPSULATION_MODES = [ VPN_ENCAPSULATION_MODE_TRANSPORT, VPN_ENCAPSULATION_MODE_TUNNEL, ] # VPN lifetime unit constants VPN_LIFETIME_UNIT_SECONDS = 'seconds' VPN_SUPPORTED_LIFETIME_UNITS = [ VPN_LIFETIME_UNIT_SECONDS, ] # VPN PFS group constants VPN_PFS_GROUP2 = 'group2' VPN_PFS_GROUP5 = 'group5' VPN_PFS_GROUP14 = 'group14' VPN_SUPPORTED_PFSES = [ VPN_PFS_GROUP2, VPN_PFS_GROUP5, VPN_PFS_GROUP14, ] # VPN IKE version constants VPN_IKE_VERSION_V1 = 'v1' VPN_IKE_VERSION_V2 = 'v2' VPN_SUPPORTED_IKE_VERSIONS = [ VPN_IKE_VERSION_V1, VPN_IKE_VERSION_V2, ] # VPN auth mode constants VPN_AUTH_MODE_PSK = 'psk' VPN_SUPPORTED_AUTH_MODES = [ VPN_AUTH_MODE_PSK, ] # VPN auth algorithm constants VPN_AUTH_ALGORITHM_SHA1 = 'sha1' VPN_AUTH_ALGORITHM_SHA256 = 'sha256' VPN_AUTH_ALGORITHM_SHA384 = 'sha384' VPN_AUTH_ALGORITHM_SHA512 = 'sha512' VPN_SUPPORTED_AUTH_ALGORITHMS = [ VPN_AUTH_ALGORITHM_SHA1, VPN_AUTH_ALGORITHM_SHA256, VPN_AUTH_ALGORITHM_SHA384, VPN_AUTH_ALGORITHM_SHA512, ] # VPN phase1 negotiation mode constants VPN_PHASE1_NEGOTIATION_MODE_MAIN = 'main' VPN_SUPPORTED_PHASE1_NEGOTIATION_MODES = [ VPN_PHASE1_NEGOTIATION_MODE_MAIN, ] # The alias of the extension. ALIAS = 'vpnaas' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'VPN service' # The description of the extension. DESCRIPTION = "Extension for VPN service" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2013-05-29T10:00:00-00:00" # Base for the API calls API_PREFIX = '/vpn' _vpn_lifetime_limits = (60, validators.UNLIMITED) RESOURCE_ATTRIBUTE_MAP = { VPNSERVICES: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'is_sort_key': True, 'primary_key': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True, 'is_sort_key': True, 'is_visible': True}, 'name': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, 'is_visible': True, 'is_sort_key': True, 'default': ''}, 'description': {'allow_post': True, 'allow_put': True, 'validate': { 'type:string': db_const.DESCRIPTION_FIELD_SIZE}, 'is_visible': True, 'default': ''}, 'subnet_id': {'allow_post': True, 'allow_put': False, 'validate': {'type:uuid_or_none': None}, 'is_visible': True, 'default': None}, 'router_id': {'allow_post': True, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_sort_key': True, 'is_visible': True}, 'admin_state_up': {'allow_post': True, 'allow_put': True, 'default': True, 'convert_to': converters.convert_to_boolean, 'is_visible': True}, 'external_v4_ip': {'allow_post': False, 'allow_put': False, 'is_visible': True}, 'external_v6_ip': {'allow_post': False, 'allow_put': False, 'is_visible': True}, 'status': {'allow_post': False, 'allow_put': False, 'is_visible': True}, }, IPSEC_SITE_CONNECTIONS: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'is_sort_key': True, 'primary_key': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True, 'is_sort_key': True, 'is_visible': True}, 'name': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, 'is_visible': True, 'is_sort_key': True, 'default': ''}, 'description': {'allow_post': True, 'allow_put': True, 'validate': { 'type:string': db_const.DESCRIPTION_FIELD_SIZE}, 'is_visible': True, 'default': ''}, 'local_id': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': None}, 'is_visible': True, 'default': ''}, 'peer_address': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': None}, 'is_visible': True}, 'peer_id': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': None}, 'is_visible': True}, 'peer_cidrs': {'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_to_list, 'validate': {'type:list_of_subnets_or_none': None}, 'is_visible': True, 'default': None}, 'local_ep_group_id': {'allow_post': True, 'allow_put': True, 'validate': {'type:uuid_or_none': None}, 'is_visible': True, 'default': None}, 'peer_ep_group_id': {'allow_post': True, 'allow_put': True, 'validate': {'type:uuid_or_none': None}, 'is_visible': True, 'default': None}, 'route_mode': {'allow_post': False, 'allow_put': False, 'is_visible': True}, 'mtu': {'allow_post': True, 'allow_put': True, 'default': 1500, 'validate': {'type:non_negative': None}, 'convert_to': converters.convert_to_int, 'is_visible': True}, 'initiator': {'allow_post': True, 'allow_put': True, 'default': VPN_INITIATOR_BI_DIRECTIONAL, 'validate': {'type:values': VPN_SUPPORTED_INITIATORS}, 'is_visible': True}, 'auth_mode': {'allow_post': False, 'allow_put': False, 'default': VPN_AUTH_MODE_PSK, 'validate': {'type:values': VPN_SUPPORTED_AUTH_MODES}, 'is_visible': True}, 'psk': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': None}, 'is_visible': True}, 'dpd': { 'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_none_to_empty_dict, 'is_visible': True, 'default': {}, 'validate': { 'type:dict_or_empty': { 'action': {'type:values': VPN_SUPPORTED_DPD_ACTIONS}, 'interval': {'type:non_negative': None}, 'timeout': {'type:non_negative': None}}}}, 'admin_state_up': {'allow_post': True, 'allow_put': True, 'default': True, 'convert_to': converters.convert_to_boolean, 'is_visible': True}, 'status': {'allow_post': False, 'allow_put': False, 'is_visible': True}, 'vpnservice_id': {'allow_post': True, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True}, 'ikepolicy_id': {'allow_post': True, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True}, 'ipsecpolicy_id': {'allow_post': True, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True}, }, IPSEC_POLICIES: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'is_sort_key': True, 'primary_key': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True, 'is_sort_key': True, 'is_visible': True}, 'name': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, 'is_visible': True, 'is_sort_key': True, 'default': ''}, 'description': {'allow_post': True, 'allow_put': True, 'validate': { 'type:string': db_const.DESCRIPTION_FIELD_SIZE}, 'is_visible': True, 'default': ''}, 'transform_protocol': { 'allow_post': True, 'allow_put': True, 'default': VPN_TRANSFORM_PROTOCOL_ESP, 'validate': {'type:values': VPN_SUPPORTED_TRANSFORM_PROTOCOLS}, 'is_visible': True}, 'auth_algorithm': { 'allow_post': True, 'allow_put': True, 'default': VPN_AUTH_ALGORITHM_SHA1, 'validate': {'type:values': VPN_SUPPORTED_AUTH_ALGORITHMS}, 'is_visible': True}, 'encryption_algorithm': { 'allow_post': True, 'allow_put': True, 'default': VPN_ENCRYPTION_ALGORITHM_AES_128, 'validate': {'type:values': VPN_SUPPORTED_ENCRYPTION_ALGORITHMS}, 'is_visible': True}, 'encapsulation_mode': { 'allow_post': True, 'allow_put': True, 'default': VPN_ENCAPSULATION_MODE_TUNNEL, 'validate': {'type:values': VPN_SUPPORTED_ENCAPSULATION_MODES}, 'is_visible': True}, 'lifetime': { 'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_none_to_empty_dict, 'default': {}, 'validate': { 'type:dict_or_empty': { 'units': {'type:values': VPN_SUPPORTED_LIFETIME_UNITS}, 'value': {'type:range': _vpn_lifetime_limits}}}, 'is_visible': True}, 'pfs': {'allow_post': True, 'allow_put': True, 'default': VPN_PFS_GROUP5, 'validate': {'type:values': VPN_SUPPORTED_PFSES}, 'is_visible': True}, }, IKE_POLICIES: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'is_sort_key': True, 'primary_key': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True, 'is_sort_key': True, 'is_visible': True}, 'name': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, 'is_visible': True, 'is_sort_key': True, 'default': ''}, 'description': {'allow_post': True, 'allow_put': True, 'validate': { 'type:string': db_const.DESCRIPTION_FIELD_SIZE}, 'is_visible': True, 'default': ''}, 'auth_algorithm': { 'allow_post': True, 'allow_put': True, 'default': VPN_AUTH_ALGORITHM_SHA1, 'validate': {'type:values': VPN_SUPPORTED_AUTH_ALGORITHMS}, 'is_visible': True}, 'encryption_algorithm': { 'allow_post': True, 'allow_put': True, 'default': VPN_ENCRYPTION_ALGORITHM_AES_128, 'validate': {'type:values': VPN_SUPPORTED_ENCRYPTION_ALGORITHMS}, 'is_visible': True}, 'phase1_negotiation_mode': { 'allow_post': True, 'allow_put': True, 'default': VPN_PHASE1_NEGOTIATION_MODE_MAIN, 'validate': { 'type:values': VPN_SUPPORTED_PHASE1_NEGOTIATION_MODES}, 'is_visible': True}, 'lifetime': { 'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_none_to_empty_dict, 'default': {}, 'validate': { 'type:dict_or_empty': { 'units': {'type:values': VPN_SUPPORTED_LIFETIME_UNITS}, 'value': {'type:range': _vpn_lifetime_limits}}}, 'is_visible': True}, 'ike_version': { 'allow_post': True, 'allow_put': True, 'default': VPN_IKE_VERSION_V1, 'validate': {'type:values': VPN_SUPPORTED_IKE_VERSIONS}, 'is_visible': True}, 'pfs': {'allow_post': True, 'allow_put': True, 'default': VPN_PFS_GROUP5, 'validate': {'type:values': VPN_SUPPORTED_PFSES}, 'is_visible': True}, }, } # The subresource attribute map for the extension. This extension has only # top level resources, not child resources, so this is set to an empty dict. SUB_RESOURCE_ATTRIBUTE_MAP = { } # The action map. ACTION_MAP = { } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [ l3.ALIAS, ] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/qos_port_network_policy.py0000664000175000017500000000272113641427107026757 0ustar zuulzuul00000000000000# Copyright (c) 2019 Red Hat Inc. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import port as port_apidef from neutron_lib.api.definitions import qos as qos_apidef from neutron_lib.services.qos import constants as qos_const ALIAS = 'qos-port-network-policy' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'QoS port network policy ID' DESCRIPTION = 'Adds a the QoS network ID to the port definition' UPDATED_TIMESTAMP = '2019-11-01T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = { port_apidef.COLLECTION_NAME: { qos_const.QOS_NETWORK_POLICY_ID: { 'allow_post': False, 'allow_put': False, 'is_visible': True, 'default': None, 'validate': {'type:uuid_or_none': None} } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [qos_apidef.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/subnet_segmentid_writable.py0000664000175000017500000000503013641427107027205 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import segment from neutron_lib.api.definitions import subnet # The alias of the extension. ALIAS = 'subnet-segmentid-writable' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Subnet SegmentID (writable)' # A prefix for API resources. An empty prefix means that the API is going # to be exposed at the v2/ level as any other core resource. API_PREFIX = '' # The description of the extension. DESCRIPTION = ( "Provides a writable segment_id attribute for a subnet resource.") # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2018-03-12T00:00:00-00:00" RESOURCE_ATTRIBUTE_MAP = { subnet.COLLECTION_NAME: { segment.SEGMENT_ID: {'allow_post': True, 'allow_put': True, 'default': None, 'validate': {'type:uuid_or_none': None}, 'is_visible': True} } } # The subresource attribute map for the extension. It adds child resources # to main extension's resource. The subresource map must have a parent and # a parameters entry. If an extension does not need such a map, None can # be specified (mandatory). SUB_RESOURCE_ATTRIBUTE_MAP = {} # The action map: it associates verbs with methods to be performed on # the API resource. ACTION_MAP = {} # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [segment.ALIAS] # The list of optional extensions. OPTIONAL_EXTENSIONS = [] neutron-lib-2.3.0/neutron_lib/api/definitions/empty_string_filtering.py0000664000175000017500000000171413641427107026551 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. ALIAS = 'empty-string-filtering' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = False NAME = 'Empty String Filtering Extension' DESCRIPTION = 'Allow filtering by attributes with empty string value' UPDATED_TIMESTAMP = '2018-05-01T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/trunk_details.py0000664000175000017500000000515413641427107024634 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import port from neutron_lib.api.definitions import trunk from neutron_lib import constants # The alias of the extension. ALIAS = 'trunk-details' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Trunk port details' # The description of the extension. DESCRIPTION = "Expose trunk port details" # A timestamp of when the extension was last updated. UPDATED_TIMESTAMP = "2016-01-01T10:00:00-00:00" # TODO(armax): to be removed when review # https://review.opendev.org/#/c/484058/ merges TIMESTAMP = UPDATED_TIMESTAMP # The name of the resource introduced or being extended. RESOURCE_NAME = port.RESOURCE_NAME # The plural for the resource introduced or being extended. COLLECTION_NAME = port.COLLECTION_NAME # The specific resources and/or attributes for the extension (optional). TRUNK_DETAILS = 'trunk_details' # The resource attribute map for the extension. RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: {TRUNK_DETAILS: {'allow_post': False, 'allow_put': False, 'default': constants.ATTR_NOT_SPECIFIED, 'is_visible': True, 'enforce_policy': True, 'required_by_policy': True}}, } # The subresource attribute map for the extension. SUB_RESOURCE_ATTRIBUTE_MAP = None # The action map. ACTION_MAP = {} # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [trunk.ALIAS] # The list of optional extensions. OPTIONAL_EXTENSIONS = [] neutron-lib-2.3.0/neutron_lib/api/definitions/dns.py0000664000175000017500000001113613641427107022545 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters as convert from neutron_lib.api.definitions import l3 from neutron_lib.api.definitions import network from neutron_lib.api.definitions import port from neutron_lib.api import validators from neutron_lib.api.validators import dns as dns_validator from neutron_lib.db import constants # The alias of the extension. ALIAS = 'dns-integration' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map (mandatory). IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension (mandatory). # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension (mandatory). NAME = 'DNS Integration' # A prefix for API resources. An empty prefix means that the API is going # to be exposed at the v2/ level as any other core resource (mandatory). API_PREFIX = '' # The description of the extension (mandatory). DESCRIPTION = "Provides integration with DNS." # A timestamp of when the extension was introduced (mandatory). UPDATED_TIMESTAMP = "2015-08-15T18:00:00-00:00" DNSNAME = 'dns_name' DNSDOMAIN = 'dns_domain' DNSASSIGNMENT = 'dns_assignment' validators.add_validator('dns_host_name', dns_validator.validate_dns_name) validators.add_validator('fip_dns_host_name', dns_validator.validate_fip_dns_name) validators.add_validator('dns_domain_name', dns_validator.validate_dns_domain) # The resource attribute map for the extension. It is effectively the # bulk of the API contract alongside ACTION_MAP (mandatory). RESOURCE_ATTRIBUTE_MAP = { port.COLLECTION_NAME: { DNSNAME: {'allow_post': True, 'allow_put': True, 'default': '', 'convert_to': convert.convert_string_to_case_insensitive, 'validate': {'type:dns_host_name': constants.FQDN_FIELD_SIZE}, 'is_visible': True}, DNSASSIGNMENT: {'allow_post': False, 'allow_put': False, 'is_visible': True}, }, l3.FLOATINGIPS: { DNSNAME: {'allow_post': True, 'allow_put': False, 'default': '', 'convert_to': convert.convert_string_to_case_insensitive, 'validate': {'type:fip_dns_host_name': constants.FQDN_FIELD_SIZE}, 'is_visible': True}, DNSDOMAIN: {'allow_post': True, 'allow_put': False, 'default': '', 'convert_to': convert.convert_string_to_case_insensitive, 'validate': {'type:dns_domain_name': constants.FQDN_FIELD_SIZE}, 'is_visible': True}, }, network.COLLECTION_NAME: { DNSDOMAIN: {'allow_post': True, 'allow_put': True, 'default': '', 'convert_to': convert.convert_string_to_case_insensitive, 'validate': {'type:dns_domain_name': constants.FQDN_FIELD_SIZE}, 'is_visible': True}, }, } # The subresource attribute map for the extension. It adds child resources # to main extension's resource. The subresource map must have a parent and # a parameters entry. If an extension does not need such a map, None can # be specified (mandatory). For example: SUB_RESOURCE_ATTRIBUTE_MAP = {} # The action map: it associates verbs with methods to be performed on # the API resource (mandatory). ACTION_MAP = {} # The action status: it associates response statuses with methods to be # performed on the API resource (mandatory). ACTION_STATUS = {} # The list of required extensions (mandatory). REQUIRED_EXTENSIONS = [l3.ALIAS] # The list of optional extensions (mandatory). OPTIONAL_EXTENSIONS = [] neutron-lib-2.3.0/neutron_lib/api/definitions/sort_key_validation.py0000664000175000017500000000174713641427107026041 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import sorting ALIAS = 'sort-key-validation' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = False NAME = 'Sort keys validation' DESCRIPTION = 'Provides validation on sort keys.' UPDATED_TIMESTAMP = '2018-07-04T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [sorting.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/dhcpagentscheduler.py0000664000175000017500000000426213641427107025617 0ustar zuulzuul00000000000000# Copyright (c) 2013 OpenStack Foundation. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import agent as agent_apidef from neutron_lib.api.definitions import network as net_apidef from neutron_lib import constants DHCP_NET = 'dhcp-network' DHCP_NETS = DHCP_NET + 's' DHCP_AGENT = 'dhcp-agent' DHCP_AGENTS = DHCP_AGENT + 's' ALIAS = constants.DHCP_AGENT_SCHEDULER_EXT_ALIAS IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'DHCP Agent Scheduler' API_PREFIX = '' DESCRIPTION = 'Schedule networks among dhcp agents' UPDATED_TIMESTAMP = '2013-02-07T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = { DHCP_NETS: { 'parent': { 'collection_name': agent_apidef.COLLECTION_NAME, 'member_name': agent_apidef.RESOURCE_NAME }, 'parameters': { 'network_id': { 'allow_post': True, 'allow_put': False, 'default': constants.ATTR_NOT_SPECIFIED, 'enforce_policy': True, 'is_visible': True, 'validate': {'type:uuid': None} } } }, DHCP_AGENTS: { 'parent': { 'collection_name': net_apidef.COLLECTION_NAME, 'member_name': net_apidef.RESOURCE_NAME }, # NOTE(boden): the reference implementation only allows the index # operation for the agent exposed under the network resource 'parameters': agent_apidef.RESOURCE_ATTRIBUTE_MAP[ agent_apidef.COLLECTION_NAME] } } ACTION_MAP = {} REQUIRED_EXTENSIONS = [agent_apidef.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/router_admin_state_down_before_update.py0000664000175000017500000000223113641427107031560 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import dvr as dvr_apidef ALIAS = 'router-admin-state-down-before-update' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = False NAME = "Enforce Router's Admin State Down Before Update Extension" DESCRIPTION = ('Ensure that the admin state of a router is DOWN ' '(admin_state_up=False) before updating the distributed ' 'attribute') UPDATED_TIMESTAMP = '2019-07-02T15:56:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [dvr_apidef.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/dns_domain_ports.py0000664000175000017500000000615613641427107025331 0ustar zuulzuul00000000000000# Copyright (c) 2017 IBM # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters as convert from neutron_lib.api.definitions import dns from neutron_lib.api.definitions import port from neutron_lib.db import constants # The alias of the extension. ALIAS = 'dns-domain-ports' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map (mandatory). IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension (mandatory). # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension (mandatory). NAME = 'dns_domain for ports' # The description of the extension (mandatory). DESCRIPTION = "Allows the DNS domain to be specified for a network port." # A timestamp of when the extension was introduced (mandatory). UPDATED_TIMESTAMP = "2017-04-24T10:00:00-00:00" # The specific resources and/or attributes for the extension (optional). # In case of simple extensions, with single resource, the string constants # RESOURCE_NAME and COLLECTION_NAME can be used, otherwise string literals # can be used instead. # The name of the resource introduced or being extended # (in case it is defined by another extension, or it is # a core resource). RESOURCE_NAME = port.RESOURCE_NAME # The plural for the resource introduced or being extended # (in case it is defined by another extension, or it is a # core resource). COLLECTION_NAME = port.COLLECTION_NAME # The resource attribute map for the extension. It is effectively the # bulk of the API contract alongside ACTION_MAP (mandatory). RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { dns.DNSDOMAIN: {'allow_post': True, 'allow_put': True, 'default': '', 'convert_to': convert.convert_string_to_case_insensitive, 'validate': {'type:dns_domain_name': constants.FQDN_FIELD_SIZE}, 'is_visible': True}, }, } # The subresource attribute map for the extension. SUB_RESOURCE_ATTRIBUTE_MAP = { } # The action map ACTION_MAP = { } # The action status ACTION_STATUS = { } # The list of required extensions (mandatory). REQUIRED_EXTENSIONS = [dns.ALIAS] # The list of optional extensions (mandatory). OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/dvr.py0000664000175000017500000000311313641427107022550 0ustar zuulzuul00000000000000# Copyright (c) 2014 OpenStack Foundation. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import l3 from neutron_lib import constants DISTRIBUTED = 'distributed' ALIAS = constants.L3_DISTRIBUTED_EXT_ALIAS IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Distributed Virtual Router' API_PREFIX = '' DESCRIPTION = 'Enables configuration of Distributed Virtual Routers.' UPDATED_TIMESTAMP = '2014-06-1T10:00:00-00:00' RESOURCE_NAME = l3.ROUTER COLLECTION_NAME = l3.ROUTERS RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { DISTRIBUTED: {'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': constants.ATTR_NOT_SPECIFIED, 'convert_to': converters.convert_to_boolean_if_not_none, 'enforce_policy': True}, } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [l3.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/data_plane_status.py0000664000175000017500000000507313641427107025457 0ustar zuulzuul00000000000000# Copyright (c) 2017 NEC Corporation. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import port from neutron_lib import constants VALID_VALUES = [None, constants.ACTIVE, constants.DOWN] # The alias of the extension. ALIAS = 'data-plane-status' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Port data plane status extension' # The description of the extension. DESCRIPTION = "Expose status of underlying data plane" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2017-01-24T10:00:00-00:00" # The name of the resource introduced or being extended. RESOURCE_NAME = port.RESOURCE_NAME # The plural for the resource introduced or being extended. COLLECTION_NAME = port.COLLECTION_NAME # The specific resources and/or attributes for the extension (optional). DATA_PLANE_STATUS = 'data_plane_status' # The resource attribute map for the extension. RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { DATA_PLANE_STATUS: {'allow_post': False, 'allow_put': True, 'default': constants.ATTR_NOT_SPECIFIED, 'validate': {'type:values': VALID_VALUES}, 'is_visible': True, 'enforce_policy': True, } }, } # The subresource attribute map for the extension. SUB_RESOURCE_ATTRIBUTE_MAP = { } # The action map. ACTION_MAP = { } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [ ] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/floatingip_pools.py0000664000175000017500000000402713641427107025332 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import l3 from neutron_lib.db import constants as db_const FLOATINGIP_POOLS = 'floatingip_pools' ALIAS = 'floatingip-pools' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Floating IP Pools Extension' API_PREFIX = '/floatingip_pools' DESCRIPTION = 'Provides a floating IP pools API.' UPDATED_TIMESTAMP = '2018-03-21T10:00:00-00:00' COLLECTION_NAME = FLOATINGIP_POOLS RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'subnet_id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True}, 'subnet_name': {'allow_post': False, 'allow_put': False, 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, 'is_visible': True}, 'network_id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True}, 'cidr': {'allow_post': False, 'allow_put': False, 'validate': {'type:subnet_or_none': None}, 'is_visible': True}, 'project_id': {'allow_post': False, 'allow_put': False, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'is_visible': True}, }, } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [l3.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/provider_net.py0000664000175000017500000000765313641427107024472 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import network from neutron_lib import constants # The alias of the extension. ALIAS = 'provider' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Provider Network' # A prefix for API resources. An empty prefix means that the API is going # to be exposed at the v2/ level as any other core resource. API_PREFIX = '' # The description of the extension. DESCRIPTION = "Expose mapping of virtual networks to physical networks" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2012-09-07T10:00:00-00:00" # The name of the resource. RESOURCE_NAME = network.RESOURCE_NAME # The plural for the resource. COLLECTION_NAME = network.COLLECTION_NAME NETWORK_TYPE = 'provider:network_type' PHYSICAL_NETWORK = 'provider:physical_network' SEGMENTATION_ID = 'provider:segmentation_id' ATTRIBUTES = (NETWORK_TYPE, PHYSICAL_NETWORK, SEGMENTATION_ID) # Common definitions for maximum string field length NETWORK_TYPE_MAX_LEN = 32 PHYSICAL_NETWORK_MAX_LEN = 64 RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { NETWORK_TYPE: {'allow_post': True, 'allow_put': True, 'validate': {'type:string': NETWORK_TYPE_MAX_LEN}, 'default': constants.ATTR_NOT_SPECIFIED, 'enforce_policy': True, 'is_filter': True, 'is_visible': True}, PHYSICAL_NETWORK: {'allow_post': True, 'allow_put': True, 'validate': {'type:string': PHYSICAL_NETWORK_MAX_LEN}, 'default': constants.ATTR_NOT_SPECIFIED, 'enforce_policy': True, 'is_filter': True, 'is_visible': True}, SEGMENTATION_ID: {'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_to_int, 'enforce_policy': True, 'default': constants.ATTR_NOT_SPECIFIED, 'is_filter': True, 'is_visible': True}, } } # The subresource attribute map for the extension. It adds child resources # to main extension's resource. The subresource map must have a parent and # a parameters entry. If an extension does not need such a map, None can # be specified (mandatory). SUB_RESOURCE_ATTRIBUTE_MAP = None # The action map: it associates verbs with methods to be performed on # the API resource. For example: # # ACTION_MAP = { # RESOURCE_NAME: { # 'add_my_foo_bars': 'PUT', # 'remove_my_foo_bars': 'PUT', # 'get_my_foo_bars': 'GET' # } # } ACTION_MAP = { } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [ ] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/extraroute.py0000664000175000017500000000276013641427107024166 0ustar zuulzuul00000000000000# Copyright 2013, Nachi Ueno, NTT MCL, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import l3 from neutron_lib import constants ROUTES = 'routes' ALIAS = 'extraroute' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Neutron Extra Route' API_PREFIX = '' DESCRIPTION = 'Extra routes configuration for L3 router' UPDATED_TIMESTAMP = '2013-02-01T10:00:00-00:00' RESOURCE_NAME = l3.ROUTER COLLECTION_NAME = l3.ROUTERS RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { ROUTES: { 'allow_post': False, 'allow_put': True, 'validate': {'type:hostroutes': None}, 'convert_to': converters.convert_none_to_empty_list, 'is_visible': True, 'default': constants.ATTR_NOT_SPECIFIED}, } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [l3.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/qos.py0000664000175000017500000001347713641427107022575 0ustar zuulzuul00000000000000# Copyright (c) 2015 Red Hat Inc. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import network from neutron_lib.api.definitions import port from neutron_lib import constants from neutron_lib.db import constants as db_const from neutron_lib.services.qos import constants as qos_const BANDWIDTH_LIMIT_RULES = "bandwidth_limit_rules" RULE_TYPES = "rule_types" POLICIES = 'policies' POLICY = 'policy' DSCP_MARKING_RULES = 'dscp_marking_rules' MIN_BANDWIDTH_RULES = 'minimum_bandwidth_rules' _QOS_RULE_COMMON_FIELDS = { 'id': { 'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'primary_key': True }, 'tenant_id': { 'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'is_visible': True } } ALIAS = 'qos' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Quality of Service' API_PREFIX = '/' + ALIAS DESCRIPTION = 'The Quality of Service extension.' UPDATED_TIMESTAMP = '2015-06-08T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = { POLICIES: { 'id': { 'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True, 'primary_key': True }, 'name': { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': '', 'is_filter': True, 'is_sort_key': True, 'validate': {'type:string': db_const.NAME_FIELD_SIZE}}, constants.SHARED: { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': False, 'is_filter': True, 'convert_to': converters.convert_to_boolean }, 'tenant_id': { 'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': {'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True }, 'rules': { 'allow_post': False, 'allow_put': False, 'is_visible': True } }, RULE_TYPES: { 'type': { 'allow_post': False, 'allow_put': False, 'is_visible': True } }, port.COLLECTION_NAME: { qos_const.QOS_POLICY_ID: { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': None, 'validate': {'type:uuid_or_none': None} } }, network.COLLECTION_NAME: { qos_const.QOS_POLICY_ID: { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': None, 'validate': {'type:uuid_or_none': None} } } } _PARENT = { 'collection_name': POLICIES, 'member_name': POLICY } SUB_RESOURCE_ATTRIBUTE_MAP = { BANDWIDTH_LIMIT_RULES: { 'parent': _PARENT, 'parameters': dict( _QOS_RULE_COMMON_FIELDS, **{qos_const.MAX_KBPS: { 'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_to_int, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'validate': { 'type:range': [0, db_const.DB_INTEGER_MAX_VALUE]} }, qos_const.MAX_BURST: { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': 0, 'is_filter': True, 'is_sort_key': True, 'convert_to': converters.convert_to_int, 'validate': { 'type:range': [0, db_const.DB_INTEGER_MAX_VALUE]}}}), }, DSCP_MARKING_RULES: { 'parent': _PARENT, 'parameters': dict( _QOS_RULE_COMMON_FIELDS, **{qos_const.DSCP_MARK: { 'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_to_int, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'validate': { 'type:values': constants.VALID_DSCP_MARKS}}}) }, MIN_BANDWIDTH_RULES: { 'parent': _PARENT, 'parameters': dict( _QOS_RULE_COMMON_FIELDS, **{qos_const.MIN_KBPS: { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'convert_to': converters.convert_to_int, 'validate': { 'type:range': [0, db_const.DB_INTEGER_MAX_VALUE]}}, qos_const.DIRECTION: { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': constants.EGRESS_DIRECTION, 'is_filter': True, 'is_sort_key': True, 'validate': { 'type:values': [constants.EGRESS_DIRECTION]}}}) } } ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/port_security.py0000664000175000017500000000567413641427107024706 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import network from neutron_lib.api.definitions import port from neutron_lib import constants DEFAULT_PORT_SECURITY = True PORTSECURITY = 'port_security_enabled' # The alias of the extension. ALIAS = 'port-security' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Port Security' # A prefix for API resources. An empty prefix means that the API is going # to be exposed at the v2/ level as any other core resource. API_PREFIX = '' # The description of the extension. DESCRIPTION = "Provides port security" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2012-07-23T10:00:00-00:00" RESOURCE_ATTRIBUTE_MAP = { network.COLLECTION_NAME: { PORTSECURITY: {'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_to_boolean, 'enforce_policy': True, 'default': DEFAULT_PORT_SECURITY, 'is_visible': True}, }, port.COLLECTION_NAME: { PORTSECURITY: {'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_to_boolean, 'default': constants.ATTR_NOT_SPECIFIED, 'enforce_policy': True, 'is_visible': True}, } } # The subresource attribute map for the extension. It adds child resources # to main extension's resource. The subresource map must have a parent and # a parameters entry. If an extension does not need such a map, None can # be specified (mandatory). SUB_RESOURCE_ATTRIBUTE_MAP = {} # The action map: it associates verbs with methods to be performed on # the API resource. ACTION_MAP = {} # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [] # The list of optional extensions. OPTIONAL_EXTENSIONS = [] neutron-lib-2.3.0/neutron_lib/api/definitions/servicetype.py0000664000175000017500000000314513641427107024324 0ustar zuulzuul00000000000000# Copyright 2013 OpenStack Foundation. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. SERVICE_ATTR = 'service_type' PLUGIN_ATTR = 'plugin' DRIVER_ATTR = 'driver' ALIAS = 'service-type' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Neutron Service Type Management' API_PREFIX = '' DESCRIPTION = ("API for retrieving service providers for " "Neutron advanced services") UPDATED_TIMESTAMP = '2013-01-20T00:00:00-00:00' RESOURCE_NAME = 'service_provider' COLLECTION_NAME = RESOURCE_NAME + 's' RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { SERVICE_ATTR: { 'allow_post': False, 'allow_put': False, 'is_visible': True }, 'name': { 'allow_post': False, 'allow_put': False, 'is_visible': True }, 'default': { 'allow_post': False, 'allow_put': False, 'is_visible': True } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/bgpvpn_routes_control.py0000664000175000017500000001277213641427107026425 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import bgpvpn from neutron_lib.db import constants as db_const # The alias of the extension. ALIAS = 'bgpvpn-routes-control' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map (mandatory). IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension (mandatory). # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension (mandatory). NAME = 'BGPVPN Routes Control Extension' # The description of the extension (mandatory). DESCRIPTION = "Provides support for controlling routes advertised to a BGPVPN" # A timestamp of when the extension was introduced (mandatory). UPDATED_TIMESTAMP = "2017-05-20T00:00:00-00:00" # The specific resources and/or attributes for the extension (optional). # In case of simple extensions, with single resource, the string constants # RESOURCE_NAME and COLLECTION_NAME can be used, otherwise string literals # can be used instead. # The name of the resource introduced or being extended (later case) RESOURCE_NAME = bgpvpn.RESOURCE_NAME # The plural for the resource introduced or being extended (later case) COLLECTION_NAME = bgpvpn.COLLECTION_NAME LOCAL_PREF_KEY = 'local_pref' LOCAL_PREF_RANGE = [0, 2**32-1] # RFC 4271, section 4.3 (p.18) RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'ports': {'allow_post': False, 'allow_put': False, 'is_visible': True, 'enforce_policy': True}, LOCAL_PREF_KEY: { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': None, 'validate': {'type:range_or_none': LOCAL_PREF_RANGE}, 'enforce_policy': True} } } PORT_ASSOCIATION = 'port_association' PORT_ASSOCIATIONS = 'port_associations' ROUTES = 'routes' PREFIX_TYPE = 'prefix' BGPVPN_TYPE = 'bgpvpn' ROUTE_TYPES = [PREFIX_TYPE, BGPVPN_TYPE] ADV_FIXED_IPS = 'advertise_fixed_ips' TYPE = 'type' PREFIX = 'prefix' BGPVPN_ID = 'bgpvpn_id' ADV_EXTRA_ROUTES = 'advertise_extra_routes' LOCAL_PREF_KEY_SPEC = {'type:range': LOCAL_PREF_RANGE, 'required': False} ROUTE_SPECS = [ {'type': {'type:values': [PREFIX_TYPE], 'required': True}, 'prefix': {'type:subnet': None, 'required': True}, LOCAL_PREF_KEY: LOCAL_PREF_KEY_SPEC, }, {'type': {'type:values': [BGPVPN_TYPE], 'required': True}, 'bgpvpn_id': {'type:uuid': None, 'required': True}, LOCAL_PREF_KEY: LOCAL_PREF_KEY_SPEC, }, ] SUB_RESOURCE_ATTRIBUTE_MAP = { PORT_ASSOCIATIONS: { 'parent': { 'collection_name': COLLECTION_NAME, 'member_name': RESOURCE_NAME}, 'parameters': { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'primary_key': True}, 'project_id': {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True, 'is_visible': True, 'enforce_policy': True}, 'port_id': {'allow_post': True, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'enforce_policy': True}, ROUTES: {'allow_post': True, 'allow_put': True, 'default': [], 'convert_list_to': converters.convert_kvp_list_to_dict, 'validate': { 'type:list_of_any_key_specs_or_none': ROUTE_SPECS }, 'enforce_policy': True, 'is_visible': True}, ADV_FIXED_IPS: {'allow_post': True, 'allow_put': True, 'default': True, 'convert_to': converters.convert_to_boolean, 'is_visible': True}, }, }, bgpvpn.ROUTER_ASSOCIATIONS: { 'parent': {'collection_name': COLLECTION_NAME, 'member_name': RESOURCE_NAME}, 'parameters': { ADV_EXTRA_ROUTES: {'allow_post': True, 'allow_put': True, 'default': True, 'convert_to': converters.convert_to_boolean, 'is_visible': True}, } } } ACTION_MAP = { } ACTION_STATUS = {} REQUIRED_EXTENSIONS = [ bgpvpn.ALIAS ] OPTIONAL_EXTENSIONS = [] neutron-lib-2.3.0/neutron_lib/api/definitions/l2_adjacency.py0000664000175000017500000000246613641427107024305 0ustar zuulzuul00000000000000# Copyright (c) 2016 NEC Technologies Ltd. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import network L2_ADJACENCY = 'l2_adjacency' ALIAS = L2_ADJACENCY IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'L2 Adjacency' API_PREFIX = '' DESCRIPTION = 'Display L2 Adjacency for Neutron Networks.' UPDATED_TIMESTAMP = '2016-04-12T16:00:00-00:00' RESOURCE_NAME = network.RESOURCE_NAME COLLECTION_NAME = network.COLLECTION_NAME RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { L2_ADJACENCY: { 'allow_post': False, 'allow_put': False, 'is_visible': True } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/l3_ext_gw_mode.py0000664000175000017500000000374113641427107024663 0ustar zuulzuul00000000000000# Copyright 2013 VMware, Inc. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import l3 ALIAS = 'ext-gw-mode' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Neutron L3 Configurable external gateway mode' API_PREFIX = '' DESCRIPTION = ('Extension of the router abstraction for specifying whether ' 'SNAT should occur on the external gateway') UPDATED_TIMESTAMP = '2013-03-28T10:00:00-00:00' RESOURCE_NAME = l3.ROUTER COLLECTION_NAME = l3.ROUTERS RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { l3.EXTERNAL_GW_INFO: { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': None, 'enforce_policy': True, 'validate': { 'type:dict_or_nodata': { 'network_id': {'type:uuid': None, 'required': True}, 'enable_snat': {'type:boolean': None, 'required': False, 'convert_to': converters.convert_to_boolean}, 'external_fixed_ips': { 'type:fixed_ips': None, 'required': False } } } } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [l3.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/rbac_security_groups.py0000664000175000017500000000174313641427107026221 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. ALIAS = 'rbac-security-groups' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = False NAME = 'Add security_group type to network RBAC' DESCRIPTION = 'Add security_group type to network RBAC' UPDATED_TIMESTAMP = '2019-02-14T00:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = ['rbac-policies', 'security-group'] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/subnet_dns_publish_fixed_ip.py0000664000175000017500000000463013641427107027523 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import dns_domain_ports from neutron_lib.api.definitions import subnet DNS_PUBLISH_FIXED_IP = 'dns_publish_fixed_ip' # The alias of the extension. ALIAS = 'subnet-dns-publish-fixed-ip' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Subnet DNS publish fixed IP' # The description of the extension. DESCRIPTION = 'Support choosing to publish DNS records for IPs from a subnet' # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2019-05-24T10:00:00-00:00" # The name of the resource introduced or being extended. RESOURCE_NAME = subnet.RESOURCE_NAME # The plural for the resource introduced or being extended. COLLECTION_NAME = subnet.COLLECTION_NAME # The resource attribute map for the extension. RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { DNS_PUBLISH_FIXED_IP: { 'allow_post': True, 'allow_put': True, 'default': False, 'convert_to': converters.convert_to_boolean, 'is_visible': True } } } # The subresource attribute map for the extension. SUB_RESOURCE_ATTRIBUTE_MAP = { } # The action map. ACTION_MAP = { } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [ dns_domain_ports.ALIAS, ] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/bgpvpn_stdattrs_net_assoc.py0000664000175000017500000000214113641427107027237 0ustar zuulzuul00000000000000# Copyright 2018 Orange # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import bgpvpn ALIAS = 'standard-attr-bgpvpn-network-association' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = True NAME = 'BGPVPN Network Association Standard Attributes' DESCRIPTION = 'Add standard attributes to BGPVPN Network Association resources' UPDATED_TIMESTAMP = '2018-04-19T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [bgpvpn.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/portbindings.py0000664000175000017500000002042413641427107024463 0ustar zuulzuul00000000000000# Copyright (c) 2012 OpenStack Foundation. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import port from neutron_lib import constants # The type of vnic that this port should be attached to VNIC_TYPE = 'binding:vnic_type' # The service will return the vif type for the specific port. VIF_TYPE = 'binding:vif_type' # The service may return a dictionary containing additional # information needed by the interface driver. The set of items # returned may depend on the value of VIF_TYPE. VIF_DETAILS = 'binding:vif_details' # In some cases different implementations may be run on different hosts. # The host on which the port will be allocated. HOST_ID = 'binding:host_id' # The profile will be a dictionary that enables the application running # on the specific host to pass and receive vif port specific information to # the plugin. PROFILE = 'binding:profile' # The keys below are used in the VIF_DETAILS attribute to convey # information to the VIF driver. # TODO(rkukura): Replace CAP_PORT_FILTER, which nova no longer # understands, with the new set of VIF security details to be used in # the VIF_DETAILS attribute. # # - port_filter : Boolean value indicating Neutron provides port filtering # features such as security group and anti MAC/IP spoofing # - ovs_hybrid_plug: Boolean used to inform Nova that the hybrid plugging # strategy for OVS should be used CAP_PORT_FILTER = 'port_filter' OVS_HYBRID_PLUG = 'ovs_hybrid_plug' VIF_DETAILS_VLAN = 'vlan' VIF_DETAILS_MACVTAP_SOURCE = 'macvtap_source' VIF_DETAILS_MACVTAP_MODE = 'macvtap_mode' VIF_DETAILS_PHYSICAL_INTERFACE = 'physical_interface' VIF_DETAILS_BRIDGE_NAME = 'bridge_name' VIF_DETAILS_CONNECTIVITY = 'connectivity' VIF_DETAILS_BOUND_DRIVERS = 'bound_drivers' # OVS bridge datapath type: String value used to define if the bridge uses # kernel or userspace datapath. OVS_DATAPATH_TYPE = 'datapath_type' # The keys below are used in the VIF_DETAILS attribute to convey # information related to the configuration of the vhost-user VIF driver. # - vhost_user_mode: String value used to declare the mode of a # vhost-user socket VHOST_USER_MODE = 'vhostuser_mode' # - server: socket created by hypervisor VHOST_USER_MODE_SERVER = 'server' # - client: socket created by vswitch VHOST_USER_MODE_CLIENT = 'client' # - vhostuser_socket String value used to declare the vhostuser socket name VHOST_USER_SOCKET = 'vhostuser_socket' # - vhost_user_ovs_plug: Boolean used to inform Nova that the ovs plug # method should be used when binding the # vhost-user vif. VHOST_USER_OVS_PLUG = 'vhostuser_ovs_plug' # VIF_TYPE: vif_types are required by Nova to determine which vif_driver to # use to attach a virtual server to the network # - vhost-user: The vhost-user interface type is a standard virtio interface # provided by qemu 2.1+. This constant defines the neutron side # of the vif binding type to provide a common definition # to enable reuse in multiple agents and drivers. VIF_TYPE_VHOST_USER = 'vhostuser' VIF_TYPE_UNBOUND = 'unbound' VIF_TYPE_BINDING_FAILED = 'binding_failed' VIF_TYPE_DISTRIBUTED = 'distributed' VIF_TYPE_OVS = 'ovs' VIF_TYPE_BRIDGE = 'bridge' VIF_TYPE_OTHER = 'other' VIF_TYPE_TAP = 'tap' # vif_type_macvtap: Tells Nova that the macvtap vif_driver should be used to # create a vif. It does not require the VNIC_TYPE_MACVTAP, # which is defined further below. E.g. Macvtap agent uses # vnic_type 'normal'. VIF_TYPE_MACVTAP = 'macvtap' # vif_type_agilio_ovs: Tells Nova that the Agilio OVS vif_driver should be # used to create a vif. In addition to the normal OVS # vif types exposed, VNIC_DIRECT and # VNIC_VIRTIO_FORWARDER are supported. VIF_TYPE_AGILIO_OVS = 'agilio_ovs' # SR-IOV VIF types VIF_TYPE_HW_VEB = 'hw_veb' VIF_TYPE_HOSTDEV_PHY = 'hostdev_physical' # VNIC_TYPE: It's used to determine which mechanism driver to use to bind a # port. It can be specified via the Neutron API. Default is normal, # used by OVS and LinuxBridge agent. VNIC_NORMAL = 'normal' VNIC_DIRECT = 'direct' VNIC_MACVTAP = 'macvtap' VNIC_BAREMETAL = 'baremetal' VNIC_DIRECT_PHYSICAL = 'direct-physical' VNIC_VIRTIO_FORWARDER = 'virtio-forwarder' VNIC_SMARTNIC = 'smart-nic' VNIC_TYPES = [VNIC_NORMAL, VNIC_DIRECT, VNIC_MACVTAP, VNIC_BAREMETAL, VNIC_DIRECT_PHYSICAL, VNIC_VIRTIO_FORWARDER, VNIC_SMARTNIC] # VIF_DETAILS_CONNECTIVITY: Indicates what kind of connectivity the network # back-end provides: L2, L3 or not specified. CONNECTIVITY_L2 = 'l2' CONNECTIVITY_L3 = 'l3' CONNECTIVITY_LEGACY = 'legacy' # The alias of the extension. ALIAS = 'binding' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Port Binding' # A prefix for API resources. An empty prefix means that the API is going # to be exposed at the v2/ level as any other core resource. API_PREFIX = '' # The description of the extension. DESCRIPTION = "Expose port bindings of a virtual port to external application" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2014-02-03T10:00:00-00:00" # The name of the resource. RESOURCE_NAME = port.RESOURCE_NAME # The plural for the resource. COLLECTION_NAME = port.COLLECTION_NAME RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { VIF_TYPE: {'allow_post': False, 'allow_put': False, 'default': constants.ATTR_NOT_SPECIFIED, 'enforce_policy': True, 'is_visible': True}, VIF_DETAILS: {'allow_post': False, 'allow_put': False, 'default': constants.ATTR_NOT_SPECIFIED, 'enforce_policy': True, 'is_visible': True}, VNIC_TYPE: {'allow_post': True, 'allow_put': True, 'default': VNIC_NORMAL, 'is_visible': True, 'validate': {'type:values': VNIC_TYPES}, 'enforce_policy': True}, HOST_ID: {'allow_post': True, 'allow_put': True, 'default': constants.ATTR_NOT_SPECIFIED, 'is_visible': True, 'is_filter': True, 'enforce_policy': True}, PROFILE: {'allow_post': True, 'allow_put': True, 'default': constants.ATTR_NOT_SPECIFIED, 'enforce_policy': True, 'validate': {'type:dict_or_none': None}, 'is_visible': True}, } } # The subresource attribute map for the extension. It adds child resources # to main extension's resource. The subresource map must have a parent and # a parameters entry. If an extension does not need such a map, None can # be specified (mandatory). SUB_RESOURCE_ATTRIBUTE_MAP = None # The action map: it associates verbs with methods to be performed on # the API resource. For example: # # ACTION_MAP = { # RESOURCE_NAME: { # 'add_my_foo_bars': 'PUT', # 'remove_my_foo_bars': 'PUT', # 'get_my_foo_bars': 'GET' # } # } ACTION_MAP = { } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [ ] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/routerservicetype.py0000664000175000017500000000251013641427107025560 0ustar zuulzuul00000000000000# Copyright 2013 VMware, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import l3 SERVICE_TYPE_ID = 'service_type_id' ALIAS = 'router-service-type' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Router Service Type' API_PREFIX = '' DESCRIPTION = 'Provides router service type' UPDATED_TIMESTAMP = '2013-01-29T00:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = { l3.ROUTERS: { SERVICE_TYPE_ID: { 'allow_post': True, 'allow_put': False, 'validate': { 'type:uuid_or_none': None }, 'default': None, 'is_visible': True}, } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [l3.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/project_id.py0000664000175000017500000000166113641427107024105 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. ALIAS = 'project-id' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = False NAME = 'project_id field enabled' API_PREFIX = '' DESCRIPTION = 'Extension that indicates that project_id field is enabled.' UPDATED_TIMESTAMP = '2016-09-09T09:09:09-09:09' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/segment.py0000664000175000017500000000772113641427107023430 0ustar zuulzuul00000000000000# Copyright (c) 2016 Hewlett Packard Enterprise Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import provider_net from neutron_lib.api.definitions import subnet from neutron_lib import constants from neutron_lib.db import constants as db_constants SEGMENT_ID = 'segment_id' NETWORK_TYPE = 'network_type' PHYSICAL_NETWORK = 'physical_network' SEGMENTATION_ID = 'segmentation_id' NAME_LEN = db_constants.NAME_FIELD_SIZE DESC_LEN = db_constants.DESCRIPTION_FIELD_SIZE ALIAS = 'segment' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Segment' API_PREFIX = '' DESCRIPTION = 'Segments extension.' UPDATED_TIMESTAMP = '2016-02-24T17:00:00-00:00' RESOURCE_NAME = 'segment' COLLECTION_NAME = RESOURCE_NAME + 's' RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'id': { 'allow_post': False, 'allow_put': False, 'validate': { 'type:uuid': None }, 'is_filter': True, 'is_sort_key': True, 'is_visible': True, 'primary_key': True }, 'tenant_id': { 'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_constants.PROJECT_ID_FIELD_SIZE }, 'is_visible': False}, 'network_id': { 'allow_post': True, 'allow_put': False, 'validate': { 'type:uuid': None }, 'is_filter': True, 'is_sort_key': True, 'is_visible': True }, PHYSICAL_NETWORK: { 'allow_post': True, 'allow_put': False, 'default': constants.ATTR_NOT_SPECIFIED, 'validate': { 'type:string': provider_net.PHYSICAL_NETWORK_MAX_LEN }, 'is_filter': True, 'is_sort_key': True, 'is_visible': True }, NETWORK_TYPE: { 'allow_post': True, 'allow_put': False, 'validate': { 'type:string': provider_net.NETWORK_TYPE_MAX_LEN }, 'is_filter': True, 'is_sort_key': True, 'is_visible': True }, SEGMENTATION_ID: { 'allow_post': True, 'allow_put': False, 'default': constants.ATTR_NOT_SPECIFIED, 'convert_to': converters.convert_to_int, 'is_sort_key': True, 'is_visible': True }, 'name': { 'allow_post': True, 'allow_put': True, 'default': constants.ATTR_NOT_SPECIFIED, 'validate': { 'type:string_or_none': NAME_LEN }, 'is_filter': True, 'is_sort_key': True, 'is_visible': True } }, subnet.COLLECTION_NAME: { SEGMENT_ID: { 'allow_post': True, 'allow_put': False, 'default': None, 'validate': { 'type:uuid_or_none': None }, 'is_filter': True, 'is_sort_key': True, 'is_visible': True } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [ 'standard-attr-description' ] OPTIONAL_EXTENSIONS = [ # Use string instead of constant to avoid circulated import 'standard-attr-segment' ] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/port_mac_address_regenerate.py0000664000175000017500000000276313641427107027501 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import port as port_def from neutron_lib import constants NAME = 'Neutron Port MAC address regenerate' ALIAS = 'port-mac-address-regenerate' DESCRIPTION = "Network port MAC address regenerate" UPDATED_TIMESTAMP = "2018-05-03T10:00:00-00:00" RESOURCE_ATTRIBUTE_MAP = { port_def.COLLECTION_NAME: { port_def.PORT_MAC_ADDRESS: { 'allow_post': True, 'allow_put': True, 'default': constants.ATTR_NOT_SPECIFIED, 'convert_to': converters.convert_to_mac_if_none, 'validate': {'type:mac_address': None}, 'enforce_policy': True, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, } } IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/address_scope.py0000664000175000017500000000733013641427107024600 0ustar zuulzuul00000000000000# Copyright (c) 2015 Huawei Technologies Co.,LTD. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib import constants from neutron_lib.db import constants as db_constants ADDRESS_SCOPE = 'address_scope' ADDRESS_SCOPE_ID = 'address_scope_id' IPV4_ADDRESS_SCOPE = 'ipv4_%s' % ADDRESS_SCOPE IPV6_ADDRESS_SCOPE = 'ipv6_%s' % ADDRESS_SCOPE ALIAS = 'address-scope' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Address scope' API_PREFIX = '' DESCRIPTION = 'Address scopes extension.' UPDATED_TIMESTAMP = '2015-07-26T10:00:00-00:00' RESOURCE_NAME = ADDRESS_SCOPE COLLECTION_NAME = RESOURCE_NAME + 's' RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True, 'primary_key': True}, 'name': {'allow_post': True, 'allow_put': True, 'default': '', 'validate': {'type:string': db_constants.NAME_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_constants.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, constants.SHARED: {'allow_post': True, 'allow_put': True, 'default': False, 'convert_to': converters.convert_to_boolean, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'required_by_policy': True, 'enforce_policy': True}, 'ip_version': {'allow_post': True, 'allow_put': False, 'convert_to': converters.convert_to_int, 'validate': {'type:values': [4, 6]}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, }, 'subnetpools': { ADDRESS_SCOPE_ID: {'allow_post': True, 'allow_put': True, 'default': constants.ATTR_NOT_SPECIFIED, 'validate': {'type:uuid_or_none': None}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True} }, 'networks': { IPV4_ADDRESS_SCOPE: {'allow_post': False, 'allow_put': False, 'is_visible': True}, IPV6_ADDRESS_SCOPE: {'allow_post': False, 'allow_put': False, 'is_visible': True}, } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/base.py0000664000175000017500000001035013641427107022670 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib import constants KNOWN_ATTRIBUTES = ( 'admin_state_up', 'allocation_pools', 'cidr', 'default_prefixlen', 'default_quota', 'description', 'device_id', 'device_owner', 'dns_nameservers', 'enable_dhcp', 'fixed_ips', 'gateway_ip', 'host_routes', 'id', 'ip_version', 'ipv6_address_mode', 'ipv6_ra_mode', 'is_default', 'mac_address', 'max_prefixlen', 'min_prefixlen', 'name', 'network_id', 'port_id', 'prefixes', 'prefixlen', 'project_id', 'qos_policy_id', 'service_types', constants.SHARED, 'status', 'subnets', 'subnetpool_id', 'tenant_id' ) KNOWN_RESOURCES = ( 'networks', 'ports', 'routers', 'subnets', 'subnetpools', 'security_groups' ) KNOWN_HTTP_ACTIONS = ( 'DELETE', 'GET', 'POST', 'PUT', ) KNOWN_ACTION_STATUSES = ( 200, 201, 202, 203, 204, 205, 206, ) KNOWN_EXTENSIONS = ( 'address-scope', 'agent', 'agent-resources-synced', 'allowed-address-pairs', 'auto-allocated-topology', 'availability_zone', 'binding', 'data-plane-status', 'project-default-networks', 'default-subnetpools', 'dhcp_agent_scheduler', 'dns-domain-ports', 'dns-integration', 'dvr', 'empty-string-filtering', 'expose-l3-conntrack-helper', 'expose-port-forwarding-in-fip', 'ext-gw-mode', 'external-net', 'extra_dhcp_opt', 'extraroute', 'extraroute-atomic', 'filter-validation', 'fip-port-details', 'flavors', 'floating-ip-port-forwarding', 'floating-ip-port-forwarding-description', 'floatingip-autodelete-internal', 'floatingip-pools', 'ip-substring-filtering', 'l3-conntrack-helper', 'l3-ha', 'l3_agent_scheduler', 'l3-port-ip-change-not-allowed', 'logging', 'metering', 'multi-provider', 'net-mtu', 'network-ip-availability', 'network-segment-range', 'network_availability_zone', 'pagination', 'port-resource-request', 'port-security', 'project-id', 'provider', 'qos', 'qos-bw-limit-direction', 'qos-gateway-ip', 'qos-port-network-policy', 'qos-rules-alias', 'quotas', 'rbac-address-scope', 'rbac-policies', 'rbac-security-groups', 'rbac-subnetpool', 'router', 'router_availability_zone', 'security-group', 'segment', 'service-type', 'sort-key-validation', 'sorting', 'standard-attr-description', 'standard-attr-revisions', 'standard-attr-segment', 'standard-attr-timestamp', 'subnet', 'subnet_allocation', 'subnet_dns_publish_fixed_ip', 'subnet_onboard', 'subnetpool-prefix-ops', 'subnet-segmentid-enforce', 'subnet-segmentid-writable', 'tag', 'trunk', 'trunk-details', # Add here list of extensions with pointers to the project repo, e.g. # 'bgp', # https://opendev.org/openstack/neutron-dynamic-routing # https://opendev.org/openstack/neutron-fwaas 'fwaas', 'fwaasrouterinsertion', 'fwaas_v2', 'bgpvpn', # https://opendev.org/openstack/networking-bgpvpn 'bgpvpn-routes-control', 'bgpvpn-vni', # https://opendev.org/openstack/neutron-vpnaas 'vpnaas', 'vpn-endpoint-groups', 'vpn-flavors', # https://opendev.org/openstack/networking-sfc: 'flow_classifier', 'sfc', ) KNOWN_KEYWORDS = ( 'allow_post', 'allow_put', 'convert_to', 'convert_list_to', 'default', 'enforce_policy', 'is_filter', 'is_sort_key', 'is_visible', 'primary_key', 'required_by_policy', 'validate', 'default_overrides_none', 'dict_populate_defaults', ) neutron-lib-2.3.0/neutron_lib/api/definitions/vpn_endpoint_groups.py0000664000175000017500000000536213641427107026067 0ustar zuulzuul00000000000000# (c) Copyright 2015 NEC Corporation, All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import vpn from neutron_lib.db import constants as db_const # VPN Endpoint type constants VPN_ENDPOINT_TYPE_CIDR = 'cidr' VPN_ENDPOINT_TYPE_NETWORK = 'network' VPN_ENDPOINT_TYPE_ROUTER = 'router' VPN_ENDPOINT_TYPE_SUBNET = 'subnet' VPN_ENDPOINT_TYPE_VLAN = 'vlan' VPN_SUPPORTED_ENDPOINT_TYPES = [ VPN_ENDPOINT_TYPE_CIDR, VPN_ENDPOINT_TYPE_NETWORK, VPN_ENDPOINT_TYPE_ROUTER, VPN_ENDPOINT_TYPE_SUBNET, VPN_ENDPOINT_TYPE_VLAN, ] ALIAS = 'vpn-endpoint-groups' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'VPN Endpoint Groups' DESCRIPTION = 'VPN endpoint groups support' UPDATED_TIMESTAMP = '2015-08-04T10:00:00-00:00' API_PREFIX = '/vpn' RESOURCE_ATTRIBUTE_MAP = { 'endpoint_groups': { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'primary_key': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True, 'is_visible': True}, 'name': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, 'is_visible': True, 'default': ''}, 'description': {'allow_post': True, 'allow_put': True, 'validate': { 'type:string': db_const.DESCRIPTION_FIELD_SIZE}, 'is_visible': True, 'default': ''}, 'type': {'allow_post': True, 'allow_put': False, 'validate': {'type:values': VPN_SUPPORTED_ENDPOINT_TYPES}, 'is_visible': True}, 'endpoints': {'allow_post': True, 'allow_put': False, 'convert_to': converters.convert_to_list, 'is_visible': True, 'default': []}, }, } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [vpn.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/allowedaddresspairs.py0000664000175000017500000000357613641427107026026 0ustar zuulzuul00000000000000# Copyright 2013 VMware, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import port from neutron_lib.api import validators from neutron_lib.api.validators import allowedaddresspairs as addr_validation from neutron_lib import constants validators.add_validator('allowed_address_pairs', addr_validation._validate_allowed_address_pairs) ADDRESS_PAIRS = 'allowed_address_pairs' ALIAS = 'allowed-address-pairs' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Allowed Address Pairs' API_PREFIX = '' DESCRIPTION = 'Provides allowed address pairs' UPDATED_TIMESTAMP = '2013-07-23T10:00:00-00:00' RESOURCE_NAME = port.RESOURCE_NAME COLLECTION_NAME = port.COLLECTION_NAME RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { ADDRESS_PAIRS: { 'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_none_to_empty_list, 'convert_list_to': converters.convert_kvp_list_to_dict, 'validate': {'type:allowed_address_pairs': None}, 'enforce_policy': True, 'default': constants.ATTR_NOT_SPECIFIED, 'is_visible': True}, } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/metering.py0000664000175000017500000000762213641427107023600 0ustar zuulzuul00000000000000# Copyright (C) 2013 eNovance SAS # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib import constants from neutron_lib.db import constants as db_const from neutron_lib.services.qos import constants as qos_consts METERING_LABELS = 'metering_labels' METERING_LABEL_RULES = 'metering_label_rules' ALIAS = 'metering' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Neutron Metering' API_PREFIX = '' DESCRIPTION = 'Neutron Metering extension.' UPDATED_TIMESTAMP = '2013-06-12T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = { METERING_LABELS: { 'id': { 'allow_post': False, 'allow_put': False, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'primary_key': True }, 'name': { 'allow_post': True, 'allow_put': False, 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True, 'default': '' }, 'description': { 'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_const.LONG_DESCRIPTION_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True, 'default': '' }, 'tenant_id': { 'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True }, constants.SHARED: { 'allow_post': True, 'allow_put': False, 'is_filter': True, 'is_sort_key': True, 'is_visible': True, 'default': False, 'convert_to': converters.convert_to_boolean } }, METERING_LABEL_RULES: { 'id': { 'allow_post': False, 'allow_put': False, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'primary_key': True }, 'metering_label_id': { 'allow_post': True, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True, 'required_by_policy': True }, qos_consts.DIRECTION: { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'is_filter': True, 'is_sort_key': True, 'validate': {'type:values': constants.VALID_DIRECTIONS} }, 'excluded': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'default': False, 'is_filter': True, 'is_sort_key': True, 'convert_to': converters.convert_to_boolean }, 'remote_ip_prefix': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'required_by_policy': True, 'is_filter': True, 'is_sort_key': True, 'validate': {'type:subnet': None} }, 'tenant_id': { 'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': {'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'is_visible': True } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/filter_validation.py0000664000175000017500000000166713641427107025470 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. ALIAS = 'filter-validation' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = False NAME = 'Filter parameters validation' DESCRIPTION = 'Provides validation on filter parameters.' UPDATED_TIMESTAMP = '2018-07-04T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/bgpvpn_stdattrs_port_assoc.py0000664000175000017500000000216613641427107027444 0ustar zuulzuul00000000000000# Copyright 2018 Orange # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import bgpvpn_routes_control ALIAS = 'standard-attr-bgpvpn-port-association' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = True NAME = 'BGPVPN Port Association Standard Attributes' DESCRIPTION = 'Add standard attributes to BGPVPN Port Association resources' UPDATED_TIMESTAMP = '2018-04-19T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [bgpvpn_routes_control.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/floatingip_autodelete_internal.py0000664000175000017500000000201613641427107030221 0ustar zuulzuul00000000000000# Copyright 2019 Ericsson # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. ALIAS = 'floatingip-autodelete-internal' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = False NAME = 'Autodelete floating IPs of internal networks' DESCRIPTION = 'Autodelete unused floating IPs' \ ' of networks being turned to router:external=False' UPDATED_TIMESTAMP = '2019-01-24T00:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/sfc.py0000664000175000017500000002250013641427107022531 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import flowclassifier as fc_api from neutron_lib import constants from neutron_lib.db import constants as db_const # The alias of the extension. ALIAS = 'sfc' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Service Function Chaining' # The description of the extension. DESCRIPTION = "Provides support for Service Function Chaining" # A timestamp of when the extension was last updated. UPDATED_TIMESTAMP = "2015-10-05T10:00:00-00:00" API_PREFIX = '/sfc' # Service Function Chaining constants PORT_PAIRS = 'port_pairs' PORT_PAIR_GROUPS = 'port_pair_groups' PORT_CHAINS = 'port_chains' MAX_CHAIN_ID = 65535 MPLS = 'mpls' NSH = 'nsh' PPG_N_TUPLE_DICT_SPEC = { 'source_ip_prefix': { 'default': None, 'type:subnet_or_none': None }, 'destination_ip_prefix': { 'default': None, 'type:subnet_or_none': None }, 'source_port_range_min': { 'default': None, 'convert_to': converters.convert_to_int_if_not_none, 'type:range_or_none': [0, constants.PORT_MAX] }, 'source_port_range_max': { 'default': None, 'convert_to': converters.convert_to_int_if_not_none, 'type:range_or_none': [0, constants.PORT_MAX] }, 'destination_port_range_min': { 'default': None, 'convert_to': converters.convert_to_int_if_not_none, 'type:range_or_none': [0, constants.PORT_MAX] }, 'destination_port_range_max': { 'default': None, 'convert_to': converters.convert_to_int_if_not_none, 'type:range_or_none': [0, constants.PORT_MAX] } } # The resource attribute map for the extension. RESOURCE_ATTRIBUTE_MAP = { PORT_PAIRS: { 'id': { 'allow_post': False, 'allow_put': False, 'is_visible': True, 'validate': {'type:uuid': None}, 'primary_key': True }, 'name': { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': '', 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, }, 'description': { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': '', 'validate': {'type:string': db_const.DESCRIPTION_FIELD_SIZE}, }, 'tenant_id': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'validate': {'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True }, 'ingress': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'validate': {'type:uuid': None} }, 'egress': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'validate': {'type:uuid': None} }, 'service_function_parameters': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'dict_populate_defaults': True, 'validate': { 'type:dict': { 'correlation': { 'type:values': [None, MPLS, NSH], 'default': None }, 'weight': { 'type:non_negative': None, 'default': 1, 'convert_to': converters.convert_to_int } } } } }, PORT_PAIR_GROUPS: { 'id': { 'allow_post': False, 'allow_put': False, 'is_visible': True, 'validate': {'type:uuid': None}, 'primary_key': True}, 'group_id': { 'allow_post': False, 'allow_put': False, 'is_visible': True }, 'name': { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': '', 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, }, 'description': { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': '', 'validate': {'type:string': db_const.DESCRIPTION_FIELD_SIZE}, }, 'tenant_id': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'validate': {'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True }, 'port_pairs': { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': None, 'validate': {'type:uuid_list': None}, 'convert_to': converters.convert_none_to_empty_list }, 'port_pair_group_parameters': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'dict_populate_defaults': True, 'validate': { 'type:dict': { 'lb_fields': { 'type:list_of_regex_or_none': 'eth|ip|tcp|udp)_(src|dst)', 'default': [] }, 'ppg_n_tuple_mapping': { 'dict_populate_defaults': True, 'type:dict': { 'ingress_n_tuple': { 'type:dict': PPG_N_TUPLE_DICT_SPEC, 'default': {} }, 'egress_n_tuple': { 'type:dict': PPG_N_TUPLE_DICT_SPEC, 'default': {} } } } } } } }, PORT_CHAINS: { 'id': { 'allow_post': False, 'allow_put': False, 'is_visible': True, 'validate': {'type:uuid': None}, 'primary_key': True }, 'chain_id': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'default': 0, 'validate': {'type:range': (0, MAX_CHAIN_ID)}, 'convert_to': converters.convert_to_int }, 'name': { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': '', 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, }, 'description': { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': '', 'validate': {'type:string': db_const.DESCRIPTION_FIELD_SIZE}, }, 'tenant_id': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'validate': {'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True }, 'port_pair_groups': { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'validate': {'type:uuid_list_non_empty': None}, 'default': None }, 'flow_classifiers': { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': None, 'validate': {'type:uuid_list': None}, 'convert_to': converters.convert_to_list }, 'chain_parameters': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'dict_populate_defaults': True, 'validate': { 'type:dict': { 'correlation': { 'type:values': [MPLS, NSH], 'default': MPLS }, 'symmetric': { 'type:boolean': None, 'default': False, 'convert_to': converters.convert_to_boolean } } }, } } } # The subresource attribute map for the extension. It adds child resources # to main extension's resource. The subresource map must have a parent and # a parameters entry. If an extension does not need such a map, None can # be specified (mandatory). SUB_RESOURCE_ATTRIBUTE_MAP = None # The action map. ACTION_MAP = { } ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [ fc_api.ALIAS, ] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/expose_l3_conntrack_helper.py0000664000175000017500000000270713641427107027267 0ustar zuulzuul00000000000000# Copyright (c) 2019 OpenStack Foundation # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import l3 from neutron_lib.api.definitions import l3_conntrack_helper ALIAS = "expose-l3-conntrack-helper" IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Expose CT target rules for conntrack helper' API_PREFIX = '' DESCRIPTION = 'Expose allow adding CT target rules for conntrack helper' UPDATED_TIMESTAMP = '2019-04-04T10:00:00-00:00' RESOURCE_NAME = l3.ROUTER COLLECTION_NAME = l3.ROUTERS RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { l3_conntrack_helper.COLLECTION_NAME: { 'allow_post': False, 'allow_put': False, 'is_visible': True, 'default': None } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [l3.ALIAS, l3_conntrack_helper.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/l3_port_ip_change_not_allowed.py0000664000175000017500000000204013641427107027721 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import l3 ALIAS = 'l3-port-ip-change-not-allowed' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = False NAME = 'Prevent L3 router ports IP address change extension' DESCRIPTION = 'Prevent change of IP address for some L3 router ports' UPDATED_TIMESTAMP = '2018-10-09T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [ l3.ALIAS ] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/network_segment_range.py0000664000175000017500000001336413641427107026355 0ustar zuulzuul00000000000000# Copyright (c) 2018 Intel Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import provider_net as providernet from neutron_lib import constants from neutron_lib.db import constants as db_const from oslo_log import log as logging LOG = logging.getLogger(__name__) # The name of the extension. NAME = 'Neutron Network Segment Range' # The alias of the extension. ALIAS = 'network-segment-range' # The description of the extension. DESCRIPTION = "Provides support for the network segment range management" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2018-11-29T00:00:00-00:00" # The name of the resource. RESOURCE_NAME = 'network_segment_range' # The plural for the resource. COLLECTION_NAME = 'network_segment_ranges' # Min ID for VLAN, VXLAN, GRE and GENEVE all equal to 1; Max ID for them are # 4094, 2 ** 24 - 1, 2 ** 32 - 1 and 2 ** 24 - 1 respectively. # Take the largest range: [MIN_GRE_ID, MAX_GRE_ID] as the limit for validation. NETWORK_SEGMENT_RANGE_LIMIT = [constants.MIN_GRE_ID, constants.MAX_GRE_ID] RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_filter': True, 'is_sort_key': True, 'primary_key': True, 'is_visible': True}, 'name': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, 'default': '', 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'default': {'allow_post': False, 'allow_put': False, 'convert_to': converters.convert_to_boolean, 'default': False, 'is_visible': True}, constants.SHARED: {'allow_post': True, 'allow_put': False, 'convert_to': converters.convert_to_boolean, 'default': True, 'is_visible': True}, 'project_id': {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'network_type': {'allow_post': True, 'allow_put': False, 'validate': { 'type:values': constants.NETWORK_SEGMENT_RANGE_TYPES}, 'default': constants.ATTR_NOT_SPECIFIED, 'is_filter': True, 'is_visible': True}, 'physical_network': {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': providernet.PHYSICAL_NETWORK_MAX_LEN}, 'default': constants.ATTR_NOT_SPECIFIED, 'is_filter': True, 'is_visible': True}, 'minimum': {'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_to_int, 'validate': {'type:range': NETWORK_SEGMENT_RANGE_LIMIT}, 'is_visible': True}, 'maximum': {'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_to_int, 'validate': {'type:range': NETWORK_SEGMENT_RANGE_LIMIT}, 'is_visible': True}, 'used': {'allow_post': False, 'allow_put': False, 'is_visible': True}, 'available': {'allow_post': False, 'allow_put': False, 'convert_to': converters.convert_none_to_empty_list, 'is_visible': True} } } # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The subresource attribute map for the extension. It adds child resources # to main extension's resource. The subresource map must have a parent and # a parameters entry. If an extension does not need such a map, None can # be specified (mandatory). SUB_RESOURCE_ATTRIBUTE_MAP = {} # The action map: it associates verbs with methods to be performed on # the API resource. ACTION_MAP = {} # The list of required extensions. REQUIRED_EXTENSIONS = [providernet.ALIAS] # The list of optional extensions. OPTIONAL_EXTENSIONS = [] # The action status. ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/revisionifmatch.py0000664000175000017500000000201113641427107025143 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. ALIAS = 'revision-if-match' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = False NAME = 'If-Match constraints based on revision_number' API_PREFIX = '' DESCRIPTION = ("Extension indicating that If-Match based on revision_number " "is supported.") UPDATED_TIMESTAMP = '2016-12-11T00:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = ['standard-attr-revisions'] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/extraroute_atomic.py0000664000175000017500000000245313641427107025521 0ustar zuulzuul00000000000000# Copyright 2019 Ericsson Software Technology # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import extraroute from neutron_lib.api.definitions import l3 ALIAS = 'extraroute-atomic' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Atomically add/remove extra routes' DESCRIPTION = ('Edit extra routes of a router on server side by atomically ' 'adding/removing extra routes') UPDATED_TIMESTAMP = '2019-07-10T00:00:00+00:00' RESOURCE_ATTRIBUTE_MAP = { l3.ROUTERS: {} } SUB_RESOURCE_ATTRIBUTE_MAP = None ACTION_MAP = l3.ACTION_MAP ACTION_MAP[l3.ROUTER].update({ 'add_extraroutes': 'PUT', 'remove_extraroutes': 'PUT', }) REQUIRED_EXTENSIONS = [l3.ALIAS, extraroute.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/_dummy.py0000664000175000017500000001020413641427107023246 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # A declaration of a dummy neutron extension: this may have a number of # constants being defined, and their aim is to document as much about # the extension as possible. # The alias of the extension. ALIAS = 'dummy' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map (mandatory). IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension (mandatory). # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension (mandatory). NAME = 'Foo Extension' # A prefix for API resources. An empty prefix means that the API is going # to be exposed at the v2/ level as any other core resource (mandatory). API_PREFIX = '' # The description of the extension (mandatory). DESCRIPTION = "Provides support for foo" # A timestamp of when the extension was introduced (mandatory). UPDATED_TIMESTAMP = "2000-00-01T00:00:00-00:00" # The specific resources and/or attributes for the extension (optional). # In case of simple extensions, with single resource, the string constants # RESOURCE_NAME and COLLECTION_NAME can be used, otherwise string literals # can be used instead. # The name of the resource introduced or being extended # (in case it is defined by another extension, or it is # a core resource). RESOURCE_NAME = 'foo' # The plural for the resource introduced or being extended # (in case it is defined by another extension, or it is a # core resource). COLLECTION_NAME = 'fooes' # The resource attribute map for the extension. It is effectively the # bulk of the API contract alongside ACTION_MAP (mandatory). RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'primary_key': True}, } } # The subresource attribute map for the extension. It adds child resources # to main extension's resource. The subresource map must have a parent and # a parameters entry. If an extension does not need such a map, None can # be specified (mandatory). # Note that if an existing sub-resource is being extended, the # existing resources to extend the new extension attributes must be # defined under the 'parameters' key. SUB_RESOURCE_ATTRIBUTE_MAP = { 'subfoo': { 'parent': { 'collection_name': COLLECTION_NAME, 'member_name': RESOURCE_NAME}, 'parameters': { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'primary_key': True}, }, }, } # The action map: it associates verbs with methods to be performed on # the API resource (mandatory). For example: # # ACTION_MAP = { # RESOURCE_NAME: { # 'add_my_foo_bars': 'PUT', # 'remove_my_foo_bars': 'PUT', # 'get_my_foo_bars': 'GET' # } # } ACTION_MAP = { } # The action status: it associates response statuses with methods to be # performed on the API resource (mandatory). For example: # # ACTION_STATUS = { # 'create': 201, # 'delete': 204 # } ACTION_STATUS = { } # The list of required extensions (mandatory). REQUIRED_EXTENSIONS = [ ] # The list of optional extensions (mandatory). OPTIONAL_EXTENSIONS = [ ] # TODO(armax): add support for modeling custom queries neutron-lib-2.3.0/neutron_lib/api/definitions/agent_resources_synced.py0000664000175000017500000000260113641427107026513 0ustar zuulzuul00000000000000# Copyright (c) 2018 Ericsson # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import agent from neutron_lib import constants ALIAS = 'agent-resources-synced' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = "Agent's Resource View Synced to Placement" DESCRIPTION = 'Stores success/failure of last sync to Placement' UPDATED_TIMESTAMP = '2018-12-19T00:00:00-00:00' RESOURCE_NAME = agent.RESOURCE_NAME COLLECTION_NAME = agent.COLLECTION_NAME RESOURCES_SYNCED = 'resources_synced' RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { RESOURCES_SYNCED: { 'allow_post': False, 'allow_put': False, 'default': constants.ATTR_NOT_SPECIFIED, 'is_visible': True, } } } SUB_RESOURCE_ATTRIBUTE_MAP = None ACTION_MAP = {} ACTION_STATUS = {} REQUIRED_EXTENSIONS = [agent.ALIAS] OPTIONAL_EXTENSIONS = [] neutron-lib-2.3.0/neutron_lib/api/definitions/default_subnetpools.py0000664000175000017500000000311213641427107026035 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import subnet as subnet_def from neutron_lib import constants USE_DEFAULT_SUBNETPOOL = 'use_default_subnetpool' ALIAS = 'default-subnetpools' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Default Subnetpools' API_PREFIX = '' DESCRIPTION = 'Provides ability to mark and use a subnetpool as the default.' UPDATED_TIMESTAMP = '2016-02-18T18:00:00-00:00' RESOURCE_NAME = subnet_def.RESOURCE_NAME COLLECTION_NAME = subnet_def.COLLECTION_NAME RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { USE_DEFAULT_SUBNETPOOL: {'allow_post': True, 'allow_put': False, 'default': False, 'convert_to': converters.convert_to_boolean, 'is_visible': False}, }, } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [constants.SUBNET_ALLOCATION_EXT_ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/network_availability_zone.py0000664000175000017500000000301213641427107027231 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from neutron_lib.api.definitions import availability_zone as az_def from neutron_lib.api.definitions import network ALIAS = 'network_availability_zone' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Network Availability Zone' API_PREFIX = '' DESCRIPTION = 'Availability zone support for network.' UPDATED_TIMESTAMP = '2015-01-01T10:00:00-00:00' RESOURCE_NAME = network.RESOURCE_NAME COLLECTION_NAME = network.COLLECTION_NAME RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { az_def.COLLECTION_NAME: { 'allow_post': False, 'allow_put': False, 'is_visible': True }, az_def.AZ_HINTS: { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'is_sort_key': True, 'validate': {'type:availability_zone_hint_list': None}, 'default': [] } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [az_def.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/firewall_v2.py0000664000175000017500000002412613641427107024200 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import constants as api_const from neutron_lib.api.definitions import port from neutron_lib import constants from neutron_lib.db import constants as db_const # The alias of the extension. ALIAS = 'fwaas_v2' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'FWaaS v2' # The description of the extension. DESCRIPTION = "Provides support for firewall-as-a-service version 2" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2016-10-06T10:00:00-00:00" # Base for the API calls API_PREFIX = '/fwaas' RESOURCE_ATTRIBUTE_MAP = { api_const.FIREWALL_RULES: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'primary_key': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': {'type:string': db_const.UUID_FIELD_SIZE}, 'is_visible': True}, 'name': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, 'is_visible': True, 'default': ''}, 'description': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.DESCRIPTION_FIELD_SIZE}, 'is_visible': True, 'default': ''}, 'firewall_policy_id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid_or_none': None}, 'is_visible': True}, constants.SHARED: { 'allow_post': True, 'allow_put': True, 'default': False, 'is_visible': True, 'convert_to': converters.convert_to_boolean, 'required_by_policy': True, 'enforce_policy': True }, 'protocol': { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': None, 'convert_to': converters.convert_to_protocol, 'validate': {'type:values': api_const.FW_PROTOCOL_VALUES}}, 'ip_version': {'allow_post': True, 'allow_put': True, 'default': 4, 'convert_to': converters.convert_to_int, 'validate': {'type:values': [4, 6]}, 'is_visible': True}, 'source_ip_address': {'allow_post': True, 'allow_put': True, 'validate': {'type:ip_or_subnet_or_none': None}, 'is_visible': True, 'default': None}, 'destination_ip_address': {'allow_post': True, 'allow_put': True, 'validate': {'type:ip_or_subnet_or_none': None}, 'is_visible': True, 'default': None}, 'source_port': {'allow_post': True, 'allow_put': True, 'validate': {'type:port_range': None}, 'convert_to': converters.convert_to_string, 'default': None, 'is_visible': True}, 'destination_port': {'allow_post': True, 'allow_put': True, 'validate': {'type:port_range': None}, 'convert_to': converters.convert_to_string, 'default': None, 'is_visible': True}, 'position': {'allow_post': False, 'allow_put': False, 'default': None, 'is_visible': True}, 'action': {'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_string_to_case_insensitive, 'validate': {'type:values': api_const.FW_VALID_ACTION_VALUES}, 'is_visible': True, 'default': 'deny'}, 'enabled': {'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_to_boolean, 'default': True, 'is_visible': True}, 'source_firewall_group_id': {'allow_post': True, 'allow_put': True, 'validate': {'type:uuid_or_none': None}, 'is_visible': True, 'default': None}, 'destination_firewall_group_id': {'allow_post': True, 'allow_put': True, 'validate': {'type:uuid_or_none': None}, 'is_visible': True, 'default': None}, }, api_const.FIREWALL_GROUPS: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'primary_key': True}, 'name': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, 'is_visible': True, 'default': ''}, 'description': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.DESCRIPTION_FIELD_SIZE}, 'is_visible': True, 'default': ''}, 'admin_state_up': {'allow_post': True, 'allow_put': True, 'default': True, 'is_visible': True, 'convert_to': converters.convert_to_boolean}, 'status': {'allow_post': False, 'allow_put': False, 'is_visible': True}, constants.SHARED: { 'allow_post': True, 'allow_put': True, 'default': False, 'convert_to': converters.convert_to_boolean, 'is_visible': True, 'required_by_policy': True, 'enforce_policy': True }, port.COLLECTION_NAME: {'allow_post': True, 'allow_put': True, 'validate': {'type:uuid_list': None}, 'convert_to': converters.convert_none_to_empty_list, 'default': None, 'is_visible': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': {'type:string': db_const.UUID_FIELD_SIZE}, 'is_visible': True}, 'ingress_firewall_policy_id': {'allow_post': True, 'allow_put': True, 'validate': {'type:uuid_or_none': None}, 'default': None, 'is_visible': True}, 'egress_firewall_policy_id': {'allow_post': True, 'allow_put': True, 'validate': {'type:uuid_or_none': None}, 'default': None, 'is_visible': True}, }, api_const.FIREWALL_POLICIES: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'primary_key': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': {'type:string': db_const.UUID_FIELD_SIZE}, 'is_visible': True}, 'name': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, 'is_visible': True, 'default': ''}, 'description': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.DESCRIPTION_FIELD_SIZE}, 'is_visible': True, 'default': ''}, constants.SHARED: { 'allow_post': True, 'allow_put': True, 'default': False, 'convert_to': converters.convert_to_boolean, 'is_visible': True, 'required_by_policy': True, 'enforce_policy': True }, api_const.FIREWALL_RULES: {'allow_post': True, 'allow_put': True, 'validate': {'type:uuid_list': None}, 'convert_to': converters.convert_none_to_empty_list, 'default': None, 'is_visible': True}, 'audited': {'allow_post': True, 'allow_put': True, 'default': False, 'convert_to': converters.convert_to_boolean, 'is_visible': True}, }, } # The subresource attribute map for the extension. This extension has only # top level resources, not child resources, so this is set to an empty dict. SUB_RESOURCE_ATTRIBUTE_MAP = { } # The action map. ACTION_MAP = { 'firewall_policy': {'insert_rule': 'PUT', 'remove_rule': 'PUT'}, } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [ ] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/rbac_address_scope.py0000664000175000017500000000202113641427107025557 0ustar zuulzuul00000000000000# Copyright (c) 2020 Cloudification GmbH. All rights reserved. # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. ALIAS = 'rbac-address-scope' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = False NAME = 'Add address_scope type to RBAC' DESCRIPTION = 'Add address_scope type to RBAC' UPDATED_TIMESTAMP = '2020-02-12T00:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = ['rbac-policies', 'address-scope'] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/standard_attr_segment.py0000664000175000017500000000214113641427107026331 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import segment ALIAS = 'standard-attr-segment' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = True NAME = 'Standard Attribute Segment Extension' DESCRIPTION = 'Add standard attributes to Segment resource' UPDATED_TIMESTAMP = '2018-04-09T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [segment.ALIAS] OPTIONAL_EXTENSIONS = [ 'standard-attr-description', 'standard-attr-timestamp', 'standard-attr-revisions' ] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/trunk.py0000664000175000017500000001007213641427107023122 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.db import constants as db_const # The alias of the extension. ALIAS = 'trunk' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Trunk Extension' # The description of the extension. DESCRIPTION = "Provides support for trunk ports" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2016-01-01T10:00:00-00:00" # The specific resources and/or attributes for the extension (optional). TRUNK = 'trunk' TRUNKS = 'trunks' SUB_PORTS = 'sub_ports' # The resource attribute map for the extension. RESOURCE_ATTRIBUTE_MAP = { TRUNKS: { 'admin_state_up': {'allow_post': True, 'allow_put': True, 'default': True, 'convert_to': converters.convert_to_boolean, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True, 'primary_key': True}, 'name': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'default': '', 'is_visible': True}, 'tenant_id': {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': {'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'port_id': {'allow_post': True, 'allow_put': False, 'required_by_policy': True, 'validate': {'type:uuid': None}, 'is_filter': True, 'is_sort_key': True, 'is_visible': True}, 'status': {'allow_post': False, 'allow_put': False, 'is_sort_key': True, 'is_visible': True}, SUB_PORTS: {'allow_post': True, 'allow_put': False, 'default': [], 'convert_list_to': converters.convert_kvp_list_to_dict, 'validate': {'type:subports': None}, 'enforce_policy': True, 'is_visible': True} }, } # The subresource attribute map for the extension. SUB_RESOURCE_ATTRIBUTE_MAP = None # The action map. ACTION_MAP = { TRUNK: { 'add_subports': 'PUT', 'remove_subports': 'PUT', 'get_subports': 'GET' } } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [ "binding", ] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ "provider", # needed to learn about network segmentation details. ] # TODO(armax): add support for modeling custom queries neutron-lib-2.3.0/neutron_lib/api/definitions/l3_conntrack_helper.py0000664000175000017500000001053113641427107025676 0ustar zuulzuul00000000000000# Copyright (c) 2019 OpenStack Foundation # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import l3 from neutron_lib import constants from neutron_lib.db import constants as db_const PROTOCOLS = constants.IPTABLES_PROTOCOL_MAP.keys() # The alias of the extension. ALIAS = 'l3-conntrack-helper' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'L3 Conntrack helper' # A prefix for API resources. An empty prefix means that the API is going # to be exposed at the v2/ level as any other core resource. API_PREFIX = '/' + l3.ROUTERS # The description of the extension. DESCRIPTION = "Allow adding CT target rules for conntrack helper" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2019-04-04T10:00:00-00:00" # The name of the resource. RESOURCE_NAME = 'conntrack_helper' # The plural for the resource. COLLECTION_NAME = 'conntrack_helpers' # parent PARENT_RESOURCE_NAME = l3.ROUTER PARENT_COLLECTION_NAME = l3.ROUTERS ID = 'id' PROJECT_ID = 'project_id' PROTOCOL = 'protocol' PORT = 'port' HELPER = 'helper' RESOURCE_ATTRIBUTE_MAP = {} # The subresource attribute map for the extension. It adds child resources # to main extension's resource. The subresource map must have a parent and # a parameters entry. If an extension does not need such a map, None can # be specified (mandatory). SUB_RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'parent': {'collection_name': PARENT_COLLECTION_NAME, 'member_name': PARENT_RESOURCE_NAME}, 'parameters': { ID: {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'primary_key': True, 'is_sort_key': True, 'is_filter': True}, PROJECT_ID: {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True, 'is_visible': False}, PROTOCOL: {'allow_post': True, 'allow_put': True, 'validate': {'type:values': PROTOCOLS}, 'is_visible': True, 'convert_to': converters.convert_to_protocol, 'is_sort_key': True, 'is_filter': True}, PORT: {'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_to_int, 'validate': {'type:range': [1, 65535]}, 'is_visible': True, 'is_sort_key': True, 'is_filter': True}, HELPER: {'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_to_string, 'validate': {'type:string': 64}, 'is_visible': True, 'is_sort_key': True, 'is_filter': True}, } } } # The action map: it associates verbs with methods to be performed on # the API resource. ACTION_MAP = { } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [l3.ALIAS] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/expose_port_forwarding_in_fip.py0000664000175000017500000000263513641427107030102 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import floating_ip_port_forwarding from neutron_lib.api.definitions import l3 ALIAS = "expose-port-forwarding-in-fip" IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Expose Floating IP port forwardings' API_PREFIX = '' DESCRIPTION = 'Expose port forwarding fields in floating IP response' UPDATED_TIMESTAMP = '2018-06-28T16:00:00-00:00' RESOURCE_NAME = l3.FLOATINGIP COLLECTION_NAME = l3.FLOATINGIPS RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { floating_ip_port_forwarding.COLLECTION_NAME: { 'allow_post': False, 'allow_put': False, 'is_visible': True, 'default': None } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [l3.ALIAS, floating_ip_port_forwarding.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/auto_allocated_topology.py0000664000175000017500000000402513641427107026674 0ustar zuulzuul00000000000000# Copyright 2015-2016 Hewlett Packard Enterprise Development Company, LP # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import constants from neutron_lib.api.definitions import l3 from neutron_lib.api.definitions import network ALIAS = 'auto-allocated-topology' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Auto Allocated Topology Services' API_PREFIX = '' DESCRIPTION = 'Auto Allocated Topology Services.' UPDATED_TIMESTAMP = '2016-01-01T00:00:00-00:00' RESOURCE_NAME = 'auto_allocated_topology' COLLECTION_NAME = 'auto_allocated_topologies' RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True}, 'tenant_id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True}, }, network.COLLECTION_NAME: { constants.IS_DEFAULT: { 'allow_post': True, 'allow_put': True, 'default': False, 'is_filter': True, 'is_visible': True, 'convert_to': converters.convert_to_boolean, 'enforce_policy': True, 'required_by_policy': True}}, } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [l3.ALIAS, 'subnet_allocation', 'external-net'] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/extra_dhcp_opt.py0000664000175000017500000001122313641427107024761 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import port # Common definitions for maximum string field length DHCP_OPT_NAME_MAX_LEN = 64 VALID_BLANK_EXTRA_DHCP_OPTS = ('router', 'classless-static-route') DHCP_OPT_VALUE_MAX_LEN = 255 EXTRA_DHCP_OPT_KEY_SPECS = [ # key spec for opt_name in _VALID_BLANK_EXTRA_DHCP_OPTS {'opt_name': {'type:values': VALID_BLANK_EXTRA_DHCP_OPTS, 'required': True}, 'opt_value': {'type:string_or_none': DHCP_OPT_VALUE_MAX_LEN, 'required': True}, 'ip_version': {'convert_to': converters.convert_to_int, 'type:values': [4, 6], 'required': False}}, # key spec if opt_name not in _VALID_BLANK_EXTRA_DHCP_OPTS {'opt_name': {'type:not_empty_string': DHCP_OPT_NAME_MAX_LEN, 'required': True}, 'opt_value': {'type:not_empty_string_or_none': DHCP_OPT_VALUE_MAX_LEN, 'required': True}, 'ip_version': {'convert_to': converters.convert_to_int, 'type:values': [4, 6], 'required': False}} ] EXTRADHCPOPTS = 'extra_dhcp_opts' DHCP_OPT_CLIENT_ID = "client-id" # client-id option value as defined in RFC 4776 DHCP_OPT_CLIENT_ID_NUM = 61 # The alias of the extension. ALIAS = 'extra_dhcp_opt' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map (mandatory). IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension (mandatory). # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension (mandatory). NAME = 'Neutron Extra DHCP options' # A prefix for API resources. An empty prefix means that the API is going # to be exposed at the v2/ level as any other core resource (mandatory). API_PREFIX = '' # The description of the extension (mandatory). DESCRIPTION = ("Extra options configuration for DHCP. " "For example PXE boot options to DHCP clients can " "be specified (e.g. tftp-server, server-ip-address, " "bootfile-name)") # A timestamp of when the extension was introduced (mandatory). UPDATED_TIMESTAMP = "2013-03-17T12:00:00-00:00" # The specific resources and/or attributes for the extension (optional). # In case of simple extensions, with single resource, the string constants # RESOURCE_NAME and COLLECTION_NAME can be used, otherwise string literals # can be used instead. # The name of the resource introduced or being extended # (in case it is defined by another extension, or it is # a core resource). RESOURCE_NAME = port.RESOURCE_NAME # The plural for the resource introduced or being extended # (in case it is defined by another extension, or it is a # core resource). COLLECTION_NAME = port.COLLECTION_NAME # The resource attribute map for the extension. It is effectively the # bulk of the API contract alongside ACTION_MAP (mandatory). RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { EXTRADHCPOPTS: { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': None, 'validate': { 'type:list_of_any_key_specs_or_none': EXTRA_DHCP_OPT_KEY_SPECS } } } } # The subresource attribute map for the extension. It adds child resources # to main extension's resource. The subresource map must have a parent and # a parameters entry. If an extension does not need such a map, None can # be specified (mandatory). SUB_RESOURCE_ATTRIBUTE_MAP = {} # The action map: it associates verbs with methods to be performed on # the API resource (mandatory). ACTION_MAP = {} # The list of required extensions (mandatory). REQUIRED_EXTENSIONS = [] # The list of optional extensions (mandatory). OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/stateful_security_group.py0000664000175000017500000000313613641427107026754 0ustar zuulzuul00000000000000# Copyright 2018 NOKIA # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters # The alias of the extension. ALIAS = 'stateful-security-group' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Stateful security group' # The description of the extension. DESCRIPTION = "Indicates if the security group is stateful or not" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2019-11-26T09:00:00-00:00" # The resource attribute map for the extension. RESOURCE_ATTRIBUTE_MAP = { 'security_groups': { 'stateful': {'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': True, 'convert_to': converters.convert_to_boolean} } } # The subresource attribute map for the extension. SUB_RESOURCE_ATTRIBUTE_MAP = { } # The action map. ACTION_MAP = { } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = ['security-group'] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/bgpvpn_stdattrs_router_assoc.py0000664000175000017500000000213613641427107027775 0ustar zuulzuul00000000000000# Copyright 2018 Orange # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import bgpvpn ALIAS = 'standard-attr-bgpvpn-router-association' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = True NAME = 'BGPVPN Router Association Standard Attributes' DESCRIPTION = 'Add standard attributes to BGPVPN Router Association resources' UPDATED_TIMESTAMP = '2018-04-19T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [bgpvpn.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/bgpvpn_stdattrs.py0000664000175000017500000000204513641427107025204 0ustar zuulzuul00000000000000# Copyright 2018 Orange # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import bgpvpn ALIAS = 'standard-attr-bgpvpn' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = True NAME = 'BGPVPN Standard Attributes' DESCRIPTION = 'Add standard attributes to BGPVPN resources' UPDATED_TIMESTAMP = '2018-04-19T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [bgpvpn.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/__init__.py0000664000175000017500000002173213641427107023523 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import address_scope from neutron_lib.api.definitions import agent from neutron_lib.api.definitions import agent_resources_synced from neutron_lib.api.definitions import allowedaddresspairs from neutron_lib.api.definitions import auto_allocated_topology from neutron_lib.api.definitions import availability_zone from neutron_lib.api.definitions import availability_zone_filter from neutron_lib.api.definitions import bgpvpn from neutron_lib.api.definitions import bgpvpn_routes_control from neutron_lib.api.definitions import bgpvpn_stdattrs from neutron_lib.api.definitions import bgpvpn_stdattrs_net_assoc from neutron_lib.api.definitions import bgpvpn_stdattrs_port_assoc from neutron_lib.api.definitions import bgpvpn_stdattrs_router_assoc from neutron_lib.api.definitions import bgpvpn_vni from neutron_lib.api.definitions import data_plane_status from neutron_lib.api.definitions import default_subnetpools from neutron_lib.api.definitions import dhcpagentscheduler from neutron_lib.api.definitions import dns from neutron_lib.api.definitions import dns_domain_ports from neutron_lib.api.definitions import dvr from neutron_lib.api.definitions import empty_string_filtering from neutron_lib.api.definitions import expose_l3_conntrack_helper from neutron_lib.api.definitions import expose_port_forwarding_in_fip from neutron_lib.api.definitions import external_net from neutron_lib.api.definitions import extra_dhcp_opt from neutron_lib.api.definitions import extraroute from neutron_lib.api.definitions import extraroute_atomic from neutron_lib.api.definitions import filter_validation from neutron_lib.api.definitions import fip64 from neutron_lib.api.definitions import fip_pf_description from neutron_lib.api.definitions import fip_port_details from neutron_lib.api.definitions import firewall_v2 from neutron_lib.api.definitions import flavors from neutron_lib.api.definitions import floating_ip_port_forwarding from neutron_lib.api.definitions import floatingip_autodelete_internal from neutron_lib.api.definitions import floatingip_pools from neutron_lib.api.definitions import flowclassifier from neutron_lib.api.definitions import ip_allocation from neutron_lib.api.definitions import ip_substring_port_filtering from neutron_lib.api.definitions import l2_adjacency from neutron_lib.api.definitions import l3 from neutron_lib.api.definitions import l3_conntrack_helper from neutron_lib.api.definitions import l3_ext_gw_mode from neutron_lib.api.definitions import l3_ext_ha_mode from neutron_lib.api.definitions import l3_flavors from neutron_lib.api.definitions import l3_port_ip_change_not_allowed from neutron_lib.api.definitions import logging from neutron_lib.api.definitions import logging_resource from neutron_lib.api.definitions import metering from neutron_lib.api.definitions import multiprovidernet from neutron_lib.api.definitions import network from neutron_lib.api.definitions import network_availability_zone from neutron_lib.api.definitions import network_ip_availability from neutron_lib.api.definitions import network_mtu from neutron_lib.api.definitions import network_mtu_writable from neutron_lib.api.definitions import network_segment_range from neutron_lib.api.definitions import pagination from neutron_lib.api.definitions import port from neutron_lib.api.definitions import port_mac_address_regenerate from neutron_lib.api.definitions import port_resource_request from neutron_lib.api.definitions import port_security from neutron_lib.api.definitions import portbindings from neutron_lib.api.definitions import portbindings_extended from neutron_lib.api.definitions import project_default_networks from neutron_lib.api.definitions import project_id from neutron_lib.api.definitions import provider_net from neutron_lib.api.definitions import qos from neutron_lib.api.definitions import qos_bw_limit_direction from neutron_lib.api.definitions import qos_bw_minimum_ingress from neutron_lib.api.definitions import qos_default from neutron_lib.api.definitions import qos_gateway_ip from neutron_lib.api.definitions import qos_port_network_policy from neutron_lib.api.definitions import qos_rule_type_details from neutron_lib.api.definitions import qos_rules_alias from neutron_lib.api.definitions import rbac_address_scope from neutron_lib.api.definitions import rbac_security_groups from neutron_lib.api.definitions import rbac_subnetpool from neutron_lib.api.definitions import revisionifmatch from neutron_lib.api.definitions import router_admin_state_down_before_update from neutron_lib.api.definitions import router_availability_zone from neutron_lib.api.definitions import router_interface_fip from neutron_lib.api.definitions import routerservicetype from neutron_lib.api.definitions import security_groups_port_filtering from neutron_lib.api.definitions import segment from neutron_lib.api.definitions import segments_peer_subnet_host_routes from neutron_lib.api.definitions import servicetype from neutron_lib.api.definitions import sfc from neutron_lib.api.definitions import sort_key_validation from neutron_lib.api.definitions import sorting from neutron_lib.api.definitions import standard_attr_segment from neutron_lib.api.definitions import stateful_security_group from neutron_lib.api.definitions import subnet from neutron_lib.api.definitions import subnet_dns_publish_fixed_ip from neutron_lib.api.definitions import subnet_onboard from neutron_lib.api.definitions import subnet_segmentid_enforce from neutron_lib.api.definitions import subnet_segmentid_writable from neutron_lib.api.definitions import subnet_service_types from neutron_lib.api.definitions import subnetpool from neutron_lib.api.definitions import subnetpool_prefix_ops from neutron_lib.api.definitions import tag_ports_during_bulk_creation from neutron_lib.api.definitions import trunk from neutron_lib.api.definitions import trunk_details from neutron_lib.api.definitions import uplink_status_propagation from neutron_lib.api.definitions import vlantransparent from neutron_lib.api.definitions import vpn from neutron_lib.api.definitions import vpn_endpoint_groups from neutron_lib.api.definitions import vpn_flavors _ALL_API_DEFINITIONS = { address_scope, agent, agent_resources_synced, allowedaddresspairs, auto_allocated_topology, availability_zone, availability_zone_filter, bgpvpn, bgpvpn_routes_control, bgpvpn_stdattrs, bgpvpn_stdattrs_net_assoc, bgpvpn_stdattrs_port_assoc, bgpvpn_stdattrs_router_assoc, bgpvpn_vni, data_plane_status, default_subnetpools, dhcpagentscheduler, dns, dns_domain_ports, dvr, empty_string_filtering, expose_l3_conntrack_helper, expose_port_forwarding_in_fip, external_net, extra_dhcp_opt, extraroute, extraroute_atomic, filter_validation, fip64, firewall_v2, fip_port_details, flavors, floating_ip_port_forwarding, fip_pf_description, floatingip_autodelete_internal, floatingip_pools, ip_allocation, ip_substring_port_filtering, l2_adjacency, flowclassifier, l3, l3_conntrack_helper, l3_ext_gw_mode, l3_ext_ha_mode, l3_flavors, l3_port_ip_change_not_allowed, logging, logging_resource, metering, multiprovidernet, network, network_availability_zone, network_ip_availability, network_mtu, network_mtu_writable, network_segment_range, pagination, port, port_mac_address_regenerate, port_resource_request, port_security, portbindings, portbindings_extended, project_default_networks, project_id, provider_net, qos, qos_bw_limit_direction, qos_bw_minimum_ingress, qos_default, qos_gateway_ip, qos_port_network_policy, qos_rule_type_details, qos_rules_alias, rbac_address_scope, rbac_security_groups, rbac_subnetpool, revisionifmatch, router_admin_state_down_before_update, router_availability_zone, router_interface_fip, routerservicetype, security_groups_port_filtering, segment, segments_peer_subnet_host_routes, servicetype, sfc, sort_key_validation, sorting, standard_attr_segment, stateful_security_group, subnet, subnet_dns_publish_fixed_ip, subnet_onboard, subnet_segmentid_enforce, subnet_segmentid_writable, subnet_service_types, subnetpool, subnetpool_prefix_ops, tag_ports_during_bulk_creation, trunk, trunk_details, uplink_status_propagation, vlantransparent, vpn, vpn_endpoint_groups, vpn_flavors, } neutron-lib-2.3.0/neutron_lib/api/definitions/fip64.py0000664000175000017500000000351613641427107022714 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import l3 # The alias of the extension. ALIAS = 'fip64' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = True # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'FIP64 Extension' # The description of the extension. DESCRIPTION = "FIP64 Extension" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2016-12-14T10:00:00-00:00" # The resource attribute map for the extension. It is effectively the # bulk of the API contract alongside ACTION_MAP RESOURCE_ATTRIBUTE_MAP = {} # The subresource attribute map for the extension. SUB_RESOURCE_ATTRIBUTE_MAP = None # The action map. ACTION_MAP = {} # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [ l3.ALIAS, ] # The list of optional extensions. OPTIONAL_EXTENSIONS = [] neutron-lib-2.3.0/neutron_lib/api/definitions/subnet_onboard.py0000664000175000017500000000313113641427107024761 0ustar zuulzuul00000000000000# (c) Copyright 2016 Hewlett Packard Enterprise Development LP # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import subnetpool as subnetpool_def import neutron_lib.constants ALIAS = "subnet_onboard" IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = "Subnet Onboard" DESCRIPTION = "Provides support for onboarding subnets into subnet pools" UPDATED_TIMESTAMP = "2018-12-18T09:00:00-00:00" ONBOARD_SUBNETS = 'onboard_network_subnets' RESOURCE_ATTRIBUTE_MAP = { subnetpool_def.COLLECTION_NAME: { } } # The subresource attribute map for the extension. This extension has only # top level resources, not child resources, so this is set to an empty dict. SUB_RESOURCE_ATTRIBUTE_MAP = { } # The action map. ACTION_MAP = { subnetpool_def.RESOURCE_NAME: { ONBOARD_SUBNETS: 'PUT' } } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [neutron_lib.constants.SUBNET_ALLOCATION_EXT_ALIAS] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/subnetpool_prefix_ops.py0000664000175000017500000000302313641427107026405 0ustar zuulzuul00000000000000# (c) Copyright 2019 SUSE LLC # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import subnetpool as subnetpool_def from neutron_lib import constants ALIAS = "subnetpool-prefix-ops" IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = "Subnet Pool Prefix Operations" DESCRIPTION = "Provides support for adjusting the prefix list of subnet pools" UPDATED_TIMESTAMP = "2019-02-08T10:00:00-00:00" RESOURCE_ATTRIBUTE_MAP = { } # The subresource attribute map for the extension. This extension has only # top level resources, not child resources, so this is set to an empty dict. SUB_RESOURCE_ATTRIBUTE_MAP = { } # The action map. ACTION_MAP = { subnetpool_def.RESOURCE_NAME: { 'add_prefixes': 'PUT', 'remove_prefixes': 'PUT' } } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [constants.SUBNET_ALLOCATION_EXT_ALIAS] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/flowclassifier.py0000664000175000017500000001533213641427107024777 0ustar zuulzuul00000000000000# Copyright 2015 Futurewei. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib import constants from neutron_lib.db import constants as db_const # The alias of the extension. ALIAS = 'flow_classifier' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Flow Classifier' # A prefix for API resources. An empty prefix means that the API is going # to be exposed at the v2/ level as any other core resource. API_PREFIX = '/sfc' # The description of the extension. DESCRIPTION = ("API for selection of packets to direct through service " "function chains") # A timestamp of when the extension was last updated. UPDATED_TIMESTAMP = "2015-10-05T10:00:00-00:00" FC_SUPPORTED_ETHERTYPES = [constants.IPv4, constants.IPv6] RESOURCE_NAME = 'flow_classifier' COLLECTION_NAME = 'flow_classifiers' # Attribute Map RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'id': { 'allow_post': False, 'allow_put': False, 'is_visible': True, 'validate': {'type:uuid': None}, 'primary_key': True}, 'name': { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': None, 'validate': {'type:string': db_const.NAME_FIELD_SIZE}, 'convert_to': converters.convert_none_to_empty_string}, 'description': { 'allow_post': True, 'allow_put': True, 'is_visible': True, 'default': None, 'validate': {'type:string': db_const.DESCRIPTION_FIELD_SIZE}, 'convert_to': converters.convert_none_to_empty_string}, 'tenant_id': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'validate': {'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True}, 'ethertype': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'default': "IPv4", 'default_overrides_none': True, 'validate': {'type:values': FC_SUPPORTED_ETHERTYPES}, 'convert_to': converters.convert_uppercase_ip}, 'protocol': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'default': None, 'convert_to': converters.convert_to_protocol}, 'source_port_range_min': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'default': None, 'convert_to': converters.convert_to_int_if_not_none, 'validate': {'type:range_or_none': [0, constants.PORT_MAX]}}, 'source_port_range_max': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'default': None, 'convert_to': converters.convert_to_int_if_not_none, 'validate': {'type:range_or_none': [0, constants.PORT_MAX]}}, 'destination_port_range_min': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'default': None, 'convert_to': converters.convert_to_int_if_not_none, 'validate': {'type:range_or_none': [0, constants.PORT_MAX]}}, 'destination_port_range_max': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'default': None, 'convert_to': converters.convert_to_int_if_not_none, 'validate': {'type:range_or_none': [0, constants.PORT_MAX]}}, 'source_ip_prefix': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'default': None, 'validate': {'type:subnet_or_none': None}}, 'destination_ip_prefix': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'default': None, 'validate': {'type:subnet_or_none': None}}, 'logical_source_port': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'default': None, 'validate': {'type:uuid_or_none': None}}, 'logical_destination_port': { 'allow_post': True, 'allow_put': False, 'is_visible': True, 'default': None, 'validate': {'type:uuid_or_none': None}}, 'l7_parameters': { # NOTE(tmorin): at this point, there is no clean way to extend # this attribute; it seems only used by GBP (by monkeypatching it # at runtime, see # http://codesearch.openstack.org/?q=AIM_FLC_L7_PARAMS) # So let's support the GBP fields by now, but consider that # future additions will need to happen via proper API extensions 'allow_post': True, 'allow_put': False, 'is_visible': True, 'default': {}, 'default_overrides_none': True, 'convert_to': converters.convert_none_to_empty_dict, 'validate': { 'type:dict': { 'logical_source_network': { 'default': None, 'type:uuid_or_none': None }, 'logical_destination_network': { 'default': None, 'type:uuid_or_none': None } } } } }, } # The subresource attribute map for the extension. It adds child resources # to main extension's resource. The subresource map must have a parent and # a parameters entry. If an extension does not need such a map, None can # be specified (mandatory). SUB_RESOURCE_ATTRIBUTE_MAP = None # The action map: it associates verbs with methods to be performed on # the API resource. ACTION_MAP = { } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [ ] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/sorting.py0000664000175000017500000000163413641427107023450 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. ALIAS = 'sorting' IS_SHIM_EXTENSION = True IS_STANDARD_ATTR_EXTENSION = False NAME = 'Sorting support' API_PREFIX = '' DESCRIPTION = 'Extension that indicates that sorting is enabled.' UPDATED_TIMESTAMP = '2016-06-12T00:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/security_groups_port_filtering.py0000664000175000017500000000341013641427107030332 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # The alias of the extension. ALIAS = 'port-security-groups-filtering' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = True # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Port filtering on security groups' # The description of the extension. DESCRIPTION = "Provides security groups filtering when listing ports" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2018-01-09T09:00:00-00:00" # The resource attribute map for the extension. RESOURCE_ATTRIBUTE_MAP = { } # The subresource attribute map for the extension. SUB_RESOURCE_ATTRIBUTE_MAP = { } # The action map. ACTION_MAP = { } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [ ] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/definitions/network_ip_availability.py0000664000175000017500000000524513641427107026700 0ustar zuulzuul00000000000000# Copyright 2016 GoDaddy. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. ALIAS = 'network-ip-availability' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Network IP Availability' API_PREFIX = '' DESCRIPTION = 'Provides IP availability data for each network and subnet.' UPDATED_TIMESTAMP = '2015-09-24T00:00:00-00:00' RESOURCE_NAME = "network_ip_availability" RESOURCE_PLURAL = "network_ip_availabilities" COLLECTION_NAME = RESOURCE_PLURAL.replace('_', '-') RESOURCE_ATTRIBUTE_MAP = { RESOURCE_PLURAL: { 'network_id': { 'allow_post': False, 'allow_put': False, 'is_visible': True, 'is_filter': True }, 'network_name': { 'allow_post': False, 'allow_put': False, 'is_visible': True, 'is_filter': True }, 'tenant_id': { 'allow_post': False, 'allow_put': False, 'is_visible': True, 'is_filter': True }, 'total_ips': { 'allow_post': False, 'allow_put': False, 'is_visible': True }, 'used_ips': { 'allow_post': False, 'allow_put': False, 'is_visible': True }, 'subnet_ip_availability': { 'allow_post': False, 'allow_put': False, 'is_visible': True }, # NOTE(hongbin): This 'ip_version' attribute (top-level) is only used # as a filter on listing the resources. There is another 'ip_version' # attribute nested inside the 'subnet_ip_availability'. # The difference is that the top-level attribute is used as input # and the nested attribute is an output. # In here, 'allow_post', 'allow_put' and 'is_visible' are set to False # because this attribute should be used as filter only. Please do not # set it to True to avoid introducing inconsistency. 'ip_version': { 'allow_post': False, 'allow_put': False, 'is_visible': False, 'is_filter': True } # TODO(wwriverrat) Make composite attribute for subnet_ip_availability } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/bgpvpn_vni.py0000664000175000017500000000532613641427107024135 0ustar zuulzuul00000000000000# # Copyright 2017 Ericsson India Global Services Pvt Ltd. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # from neutron_lib.api import converters as lib_converters from neutron_lib.api.definitions import bgpvpn from neutron_lib import constants VNI = 'vni' # The alias of the extension. ALIAS = 'bgpvpn-vni' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'BGPVPN VXLAN VNI extension' # A prefix for API resources. An empty prefix means that the API is going # to be exposed at the v2/ level as any other core resource. API_PREFIX = '' # The description of the extension. DESCRIPTION = "BGPVPN VXLAN VNI extension" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2017-09-12T10:00:00-00:00" RESOURCE_ATTRIBUTE_MAP = { bgpvpn.COLLECTION_NAME: { VNI: {'allow_post': True, 'allow_put': False, 'convert_to': lib_converters.convert_to_int_if_not_none, 'default': None, 'validate': {'type:range_or_none': [constants.MIN_VXLAN_VNI, constants.MAX_VXLAN_VNI] }, 'is_visible': True, 'enforce_policy': True}, }, } # The subresource attribute map for the extension. It adds child resources # to main extension's resource. The subresource map must have a parent and # a parameters entry. If an extension does not need such a map, None can # be specified (mandatory). SUB_RESOURCE_ATTRIBUTE_MAP = {} # The action map: it associates verbs with methods to be performed on # the API resource. ACTION_MAP = {} # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [bgpvpn.ALIAS] # The list of optional extensions. OPTIONAL_EXTENSIONS = [] neutron-lib-2.3.0/neutron_lib/api/definitions/qos_default.py0000664000175000017500000000260313641427107024266 0ustar zuulzuul00000000000000# Copyright (c) 2017 Intel Corporation. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import qos as qos_apidef ALIAS = 'qos-default' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'QoS default policy' API_PREFIX = '' DESCRIPTION = 'Expose the QoS default policy per project' UPDATED_TIMESTAMP = '2017-041-06T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = { qos_apidef.POLICIES: { 'is_default': { 'allow_post': True, 'allow_put': True, 'default': False, 'convert_to': converters.convert_to_boolean, 'is_filter': True, 'is_visible': True } } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [qos_apidef.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/availability_zone.py0000664000175000017500000000324713641427107025472 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from neutron_lib.api.definitions import agent from neutron_lib.api import validators from neutron_lib.api.validators import availability_zone as az_validator validators.add_validator('availability_zone_hint_list', az_validator._validate_availability_zone_hints) AZ_HINTS = 'availability_zone_hints' ALIAS = 'availability_zone' IS_SHIM_EXTENSION = False IS_STANDARD_ATTR_EXTENSION = False NAME = 'Availability Zone' API_PREFIX = '' DESCRIPTION = 'The availability zone extension.' UPDATED_TIMESTAMP = '2015-01-01T10:00:00-00:00' RESOURCE_NAME = 'availability_zone' COLLECTION_NAME = RESOURCE_NAME + 's' RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'name': {'is_visible': True, 'is_filter': True}, 'resource': {'is_visible': True, 'is_filter': True}, 'state': {'is_visible': True, 'is_filter': True} }, agent.COLLECTION_NAME: { RESOURCE_NAME: { 'allow_post': False, 'allow_put': False, 'is_filter': True, 'is_visible': True} } } SUB_RESOURCE_ATTRIBUTE_MAP = {} ACTION_MAP = {} REQUIRED_EXTENSIONS = [agent.ALIAS] OPTIONAL_EXTENSIONS = [] ACTION_STATUS = {} neutron-lib-2.3.0/neutron_lib/api/definitions/floating_ip_port_forwarding.py0000664000175000017500000001202713641427107027542 0ustar zuulzuul00000000000000# Copyright (c) 2012 OpenStack Foundation. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import converters from neutron_lib.api.definitions import l3 from neutron_lib import constants from neutron_lib.db import constants as db_const PROTOCOLS = constants.IPTABLES_PROTOCOL_MAP.keys() # The alias of the extension. ALIAS = 'floating-ip-port-forwarding' # Whether or not this extension is simply signaling behavior to the user # or it actively modifies the attribute map. IS_SHIM_EXTENSION = False # Whether the extension is marking the adoption of standardattr model for # legacy resources, or introducing new standardattr attributes. False or # None if the standardattr model is adopted since the introduction of # resource extension. # If this is True, the alias for the extension should be prefixed with # 'standard-attr-'. IS_STANDARD_ATTR_EXTENSION = False # The name of the extension. NAME = 'Floating IP Port Forwarding' # A prefix for API resources. An empty prefix means that the API is going # to be exposed at the v2/ level as any other core resource. API_PREFIX = '/' + l3.FLOATINGIPS # The description of the extension. DESCRIPTION = "Allow port forwarding from floating IP port to an internal port" # A timestamp of when the extension was introduced. UPDATED_TIMESTAMP = "2018-01-19T10:00:00-00:00" # The name of the resource. RESOURCE_NAME = 'port_forwarding' # The plural for the resource. COLLECTION_NAME = 'port_forwardings' # parent PARENT_RESOURCE_NAME = l3.FLOATINGIP PARENT_COLLECTION_NAME = l3.FLOATINGIPS ID = 'id' PROJECT_ID = 'project_id' EXTERNAL_PORT = 'external_port' INTERNAL_PORT = 'internal_port' INTERNAL_IP_ADDRESS = 'internal_ip_address' PROTOCOL = 'protocol' INTERNAL_PORT_ID = 'internal_port_id' RESOURCE_ATTRIBUTE_MAP = {} # The subresource attribute map for the extension. It adds child resources # to main extension's resource. The subresource map must have a parent and # a parameters entry. If an extension does not need such a map, None can # be specified (mandatory). SUB_RESOURCE_ATTRIBUTE_MAP = { COLLECTION_NAME: { 'parent': {'collection_name': PARENT_COLLECTION_NAME, 'member_name': PARENT_RESOURCE_NAME}, 'parameters': { ID: {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'primary_key': True, 'is_sort_key': True, 'is_filter': True}, PROJECT_ID: {'allow_post': True, 'allow_put': False, 'validate': { 'type:string': db_const.PROJECT_ID_FIELD_SIZE}, 'required_by_policy': True, 'is_visible': False}, EXTERNAL_PORT: { 'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_to_int, 'validate': {'type:range': [1, 65535]}, 'is_visible': True, 'is_sort_key': True, 'is_filter': True}, INTERNAL_PORT: { 'allow_post': True, 'allow_put': True, 'convert_to': converters.convert_to_int, 'validate': {'type:range': [1, 65535]}, 'is_visible': True}, INTERNAL_IP_ADDRESS: {'allow_post': True, 'allow_put': True, 'validate': { 'type:ip_address': None}, 'is_visible': True}, PROTOCOL: {'allow_post': True, 'allow_put': True, 'validate': {'type:values': PROTOCOLS}, 'is_visible': True, 'convert_to': converters.convert_to_protocol, 'is_sort_key': True, 'is_filter': True}, INTERNAL_PORT_ID: {'allow_post': True, 'allow_put': True, 'validate': {'type:uuid': None}, 'is_visible': True, 'is_sort_key': True, 'is_filter': True}, } } } # The action map: it associates verbs with methods to be performed on # the API resource. ACTION_MAP = { } # The action status. ACTION_STATUS = { } # The list of required extensions. REQUIRED_EXTENSIONS = [l3.ALIAS] # The list of optional extensions. OPTIONAL_EXTENSIONS = [ ] neutron-lib-2.3.0/neutron_lib/api/validators/0000775000175000017500000000000013641427200021234 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/api/validators/multiprovidernet.py0000664000175000017500000000321313641427107025227 0ustar zuulzuul00000000000000# Copyright (c) 2013 OpenStack Foundation. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from webob import exc from neutron_lib._i18n import _ from neutron_lib.api import converters from neutron_lib.api.definitions import provider_net as pnet from neutron_lib import constants def convert_and_validate_segments(segments, valid_values=None): for segment in segments: segment.setdefault(pnet.NETWORK_TYPE, constants.ATTR_NOT_SPECIFIED) segment.setdefault(pnet.PHYSICAL_NETWORK, constants.ATTR_NOT_SPECIFIED) segmentation_id = segment.get(pnet.SEGMENTATION_ID) if segmentation_id: segment[pnet.SEGMENTATION_ID] = converters.convert_to_int( segmentation_id) else: segment[pnet.SEGMENTATION_ID] = constants.ATTR_NOT_SPECIFIED if len(segment) != 3: msg = (_("Unrecognized attribute(s) '%s'") % ', '.join(set(segment.keys()) - set([pnet.NETWORK_TYPE, pnet.PHYSICAL_NETWORK, pnet.SEGMENTATION_ID]))) raise exc.HTTPBadRequest(msg) neutron-lib-2.3.0/neutron_lib/api/validators/dns.py0000664000175000017500000001670613641427107022412 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import re from oslo_config import cfg from neutron_lib._i18n import _ from neutron_lib.api import validators from neutron_lib import constants from neutron_lib.db import constants as db_constants def _validate_dns_format(data, max_len=db_constants.FQDN_FIELD_SIZE): # NOTE: An individual name regex instead of an entire FQDN was used # because its easier to make correct. The logic should validate that the # dns_name matches RFC 1123 (section 2.1) and RFC 952. if not data: return try: # A trailing period is allowed to indicate that a name is fully # qualified per RFC 1034 (page 7). trimmed = data[:-1] if data.endswith('.') else data if len(trimmed) > max_len: raise TypeError( _("'%(trimmed)s' exceeds the %(maxlen)s character FQDN " "limit") % {'trimmed': trimmed, 'maxlen': max_len}) labels = trimmed.split('.') for label in labels: if not label: raise TypeError(_("Encountered an empty component")) if label.endswith('-') or label.startswith('-'): raise TypeError( _("Name '%s' must not start or end with a hyphen") % label) if not re.match(constants.DNS_LABEL_REGEX, label): raise TypeError( _("Name '%s' must be 1-63 characters long, each of " "which can only be alphanumeric or a hyphen") % label) # RFC 1123 hints that a TLD can't be all numeric. last is a TLD if # it's an FQDN. if len(labels) > 1 and re.match("^[0-9]+$", labels[-1]): raise TypeError( _("TLD '%s' must not be all numeric") % labels[-1]) except TypeError as e: msg = _("'%(data)s' not a valid PQDN or FQDN. Reason: %(reason)s") % { 'data': data, 'reason': e} return msg def _validate_dns_name_with_dns_domain(request_dns_name, dns_domain): # If a PQDN was passed, make sure the FQDN that will be generated is of # legal size higher_labels = dns_domain if dns_domain: higher_labels = '.%s' % dns_domain higher_labels_len = len(higher_labels) dns_name_len = len(request_dns_name) if not request_dns_name.endswith('.'): if dns_name_len + higher_labels_len > db_constants.FQDN_FIELD_SIZE: msg = _("The dns_name passed is a PQDN and its size is " "'%(dns_name_len)s'. The dns_domain option in " "neutron.conf is set to %(dns_domain)s, with a " "length of '%(higher_labels_len)s'. When the two are " "concatenated to form a FQDN (with a '.' at the end), " "the resulting length exceeds the maximum size " "of '%(fqdn_max_len)s'" ) % {'dns_name_len': dns_name_len, 'dns_domain': cfg.CONF.dns_domain, 'higher_labels_len': higher_labels_len, 'fqdn_max_len': db_constants.FQDN_FIELD_SIZE} return msg return # A FQDN was passed if (dns_name_len <= higher_labels_len or not request_dns_name.endswith(higher_labels)): msg = _("The dns_name passed is a FQDN. Its higher level labels " "must be equal to the dns_domain option in neutron.conf, " "that has been set to '%(dns_domain)s'. It must also " "include one or more valid DNS labels to the left " "of '%(dns_domain)s'") % {'dns_domain': cfg.CONF.dns_domain} return msg def _get_dns_domain_config(): if not cfg.CONF.dns_domain: return '' if cfg.CONF.dns_domain.endswith('.'): return cfg.CONF.dns_domain return '%s.' % cfg.CONF.dns_domain def _get_request_dns_name(dns_name): dns_domain = _get_dns_domain_config() if (dns_domain and dns_domain != constants.DNS_DOMAIN_DEFAULT): # If CONF.dns_domain is the default value 'openstacklocal', # neutron don't let the user to assign dns_name to ports return dns_name return '' def validate_dns_name(data, max_len=db_constants.FQDN_FIELD_SIZE): """Validate DNS name. This method validates dns name and also needs to have dns_domain in config because this may call a method which uses the config. :param data: The data to validate. :param max_len: An optional cap on the length of the string. :returns: None if data is valid, otherwise a human readable message indicating why validation failed. """ msg = _validate_dns_format(data, max_len) if msg: return msg request_dns_name = _get_request_dns_name(data) if request_dns_name: dns_domain = _get_dns_domain_config() msg = _validate_dns_name_with_dns_domain(request_dns_name, dns_domain) if msg: return msg def validate_fip_dns_name(data, max_len=db_constants.FQDN_FIELD_SIZE): """Validate DNS name for floating IP. :param data: The data to validate. :param max_len: An optional cap on the length of the string. :returns: None if data is valid, otherwise a human readable message indicating why validation failed. """ msg = validators.validate_string(data) if msg: return msg if not data: return if data.endswith('.'): msg = _("'%s' is a FQDN. It should be a relative domain name") % data return msg msg = _validate_dns_format(data, max_len) if msg: return msg length = len(data) if length > max_len - 3: msg = _("'%(data)s' contains %(length)s characters. Adding a " "domain name will cause it to exceed the maximum length " "of a FQDN of '%(max_len)s'") % {"data": data, "length": length, "max_len": max_len} return msg def validate_dns_domain(data, max_len=db_constants.FQDN_FIELD_SIZE): """Validate DNS domain. :param data: The data to validate. :param max_len: An optional cap on the length of the string. :returns: None if data is valid, otherwise a human readable message indicating why validation failed. """ msg = validators.validate_string(data) if msg: return msg if not data: return if not data.endswith('.'): msg = _("'%s' is not a FQDN") % data return msg msg = _validate_dns_format(data, max_len) if msg: return msg length = len(data) if length > max_len - 2: msg = _("'%(data)s' contains %(length)s characters. Adding a " "sub-domain will cause it to exceed the maximum length of a " "FQDN of '%(max_len)s'") % {"data": data, "length": length, "max_len": max_len} return msg neutron-lib-2.3.0/neutron_lib/api/validators/allowedaddresspairs.py0000664000175000017500000000650213641427107025653 0ustar zuulzuul00000000000000# Copyright 2013 VMware, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from oslo_config import cfg from webob import exc from neutron_lib._i18n import _ from neutron_lib.api import validators from neutron_lib.exceptions import allowedaddresspairs as exceptions def _validate_allowed_address_pairs(address_pairs, valid_values=None): """Validates a list of allowed address pair dicts. Validation herein requires the caller to have registered the max_allowed_address_pair oslo config option in the global CONF prior to having this validator used. :param address_pairs: A list of address pair dicts to validate. :param valid_values: Not used. :returns: None :raises: AllowedAddressPairExhausted if the address pairs requested exceeds cfg.CONF.max_allowed_address_pair. AllowedAddressPairsMissingIP if any address pair dicts are missing and IP address. DuplicateAddressPairInRequest if duplicated IPs are in the list of address pair dicts. Otherwise a HTTPBadRequest is raised if any of the address pairs are invalid. """ unique_check = {} if not isinstance(address_pairs, list): raise exc.HTTPBadRequest( _("Allowed address pairs must be a list.")) if len(address_pairs) > cfg.CONF.max_allowed_address_pair: raise exceptions.AllowedAddressPairExhausted( quota=cfg.CONF.max_allowed_address_pair) for address_pair in address_pairs: msg = validators.validate_dict(address_pair) if msg: return msg # mac_address is optional, if not set we use the mac on the port if 'mac_address' in address_pair: msg = validators.validate_mac_address(address_pair['mac_address']) if msg: raise exc.HTTPBadRequest(msg) if 'ip_address' not in address_pair: raise exceptions.AllowedAddressPairsMissingIP() mac = address_pair.get('mac_address') ip_address = address_pair['ip_address'] if (mac, ip_address) not in unique_check: unique_check[(mac, ip_address)] = None else: raise exceptions.DuplicateAddressPairInRequest( mac_address=mac, ip_address=ip_address) invalid_attrs = set(address_pair.keys()) - set(['mac_address', 'ip_address']) if invalid_attrs: msg = (_("Unrecognized attribute(s) '%s'") % ', '.join(set(address_pair.keys()) - set(['mac_address', 'ip_address']))) raise exc.HTTPBadRequest(msg) if '/' in ip_address: msg = validators.validate_subnet(ip_address) else: msg = validators.validate_ip_address(ip_address) if msg: raise exc.HTTPBadRequest(msg) neutron-lib-2.3.0/neutron_lib/api/validators/__init__.py0000664000175000017500000013264113641427107023362 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import collections import functools import inspect import re import netaddr from os_ken.lib.packet import ether_types from oslo_config import cfg from oslo_log import log as logging from oslo_utils import netutils from oslo_utils import strutils from oslo_utils import uuidutils from webob import exc from neutron_lib._i18n import _ from neutron_lib import constants from neutron_lib import exceptions as n_exc from neutron_lib.plugins import directory LOG = logging.getLogger(__name__) # Used by range check to indicate no limit for a bound. UNLIMITED = None # Note: In order to ensure that the MAC address is unicast the first byte # must be even. MAC_PATTERN = "^%s[aceACE02468](:%s{2}){5}$" % (constants.HEX_ELEM, constants.HEX_ELEM) def _verify_dict_keys(expected_keys, target_dict, strict=True): """Verify expected keys in a dictionary. :param expected_keys: A list of keys expected to be present. :param target_dict: The dictionary which should be verified. :param strict: Specifies whether additional keys are allowed to be present. :returns: None if the expected keys are found. Otherwise a human readable message indicating why the validation failed. """ if not isinstance(target_dict, dict): msg = (_("Invalid input. '%(target_dict)s' must be a dictionary " "with keys: %(expected_keys)s") % {'target_dict': target_dict, 'expected_keys': expected_keys}) LOG.debug(msg) return msg expected_keys = set(expected_keys) provided_keys = set(target_dict.keys()) predicate = expected_keys.__eq__ if strict else expected_keys.issubset if not predicate(provided_keys): msg = (_("Validation of dictionary's keys failed. " "Expected keys: %(expected_keys)s " "Provided keys: %(provided_keys)s") % {'expected_keys': expected_keys, 'provided_keys': provided_keys}) LOG.debug(msg) return msg def _collect_duplicates(data_list): """Collects duplicate items from a list and returns them. :param data_list: A list of items to check for duplicates. The list may include dict items. :returns: A set of items that are duplicates in data_list. If no duplicates are found, the returned set is empty. """ seen = [] dups = set() for datum in data_list: if datum in seen: dups.add(datum) continue seen.append(datum) return dups def is_attr_set(attribute): """Determine if an attribute value is set. :param attribute: The attribute value to check. :returns: False if the attribute value is None or ATTR_NOT_SPECIFIED, otherwise True. """ return not (attribute is None or attribute is constants.ATTR_NOT_SPECIFIED) def _validate_list_of_items(item_validator, data, *args, **kwargs): if not isinstance(data, list): msg = _("'%s' is not a list") % data return msg dups = _collect_duplicates(data) if dups: msg = _("Duplicate items in the list: '%s'") % ', '.join( [str(d) for d in dups]) return msg for item in data: msg = item_validator(item, *args, **kwargs) if msg: return msg def _validate_list_of_items_non_empty(item_validator, data, *args, **kwargs): res = _validate_list_of_items(item_validator, data, *args, **kwargs) if res is not None: return res if len(data) == 0: msg = _("List should not be empty") return msg def validate_values(data, valid_values=None, valid_values_display=None): """Validate that the provided 'data' is within 'valid_values'. :param data: The data to check within valid_values. :param valid_values: A collection of values that 'data' must be in to be valid. The collection can be any type that supports the 'in' operation. :param valid_values_display: A string to display that describes the valid values. This string is only displayed when an invalid value is encountered. If no string is provided, the string "valid_values" will be used. :returns: The message to return if data not in valid_values. :raises: TypeError if the values for 'data' or 'valid_values' are not compatible for comparison or doesn't have __contains__. If TypeError is raised this is considered a programming error and the inputs (data) and (valid_values) must be checked so this is never raised on validation. """ # If valid_values is not specified we don't check against it. if valid_values is None: return # Check if we can use 'in' to find membership of data in valid_values contains = getattr(valid_values, "__contains__", None) if callable(contains): try: if data not in valid_values: valid_values_display = valid_values_display or 'valid_values' msg = (_("%(data)s is not in %(valid_values)s") % {'data': data, 'valid_values': valid_values_display}) LOG.debug(msg) return msg except TypeError: # This is a programming error msg = (_("'data' of type '%(typedata)s' and 'valid_values' " "of type '%(typevalues)s' are not " "compatible for comparison") % {'typedata': type(data), 'typevalues': type(valid_values)}) raise TypeError(msg) else: # This is a programming error msg = (_("'valid_values' does not support membership operations")) raise TypeError(msg) def validate_not_empty_string_or_none(data, max_len=None): """Validate data is a non-empty string or None. :param data: The data to validate. :param max_len: An optional cap on the str length to validate. :returns: None if the data string is not None and is not an empty string, otherwise a human readable message as to why the string data is invalid. """ if data is not None: return validate_not_empty_string(data, max_len=max_len) def validate_not_empty_string(data, max_len=None): """Validate data is a non-empty/non-blank string. :param data: The data to validate. :param max_len: An optional cap on the length of the string data. :returns: None if the data is non-empty/non-blank, otherwise a human readable string message indicating why validation failed. """ msg = validate_string(data, max_len=max_len) if msg: return msg if not data.strip(): msg = _("'%s' Blank strings are not permitted") % data LOG.debug(msg) return msg def validate_string_or_none(data, max_len=None): """Validate data is a string or None. :param data: The data to validate. :param max_len: An optional cap on the length of the string data. :returns: None if the data is None or a valid string, otherwise a human readable message indicating why validation failed. """ if data is not None: return validate_string(data, max_len=max_len) def validate_string(data, max_len=None): """Validate data is a string object optionally capping it length. :param data: The data to validate. :param max_len: An optional cap on the length of the string. :returns: None if the data is a valid string type and (optionally) within the given max_len. Otherwise a human readable message indicating why the data is invalid. """ if not isinstance(data, str): msg = _("'%s' is not a valid string") % data LOG.debug(msg) return msg if max_len is not None and len(data) > max_len: msg = (_("'%(data)s' exceeds maximum length of %(max_len)s") % {'data': data, 'max_len': max_len}) LOG.debug(msg) return msg _validate_list_of_unique_strings = functools.partial(_validate_list_of_items, validate_string) # NOTE(boden): stubbed out for docstring comments. def validate_list_of_unique_strings(data, max_len=None): """Validate data is a list of unique strings. :param data: The data to validate. :param max_len: An optional cap on the length of the string. :returns: None if the data is a list of non-empty/non-blank strings, otherwise a human readable message indicating why validation failed. """ return _validate_list_of_unique_strings(data, max_len=max_len) def validate_boolean(data, valid_values=None): """Validate data is a python bool compatible object. :param data: The data to validate. :param valid_values: Not used! :return: None if the value can be converted to a bool, otherwise a human readable message indicating why data is invalid. """ try: strutils.bool_from_string(data, strict=True) except ValueError: msg = _("'%s' is not a valid boolean value") % data LOG.debug(msg) return msg def validate_integer(data, valid_values=None): """This function validates if the data is an integer. It checks both number or string provided to validate it's an integer and returns a message with the error if it's not :param data: The string or number to validate as integer. :param valid_values: values to limit the 'data' to. :returns: None if data is an integer, otherwise a human readable message indicating why validation failed.. """ if valid_values is not None: msg = validate_values(data=data, valid_values=valid_values) if msg: return msg msg = _("'%s' is not an integer") % data try: fl_n = float(data) int_n = int(data) except (ValueError, TypeError, OverflowError): LOG.debug(msg) return msg # Fail test if non equal or boolean if fl_n != int_n: LOG.debug(msg) return msg elif isinstance(data, bool): msg = _("'%s' is not an integer:boolean") % data LOG.debug(msg) return msg def validate_range(data, valid_values=None): """Check that integer value is within a range provided. Test is inclusive. Allows either limit to be ignored, to allow checking ranges where only the lower or upper limit matter. It is expected that the limits provided are valid integers or the value None. :param data: The data to validate. :param valid_values: A list of 2 elements where element 0 is the min value the int data can have and element 1 is the max. :returns: None if the data is a valid int in the given range, otherwise a human readable message as to why validation failed. """ min_value = valid_values[0] max_value = valid_values[1] try: data = int(data) except (ValueError, TypeError): msg = _("'%s' is not an integer") % data LOG.debug(msg) return msg if min_value is not UNLIMITED and data < min_value: msg = _("'%(data)s' is too small - must be at least " "'%(limit)d'") % {'data': data, 'limit': min_value} LOG.debug(msg) return msg if max_value is not UNLIMITED and data > max_value: msg = _("'%(data)s' is too large - must be no larger than " "'%(limit)d'") % {'data': data, 'limit': max_value} LOG.debug(msg) return msg def validate_range_or_none(data, valid_values=None): """Check that the provided value is none or a ranged integer""" if data is not None: return validate_range(data, valid_values) def validate_no_whitespace(data): """Validates that input has no whitespace. :param data: The data to validate. Must be a python string type suitable for searching via regex. :returns: The data itself. :raises InvalidInput: If the data contains whitespace. """ if re.search(r'\s', data): msg = _("'%s' contains whitespace") % data LOG.debug(msg) raise n_exc.InvalidInput(error_message=msg) return data def validate_mac_address(data, valid_values=None): """Validate data is a MAC address. :param data: The data to validate. :param valid_values: Not used! :returns: None if the data is a valid MAC address, otherwise a human readable message as to why validation failed. """ try: valid_mac = netaddr.valid_mac(validate_no_whitespace(data)) except Exception: valid_mac = False if valid_mac: valid_mac = (not netaddr.EUI(data) in map(netaddr.EUI, constants.INVALID_MAC_ADDRESSES)) # TODO(arosen): The code in this file should be refactored # so it catches the correct exceptions. validate_no_whitespace # raises AttributeError if data is None. if not valid_mac: msg = _("'%s' is not a valid MAC address") % data LOG.debug(msg) return msg def validate_mac_address_or_none(data, valid_values=None): """Validate data is a MAC address if the data isn't None. :param data: The data to validate. :param valid_values: Not used! :returns: None if the data is None or a valid MAC address, otherwise a human readable message indicating why validation failed. """ if data is not None: return validate_mac_address(data, valid_values) def validate_ip_address(data, valid_values=None): """Validate data is an IP address. :param data: The data to validate. :param valid_values: Not used! :returns: None if data is an IP address, otherwise a human readable message indicating why data isn't an IP address. """ msg = None try: # netaddr.core.ZEROFILL is only applicable to IPv4. # it will remove leading zeros from IPv4 address octets. ip = netaddr.IPAddress(validate_no_whitespace(data), flags=netaddr.core.ZEROFILL) # The followings are quick checks for IPv6 (has ':') and # IPv4. (has 3 periods like 'xx.xx.xx.xx') # NOTE(yamamoto): netaddr uses libraries provided by the underlying # platform to convert addresses. For example, inet_aton(3). # Some platforms, including NetBSD and OS X, have inet_aton # implementation which accepts more varying forms of addresses than # we want to accept here. The following check is to reject such # addresses. For Example: # >>> netaddr.IPAddress('1' * 59) # IPAddress('199.28.113.199') # >>> netaddr.IPAddress(str(int('1' * 59) & 0xffffffff)) # IPAddress('199.28.113.199') # >>> if ':' not in data and data.count('.') != 3: msg = _("'%s' is not a valid IP address") % data # A leading '0' in IPv4 address may be interpreted as an octal number, # e.g. 011 octal is 9 decimal. Since there is no standard saying # whether IP address with leading '0's should be interpreted as octal # or decimal, hence we reject leading '0's to avoid ambiguity. elif ip.version == 4 and str(ip) != data: msg = _("'%(data)s' is not an accepted IP address, " "'%(ip)s' is recommended") % {"data": data, "ip": ip} except Exception: msg = _("'%s' is not a valid IP address") % data if msg: LOG.debug(msg) return msg def _validate_any_key_spec(data, key_specs=None): """Validate a dict matches at least 1 key spec. :param data: The dict to validate. :param key_specs: An iterable collection of key spec dicts used to validate data. :returns: None if at least 1 of the key_specs matches data, otherwise a message is returned indicating data could not be matched with any of the key_specs. """ for spec in key_specs: if validate_dict(data, spec) is None: return None msg = _("No valid key specs matched for: %s") % data LOG.debug(msg) return msg def validate_any_key_specs_or_none(data, key_specs=None): """Validate each dict in a list matches at least 1 key_spec. :param data: The list of dicts to validate. :param key_specs: An iterable collection of key spec dicts that is used to check each dict in data. :returns: None. :raises InvalidInput: If any of the dicts in data do not match at least 1 of the key_specs given. """ if data is None: return def dict_validator(data_dict): msg = _validate_any_key_spec(data_dict, key_specs=key_specs) if msg: raise n_exc.InvalidInput(error_message=msg) msg = _validate_list_of_items(dict_validator, data) if msg: raise n_exc.InvalidInput(error_message=msg) def validate_ip_pools(data, valid_values=None): """Validate that start and end IP addresses are present. In addition to this the IP addresses will also be validated. :param data: The data to validate. Must be a list-like structure of IP pool dicts that each have a 'start' and 'end' key value. :param valid_values: Not used! :returns: None if data is a valid list of IP pools, otherwise a message indicating why the data is invalid. """ if not isinstance(data, list): msg = _("Invalid data format for IP pool: '%s'") % data LOG.debug(msg) return msg expected_keys = ['start', 'end'] for ip_pool in data: msg = _verify_dict_keys(expected_keys, ip_pool) if msg: return msg for k in expected_keys: msg = validate_ip_address(ip_pool[k]) if msg: return msg def validate_fixed_ips(data, valid_values=None): """Validate data is a list of fixed IP dicts. In addition this function validates the ip_address and subnet_id if present in each fixed IP dict. :param data: The data to validate. :param valid_values: Not used! :returns: None if data is a valid list of fixed IP dicts. Otherwise a human readable message is returned indicating why validation failed. """ if not isinstance(data, list): msg = _("Invalid data format for fixed IP: '%s'") % data LOG.debug(msg) return msg ips = [] for fixed_ip in data: if not isinstance(fixed_ip, dict): msg = _("Invalid data format for fixed IP: '%s'") % fixed_ip LOG.debug(msg) return msg if 'ip_address' in fixed_ip: # Ensure that duplicate entries are not set - just checking IP # suffices. Duplicate subnet_id's are legitimate. fixed_ip_address = fixed_ip['ip_address'] if fixed_ip_address in ips: msg = _("Duplicate IP address '%s'") % fixed_ip_address LOG.debug(msg) else: msg = validate_ip_address(fixed_ip_address) if msg: return msg ips.append(fixed_ip_address) if 'subnet_id' in fixed_ip: msg = validate_uuid(fixed_ip['subnet_id']) if msg: return msg def validate_nameservers(data, valid_values=None): """Validate a list of unique IP addresses. :param data: The data to validate. :param valid_values: Not used! :returns: None if data is a list of valid IP addresses, otherwise a human readable message is returned indicating why validation failed. """ if not hasattr(data, '__iter__'): msg = _("Invalid data format for nameserver: '%s'") % data LOG.debug(msg) return msg hosts = [] for host in data: # This must be an IP address only msg = validate_ip_address(host) if msg: msg = _("'%(host)s' is not a valid nameserver. %(msg)s") % { 'host': host, 'msg': msg} LOG.debug(msg) return msg if host in hosts: msg = _("Duplicate nameserver '%s'") % host LOG.debug(msg) return msg hosts.append(host) def validate_hostroutes(data, valid_values=None): """Validate a list of unique host route dicts. :param data: The data to validate. To be valid it must be a list like structure of host route dicts, each containing 'destination' and 'nexthop' key values. :param valid_values: Not used! :returns: None if data is a valid list of unique host route dicts, otherwise a human readable message indicating why validation failed. """ if not isinstance(data, list): msg = _("Invalid data format for hostroute: '%s'") % data LOG.debug(msg) return msg expected_keys = ['destination', 'nexthop'] hostroutes = [] for hostroute in data: msg = _verify_dict_keys(expected_keys, hostroute) if msg: return msg msg = validate_route_cidr(hostroute['destination']) if msg: return msg msg = validate_ip_address(hostroute['nexthop']) if msg: return msg if hostroute in hostroutes: msg = _("Duplicate hostroute '%s'") % hostroute LOG.debug(msg) return msg hostroutes.append(hostroute) def validate_ip_address_or_none(data, valid_values=None): """Validate data is an IP address or None. :param data: The data to validate. :param valid_values: An optional list of values data may take on. :return: None if data is None or a valid IP address, otherwise a human readable message indicating why the data is invalid. """ if data is not None: return validate_ip_address(data, valid_values) def validate_ip_or_subnet_or_none(data, valid_values=None): """Validate data is an IP address, a valid IP subnet string, or None. :param data: The data to validate. :param valid_values: Not used! :return: None if data is None or a valid IP address or a valid IP subnet, otherwise a human readable message indicating why the data is neither an IP address nor IP subnet. """ msg_ip = validate_ip_address_or_none(data) msg_subnet = validate_subnet_or_none(data) if msg_ip is not None and msg_subnet is not None: return _("'%(data)s' is neither a valid IP address, nor " "is it a valid IP subnet") % {'data': data} def validate_subnet(data, valid_values=None): """Validate data is an IP network subnet string. :param data: The data to validate. :param valid_values: Not used! :returns: None if data is valid IP network address. Otherwise a human readable message as to why data is invalid. """ msg = None try: net = netaddr.IPNetwork(validate_no_whitespace(data)) if '/' not in data or (net.version == 4 and str(net) != data): msg = _("'%(data)s' isn't a recognized IP subnet cidr," " '%(cidr)s' is recommended") % {"data": data, "cidr": net.cidr} else: return except Exception: msg = _("'%s' is not a valid IP subnet") % data if msg: LOG.debug(msg) return msg def validate_route_cidr(data, valid_values=None): """Validate data is a proper CIDR string. :param data: The data to validate. :param valid_values: Not used! :returns: None if data is valid CIDR. Otherwise a human readable message as to why data is invalid. """ msg = None try: net = netaddr.IPNetwork(validate_no_whitespace(data)) if '/' not in data or (net.network != net.ip): msg = _("'%(data)s' is not a recognized CIDR," " '%(cidr)s' is recommended") % {"data": data, "cidr": net.cidr} elif net.is_loopback(): msg = _("'%(data)s' is not a routable CIDR") % {"data": data} else: return except Exception: msg = _("'%s' is not a valid CIDR") % data if msg: LOG.debug(msg) return msg def validate_subnet_or_none(data, valid_values=None): """Validate data is a valid subnet address string or None. :param data: The data to validate. :param valid_values: The optional list of values data may take on. :returns: None if data is None or a valid subnet, otherwise a human readable message as to why data is invalid. """ if data is not None: return validate_subnet(data, valid_values) _validate_subnet_list = functools.partial(_validate_list_of_items, validate_subnet) # NOTE(boden): subbed out for docstring comments. def validate_subnet_list(data, valid_values=None): """Validate data is a list of subnet dicts. :param data: The data to validate. :param valid_values: Not used! :returns: None if data is a valid list of subnet dicts, otherwise a human readable message as to why the data is invalid. """ return _validate_subnet_list(data, valid_values) def validate_subnet_list_or_none(data, key_specs=None): """Validate data is a list of subnet dicts or None. :param data: The data to validate. :param key_specs: Not used! :returns: None if data is None or a valid list of subnet dicts, otherwise a human readable message as to why the data is invalid. """ if data is not None: return validate_subnet_list(data, key_specs) def validate_regex(data, valid_values=None): """Validate data is matched against a regex. :param data: The data to validate. :param valid_values: The regular expression to use with re.match on the data. :returns: None if data contains matches for valid_values, otherwise a human readable message as to why data is invalid. """ try: if re.match(valid_values, data): return except TypeError: pass msg = _("'%s' is not a valid input") % data LOG.debug(msg) return msg def validate_regex_or_none(data, valid_values=None): """Validate data is None or matched against a regex. :param data: The data to validate. :param valid_values: The regular expression to use with re.match on the data. :returns: None if data is None or contains matches for valid_values, otherwise a human readable message as to why data is invalid. """ if data is not None: return validate_regex(data, valid_values) def validate_list_of_regex_or_none(data, valid_values=None): """Validate data is None or a list of items matching regex. :param data: A list of data to validate. :param valid_values: The regular expression to use with re.match on each element of the data. :returns: None if data is None or contains matches for valid_values, otherwise a human readable message as to why data is invalid. """ if data is not None: return _validate_list_of_items(validate_regex, data, valid_values) def validate_subnetpool_id(data, valid_values=None): """Validate data is valid subnet pool ID. :param data: The data to validate. :param valid_values: Not used! :returns: None if data is a valid subnet pool ID, otherwise a human readable message as to why it's invalid. """ if data != constants.IPV6_PD_POOL_ID: return validate_uuid_or_none(data, valid_values) def validate_subnetpool_id_or_none(data, valid_values=None): """Validate data is valid subnet pool ID or None. :param data: The data to validate. :param valid_values: Not used! :returns: None if data is a valid subnet pool ID or None, otherwise a human readable message as to why it's invalid. """ if data is not None: return validate_subnetpool_id(data, valid_values) def validate_uuid(data, valid_values=None): """Validate data is UUID like. :param data: The data to validate. :param valid_values: Not used! :returns: None if data is UUID like in form, otherwise a human readable message indicating why data is invalid. """ if not uuidutils.is_uuid_like(data): msg = _("'%s' is not a valid UUID") % data LOG.debug(msg) return msg def validate_uuid_or_none(data, valid_values=None): """Validate data is UUID like or None. :param data: The data to validate. :param valid_values: Not used! :returns: None if data is UUID like in form or None, otherwise a human readable message indicating why data is invalid. """ if data is not None: return validate_uuid(data) _validate_uuid_list = functools.partial(_validate_list_of_items, validate_uuid) # NOTE(boden): subbed out for docstring comments. def validate_uuid_list(data, valid_values=None): """Validate data is a list of UUID like values. :param data: The data to validate. :param valid_values: Not used! :returns: None if data is an iterable that contains valid UUID values, otherwise a message is returned indicating why validation failed. """ return _validate_uuid_list(data, valid_values) def validate_uuid_list_non_empty(data, valid_values=None): """Validate data is a non-empty list of UUID like values. :param data: The data to validate. :param valid_values: Not used! :returns: None if data is a non-empty iterable that contains valid UUID values, otherwise a message is returned indicating why validation failed. """ return _validate_list_of_items_non_empty(validate_uuid, data) def _extract_validator(key_validator): # Find validator function in key validation spec # # TODO(salv-orlando): Structure of dict attributes should be improved # to avoid iterating over items for (k, v) in key_validator.items(): if k.startswith('type:'): (validator_name, validator_params) = (k, v) try: return (validator_name, validators[validator_name], validator_params) except KeyError: raise UndefinedValidator(validator_name) return None, None, None def _validate_dict_item(key, key_validator, data): # Find conversion function, if any, and apply it conv_func = key_validator.get('convert_to') if conv_func: data[key] = conv_func(data.get(key)) try: dummy_, val_func, val_params = _extract_validator(key_validator) if val_func: return val_func(data.get(key), val_params) # NOTE(tmorin): here we silently omit to validate a key for which # no type validator has been defined except UndefinedValidator as e: # NOTE(tmorin): Should we really return an API error on such # an issue. Wouldn't InternalServer error be more natural ? LOG.debug(e.message) return e.message def validate_dict(data, key_specs=None): """Validate data is a dict optionally containing a specific set of keys. :param data: The data to validate. :param key_specs: The optional list of keys that must be contained in data. :returns: None if data is a dict and (optionally) contains only key_specs. Otherwise a human readable message is returned indicating why data is not valid. """ if not isinstance(data, dict): msg = _("'%s' is not a dictionary") % data LOG.debug(msg) return msg # Do not perform any further validation, if no constraints are supplied if not key_specs: return # Check whether all required keys are present required_keys = [key for key, spec in key_specs.items() if spec.get('required')] if required_keys: msg = _verify_dict_keys(required_keys, data, False) if msg: return msg # Check whether unexpected keys are supplied in data unexpected_keys = [key for key in data if key not in key_specs] if unexpected_keys: msg = _("Unexpected keys supplied: %s") % ', '.join(unexpected_keys) LOG.debug(msg) return msg # Perform validation and conversion of all values # according to the specifications. for key, key_validator in [(k, v) for k, v in key_specs.items() if k in data]: msg = _validate_dict_item(key, key_validator, data) if msg: return msg def validate_dict_or_none(data, key_specs=None): """Validate data is None or a dict containing a specific set of keys. :param data: The data to validate. :param key_specs: The optional list of keys that must be contained in data. :returns: None if data is None or a dict that (optionally) contains all key_specs. Otherwise a human readable message is returned indicating why data is not valid. """ if data is not None: return validate_dict(data, key_specs) def validate_dict_or_empty(data, key_specs=None): """Validate data is {} or a dict containing a specific set of keys. :param data: The data to validate. :param key_specs: The optional list of keys that must be contained in data. :returns: None if data is {} or a dict (optionally) containing only key_specs. Otherwise a human readable message is returned indicating why data is not valid. """ if data != {}: return validate_dict(data, key_specs) def validate_dict_or_nodata(data, key_specs=None): """Validate no data or a dict containing a specific set of keys. :param data: The data to validate. May be None. :param key_specs: The optional list of keys that must be contained in data. :returns: None if no data/empty dict or a dict and (optionally) contains all key_specs. Otherwise a human readable message is returned indicating why data is not valid. """ if data: return validate_dict(data, key_specs) def validate_non_negative(data, valid_values=None): """Validate data is a positive int. :param data: The data to validate :param valid_values: Not used! :returns: None if data is an int and is positive, otherwise a human readable message as to why data is invalid. """ try: data = int(data) except (ValueError, TypeError): msg = _("'%s' is not an integer") % data LOG.debug(msg) return msg if data < 0: msg = _("'%s' should be non-negative") % data LOG.debug(msg) return msg def validate_port_range_or_none(data, valid_values=None): """Validate data is a range of TCP/UDP port numbers :param data: The data to validate :param valid_values: Not used! :returns: None if data is an int between 0 and 65535, or two ints between 0 and 65535 with a colon between them, otherwise a human readable message as to why data is invalid. """ if data is None: return data = str(data) ports = data.split(':') if len(ports) > 2: msg = _("Port range must be two integers separated by a colon") LOG.debug(msg) return msg for p in ports: if len(p) == 0: msg = _("Port range must be two integers separated by a colon") LOG.debug(msg) return msg if not netutils.is_valid_port(p): msg = _("Invalid port: %s") % p LOG.debug(msg) return msg if len(ports) > 1 and int(ports[0]) > int(ports[1]): msg = _("First port in a port range must be lower than the second " "port") LOG.debug(msg) return msg def validate_subports(data, valid_values=None): """Validate data is a list of subnet port dicts. :param data: The data to validate. :param valid_values: Not used! :returns: None if data is a list of subport dicts each with a unique valid port_id, segmentation_id and segmentation_type. Otherwise a human readable message is returned indicating why the data is invalid. """ if not isinstance(data, list): msg = _("Invalid data format for subports: '%s' is not a list") % data LOG.debug(msg) return msg subport_ids = set() segmentations = collections.defaultdict(set) for subport in data: if not isinstance(subport, dict): msg = _("Invalid data format for subport: " "'%s' is not a dict") % subport LOG.debug(msg) return msg # Expect a non duplicated and valid port_id for the subport if 'port_id' not in subport: msg = _("A valid port UUID must be specified") LOG.debug(msg) return msg elif validate_uuid(subport["port_id"]): msg = _("Invalid UUID for subport: '%s'") % subport["port_id"] return msg elif subport["port_id"] in subport_ids: msg = _("Non unique UUID for subport: '%s'") % subport["port_id"] return msg subport_ids.add(subport["port_id"]) # Validate that both segmentation ID and segmentation type are # specified, and that the client does not duplicate segmentation # IDs (unless it is explicitly asked to inherit segmentation # details from the underlying subport's network). segmentation_type = subport.get("segmentation_type") if segmentation_type == 'inherit': return segmentation_id = subport.get("segmentation_id") if ((not segmentation_type or segmentation_id is None) and len(subport) > 1): msg = _("Invalid subport details '%s': missing segmentation " "information. Must specify both segmentation_id and " "segmentation_type") % subport LOG.debug(msg) return msg if segmentation_id in segmentations.get(segmentation_type, []): msg = _("Segmentation ID '%(seg_id)s' for '%(subport)s' is not " "unique") % {"seg_id": segmentation_id, "subport": subport["port_id"]} LOG.debug(msg) return msg if segmentation_id is not None: segmentations[segmentation_type].add(segmentation_id) def validate_service_plugin_type(data, valid_values=None): """Validates data is a valid service plugin. :param data: The service plugin type to validate. :param valid_values: Not used. :returns: None if data is a valid service plugin known to the plugin directory. :raises: InvalidServiceType if data is not a service known by the plugin directory. """ if not directory.get_plugin(data): raise n_exc.InvalidServiceType(service_type=data) def validate_subnet_service_types(service_types, valid_values=None): if service_types: if not isinstance(service_types, list): raise exc.HTTPBadRequest( _("Subnet service types must be a list.")) # Include standard prefixes prefixes = list(constants.DEVICE_OWNER_PREFIXES) prefixes += constants.DEVICE_OWNER_COMPUTE_PREFIX for service_type in service_types: if not isinstance(service_type, str): raise n_exc.InvalidInputSubnetServiceType( service_type=service_type) elif not service_type.startswith(tuple(prefixes)): raise n_exc.InvalidSubnetServiceType(service_type=service_type) def validate_ethertype(ethertype, valid_values=None): """Validates ethertype is a valid ethertype. :param ethertype: Ethertype to validate. :returns: None if data is a valid ethertype. Otherwise a human-readable message indicating that the data is not a valid ethertype. """ if cfg.CONF.sg_filter_ethertypes: os_ken_ethertypes = ether_types.__dict__ try: # Use the ethertype constants from os_ken with the special # exception of 'IPv4', which appears as 'ETH_TYPE_IP' in os_ken. # Be case-insensitive. ethertype_str = str(ethertype).upper() if ethertype_str == "IPV4": ethertype_str = "IP" ethertype_name = 'ETH_TYPE_' + ethertype_str if ethertype_name in os_ken_ethertypes: ethertype = os_ken_ethertypes[ethertype_name] except TypeError: # Value of ethertype cannot be coerced into a string, like None pass try: if isinstance(ethertype, str): ethertype = int(ethertype, 16) if (isinstance(ethertype, int) and constants.ETHERTYPE_MIN <= ethertype and ethertype <= constants.ETHERTYPE_MAX): return None except ValueError: pass msg = _("Ethertype %s is not a two octet hexadecimal " "number or ethertype name.") % ethertype LOG.debug(msg) return msg else: if ethertype in constants.VALID_ETHERTYPES: return None valids = ','.join(map(str, constants.VALID_ETHERTYPES)) msg = _("Ethertype %(ethertype)s is not a valid ethertype, must be " "one of %(valid_ethertypes)s.") % {'ethertype': ethertype, 'valid_ethertypes': valids} LOG.debug(msg) return msg # Dictionary that maintains a list of validation functions validators = {'type:dict': validate_dict, 'type:dict_or_none': validate_dict_or_none, 'type:dict_or_empty': validate_dict_or_empty, 'type:dict_or_nodata': validate_dict_or_nodata, 'type:ethertype': validate_ethertype, 'type:fixed_ips': validate_fixed_ips, 'type:hostroutes': validate_hostroutes, 'type:ip_address': validate_ip_address, 'type:ip_address_or_none': validate_ip_address_or_none, 'type:ip_or_subnet_or_none': validate_ip_or_subnet_or_none, 'type:ip_pools': validate_ip_pools, 'type:list_of_regex_or_none': validate_list_of_regex_or_none, 'type:mac_address': validate_mac_address, 'type:mac_address_or_none': validate_mac_address_or_none, 'type:nameservers': validate_nameservers, 'type:non_negative': validate_non_negative, 'type:port_range': validate_port_range_or_none, 'type:range': validate_range, 'type:range_or_none': validate_range_or_none, 'type:regex': validate_regex, 'type:regex_or_none': validate_regex_or_none, 'type:string': validate_string, 'type:string_or_none': validate_string_or_none, 'type:not_empty_string': validate_not_empty_string, 'type:not_empty_string_or_none': validate_not_empty_string_or_none, 'type:subnet': validate_subnet, 'type:subnet_list': validate_subnet_list, 'type:subnet_or_none': validate_subnet_or_none, 'type:subnetpool_id': validate_subnetpool_id, 'type:subnetpool_id_or_none': validate_subnetpool_id_or_none, 'type:subports': validate_subports, 'type:uuid': validate_uuid, 'type:uuid_or_none': validate_uuid_or_none, 'type:uuid_list': validate_uuid_list, 'type:uuid_list_non_empty': validate_uuid_list_non_empty, 'type:values': validate_values, 'type:boolean': validate_boolean, 'type:integer': validate_integer, 'type:list_of_unique_strings': validate_list_of_unique_strings, 'type:list_of_any_key_specs_or_none': validate_any_key_specs_or_none, 'type:service_plugin_type': validate_service_plugin_type, 'type:list_of_subnets_or_none': validate_subnet_list_or_none, 'type:list_of_subnet_service_types': validate_subnet_service_types } class UndefinedValidator(Exception): def __init__(self, validator_name): self.validator_name = validator_name self.message = _("Validator '%s' does not exist") % self.validator_name def _to_validation_type(validation_type): return (validation_type if validation_type.startswith('type:') else 'type:' + validation_type) def get_validator(validation_type, default=None): """Get a registered validator by type. :param validation_type: The type to retrieve the validator for. :param default: A default value to return if the validator is not registered. :return: The validator if registered, otherwise the default value. """ return validators.get(_to_validation_type(validation_type), default) def add_validator(validation_type, validator): """Dynamically add a validator. This can be used by clients to add their own, private validators, rather than directly modifying the data structure. The clients can NOT modify existing validators. """ key = _to_validation_type(validation_type) if key in validators: # NOTE(boden): imp.load_source() forces module reinitialization that # can lead to validator redefinition from the same call site if inspect.getsource(validator) != inspect.getsource(validators[key]): msg = _("Validator type %s is already defined") % validation_type raise KeyError(msg) return validators[key] = validator neutron-lib-2.3.0/neutron_lib/api/validators/availability_zone.py0000664000175000017500000000313213641427107025320 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from oslo_serialization import jsonutils from neutron_lib._i18n import _ from neutron_lib.api import validators from neutron_lib.db import constants as db_const from neutron_lib import exceptions def convert_az_list_to_string(az_list): """Convert a list of availability zones into a string. :param az_list: A list of AZs. :returns: The az_list in string format. """ return jsonutils.dumps(az_list) def convert_az_string_to_list(az_string): """Convert an AZ list in string format into a python list. :param az_string: The AZ list in string format. :returns: The python list of AZs build from az_string. """ return jsonutils.loads(az_string) if az_string else [] def _validate_availability_zone_hints(data, valid_value=None): msg = validators.validate_list_of_unique_strings(data) if msg: return msg az_string = convert_az_list_to_string(data) if len(az_string) > db_const.AZ_HINTS_DB_LEN: msg = _("Too many availability_zone_hints specified") raise exceptions.InvalidInput(error_message=msg) neutron-lib-2.3.0/neutron_lib/api/__init__.py0000664000175000017500000000000013641427107021171 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/constants.py0000664000175000017500000005116613641427107020720 0ustar zuulzuul00000000000000# Copyright (c) 2012 OpenStack Foundation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. # TODO(salv-orlando): Verify if a single set of operational # status constants is achievable NET_STATUS_ACTIVE = 'ACTIVE' NET_STATUS_BUILD = 'BUILD' NET_STATUS_DOWN = 'DOWN' NET_STATUS_ERROR = 'ERROR' PORT_STATUS_ACTIVE = 'ACTIVE' PORT_STATUS_BUILD = 'BUILD' PORT_STATUS_DOWN = 'DOWN' PORT_STATUS_ERROR = 'ERROR' PORT_STATUS_NOTAPPLICABLE = 'N/A' FLOATINGIP_STATUS_ACTIVE = 'ACTIVE' FLOATINGIP_STATUS_DOWN = 'DOWN' FLOATINGIP_STATUS_ERROR = 'ERROR' # Service operation status constants ACTIVE = "ACTIVE" DOWN = "DOWN" CREATED = "CREATED" PENDING_CREATE = "PENDING_CREATE" PENDING_UPDATE = "PENDING_UPDATE" PENDING_DELETE = "PENDING_DELETE" INACTIVE = "INACTIVE" ERROR = "ERROR" DEVICE_OWNER_COMPUTE_PREFIX = "compute:" DEVICE_OWNER_NETWORK_PREFIX = "network:" DEVICE_OWNER_NEUTRON_PREFIX = "neutron:" DEVICE_OWNER_BAREMETAL_PREFIX = "baremetal:" DEVICE_OWNER_ROUTER_HA_INTF = (DEVICE_OWNER_NETWORK_PREFIX + "router_ha_interface") DEVICE_OWNER_HA_REPLICATED_INT = (DEVICE_OWNER_NETWORK_PREFIX + "ha_router_replicated_interface") DEVICE_OWNER_ROUTER_INTF = DEVICE_OWNER_NETWORK_PREFIX + "router_interface" DEVICE_OWNER_ROUTER_GW = DEVICE_OWNER_NETWORK_PREFIX + "router_gateway" DEVICE_OWNER_FLOATINGIP = DEVICE_OWNER_NETWORK_PREFIX + "floatingip" DEVICE_OWNER_DHCP = DEVICE_OWNER_NETWORK_PREFIX + "dhcp" DEVICE_OWNER_DVR_INTERFACE = (DEVICE_OWNER_NETWORK_PREFIX + "router_interface_distributed") DEVICE_OWNER_AGENT_GW = (DEVICE_OWNER_NETWORK_PREFIX + "floatingip_agent_gateway") DEVICE_OWNER_ROUTER_SNAT = (DEVICE_OWNER_NETWORK_PREFIX + "router_centralized_snat") # TODO(johnsom) Remove after these stop being used. Neutron-LBaaS is now # retired (train) and these should no longer be necessary. DEVICE_OWNER_LOADBALANCER = DEVICE_OWNER_NEUTRON_PREFIX + "LOADBALANCER" DEVICE_OWNER_LOADBALANCERV2 = DEVICE_OWNER_NEUTRON_PREFIX + "LOADBALANCERV2" DEVICE_OWNER_PREFIXES = (DEVICE_OWNER_NETWORK_PREFIX, DEVICE_OWNER_NEUTRON_PREFIX) # Collection used to identify devices owned by router interfaces. # DEVICE_OWNER_ROUTER_HA_INTF is a special case and so is not included. ROUTER_INTERFACE_OWNERS = (DEVICE_OWNER_ROUTER_INTF, DEVICE_OWNER_HA_REPLICATED_INT, DEVICE_OWNER_DVR_INTERFACE) ROUTER_INTERFACE_OWNERS_SNAT = (DEVICE_OWNER_ROUTER_INTF, DEVICE_OWNER_HA_REPLICATED_INT, DEVICE_OWNER_DVR_INTERFACE, DEVICE_OWNER_ROUTER_SNAT) DEVICE_ID_RESERVED_DHCP_PORT = 'reserved_dhcp_port' FLOATINGIP_KEY = '_floatingips' PORT_FORWARDING_FLOATINGIP_KEY = '_pf_floatingips' INTERFACE_KEY = '_interfaces' HA_INTERFACE_KEY = '_ha_interface' IPv4 = 'IPv4' IPv6 = 'IPv6' IP_VERSION_4 = 4 IP_VERSION_6 = 6 IPv4_BITS = 32 IPv6_BITS = 128 INVALID_MAC_ADDRESSES = ['00:00:00:00:00:00', 'FF:FF:FF:FF:FF:FF'] IPv4_ANY = '0.0.0.0/0' IPv6_ANY = '::/0' IP_ANY = {IP_VERSION_4: IPv4_ANY, IP_VERSION_6: IPv6_ANY} IPv6_LLA_PREFIX = 'fe80::/64' DHCP_CLIENT_PORT = 67 DHCP_RESPONSE_PORT = 68 DHCPV6_CLIENT_PORT = 546 DHCPV6_RESPONSE_PORT = 547 FLOODING_ENTRY = ('00:00:00:00:00:00', '0.0.0.0') AGENT_TYPE_DHCP = 'DHCP agent' AGENT_TYPE_OVS = 'Open vSwitch agent' AGENT_TYPE_LINUXBRIDGE = 'Linux bridge agent' AGENT_TYPE_OFA = 'OFA driver agent' AGENT_TYPE_L3 = 'L3 agent' AGENT_TYPE_METERING = 'Metering agent' AGENT_TYPE_METADATA = 'Metadata agent' AGENT_TYPE_NIC_SWITCH = 'NIC Switch agent' AGENT_TYPE_MACVTAP = 'Macvtap agent' L2_AGENT_TOPIC = 'N/A' L3_AGENT_MODE_DVR = 'dvr' L3_AGENT_MODE_DVR_SNAT = 'dvr_snat' L3_AGENT_MODE_LEGACY = 'legacy' L3_AGENT_MODE = 'agent_mode' L3_AGENT_MODE_DVR_NO_EXTERNAL = 'dvr_no_external' DVR_SNAT_BOUND = 'dvr_snat_bound' PORT_BINDING_EXT_ALIAS = 'binding' L3_AGENT_SCHEDULER_EXT_ALIAS = 'l3_agent_scheduler' DHCP_AGENT_SCHEDULER_EXT_ALIAS = 'dhcp_agent_scheduler' L3_DISTRIBUTED_EXT_ALIAS = 'dvr' L3_HA_MODE_EXT_ALIAS = 'l3-ha' SUBNET_ALLOCATION_EXT_ALIAS = 'subnet_allocation' # Protocol names and numbers for Security Groups/Firewalls PROTO_NAME_AH = 'ah' PROTO_NAME_DCCP = 'dccp' PROTO_NAME_EGP = 'egp' PROTO_NAME_ESP = 'esp' PROTO_NAME_GRE = 'gre' PROTO_NAME_HOPOPT = 'hopopt' PROTO_NAME_ICMP = 'icmp' PROTO_NAME_IGMP = 'igmp' PROTO_NAME_IP = 'ip' PROTO_NAME_IPIP = 'ipip' PROTO_NAME_IPV6_ENCAP = 'ipv6-encap' PROTO_NAME_IPV6_FRAG = 'ipv6-frag' PROTO_NAME_IPV6_ICMP = 'ipv6-icmp' # For backward-compatibility of security group rule API, we keep the old value # for IPv6 ICMP. It should be clean up in the future. PROTO_NAME_IPV6_ICMP_LEGACY = 'icmpv6' PROTO_NAME_IPV6_NONXT = 'ipv6-nonxt' PROTO_NAME_IPV6_OPTS = 'ipv6-opts' PROTO_NAME_IPV6_ROUTE = 'ipv6-route' PROTO_NAME_OSPF = 'ospf' PROTO_NAME_PGM = 'pgm' PROTO_NAME_RSVP = 'rsvp' PROTO_NAME_SCTP = 'sctp' PROTO_NAME_TCP = 'tcp' PROTO_NAME_UDP = 'udp' PROTO_NAME_UDPLITE = 'udplite' PROTO_NAME_VRRP = 'vrrp' PROTO_NUM_AH = 51 PROTO_NUM_DCCP = 33 PROTO_NUM_EGP = 8 PROTO_NUM_ESP = 50 PROTO_NUM_GRE = 47 PROTO_NUM_HOPOPT = 0 PROTO_NUM_ICMP = 1 PROTO_NUM_IGMP = 2 PROTO_NUM_IP = 0 PROTO_NUM_IPIP = 4 PROTO_NUM_IPV6_ENCAP = 41 PROTO_NUM_IPV6_FRAG = 44 PROTO_NUM_IPV6_ICMP = 58 PROTO_NUM_IPV6_NONXT = 59 PROTO_NUM_IPV6_OPTS = 60 PROTO_NUM_IPV6_ROUTE = 43 PROTO_NUM_OSPF = 89 PROTO_NUM_PGM = 113 PROTO_NUM_RSVP = 46 PROTO_NUM_SCTP = 132 PROTO_NUM_TCP = 6 PROTO_NUM_UDP = 17 PROTO_NUM_UDPLITE = 136 PROTO_NUM_VRRP = 112 IP_PROTOCOL_MAP = {PROTO_NAME_AH: PROTO_NUM_AH, PROTO_NAME_DCCP: PROTO_NUM_DCCP, PROTO_NAME_EGP: PROTO_NUM_EGP, PROTO_NAME_ESP: PROTO_NUM_ESP, PROTO_NAME_GRE: PROTO_NUM_GRE, PROTO_NAME_HOPOPT: PROTO_NUM_HOPOPT, PROTO_NAME_ICMP: PROTO_NUM_ICMP, PROTO_NAME_IGMP: PROTO_NUM_IGMP, PROTO_NAME_IP: PROTO_NUM_IP, PROTO_NAME_IPIP: PROTO_NUM_IPIP, PROTO_NAME_IPV6_ENCAP: PROTO_NUM_IPV6_ENCAP, PROTO_NAME_IPV6_FRAG: PROTO_NUM_IPV6_FRAG, PROTO_NAME_IPV6_ICMP: PROTO_NUM_IPV6_ICMP, # For backward-compatibility of security group rule API PROTO_NAME_IPV6_ICMP_LEGACY: PROTO_NUM_IPV6_ICMP, PROTO_NAME_IPV6_NONXT: PROTO_NUM_IPV6_NONXT, PROTO_NAME_IPV6_OPTS: PROTO_NUM_IPV6_OPTS, PROTO_NAME_IPV6_ROUTE: PROTO_NUM_IPV6_ROUTE, PROTO_NAME_OSPF: PROTO_NUM_OSPF, PROTO_NAME_PGM: PROTO_NUM_PGM, PROTO_NAME_RSVP: PROTO_NUM_RSVP, PROTO_NAME_SCTP: PROTO_NUM_SCTP, PROTO_NAME_TCP: PROTO_NUM_TCP, PROTO_NAME_UDP: PROTO_NUM_UDP, PROTO_NAME_UDPLITE: PROTO_NUM_UDPLITE, PROTO_NAME_VRRP: PROTO_NUM_VRRP} # Note that this differs from IP_PROTOCOL_MAP because iptables refers to IPv6 # ICMP as 'icmp6' whereas it is 'ipv6-icmp' in IP_PROTOCOL_MAP. IPTABLES_PROTOCOL_MAP = {PROTO_NAME_DCCP: 'dccp', PROTO_NAME_ICMP: 'icmp', PROTO_NAME_IPV6_ICMP: 'icmp6', PROTO_NAME_SCTP: 'sctp', PROTO_NAME_TCP: 'tcp', PROTO_NAME_UDP: 'udp'} # IP header length IP_HEADER_LENGTH = { 4: 20, 6: 40, } # ICMPv6 types: # Destination Unreachable (1) ICMPV6_TYPE_DEST_UNREACH = 1 # Packet Too Big (2) ICMPV6_TYPE_PKT_TOOBIG = 2 # Time Exceeded (3) ICMPV6_TYPE_TIME_EXCEED = 3 # Parameter Problem (4) ICMPV6_TYPE_PARAMPROB = 4 # Echo Request (128) ICMPV6_TYPE_ECHO_REQUEST = 128 # Echo Reply (129) ICMPV6_TYPE_ECHO_REPLY = 129 # Multicast Listener Query (130) ICMPV6_TYPE_MLD_QUERY = 130 # Multicast Listener Report (131) ICMPV6_TYPE_MLD_REPORT = 131 # Multicast Listener Done (132) ICMPV6_TYPE_MLD_DONE = 132 # Router Solicitation (133) ICMPV6_TYPE_RS = 133 # Router Advertisement (134) ICMPV6_TYPE_RA = 134 # Neighbor Solicitation (135) ICMPV6_TYPE_NS = 135 # Neighbor Advertisement (136) ICMPV6_TYPE_NA = 136 # Multicast Listener v2 Report (143) ICMPV6_TYPE_MLD2_REPORT = 143 # List of ICMPv6 types that should be allowed from the unspecified address for # Duplicate Address Detection: ICMPV6_ALLOWED_UNSPEC_ADDR_TYPES = [ICMPV6_TYPE_MLD_REPORT, ICMPV6_TYPE_NS, ICMPV6_TYPE_MLD2_REPORT] # Human-readable ID to which the subnetpool ID should be set to # indicate that IPv6 Prefix Delegation is enabled for a given subnetpool IPV6_PD_POOL_ID = 'prefix_delegation' # Device names start with "tap" TAP_DEVICE_PREFIX = 'tap' # Device names start with "macvtap" MACVTAP_DEVICE_PREFIX = 'macvtap' # Linux interface max length DEVICE_NAME_MAX_LEN = 15 # Time format ISO8601_TIME_FORMAT = '%Y-%m-%dT%H:%M:%S.%f' DHCPV6_STATEFUL = 'dhcpv6-stateful' DHCPV6_STATELESS = 'dhcpv6-stateless' IPV6_SLAAC = 'slaac' IPV6_MODES = [DHCPV6_STATEFUL, DHCPV6_STATELESS, IPV6_SLAAC] ACTIVE_PENDING_STATUSES = ( ACTIVE, PENDING_CREATE, PENDING_UPDATE ) # Network Type constants TYPE_FLAT = 'flat' TYPE_GENEVE = 'geneve' TYPE_GRE = 'gre' TYPE_LOCAL = 'local' TYPE_VXLAN = 'vxlan' TYPE_VLAN = 'vlan' TYPE_NONE = 'none' # List of supported network segment range types NETWORK_SEGMENT_RANGE_TYPES = [TYPE_VLAN, TYPE_VXLAN, TYPE_GRE, TYPE_GENEVE] # Values for network_type # For VLAN Network MIN_VLAN_TAG = 1 MAX_VLAN_TAG = 4094 # For Geneve Tunnel MIN_GENEVE_VNI = 1 MAX_GENEVE_VNI = 2 ** 24 - 1 # For GRE Tunnel MIN_GRE_ID = 1 MAX_GRE_ID = 2 ** 32 - 1 # For VXLAN Tunnel MIN_VXLAN_VNI = 1 MAX_VXLAN_VNI = 2 ** 24 - 1 VXLAN_UDP_PORT = 4789 # Overlay (tunnel) protocol overhead GENEVE_ENCAP_MIN_OVERHEAD = 30 GRE_ENCAP_OVERHEAD = 22 VXLAN_ENCAP_OVERHEAD = 30 # For DNS extension DNS_DOMAIN_DEFAULT = 'openstacklocal.' DNS_LABEL_KEYWORDS = ['project_id', 'project_name', 'user_name', 'user_id'] DNS_LABEL_MAX_LEN = 63 DNS_LABEL_REGEX = "^([a-z0-9-]{1,%d}|%s)$" % ( DNS_LABEL_MAX_LEN, '<' + '>|<'.join(DNS_LABEL_KEYWORDS) + '>') # max value for TCP, UDP, SCTP ports PORT_MAX = 2**16 - 1 VALID_DSCP_MARKS = [0, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 46, 48, 56] INGRESS_DIRECTION = 'ingress' EGRESS_DIRECTION = 'egress' VALID_DIRECTIONS = (INGRESS_DIRECTION, EGRESS_DIRECTION) PROVISIONAL_IPV6_PD_PREFIX = '::/64' # Traffic control TC_QDISC_TYPE_HTB = 'htb' TC_QDISC_TYPE_TBF = 'tbf' TC_QDISC_TYPE_INGRESS = 'ingress' TC_QDISC_TYPES = (TC_QDISC_TYPE_HTB, TC_QDISC_TYPE_TBF, TC_QDISC_TYPE_INGRESS) TC_QDISC_INGRESS_ID = 'ffff:' TC_QDISC_PARENTS = {'root': 0xffffffff, 'ingress': 0xfffffff1} class Sentinel(object): """A constant object that does not change even when copied.""" def __deepcopy__(self, memo): # Always return the same object because this is essentially a constant. return self def __copy__(self): # called via copy.copy(x) return self ############################# # Attribute related constants ############################# ATTR_NOT_SPECIFIED = Sentinel() DICT_POPULATE_DEFAULTS = 'dict_populate_defaults' HEX_ELEM = '[0-9A-Fa-f]' UUID_PATTERN = '-'.join([HEX_ELEM + '{8}', HEX_ELEM + '{4}', HEX_ELEM + '{4}', HEX_ELEM + '{4}', HEX_ELEM + '{12}']) SHARED = 'shared' ########################## # Device related constants ########################## # vhost-user device names start with "vhu" VHOST_USER_DEVICE_PREFIX = 'vhu' # The vswitch side of a veth pair for a nova iptables filter setup VETH_DEVICE_PREFIX = 'qvo' # prefix for SNAT interface in DVR SNAT_INT_DEV_PREFIX = 'sg-' ROUTER_PORT_OWNERS = ROUTER_INTERFACE_OWNERS_SNAT + (DEVICE_OWNER_ROUTER_GW,) ROUTER_STATUS_ACTIVE = 'ACTIVE' ROUTER_STATUS_ALLOCATING = 'ALLOCATING' ROUTER_STATUS_ERROR = 'ERROR' VALID_ROUTER_STATUS = (ROUTER_STATUS_ACTIVE, ROUTER_STATUS_ALLOCATING, ROUTER_STATUS_ERROR) HA_ROUTER_STATE_KEY = '_ha_state' METERING_LABEL_KEY = '_metering_labels' FLOATINGIP_AGENT_INTF_KEY = '_floatingip_agent_interfaces' SNAT_ROUTER_INTF_KEY = '_snat_router_interfaces' HA_NETWORK_NAME = 'HA network tenant %s' HA_SUBNET_NAME = 'HA subnet tenant %s' HA_PORT_NAME = 'HA port tenant %s' HA_ROUTER_STATE_ACTIVE = 'active' HA_ROUTER_STATE_STANDBY = 'standby' HA_ROUTER_STATE_UNKNOWN = 'unknown' VALID_HA_STATES = (HA_ROUTER_STATE_ACTIVE, HA_ROUTER_STATE_STANDBY, HA_ROUTER_STATE_UNKNOWN) PAGINATION_INFINITE = 'infinite' SORT_DIRECTION_ASC = 'asc' SORT_DIRECTION_DESC = 'desc' ETHERTYPE_NAME_ARP = 'arp' ETHERTYPE_ARP = 0x0806 ETHERTYPE_RARP = 0x8035 ETHERTYPE_IP = 0x0800 ETHERTYPE_IPV6 = 0x86DD IP_PROTOCOL_NAME_ALIASES = {PROTO_NAME_IPV6_ICMP_LEGACY: PROTO_NAME_IPV6_ICMP} # We only want one mapping from '58' to 'ipv6-icmp' since that is the # normalized string, the name to number mapping can have both IP_PROTOCOL_NUM_TO_NAME_MAP = ({str(v): k for k, v in IP_PROTOCOL_MAP.items() if k != PROTO_NAME_IPV6_ICMP_LEGACY}) # When using iptables-save we specify '-p {proto}', # but sometimes those values are not identical. This is a map # of known protocol numbers that require a name to be used and # protocol names that require a different name to be used, # because that is how iptables-save will display them. # # This is how the list was created, so there is a possibility # it will need to be updated in the future: # # $ for num in {0..255}; do iptables -A INPUT -p $num; done # $ iptables-save # # These cases are special, and were found by inspection: # - 'ipv6-encap' uses 'ipv6' # - 'icmpv6' uses 'ipv6-icmp' # - 'pgm' uses '113' instead of its name # - protocol '0' uses no -p argument IPTABLES_PROTOCOL_NAME_MAP = {PROTO_NAME_IPV6_ENCAP: 'ipv6', PROTO_NAME_IPV6_ICMP_LEGACY: 'ipv6-icmp', PROTO_NAME_PGM: '113', '0': None, '1': 'icmp', '2': 'igmp', '3': 'ggp', '4': 'ipencap', '5': 'st', '6': 'tcp', '8': 'egp', '9': 'igp', '12': 'pup', '17': 'udp', '20': 'hmp', '22': 'xns-idp', '27': 'rdp', '29': 'iso-tp4', '33': 'dccp', '36': 'xtp', '37': 'ddp', '38': 'idpr-cmtp', '41': 'ipv6', '43': 'ipv6-route', '44': 'ipv6-frag', '45': 'idrp', '46': 'rsvp', '47': 'gre', '50': 'esp', '51': 'ah', '57': 'skip', '58': 'ipv6-icmp', '59': 'ipv6-nonxt', '60': 'ipv6-opts', '73': 'rspf', '81': 'vmtp', '88': 'eigrp', '89': 'ospf', '93': 'ax.25', '94': 'ipip', '97': 'etherip', '98': 'encap', '103': 'pim', '108': 'ipcomp', '112': 'vrrp', '115': 'l2tp', '124': 'isis', '132': 'sctp', '133': 'fc', '135': 'mobility-header', '136': 'udplite', '137': 'mpls-in-ip', '138': 'manet', '139': 'hip', '140': 'shim6', '141': 'wesp', '142': 'rohc'} # A length of a iptables chain name must be less than or equal to 11 # characters. # - ( + '-') = 28-(16+1) = 11 MAX_IPTABLES_CHAIN_LEN_WRAP = 11 MAX_IPTABLES_CHAIN_LEN_NOWRAP = 28 # Timeout in seconds for getting an IPv6 LLA LLA_TASK_TIMEOUT = 40 # length of all device prefixes (e.g. qvo, tap, qvb) LINUX_DEV_PREFIX_LEN = 3 # must be shorter than linux IFNAMSIZ (which is 16) LINUX_DEV_LEN = 14 # Possible prefixes to partial port IDs in interface names used by the OVS, # Linux Bridge, and IVS VIF drivers in Nova and the neutron agents. See the # 'get_ovs_interfaceid' method in Nova (nova/virt/libvirt/vif.py) for details. INTERFACE_PREFIXES = (TAP_DEVICE_PREFIX, VETH_DEVICE_PREFIX, SNAT_INT_DEV_PREFIX) ATTRIBUTES_TO_UPDATE = 'attributes_to_update' # TODO(amuller): Re-define the RPC namespaces once Oslo messaging supports # Targets with multiple namespaces. Neutron will then implement callbacks # for its RPC clients in order to support rolling upgrades. # RPC Interface for agents to call DHCP API implemented on the plugin side RPC_NAMESPACE_DHCP_PLUGIN = None # RPC interface for the metadata service to get info from the plugin side RPC_NAMESPACE_METADATA = None # RPC interface for agent to plugin security group API RPC_NAMESPACE_SECGROUP = None # RPC interface for agent to plugin DVR api RPC_NAMESPACE_DVR = None # RPC interface for reporting state back to the plugin RPC_NAMESPACE_STATE = None # RPC interface for agent to plugin resources API RPC_NAMESPACE_RESOURCES = None # Default network MTU value when not configured DEFAULT_NETWORK_MTU = 1500 IPV6_MIN_MTU = 1280 ROUTER_MARK_MASK = "0xffff" VALID_ETHERTYPES = (IPv4, IPv6) IP_ALLOWED_VERSIONS = [IP_VERSION_4, IP_VERSION_6] PORT_RANGE_MIN = 1 PORT_RANGE_MAX = 65535 ETHERTYPE_MIN = 0 ETHERTYPE_MAX = 65535 DHCPV6_CLIENT_PORT = 546 # Configuration values for accept_ra sysctl, copied from linux kernel # networking (netdev) tree, file Documentation/networking/ip-sysctl.txt # # Possible values are: # 0 Do not accept Router Advertisements. # 1 Accept Router Advertisements if forwarding is disabled. # 2 Overrule forwarding behaviour. Accept Router Advertisements # even if forwarding is enabled. ACCEPT_RA_DISABLED = 0 ACCEPT_RA_WITHOUT_FORWARDING = 1 ACCEPT_RA_WITH_FORWARDING = 2 # Some components communicate using private address ranges, define # them all here. These address ranges should not cause any issues # even if they overlap since they are used in disjoint namespaces, # but for now they are unique. # We define the metadata cidr since it falls in the range. PRIVATE_CIDR_RANGE = '169.254.0.0/16' DVR_FIP_LL_CIDR = '169.254.64.0/18' L3_HA_NET_CIDR = '169.254.192.0/18' METADATA_CIDR = '169.254.169.254/32' # The only defined IpamAllocation status at this stage is 'ALLOCATED'. # More states will be available in the future - e.g.: RECYCLABLE IPAM_ALLOCATION_STATUS_ALLOCATED = 'ALLOCATED' VALID_IPAM_ALLOCATION_STATUSES = (IPAM_ALLOCATION_STATUS_ALLOCATED,) # Port binding states for Live Migration PORT_BINDING_STATUSES = (ACTIVE, INACTIVE) VALID_FLOATINGIP_STATUS = (FLOATINGIP_STATUS_ACTIVE, FLOATINGIP_STATUS_DOWN, FLOATINGIP_STATUS_ERROR) # Floating IP host binding states FLOATING_IP_HOST_UNBOUND = "FLOATING_IP_HOST_UNBOUND" FLOATING_IP_HOST_NEEDS_BINDING = "FLOATING_IP_HOST_NEEDS_BINDING" # Possible types of values (e.g. in QoS rule types) VALUES_TYPE_CHOICES = "choices" VALUES_TYPE_RANGE = "range" # Units base SI_BASE = 1000 IEC_BASE = 1024 # Port bindings handling NO_ACTIVE_BINDING = 'no_active_binding' EXT_PARENT_PREFIX = 'ext_parent' RP_BANDWIDTHS = 'resource_provider_bandwidths' RP_INVENTORY_DEFAULTS = 'resource_provider_inventory_defaults' neutron-lib-2.3.0/neutron_lib/callbacks/0000775000175000017500000000000013641427200020232 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/callbacks/registry.py0000664000175000017500000001122313641427107022461 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import collections import inspect from neutron_lib._i18n import _ from neutron_lib.callbacks import manager from neutron_lib.callbacks import priority_group # TODO(armax): consider adding locking _CALLBACK_MANAGER = None # stores a dictionary keyed on function pointers with a list of # (resource, event) tuples to subscribe to on class initialization _REGISTERED_CLASS_METHODS = collections.defaultdict(list) def _get_callback_manager(): global _CALLBACK_MANAGER if _CALLBACK_MANAGER is None: _CALLBACK_MANAGER = manager.CallbacksManager() return _CALLBACK_MANAGER def subscribe(callback, resource, event, priority=priority_group.PRIORITY_DEFAULT): _get_callback_manager().subscribe(callback, resource, event, priority) def unsubscribe(callback, resource, event): _get_callback_manager().unsubscribe(callback, resource, event) def unsubscribe_by_resource(callback, resource): _get_callback_manager().unsubscribe_by_resource(callback, resource) def unsubscribe_all(callback): _get_callback_manager().unsubscribe_all(callback) # NOTE(boden): This method is deprecated in favor of publish() and will be # removed in Queens, but not deprecation message to reduce log flooding def notify(resource, event, trigger, **kwargs): _get_callback_manager().notify(resource, event, trigger, **kwargs) def publish(resource, event, trigger, payload=None): _get_callback_manager().publish(resource, event, trigger, payload=payload) def clear(): _get_callback_manager().clear() def receives(resource, events, priority=priority_group.PRIORITY_DEFAULT): """Use to decorate methods on classes before initialization. Any classes that use this must themselves be decorated with the @has_registry_receivers decorator to setup the __new__ method to actually register the instance methods after initialization. """ if not isinstance(events, (list, tuple, set)): msg = _("'events' must be a collection (list, tuple, set)") raise AssertionError(msg) def decorator(f): for e in events: _REGISTERED_CLASS_METHODS[f].append((resource, e, priority)) return f return decorator def has_registry_receivers(klass): """Decorator to setup __new__ method in classes to subscribe bound methods. Any method decorated with @receives above is an unbound method on a class. This decorator sets up the class __new__ method to subscribe the bound method in the callback registry after object instantiation. """ orig_new = klass.__new__ new_inherited = '__new__' not in klass.__dict__ @staticmethod def replacement_new(cls, *args, **kwargs): if new_inherited: # class didn't define __new__ so we need to call inherited __new__ super_new = super(klass, cls).__new__ if super_new is object.__new__: # object.__new__ doesn't accept args nor kwargs instance = super_new(cls) else: instance = super_new(cls, *args, **kwargs) else: instance = orig_new(cls, *args, **kwargs) if getattr(instance, '_DECORATED_METHODS_SUBSCRIBED', False): # Avoid running this logic twice for classes inheriting other # classes with this same decorator. Only one needs to execute # to subscribe all decorated methods. return instance for name, unbound_method in inspect.getmembers(cls): if (not inspect.ismethod(unbound_method) and not inspect.isfunction(unbound_method)): continue # handle py27/py34 difference func = getattr(unbound_method, 'im_func', unbound_method) if func not in _REGISTERED_CLASS_METHODS: continue for resource, event, priority in _REGISTERED_CLASS_METHODS[func]: # subscribe the bound method subscribe(getattr(instance, name), resource, event, priority) setattr(instance, '_DECORATED_METHODS_SUBSCRIBED', True) return instance klass.__new__ = replacement_new return klass neutron-lib-2.3.0/neutron_lib/callbacks/resources.py0000664000175000017500000000237313641427107022631 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # String literals representing core resources. AGENT = 'agent' FLOATING_IP = 'floatingip' NETWORK = 'network' NETWORKS = 'networks' PORT = 'port' PORTS = 'ports' PORT_BINDING = 'port_binding' PORT_DEVICE = 'port_device' PROCESS = 'process' RBAC_POLICY = 'rbac-policy' ROUTER = 'router' ROUTER_CONTROLLER = 'router_controller' ROUTER_GATEWAY = 'router_gateway' ROUTER_INTERFACE = 'router_interface' SECURITY_GROUP = 'security_group' SECURITY_GROUP_RULE = 'security_group_rule' SEGMENT = 'segment' SEGMENT_HOST_MAPPING = 'segment_host_mapping' SUBNET = 'subnet' SUBNETS = 'subnets' SUBNETPOOL_ADDRESS_SCOPE = 'subnetpool_address_scope' SUBPORTS = 'subports' TRUNK = 'trunk' TRUNK_PLUGIN = 'trunk_plugin' neutron-lib-2.3.0/neutron_lib/callbacks/events.py0000664000175000017500000001267613641427107022132 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # String literals representing events associated to data store operations BEFORE_CREATE = 'before_create' BEFORE_READ = 'before_read' BEFORE_UPDATE = 'before_update' BEFORE_DELETE = 'before_delete' PRECOMMIT_CREATE = 'precommit_create' PRECOMMIT_UPDATE = 'precommit_update' PRECOMMIT_DELETE = 'precommit_delete' PRECOMMIT_ADD_ASSOCIATION = 'precommit_add_association' PRECOMMIT_DELETE_ASSOCIATIONS = 'precommit_delete_associations' AFTER_CREATE = 'after_create' AFTER_READ = 'after_read' AFTER_UPDATE = 'after_update' AFTER_DELETE = 'after_delete' # String literals representing events associated to API operations BEFORE_RESPONSE = 'before_response' AFTER_REQUEST = 'after_request' # String literals representing events associated to process operations BEFORE_INIT = 'before_init' BEFORE_SPAWN = 'before_spawn' # sent per process AFTER_SPAWN = 'after_spawn' # sent per process AFTER_INIT = 'after_init' # sent per worker # String literals representing events associated to error conditions ABORT_CREATE = 'abort_create' ABORT_READ = 'abort_read' ABORT_UPDATE = 'abort_update' ABORT_DELETE = 'abort_delete' ABORT = 'abort_' BEFORE = 'before_' PRECOMMIT = 'precommit_' OVS_RESTARTED = 'ovs_restarted' class EventPayload(object): """Base event payload object. This class is intended to be the super class for all event payloads. As such, it defines common attributes many events are likely to use in their payload. Note that event attributes are passed by reference; no copying of states, metadata or request_body is performed and thus consumers should not modify payload references. For more information, see the callbacks dev-ref documentation for this project. """ def __init__(self, context, metadata=None, request_body=None, states=None, resource_id=None): # the event context self.context = context # NOTE(boden): longer term we should consider removing metadata # optional 'unstructured' (key,value) pairs for special needs self.metadata = metadata if metadata else {} # the request body associated to the resource self.request_body = request_body # an iterable of states for the resource from the newest to the oldest # for example db states or api request/response # the actual object type for states will vary depending on event caller self.states = states if states else [] # a unique ID for the event resource; may be None if the resource # isn't created yet self.resource_id = resource_id @property def has_states(self): """Determines if this event payload has any states. :returns: True if this event payload has states, otherwise False. """ return len(self.states) > 0 @property def latest_state(self): """Returns the latest state for the event payload. :returns: The last state of this event payload if has_state else None. """ return self.states[-1] if self.has_states else None class DBEventPayload(EventPayload): """The payload for data store events payloads.""" def __init__(self, context, metadata=None, request_body=None, states=None, resource_id=None, desired_state=None): super(DBEventPayload, self).__init__( context, metadata=metadata, request_body=request_body, states=states, resource_id=resource_id) # the model object to be persisted in pre create/commit payloads self.desired_state = desired_state @property def is_persisted(self): """Determine if the resource for this event payload is persisted. :returns: True if this payload's resource is persisted, otherwise False. """ return self.resource_id is not None and self.has_states @property def is_to_be_committed(self): """"Determine if the event payload resource is to be committed. :returns: True if the desired state has been populated, else False. """ return self.desired_state is not None @property def latest_state(self): """Returns the latest state for the event payload resource. :returns: If this payload has a desired_state its returned, otherwise latest_state is returned. """ return (self.desired_state or super(DBEventPayload, self).latest_state) class APIEventPayload(EventPayload): """The payload for API events.""" def __init__(self, context, method_name, action, metadata=None, request_body=None, states=None, resource_id=None, collection_name=None): super(APIEventPayload, self).__init__( context, metadata=metadata, request_body=request_body, states=states, resource_id=resource_id) self.method_name = method_name self.action = action self.collection_name = collection_name neutron-lib-2.3.0/neutron_lib/callbacks/priority_group.py0000664000175000017500000000266213641427107023715 0ustar zuulzuul00000000000000# Copyright (c) 2018 Intel Corporation. # Copyright (c) 2018 Isaku Yamahata # # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # NOTE(yamahata):smallest one is called first. # we are using a big enough number for default that can # be manipulated to increase or decrease the priorities. # for all the callbacks, to reduce the priority division # can be used for reducing that number for higher priority. # each resources would want to define their own symbolic values for their use. PRIORITY_DEFAULT = 55550000 # For l3 plugin and flavor PRIORITY_ROUTER_EXTENDED_ATTRIBUTE = PRIORITY_DEFAULT - 100 # DEFAULT is reserved for third party which may not know priority yet PRIORITY_ROUTER_DEFAULT = PRIORITY_DEFAULT PRIORITY_ROUTER_CONTROLLER = PRIORITY_DEFAULT + 100 PRIORITY_ROUTER_DRIVER = PRIORITY_DEFAULT + 200 neutron-lib-2.3.0/neutron_lib/callbacks/manager.py0000664000175000017500000002264313641427107022233 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import collections import itertools from oslo_log import log as logging from oslo_utils import reflection from neutron_lib.callbacks import events from neutron_lib.callbacks import exceptions from neutron_lib.callbacks import priority_group from neutron_lib.db import utils as db_utils LOG = logging.getLogger(__name__) class CallbacksManager(object): """A callback system that allows objects to cooperate in a loose manner.""" def __init__(self): self.clear() def subscribe(self, callback, resource, event, priority=priority_group.PRIORITY_DEFAULT): """Subscribe callback for a resource event. The same callback may register for more than one event. :param callback: the callback. It must raise or return a boolean. :param resource: the resource. It must be a valid resource. :param event: the event. It must be a valid event. :param priority: the priority. Callbacks are sorted by priority to be called. Smaller one is called earlier. """ LOG.debug("Subscribe: %(callback)s %(resource)s %(event)s " "%(priority)d", {'callback': callback, 'resource': resource, 'event': event, 'priority': priority}) callback_id = _get_id(callback) callbacks_list = self._callbacks[resource].setdefault(event, []) for pc_pair in callbacks_list: if pc_pair[0] == priority: pri_callbacks = pc_pair[1] break else: pri_callbacks = {} callbacks_list.append((priority, pri_callbacks)) callbacks_list.sort(key=lambda x: x[0]) pri_callbacks[callback_id] = callback # We keep a copy of callbacks to speed the unsubscribe operation. if callback_id not in self._index: self._index[callback_id] = collections.defaultdict(set) self._index[callback_id][resource].add(event) def _del_callback(self, callbacks_list, callback_id): for pc_pair in callbacks_list: pri_callbacks = pc_pair[1] if callback_id in pri_callbacks: del pri_callbacks[callback_id] if not pri_callbacks: callbacks_list.remove(pc_pair) break def unsubscribe(self, callback, resource, event): """Unsubscribe callback from the registry. :param callback: the callback. :param resource: the resource. :param event: the event. """ LOG.debug("Unsubscribe: %(callback)s %(resource)s %(event)s", {'callback': callback, 'resource': resource, 'event': event}) callback_id = self._find(callback) if not callback_id: LOG.debug("Callback %s not found", callback_id) return if resource and event: self._del_callback(self._callbacks[resource][event], callback_id) self._index[callback_id][resource].discard(event) if not self._index[callback_id][resource]: del self._index[callback_id][resource] if not self._index[callback_id]: del self._index[callback_id] else: value = '%s,%s' % (resource, event) raise exceptions.Invalid(element='resource,event', value=value) def unsubscribe_by_resource(self, callback, resource): """Unsubscribe callback for any event associated to the resource. :param callback: the callback. :param resource: the resource. """ callback_id = self._find(callback) if callback_id: if resource in self._index[callback_id]: for event in self._index[callback_id][resource]: self._del_callback(self._callbacks[resource][event], callback_id) del self._index[callback_id][resource] if not self._index[callback_id]: del self._index[callback_id] def unsubscribe_all(self, callback): """Unsubscribe callback for all events and all resources. :param callback: the callback. """ callback_id = self._find(callback) if callback_id: for resource, resource_events in self._index[callback_id].items(): for event in resource_events: self._del_callback(self._callbacks[resource][event], callback_id) del self._index[callback_id] def publish(self, resource, event, trigger, payload=None): """Notify all subscribed callback(s) with a payload. Dispatch the resource's event to the subscribed callbacks. :param resource: The resource for the event. :param event: The event. :param trigger: The trigger. A reference to the sender of the event. :param payload: The optional event object to send to subscribers. If passed this must be an instance of BaseEvent. :raises neutron_lib.callbacks.exceptions.Invalid: if the payload object is not an instance of BaseEvent. :raises CallbackFailure: if the underlying callback has errors. """ if payload: if not isinstance(payload, events.EventPayload): raise exceptions.Invalid(element='event payload', value=type(payload)) return self.notify(resource, event, trigger, payload=payload) # NOTE(boden): We plan to deprecate the usage of this method and **kwargs # as the payload in Queens, but no warning here to avoid log flooding @db_utils.reraise_as_retryrequest def notify(self, resource, event, trigger, **kwargs): """Notify all subscribed callback(s). Dispatch the resource's event to the subscribed callbacks. :param resource: The resource for the event. :param event: The event. :param trigger: The trigger. A reference to the sender of the event. :param kwargs: (deprecated) Unstructured key/value pairs to invoke the callback with. Using event objects with publish() is preferred. :raises CallbackFailure: CallbackFailure is raised if the underlying callback has errors. """ errors = self._notify_loop(resource, event, trigger, **kwargs) if errors: if event.startswith(events.BEFORE): abort_event = event.replace( events.BEFORE, events.ABORT) self._notify_loop(resource, abort_event, trigger, **kwargs) raise exceptions.CallbackFailure(errors=errors) if event.startswith(events.PRECOMMIT): raise exceptions.CallbackFailure(errors=errors) def clear(self): """Brings the manager to a clean slate.""" self._callbacks = collections.defaultdict(dict) self._index = collections.defaultdict(dict) def _notify_loop(self, resource, event, trigger, **kwargs): """The notification loop.""" errors = [] # NOTE(yamahata): Since callback may unsubscribe it, # convert iterator to list to avoid runtime error. callbacks = list(itertools.chain( *[pri_callbacks.items() for (priority, pri_callbacks) in self._callbacks[resource].get(event, [])])) LOG.debug("Notify callbacks %s for %s, %s", [c[0] for c in callbacks], resource, event) # TODO(armax): consider using a GreenPile for callback_id, callback in callbacks: try: callback(resource, event, trigger, **kwargs) except Exception as e: abortable_event = ( event.startswith(events.BEFORE) or event.startswith(events.PRECOMMIT) ) if not abortable_event: LOG.exception("Error during notification for " "%(callback)s %(resource)s, %(event)s", {'callback': callback_id, 'resource': resource, 'event': event}) else: LOG.debug("Callback %(callback)s raised %(error)s", {'callback': callback_id, 'error': e}) errors.append(exceptions.NotificationError(callback_id, e)) return errors def _find(self, callback): """Return the callback_id if found, None otherwise.""" callback_id = _get_id(callback) return callback_id if callback_id in self._index else None def _get_id(callback): """Return a unique identifier for the callback.""" # TODO(armax): consider using something other than names # https://www.python.org/dev/peps/pep-3155/, but this # might be okay for now. parts = (reflection.get_callable_name(callback), str(hash(callback))) return '-'.join(parts) neutron-lib-2.3.0/neutron_lib/callbacks/__init__.py0000664000175000017500000000000013641427107022337 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/callbacks/exceptions.py0000664000175000017500000000370313641427107022776 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class Invalid(exceptions.NeutronException): message = _("The value '%(value)s' for %(element)s is not valid.") class CallbackFailure(exceptions.MultipleExceptions): def __init__(self, errors): self.errors = errors def __str__(self): if isinstance(self.errors, list): return ','.join(str(error) for error in self.errors) else: return str(self.errors) @property def inner_exceptions(self): """The list of unpacked errors for this exception. :return: A list of unpacked errors for this exception. An unpacked error is the Exception's 'error' attribute if it inherits from NotificationError, otherwise it's the exception itself. """ if isinstance(self.errors, list): return [self._unpack_if_notification_error(e) for e in self.errors] return [self._unpack_if_notification_error(self.errors)] @staticmethod def _unpack_if_notification_error(exc): if isinstance(exc, NotificationError): return exc.error return exc class NotificationError(object): def __init__(self, callback_id, error): self.callback_id = callback_id self.error = error def __str__(self): return 'Callback %s failed with "%s"' % (self.callback_id, self.error) neutron-lib-2.3.0/neutron_lib/_i18n.py0000664000175000017500000000171313641427107017613 0ustar zuulzuul00000000000000# All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # # INTERNAL INTERFACE: PLEASE NOTE THE LEADING _ ON THIS FILE. THIS IS # NOT A LIBRARY INTERFACE. IF YOU WISH TO USE OSLO_I18N, please refer # to https://docs.openstack.org/oslo.i18n/latest/user/usage.html import oslo_i18n _translators = oslo_i18n.TranslatorFactory(domain='neutron_lib') # The translation function using the well-known name "_" _ = _translators.primary neutron-lib-2.3.0/neutron_lib/services/0000775000175000017500000000000013641427200020136 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/services/qos/0000775000175000017500000000000013641427200020740 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/services/qos/constants.py0000664000175000017500000000365413641427107023344 0ustar zuulzuul00000000000000# Copyright (c) 2015 Red Hat Inc. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. RULE_TYPE_BANDWIDTH_LIMIT = 'bandwidth_limit' RULE_TYPE_DSCP_MARKING = 'dscp_marking' RULE_TYPE_MINIMUM_BANDWIDTH = 'minimum_bandwidth' VALID_RULE_TYPES = [RULE_TYPE_BANDWIDTH_LIMIT, RULE_TYPE_DSCP_MARKING, RULE_TYPE_MINIMUM_BANDWIDTH, ] # Names of rules' attributes MAX_KBPS = "max_kbps" MAX_BURST = "max_burst_kbps" MIN_KBPS = "min_kbps" DIRECTION = "direction" DSCP_MARK = "dscp_mark" QOS_POLICY_ID = 'qos_policy_id' QOS_NETWORK_POLICY_ID = 'qos_network_policy_id' QOS_PLUGIN = 'qos_plugin' # NOTE(slaweq): Value used to calculate burst value for egress bandwidth limit # if burst is not given by user. In such case burst value will be calculated # as 80% of bw_limit to ensure that at least limits for TCP traffic will work # fine. DEFAULT_BURST_RATE = 0.8 # Method names for QoSDriver PRECOMMIT_POSTFIX = '_precommit' CREATE_POLICY = 'create_policy' CREATE_POLICY_PRECOMMIT = CREATE_POLICY + PRECOMMIT_POSTFIX UPDATE_POLICY = 'update_policy' UPDATE_POLICY_PRECOMMIT = UPDATE_POLICY + PRECOMMIT_POSTFIX DELETE_POLICY = 'delete_policy' DELETE_POLICY_PRECOMMIT = DELETE_POLICY + PRECOMMIT_POSTFIX QOS_CALL_METHODS = ( CREATE_POLICY, CREATE_POLICY_PRECOMMIT, UPDATE_POLICY, UPDATE_POLICY_PRECOMMIT, DELETE_POLICY, DELETE_POLICY_PRECOMMIT, ) neutron-lib-2.3.0/neutron_lib/services/qos/base.py0000664000175000017500000001521713641427107022240 0ustar zuulzuul00000000000000# Copyright 2016 Hewlett Packard Enterprise Development Company, LP # Copyright 2016 Red Hat Inc. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from oslo_log import log as logging from neutron_lib.api import validators as lib_validators from neutron_lib.callbacks import events from neutron_lib.callbacks import registry from neutron_lib.services.qos import constants LOG = logging.getLogger(__name__) @registry.has_registry_receivers class DriverBase(object): def __init__(self, name, vif_types, vnic_types, supported_rules, requires_rpc_notifications=False): """Instantiate a qos driver. :param name: driver name. :param vif_types: list of interfaces (VIFs) supported. :param vnic_types: list of vnic types supported. :param supported_rules: dict of supported rules. :param requires_rpc_notifications: indicates if this driver expects rpc push notifications to be sent from the driver. """ self.name = name self.vif_types = vif_types self.vnic_types = vnic_types self.supported_rules = supported_rules self.requires_rpc_notifications = requires_rpc_notifications @registry.receives(constants.QOS_PLUGIN, [events.AFTER_INIT]) def _register(self, resource, event, trigger, **kwargs): if self.is_loaded: # trigger is the QosServiceDriverManager trigger.register_driver(self) def is_loaded(self): """True if the driver is active for the Neutron Server. Implement this property to determine if your driver is actively configured for this Neutron Server deployment. """ return True def is_vif_type_compatible(self, vif_type): """True if the driver is compatible with the VIF type.""" return vif_type in self.vif_types def is_vnic_compatible(self, vnic_type): """True if the driver is compatible with the specific VNIC type.""" return vnic_type in self.vnic_types def is_rule_supported(self, rule): supported_parameters = self.supported_rules.get(rule.rule_type) if not supported_parameters: LOG.debug("Rule type %(rule_type)s is not supported by " "%(driver_name)s", {'rule_type': rule.rule_type, 'driver_name': self.name}) return False for parameter, validators in supported_parameters.items(): parameter_value = rule.get(parameter) for validator_type, validator_data in validators.items(): validator_function = lib_validators.get_validator( validator_type) validate_result = validator_function(parameter_value, validator_data) # NOTE(slaweq): validator functions returns None if data is # valid or string with reason why data is not valid if validate_result: LOG.debug("Parameter %(parameter)s=%(value)s in " "rule type %(rule_type)s is not " "supported by %(driver_name)s. " "Validate result: %(validate_result)s", {'parameter': parameter, 'value': parameter_value, 'rule_type': rule.rule_type, 'driver_name': self.name, 'validate_result': validate_result}) return False return True def validate_rule_for_port(self, context, rule, port): """Return True/False for valid/invalid. This is only meant to be used when a rule is compatible with some ports/networks but not with others (depending on port/network properties). Returns True by default for backwards compatibility. """ return True def create_policy(self, context, policy): """Create policy invocation. This method can be implemented by the specific driver subclass to update the backend where necessary with the specific policy information. :param context: current running context information :param policy: a QoSPolicy object being created, which will have no rules. """ def create_policy_precommit(self, context, policy): """Create policy precommit. This method can be implemented by the specific driver subclass to handle the precommit event of a policy that is being created. :param context: current running context information :param policy: a QoSPolicy object being created, which will have no rules. """ def update_policy(self, context, policy): """Update policy invocation. This method can be implemented by the specific driver subclass to update the backend where necessary. :param context: current running context information :param policy: a QoSPolicy object being updated. """ def update_policy_precommit(self, context, policy): """Update policy precommit. This method can be implemented by the specific driver subclass to handle update precommit event of a policy that is being updated. :param context: current running context information :param policy: a QoSPolicy object being updated. """ def delete_policy(self, context, policy): """Delete policy invocation. This method can be implemented by the specific driver subclass to delete the backend policy where necessary. :param context: current running context information :param policy: a QoSPolicy object being deleted """ def delete_policy_precommit(self, context, policy): """Delete policy precommit. This method can be implemented by the specific driver subclass to handle delete precommit event of a policy that is being deleted. :param context: current running context information :param policy: a QoSPolicy object being deleted """ neutron-lib-2.3.0/neutron_lib/services/qos/__init__.py0000664000175000017500000000000013641427107023045 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/services/constants.py0000664000175000017500000000246413641427107022540 0ustar zuulzuul00000000000000# All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import l3 from neutron_lib.plugins import constants as plugin_const # Registered extension parent resource check mapping # If we want to register some service plugin resources into policy and check # the owner when operating their subresources. We can write here to use # existing policy engine for parent resource owner check. # Each entry here should be PARENT_RESOURCE_NAME: SERVICE_PLUGIN_NAME, # PARENT_RESOURCE_NAME is usually from api definition. # SERVICE_PLUGIN_NAME is the service plugin which introduced the resource and # registered the service plugin name in neutron-lib. EXT_PARENT_RESOURCE_MAPPING = { l3.FLOATINGIP: plugin_const.L3, l3.ROUTER: plugin_const.CONNTRACKHELPER } neutron-lib-2.3.0/neutron_lib/services/logapi/0000775000175000017500000000000013641427200021411 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/services/logapi/constants.py0000664000175000017500000000325313641427107024010 0ustar zuulzuul00000000000000# Copyright 2017 Fujitsu Limited. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. ACCEPT_EVENT = 'ACCEPT' DROP_EVENT = 'DROP' ALL_EVENT = 'ALL' LOG_EVENTS = [ACCEPT_EVENT, DROP_EVENT, ALL_EVENT] LOGGING_PLUGIN = 'logging-plugin' # supported logging types SECURITY_GROUP = 'security_group' SNAT = 'snat' # target resource types PORT = 'port' RPC_NAMESPACE_LOGGING = 'logging-plugin' # Define for rpc_method_key LOG_RESOURCE = 'log_resource' # String literal for identifying log resource LOGGING = 'log' # Method names for Logging Driver PRECOMMIT_POSTFIX = '_precommit' CREATE_LOG = 'create_log' CREATE_LOG_PRECOMMIT = CREATE_LOG + PRECOMMIT_POSTFIX UPDATE_LOG = 'update_log' UPDATE_LOG_PRECOMMIT = UPDATE_LOG + PRECOMMIT_POSTFIX DELETE_LOG = 'delete_log' DELETE_LOG_PRECOMMIT = DELETE_LOG + PRECOMMIT_POSTFIX # Tell to agent when resources related log_objects update RESOURCE_UPDATE = 'resource_update' LOG_CALL_METHODS = ( CREATE_LOG, CREATE_LOG_PRECOMMIT, UPDATE_LOG, UPDATE_LOG_PRECOMMIT, DELETE_LOG, DELETE_LOG_PRECOMMIT, RESOURCE_UPDATE ) DIRECTION_IP_PREFIX = {'ingress': 'source_ip_prefix', 'egress': 'dest_ip_prefix'} neutron-lib-2.3.0/neutron_lib/services/logapi/__init__.py0000664000175000017500000000000013641427107023516 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/services/trunk/0000775000175000017500000000000013641427200021301 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/services/trunk/constants.py0000664000175000017500000000753513641427107023707 0ustar zuulzuul00000000000000# All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # Valid trunk statuses # The trunk is happy, yay! # A trunk remains in ACTIVE state when updates like name or admin_status_up # occur. It goes back to ACTIVE state from other states (e.g. BUILD) when # logical and physical resource provisioning has completed successfully. The # attribute ADMIN_STATE_UP is not to be confused with STATUS: the former # indicates whether a trunk can be managed. If a trunk has admin_state_up # equal to false, the trunk plugin will reject any user request to manage # the trunk resources (i.e. adding/removing sub-ports). ACTIVE_STATUS # reflects the provisioning state of logical and physical resources associated # with the trunk. TRUNK_ACTIVE_STATUS = 'ACTIVE' # A trunk is in DOWN state any time the logical and physical resources # associated to a trunk are not in sync. This can happen in the following # cases: # a) A user has asked to create a trunk, or add(remove) subports to a # trunk in ACTIVE state. In this case, the plugin has created/updated the # logical resource, and the request has been passed along to a backend. The # physical resources associated to the trunk are in the process of being # (de)commissioned. While this happens, the logical and physical state are # mismatching, albeit temporarily during subport operations, or until a user # spawns a VM after a trunk creation. # b) A system event, such as instance deletion, has led to the deprovisioning # of the entire set of physical resources associated to the trunk. In this # case, the logical resource exists but it has no physical resources # associated with it, and the logical and physical state of the trunk are # not matching. TRUNK_DOWN_STATUS = 'DOWN' # A driver/backend has acknowledged the server request: once the server # notifies the driver/backend, a trunk is in BUILD state while the # backend provisions the trunk resources. TRUNK_BUILD_STATUS = 'BUILD' # Should any temporary system failure occur during the provisioning process, # a trunk is in DEGRADED state. This means that the trunk was only # partially provisioned, and only a subset of the subports were added # successfully to the trunk. The operation of removing/adding the faulty # subports may be attempted as a recovery measure. TRUNK_DEGRADED_STATUS = 'DEGRADED' # Due to unforeseen circumstances, the user request has led to a conflict, and # the trunk cannot be provisioned correctly for a subset of subports. For # instance, a subport belonging to a network might not be compatible with # the current trunk configuration, or the binding process leads to a persistent # failure. Removing the 'offending' resource may be attempted as a recovery # measure, but readding it to the trunk should lead to the same error # condition. A trunk in ERROR status should be brought back to a sane status # (i.e. any state except ERROR state) before attempting to add more subports, # therefore requests of adding more subports must be rejected to avoid # cascading errors. TRUNK_ERROR_STATUS = 'ERROR' # String literals for identifying trunk resources # also see SUBPORTS, TRUNK and TRUNK_PLUGIN in neutron_lib.callbacks.resources TRUNK_PARENT_PORT = 'parent_port' TRUNK_SUBPORT_OWNER = 'trunk:subport' # String literals for segmentation types SEGMENTATION_TYPE_VLAN = 'vlan' SEGMENTATION_TYPE_INHERIT = 'inherit' neutron-lib-2.3.0/neutron_lib/services/trunk/__init__.py0000664000175000017500000000000013641427107023406 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/services/base.py0000664000175000017500000000507513641427107021437 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import abc class WorkerBase(object): @property def _workers(self): try: return self.__workers except AttributeError: self.__workers = [] return self.__workers def get_workers(self): """Returns a collection NeutronWorker instances needed by this service. """ return list(self._workers) def add_worker(self, worker): """Adds NeutronWorker needed for this service If a object needs to define workers thread/processes outside of API/RPC workers then it will call this method to register worker. Should be called on initialization stage before running services """ self._workers.append(worker) def add_workers(self, workers): """Adds NeutronWorker list needed for this service The same as add_worker but adds a list of workers """ self._workers.extend(workers) class ServicePluginBase(WorkerBase, metaclass=abc.ABCMeta): """Define base interface for any Advanced Service plugin.""" supported_extension_aliases = [] @classmethod def __subclasshook__(cls, klass): """Checking plugin class. The __subclasshook__ method is a class method that will be called every time a class is tested using issubclass(klass, ServicePluginBase). In that case, it will check that every method marked with the abstractmethod decorator is provided by the plugin class. """ if not cls.__abstractmethods__: return NotImplemented for method in cls.__abstractmethods__: if any(method in base.__dict__ for base in klass.__mro__): continue return NotImplemented return True @abc.abstractmethod def get_plugin_type(self): """Return one of predefined service types. """ pass @abc.abstractmethod def get_plugin_description(self): """Return string description of the plugin.""" pass neutron-lib-2.3.0/neutron_lib/services/__init__.py0000664000175000017500000000000013641427107022243 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/agent/0000775000175000017500000000000013641427200017411 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/agent/constants.py0000664000175000017500000000235713641427107022014 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. ################################### # Agent extension related constants ################################### # Extension driver type for Open vSwitch mech driver OVS_EXTENSION_DRIVER = 'ovs' # Extension driver type for Linux Bridge mech driver LB_EXTENSION_DRIVER = 'linuxbridge' # Extension driver type for macvtap mech driver MACVTAP_EXTENSION_DRIVER = 'macvtap' # Extension driver type for SR-IOV mech driver SRIOV_EXTENSION_DRIVER = 'sriov' # Agent states as detected by server, used to reply on agent's state report # agent has just been registered AGENT_NEW = 'new' # agent is alive AGENT_ALIVE = 'alive' # agent has just returned to alive after being dead AGENT_REVIVED = 'revived' neutron-lib-2.3.0/neutron_lib/agent/topics.py0000664000175000017500000000433213641427107021274 0ustar zuulzuul00000000000000# Copyright (c) 2012 OpenStack Foundation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from neutron_lib.api.definitions import network from neutron_lib.api.definitions import port from neutron_lib.api.definitions import portbindings_extended from neutron_lib.api.definitions import subnet NETWORK = network.RESOURCE_NAME SUBNET = subnet.RESOURCE_NAME PORT = port.RESOURCE_NAME PORT_BINDING = portbindings_extended.RESOURCE_NAME SECURITY_GROUP = 'security_group' L2POPULATION = 'l2population' DVR = 'dvr' RESOURCES = 'resources' CREATE = 'create' DELETE = 'delete' UPDATE = 'update' ACTIVATE = 'activate' DEACTIVATE = 'deactivate' AGENT = 'q-agent-notifier' PLUGIN = 'q-plugin' SERVER_RESOURCE_VERSIONS = 'q-server-resource-versions' L3PLUGIN = 'q-l3-plugin' REPORTS = 'q-reports-plugin' DHCP = 'q-dhcp-notifer' METERING_PLUGIN = 'q-metering-plugin' L3_AGENT = 'l3_agent' DHCP_AGENT = 'dhcp_agent' METERING_AGENT = 'metering_agent' RESOURCE_TOPIC_PATTERN = "neutron-vo-%(resource_type)s-%(version)s" def get_topic_name(prefix, table, operation, host=None): """Create a topic name. The topic name needs to be synced between the agent and the plugin. The plugin will send a fanout message to all of the listening agents so that the agents in turn can perform their updates accordingly. :param prefix: Common prefix for the plugin/agent message queues. :param table: The table in question (NETWORK, SUBNET, PORT). :param operation: The operation that invokes notification (CREATE, DELETE, UPDATE) :param host: Add host to the topic :returns: The topic name. """ if host: return '%s-%s-%s.%s' % (prefix, table, operation, host) return '%s-%s-%s' % (prefix, table, operation) neutron-lib-2.3.0/neutron_lib/agent/l2_extension.py0000664000175000017500000000343313641427107022405 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import abc from neutron_lib.agent import extension class L2AgentExtension(extension.AgentExtension, metaclass=abc.ABCMeta): """Define stable abstract interface for l2 agent extensions. An agent extension extends the agent core functionality. """ def initialize(self, connection, driver_type): """Initialize agent extension. :param connection: RPC connection that can be reused by the extension to define its RPC endpoints :param driver_type: String that defines the agent type to the extension. Can be used to choose the right backend implementation. """ @abc.abstractmethod def handle_port(self, context, data): """Handle a port add/update event. This can be called on either create or update, depending on the code flow. Thus, it's this function's responsibility to check what actually changed. :param context: RPC context. :param data: Port data. """ @abc.abstractmethod def delete_port(self, context, data): """Handle a port delete event. :param context: RPC context. :param data: Port data. """ neutron-lib-2.3.0/neutron_lib/agent/extension.py0000664000175000017500000000342113641427107022005 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import abc class AgentExtension(object, metaclass=abc.ABCMeta): """Define stable abstract interface for agent extensions. An agent extension extends the agent core functionality. """ @abc.abstractmethod def initialize(self, connection, driver_type): """Perform agent core resource extension initialization. :param connection: RPC connection that can be reused by the extension to define its RPC endpoints :param driver_type: String that defines the agent type to the extension. Can be used to choose the right backend implementation. Called after all extensions have been loaded. No resource (port, policy, router, etc.) handling will be called before this method. """ def consume_api(self, agent_api): """Consume the AgentAPI instance from the AgentExtensionsManager. Allows an extension to gain access to resources internal to the neutron agent and otherwise unavailable to the extension. Examples of such resources include bridges, ports, and routers. :param agent_api: An instance of an agent-specific API. """ neutron-lib-2.3.0/neutron_lib/agent/__init__.py0000664000175000017500000000000013641427107021516 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/agent/l3_extension.py0000664000175000017500000000332413641427107022405 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import abc from neutron_lib.agent import extension class L3AgentExtension(extension.AgentExtension, metaclass=abc.ABCMeta): """Define stable abstract interface for l3 agent extensions. An agent extension extends the agent core functionality. """ @abc.abstractmethod def add_router(self, context, data): """Handle a router add event. Called on router create. :param context: RPC context. :param data: Router data. """ @abc.abstractmethod def update_router(self, context, data): """Handle a router update event. Called on router update. :param context: RPC context. :param data: Router data. """ @abc.abstractmethod def delete_router(self, context, data): """Handle a router delete event. :param context: RPC context. :param data: Router data. """ @abc.abstractmethod def ha_state_change(self, context, data): """Change router state from agent extension. Called on HA router state change. :param context: rpc context :param data: dict of router_id and new state """ neutron-lib-2.3.0/neutron_lib/hacking/0000775000175000017500000000000013641427200017717 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/hacking/translation_checks.py0000664000175000017500000000677113641427107024170 0ustar zuulzuul00000000000000# Copyright (c) 2014 OpenStack Foundation. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import re from hacking import core _all_log_levels = {'critical', 'error', 'exception', 'info', 'warning', 'debug'} _all_hints = {'_LC', '_LE', '_LI', '_', '_LW'} _log_warn = re.compile( r"(.)*LOG\.(warn)\(\s*('|\")") _log_translation_hint = re.compile( r".*LOG\.(%(levels)s)\(\s*(%(hints)s)\(" % { 'levels': '|'.join(_all_log_levels), 'hints': '|'.join(_all_hints), }) def _translation_checks_not_enforced(filename): # Do not do these validations on tests return any(pat in filename for pat in ["/tests/", "rally-jobs/plugins/"]) @core.flake8ext def check_log_warn_deprecated(logical_line, filename): """N532 - Use LOG.warning due to compatibility with py3. :param logical_line: The logical line to check. :param filename: The file name where the logical line exists. :returns: None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure. """ msg = "N532: Use LOG.warning due to compatibility with py3" if _log_warn.match(logical_line): yield (0, msg) @core.flake8ext def check_raised_localized_exceptions(logical_line, filename): """N534 - Untranslated exception message. :param logical_line: The logical line to check. :param filename: The file name where the logical line exists. :returns: None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure. """ if _translation_checks_not_enforced(filename): return logical_line = logical_line.strip() raised_search = re.compile( r"raise (?:\w*)\((.*)\)").match(logical_line) if raised_search: exception_msg = raised_search.groups()[0] if exception_msg.startswith("\"") or exception_msg.startswith("\'"): msg = "N534: Untranslated exception message." yield (logical_line.index(exception_msg), msg) @core.flake8ext def no_translate_logs(logical_line, filename): """N537 - Don't translate logs. Check for 'LOG.*(_(' and 'LOG.*(_Lx(' Translators don't provide translations for log messages, and operators asked not to translate them. * This check assumes that 'LOG' is a logger. :param logical_line: The logical line to check. :param filename: The file name where the logical line exists. :returns: None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure. """ if _translation_checks_not_enforced(filename): return msg = "N537: Log messages should not be translated!" match = _log_translation_hint.match(logical_line) if match: yield (logical_line.index(match.group()), msg) neutron-lib-2.3.0/neutron_lib/hacking/checks.py0000664000175000017500000001774013641427107021550 0ustar zuulzuul00000000000000# Copyright (c) 2014 OpenStack Foundation. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import re from hacking import core from neutron_lib.hacking import translation_checks # Guidelines for writing new hacking checks # # - Use only for Neutron specific tests. OpenStack general tests # should be submitted to the common 'hacking' module. # - Pick numbers in the range N5xx. Find the current test with # the highest allocated number and then pick the next value. # - Keep the test method code in the source file ordered based # on the N5xx value. # - List the new rule in the top level HACKING.rst file # - Add test cases for each new rule to # neutron_lib/tests/unit/hacking/test_checks.py mutable_default_args = re.compile(r"^\s*def .+\((.+=\{\}|.+=\[\])") namespace_imports_dot = re.compile(r"import[\s]+([\w]+)[.][^\s]+") namespace_imports_from_dot = re.compile(r"from[\s]+([\w]+)[.]") namespace_imports_from_root = re.compile(r"from[\s]+([\w]+)[\s]+import[\s]+") contextlib_nested = re.compile(r"^\s*with (contextlib\.)?nested\(") assert_equal_none_re = re.compile( r"assertEqual\(.*?,\s+None\)(( |\t)*#.*)?$|assertEqual\(None,") assert_is_none_re = re.compile( r"assertIs(Not)?\(.*,\s+None\)(( |\t)*#.*)?$|assertIs(Not)?\(None,") @core.flake8ext def use_jsonutils(logical_line, filename): """N521 - jsonutils must be used instead of json. :param logical_line: The logical line to check. :param filename: The file name where the logical line exists. :returns: None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure. """ msg = "N521: jsonutils.%(fun)s must be used instead of json.%(fun)s" # Some files in the tree are not meant to be run from inside Neutron # itself, so we should not complain about them not using jsonutils json_check_skipped_patterns = [ "neutron/plugins/ml2/drivers/openvswitch/agent/xenapi/etc/xapi.d/" "plugins/netwrap", ] for pattern in json_check_skipped_patterns: if pattern in filename: return if "json." in logical_line: json_funcs = ['dumps(', 'dump(', 'loads(', 'load('] for f in json_funcs: pos = logical_line.find('json.%s' % f) if pos != -1: yield (pos, msg % {'fun': f[:-1]}) def _check_imports(regex, submatch, logical_line): m = re.match(regex, logical_line) if m and m.group(1) == submatch: return True def _check_namespace_imports(failure_code, namespace, new_ns, logical_line, message_override=None): if message_override is not None: msg_o = "%s: %s" % (failure_code, message_override) else: msg_o = None if _check_imports(namespace_imports_from_dot, namespace, logical_line): msg = ("%s: '%s' must be used instead of '%s'.") % ( failure_code, logical_line.replace('%s.' % namespace, new_ns), logical_line) return (0, msg_o or msg) elif _check_imports(namespace_imports_from_root, namespace, logical_line): msg = ("%s: '%s' must be used instead of '%s'.") % ( failure_code, logical_line.replace( 'from %s import ' % namespace, 'import %s' % new_ns), logical_line) return (0, msg_o or msg) elif _check_imports(namespace_imports_dot, namespace, logical_line): msg = ("%s: '%s' must be used instead of '%s'.") % ( failure_code, logical_line.replace('import', 'from').replace('.', ' import '), logical_line) return (0, msg_o or msg) @core.flake8ext def check_no_contextlib_nested(logical_line, filename): """N524 - Use of contextlib.nested is deprecated. :param logical_line: The logical line to check. :param filename: The file name where the logical line exists. :returns: None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure. """ msg = ("N524: contextlib.nested is deprecated. With Python 2.7 and later " "the with-statement supports multiple nested objects. See https://" "docs.python.org/2/library/contextlib.html#contextlib.nested for " "more information.") if contextlib_nested.match(logical_line): yield(0, msg) @core.flake8ext def no_mutable_default_args(logical_line): """N529 - Method's default argument shouldn't be mutable. :param logical_line: The logical line to check. :returns: None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure. """ msg = "N529: Method's default argument shouldn't be mutable!" if mutable_default_args.match(logical_line): yield (0, msg) # Chances are that most projects will need to put an ignore on this rule # until they can fully migrate to the lib. @core.flake8ext def check_neutron_namespace_imports(logical_line): """N530 - Direct neutron imports not allowed. :param logical_line: The logical line to check. :returns: None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure. """ x = _check_namespace_imports( 'N530', 'neutron', 'neutron_lib.', logical_line, message_override="direct neutron imports not allowed") if x is not None: yield x @core.flake8ext def check_no_eventlet_imports(logical_line): """N535 - Usage of Python eventlet module not allowed. :param logical_line: The logical line to check. :returns: None if the logical line passes the check, otherwise a tuple is yielded that contains the offending index in logical line and a message describe the check validation failure. """ if re.match(r'(import|from)\s+[(]?eventlet', logical_line): msg = 'N535: Usage of Python eventlet module not allowed' yield logical_line.index('eventlet'), msg @core.flake8ext def assert_equal_none(logical_line): """N536 - Use assertIsNone.""" if assert_equal_none_re.search(logical_line): msg = ("N536: Use assertIsNone rather than assertEqual " "to check for None values") yield logical_line.index('assert'), msg if assert_is_none_re.search(logical_line): msg = ("N536: Use assertIsNone or assertIsNotNone rather than " "assertIs or assertIsNone to check for None values.") yield logical_line.index('assert'), msg # TODO(amotoki): Drop this once all neutron related projects # have switched to hacking 2.x def factory(register): """Hacking check factory for neutron-lib adopter compliant checks. Hacking check factory for use with tox.ini. This factory registers all neutron-lib adopter checks consumers should seek to comply with. :param register: The function to register the check functions with. :returns: None. """ register(use_jsonutils) register(check_no_contextlib_nested) register(no_mutable_default_args) register(check_neutron_namespace_imports) register(translation_checks.no_translate_logs) register(translation_checks.check_log_warn_deprecated) register(translation_checks.check_raised_localized_exceptions) register(assert_equal_none) neutron-lib-2.3.0/neutron_lib/hacking/__init__.py0000664000175000017500000000000013641427107022024 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/policy/0000775000175000017500000000000013641427200017612 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/policy/_engine.py0000664000175000017500000000666513641427107021613 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import sys from oslo_config import cfg from oslo_policy import policy _ROLE_ENFORCER = None _ADMIN_CTX_POLICY = 'context_is_admin' _ADVSVC_CTX_POLICY = 'context_is_advsvc' _BASE_RULES = [ policy.RuleDefault( _ADMIN_CTX_POLICY, 'role:admin', description='Rule for cloud admin access'), policy.RuleDefault( _ADVSVC_CTX_POLICY, 'role:advsvc', description='Rule for advanced service role access'), ] def init(conf=cfg.CONF, policy_file=None): """Initialize the global enforcer if not already initialized. Initialize the global enforcer (and load its rules) if not already initialized; otherwise this is a no-op. :param conf: The configuration to initialize the global enforcer with. Defaults to oslo_config.cfg.CONF. :param policy_file: The policy file to initialize the global enforcer with. :returns: None. """ global _ROLE_ENFORCER if not _ROLE_ENFORCER: _ROLE_ENFORCER = policy.Enforcer(conf, policy_file=policy_file) _ROLE_ENFORCER.register_defaults(_BASE_RULES) _ROLE_ENFORCER.load_rules(True) def _check_rule(context, rule): init() # the target is user-self credentials = context.to_policy_values() try: return _ROLE_ENFORCER.authorize(rule, credentials, credentials) except policy.PolicyNotRegistered: return False def check_is_admin(context): """Verify context has admin rights according to the global policy settings. :param context: The context object. :returns: True if the context has admin rights (as per the global enforcer) and False otherwise. """ return _check_rule(context, _ADMIN_CTX_POLICY) def check_is_advsvc(context): """Verify context has advsvc rights according to global policy settings. :param context: The context object. :returns: True if the context has advsvc rights (as per the global enforcer) and False otherwise. """ return _check_rule(context, _ADVSVC_CTX_POLICY) def list_rules(): return _BASE_RULES def get_enforcer(): # NOTE(amotoki): This was borrowed from nova/policy.py. # This method is for use by oslo.policy CLI scripts. Those scripts need the # 'output-file' and 'namespace' options, but having those in sys.argv means # loading the neutron config options will fail as those are not expected to # be present. So we pass in an arg list with those stripped out. conf_args = [] # Start at 1 because cfg.CONF expects the equivalent of sys.argv[1:] i = 1 while i < len(sys.argv): if sys.argv[i].strip('-') in ['namespace', 'output-file']: i += 2 continue conf_args.append(sys.argv[i]) i += 1 # 'project' must be 'neutron' so that get_enforcer looks at # /etc/neutron/policy.json by default. cfg.CONF(conf_args, project='neutron') init() return _ROLE_ENFORCER neutron-lib-2.3.0/neutron_lib/policy/__init__.py0000664000175000017500000000207013641427107021730 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. def policy_and(*args): return ' and '.join(args) def policy_or(*args): return ' or '.join(args) RULE_ADMIN_OR_OWNER = 'rule:admin_or_owner' RULE_ADMIN_ONLY = 'rule:admin_only' RULE_ANY = 'rule:regular_user' RULE_ADVSVC = 'rule:context_is_advsvc' RULE_ADMIN_OR_NET_OWNER = 'rule:admin_or_network_owner' RULE_ADMIN_OR_NET_OWNER_OR_ADVSVC = policy_or(RULE_ADMIN_OR_NET_OWNER, RULE_ADVSVC) RULE_ADMIN_OR_PARENT_OWNER = 'rule:admin_or_ext_parent_owner' neutron-lib-2.3.0/neutron_lib/rpc.py0000664000175000017500000003146013641427107017463 0ustar zuulzuul00000000000000# Copyright (c) 2012 OpenStack Foundation. # Copyright (c) 2014 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import collections import random import time from neutron_lib._i18n import _ from neutron_lib import context from neutron_lib import exceptions from neutron_lib.utils import runtime from oslo_config import cfg from oslo_log import log as logging import oslo_messaging from oslo_messaging import exceptions as oslomsg_exc from oslo_messaging.rpc import dispatcher from oslo_messaging import serializer as om_serializer from oslo_service import service from oslo_utils import excutils from osprofiler import profiler LOG = logging.getLogger(__name__) TRANSPORT = None NOTIFICATION_TRANSPORT = None NOTIFIER = None _DFT_EXMODS = runtime.list_package_modules(exceptions.__name__) def init(conf, rpc_ext_mods=None): """Initialize the global RPC objects. :param conf: The oslo conf to use for initialization. :param rpc_ext_mods: Exception modules to expose via RPC. :returns: None. """ global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER if rpc_ext_mods is None: rpc_ext_mods = _DFT_EXMODS else: rpc_ext_mods = list(set(rpc_ext_mods + _DFT_EXMODS)) TRANSPORT = oslo_messaging.get_rpc_transport( conf, allowed_remote_exmods=rpc_ext_mods) NOTIFICATION_TRANSPORT = oslo_messaging.get_notification_transport( conf, allowed_remote_exmods=rpc_ext_mods) serializer = RequestContextSerializer() NOTIFIER = oslo_messaging.Notifier(NOTIFICATION_TRANSPORT, serializer=serializer) def cleanup(): """Deactivate and cleanup the global RPC objects. :returns: None. """ global TRANSPORT, NOTIFICATION_TRANSPORT, NOTIFIER if TRANSPORT is None: raise AssertionError(_("'TRANSPORT' must not be None")) if NOTIFICATION_TRANSPORT is None: raise AssertionError( _("'NOTIFICATION_TRANSPORT' must not be None")) if NOTIFIER is None: raise AssertionError(_("'NOTIFIER' must not be None")) TRANSPORT.cleanup() NOTIFICATION_TRANSPORT.cleanup() _BackingOffContextWrapper.reset_timeouts() TRANSPORT = NOTIFICATION_TRANSPORT = NOTIFIER = None def _get_default_method_timeout(): return TRANSPORT.conf.rpc_response_timeout def _get_default_method_timeouts(): return collections.defaultdict(_get_default_method_timeout) def _get_rpc_response_max_timeout(): return TRANSPORT.conf.rpc_response_max_timeout class _ContextWrapper(object): def __init__(self, original_context): self._original_context = original_context def __getattr__(self, name): return getattr(self._original_context, name) def cast(self, ctxt, method, **kwargs): try: self._original_context.cast(ctxt, method, **kwargs) except oslomsg_exc.MessageDeliveryFailure as e: LOG.debug("Ignored exception during cast: %s", str(e)) class _BackingOffContextWrapper(_ContextWrapper): """Wraps oslo messaging contexts to set the timeout for calls. This intercepts RPC calls and sets the timeout value to the globally adapting value for each method. An oslo messaging timeout results in a doubling of the timeout value for the method on which it timed out. There currently is no logic to reduce the timeout since busy Neutron servers are more frequently the cause of timeouts rather than lost messages. """ _METHOD_TIMEOUTS = _get_default_method_timeouts() _max_timeout = None @classmethod def reset_timeouts(cls): # restore the original default timeout factory cls._METHOD_TIMEOUTS = _get_default_method_timeouts() cls._max_timeout = None @classmethod def get_max_timeout(cls): return cls._max_timeout or _get_rpc_response_max_timeout() @classmethod def set_max_timeout(cls, max_timeout): if max_timeout < cls.get_max_timeout(): cls._METHOD_TIMEOUTS = collections.defaultdict( lambda: max_timeout, **{ k: min(v, max_timeout) for k, v in cls._METHOD_TIMEOUTS.items() }) cls._max_timeout = max_timeout def call(self, ctxt, method, **kwargs): # two methods with the same name in different namespaces should # be tracked independently if self._original_context.target.namespace: scoped_method = '%s.%s' % (self._original_context.target.namespace, method) else: scoped_method = method # set the timeout from the global method timeout tracker for this # method self._original_context.timeout = self._METHOD_TIMEOUTS[scoped_method] try: return self._original_context.call(ctxt, method, **kwargs) except oslo_messaging.MessagingTimeout: with excutils.save_and_reraise_exception(): wait = random.uniform( 0, min(self._METHOD_TIMEOUTS[scoped_method], TRANSPORT.conf.rpc_response_timeout) ) LOG.error("Timeout in RPC method %(method)s. Waiting for " "%(wait)s seconds before next attempt. If the " "server is not down, consider increasing the " "rpc_response_timeout option as Neutron " "server(s) may be overloaded and unable to " "respond quickly enough.", {'wait': int(round(wait)), 'method': scoped_method}) new_timeout = min( self._original_context.timeout * 2, self.get_max_timeout()) if new_timeout > self._METHOD_TIMEOUTS[scoped_method]: LOG.warning("Increasing timeout for %(method)s calls " "to %(new)s seconds. Restart the agent to " "restore it to the default value.", {'method': scoped_method, 'new': new_timeout}) self._METHOD_TIMEOUTS[scoped_method] = new_timeout time.sleep(wait) class BackingOffClient(oslo_messaging.RPCClient): """An oslo messaging RPC Client that implements a timeout backoff. This has all of the same interfaces as oslo_messaging.RPCClient but if the timeout parameter is not specified, the _BackingOffContextWrapper returned will track when call timeout exceptions occur and exponentially increase the timeout for the given call method. """ def prepare(self, *args, **kwargs): ctx = super(BackingOffClient, self).prepare(*args, **kwargs) # don't back off contexts that explicitly set a timeout if 'timeout' in kwargs: return _ContextWrapper(ctx) return _BackingOffContextWrapper(ctx) @staticmethod def set_max_timeout(max_timeout): '''Set RPC timeout ceiling for all backing-off RPC clients.''' _BackingOffContextWrapper.set_max_timeout(max_timeout) def get_client(target, version_cap=None, serializer=None): """Get an RPC client for the said target. The init() function must be called prior to calling this. :param target: The RPC target for the client. :param version_cap: The optional version cap for the RPC client. :param serializer: The optional serializer to use for the RPC client. :returns: A new RPC client. """ if TRANSPORT is None: raise AssertionError(_("'TRANSPORT' must not be None")) serializer = RequestContextSerializer(serializer) return BackingOffClient(TRANSPORT, target, version_cap=version_cap, serializer=serializer) def get_server(target, endpoints, serializer=None): """Get a new RPC server reference. :param target: The target for the new RPC server. :param endpoints: The endpoints for the RPC server. :param serializer: The optional serialize to use for the RPC server. :returns: A new RPC server reference. """ if TRANSPORT is None: raise AssertionError(_("'TRANSPORT' must not be None")) serializer = RequestContextSerializer(serializer) access_policy = dispatcher.DefaultRPCAccessPolicy return oslo_messaging.get_rpc_server(TRANSPORT, target, endpoints, 'eventlet', serializer, access_policy=access_policy) def get_notifier(service=None, host=None, publisher_id=None): """Get a new notifier reference. :param service: The optional service for the notifier. :param host: The optional host for the notifier. If not given the host will be taken from the global CONF. :param publisher_id: The optional publisher ID for the notifer. :returns: A new RPC notifier reference. """ if NOTIFIER is None: raise AssertionError(_("'NOTIFIER' must not be None")) if not publisher_id: publisher_id = "%s.%s" % (service, host or cfg.CONF.host) return NOTIFIER.prepare(publisher_id=publisher_id) class RequestContextSerializer(om_serializer.Serializer): """Convert RPC common context into Neutron Context.""" def __init__(self, base=None): super(RequestContextSerializer, self).__init__() self._base = base def serialize_entity(self, ctxt, entity): if not self._base: return entity return self._base.serialize_entity(ctxt, entity) def deserialize_entity(self, ctxt, entity): if not self._base: return entity return self._base.deserialize_entity(ctxt, entity) def serialize_context(self, ctxt): _context = ctxt.to_dict() prof = profiler.get() if prof: trace_info = { "hmac_key": prof.hmac_key, "base_id": prof.get_base_id(), "parent_id": prof.get_id() } _context['trace_info'] = trace_info return _context def deserialize_context(self, ctxt): rpc_ctxt_dict = ctxt.copy() trace_info = rpc_ctxt_dict.pop("trace_info", None) if trace_info: profiler.init(**trace_info) return context.Context.from_dict(rpc_ctxt_dict) @profiler.trace_cls("rpc") class Service(service.Service): """Service object for binaries running on hosts. A service enables rpc by listening to queues based on topic and host. """ def __init__(self, host, topic, manager=None, serializer=None): super(Service, self).__init__() self.host = host self.topic = topic self.serializer = serializer if manager is None: self.manager = self else: self.manager = manager def start(self): super(Service, self).start() self.conn = Connection() LOG.debug("Creating Consumer connection for Service %s", self.topic) endpoints = [self.manager] self.conn.create_consumer(self.topic, endpoints) # Hook to allow the manager to do other initializations after # the rpc connection is created. if callable(getattr(self.manager, 'initialize_service_hook', None)): self.manager.initialize_service_hook(self) # Consume from all consumers in threads self.conn.consume_in_threads() def stop(self): # Try to shut the connection down, but if we get any sort of # errors, go ahead and ignore them.. as we're shutting down anyway try: self.conn.close() except Exception: # nosec pass super(Service, self).stop() class Connection(object): """A utility class that manages a collection of RPC servers.""" def __init__(self): super(Connection, self).__init__() self.servers = [] def create_consumer(self, topic, endpoints, fanout=False): target = oslo_messaging.Target( topic=topic, server=cfg.CONF.host, fanout=fanout) server = get_server(target, endpoints) self.servers.append(server) def consume_in_threads(self): for server in self.servers: server.start() return self.servers def close(self): for server in self.servers: server.stop() for server in self.servers: server.wait() neutron-lib-2.3.0/neutron_lib/tests/0000775000175000017500000000000013641427200017455 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/tools.py0000664000175000017500000000436313641427107021203 0ustar zuulzuul00000000000000# Copyright (c) 2013 NEC Corporation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import os import platform import random import time import netaddr from neutron_lib.utils import helpers from neutron_lib.utils import net class UnorderedList(list): """A list that is equals to any permutation of itself.""" def __eq__(self, other): if not isinstance(other, list): return False return (sorted(self, key=helpers.safe_sort_key) == sorted(other, key=helpers.safe_sort_key)) def __neq__(self, other): return not self == other def is_bsd(): """Return True on BSD-based systems.""" system = platform.system() if system == 'Darwin': return True if 'bsd' in system.lower(): return True return False def get_random_cidr(version=4): if version == 4: return '10.%d.%d.0/%d' % (random.randint(3, 254), random.randint(3, 254), 24) return '2001:db8:%x::/%d' % (random.getrandbits(16), 64) def reset_random_seed(): # reset random seed to make sure other processes extracting values from RNG # don't get the same results (useful especially when you then use the # random values to allocate system resources from global pool, like ports # to listen). Use both current time and pid to make sure no tests started # at the same time get the same values from RNG seed = time.time() + os.getpid() random.seed(seed) def get_random_EUI(): return netaddr.EUI( net.get_random_mac(['fe', '16', '3e', '00', '00', '00']) ) def get_random_ip_network(version=4): return netaddr.IPNetwork(get_random_cidr(version=version)) neutron-lib-2.3.0/neutron_lib/tests/_post_mortem_debug.py0000664000175000017500000001021513641427107023711 0ustar zuulzuul00000000000000# Copyright 2013 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import functools import traceback def get_exception_handler(debugger_name): debugger = _get_debugger(debugger_name) return functools.partial(_exception_handler, debugger) def _get_debugger(debugger_name): try: debugger = __import__(debugger_name) except ImportError: raise ValueError("can't import %s module as a post mortem debugger" % debugger_name) if 'post_mortem' in dir(debugger): return debugger else: raise ValueError("%s is not a supported post mortem debugger" % debugger_name) def _exception_handler(debugger, exc_info): """Exception handler enabling post-mortem debugging. A class extending testtools.TestCase can add this handler in setUp(): self.addOnException(post_mortem_debug.exception_handler) When an exception occurs, the user will be dropped into a debugger session in the execution environment of the failure. Frames associated with the testing framework are excluded so that the post-mortem session for an assertion failure will start at the assertion call (e.g. self.assertTrue) rather than the framework code that raises the failure exception (e.g. the assertTrue method). """ tb = exc_info[2] ignored_traceback = get_ignored_traceback(tb) if ignored_traceback: tb = FilteredTraceback(tb, ignored_traceback) traceback.print_exception(exc_info[0], exc_info[1], tb) debugger.post_mortem(tb) def get_ignored_traceback(tb): """Retrieve the first traceback of an ignored trailing chain. Given an initial traceback, find the first traceback of a trailing chain of tracebacks that should be ignored. The criteria for whether a traceback should be ignored is whether its frame's globals include the __unittest marker variable. This criteria is culled from: unittest.TestResult._is_relevant_tb_level For example: tb.tb_next => tb0.tb_next => tb1.tb_next - If no tracebacks were to be ignored, None would be returned. - If only tb1 was to be ignored, tb1 would be returned. - If tb0 and tb1 were to be ignored, tb0 would be returned. - If either of only tb or only tb0 was to be ignored, None would be returned because neither tb or tb0 would be part of a trailing chain of ignored tracebacks. """ # Turn the traceback chain into a list tb_list = [] while tb: tb_list.append(tb) tb = tb.tb_next # Find all members of an ignored trailing chain ignored_tracebacks = [] for tb in reversed(tb_list): if '__unittest' in tb.tb_frame.f_globals: ignored_tracebacks.append(tb) else: break # Return the first member of the ignored trailing chain if ignored_tracebacks: return ignored_tracebacks[-1] class FilteredTraceback(object): """Wraps a traceback to filter unwanted frames.""" def __init__(self, tb, filtered_traceback): """Constructor. :param tb: The start of the traceback chain to filter. :param filtered_traceback: The first traceback of a trailing chain that is to be filtered. """ self._tb = tb self.tb_lasti = self._tb.tb_lasti self.tb_lineno = self._tb.tb_lineno self.tb_frame = self._tb.tb_frame self._filtered_traceback = filtered_traceback @property def tb_next(self): tb_next = self._tb.tb_next if tb_next and tb_next != self._filtered_traceback: return FilteredTraceback(tb_next, self._filtered_traceback) neutron-lib-2.3.0/neutron_lib/tests/etc/0000775000175000017500000000000013641427200020230 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/etc/no_policy.json0000664000175000017500000000000413641427107023116 0ustar zuulzuul00000000000000{ } neutron-lib-2.3.0/neutron_lib/tests/etc/dummy_policy.json0000664000175000017500000000012213641427107023636 0ustar zuulzuul00000000000000{ "context_is_admin": "role:dummy", "context_is_advsvc": "role:dummy" } neutron-lib-2.3.0/neutron_lib/tests/etc/policy.json0000664000175000017500000000017113641427107022427 0ustar zuulzuul00000000000000{ "context_is_admin": "role:admin", "context_is_advsvc": "role:advsvc", "default": "rule:admin_or_owner" } neutron-lib-2.3.0/neutron_lib/tests/etc/neutron_lib.conf0000664000175000017500000000023113641427107023421 0ustar zuulzuul00000000000000[DEFAULT] # Show debugging output in logs (sets DEBUG log level output) debug = False lock_path = $state_path/lock [database] connection = 'sqlite://' neutron-lib-2.3.0/neutron_lib/tests/unit/0000775000175000017500000000000013641427200020434 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/placement/0000775000175000017500000000000013641427200022404 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/placement/test_client.py0000664000175000017500000007344513641427107025316 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from unittest import mock from keystoneauth1 import exceptions as ks_exc from keystoneauth1 import loading as keystone from oslo_serialization import jsonutils from oslo_utils import uuidutils from neutron_lib._i18n import _ from neutron_lib.exceptions import placement as n_exc from neutron_lib import fixture from neutron_lib.placement import client as place_client from neutron_lib.tests import _base as base RESOURCE_PROVIDER_UUID = uuidutils.generate_uuid() RESOURCE_PROVIDER_NAME = 'resource_provider_name' RESOURCE_PROVIDER = { 'uuid': RESOURCE_PROVIDER_UUID, 'name': RESOURCE_PROVIDER_NAME, } RESOURCE_PROVIDER_GENERATION = 1 RESOURCE_CLASS_NAME = 'resource_class_name' TRAIT_NAME = 'trait_name' INVENTORY = { RESOURCE_CLASS_NAME: { 'total': 42 } } class TestNoAuthClient(base.BaseTestCase): def setUp(self): super(TestNoAuthClient, self).setUp() self.noauth_client = place_client.NoAuthClient('placement/') self.body_json = jsonutils.dumps({'name': 'foo'}) self.uuid = '42' @mock.patch.object(place_client.NoAuthClient, 'request') def test_get(self, mock_request): self.noauth_client.get('resource_providers', '') mock_request.assert_called_with('placement/resource_providers', 'GET') @mock.patch.object(place_client.NoAuthClient, 'request') def test_post(self, mock_request): self.noauth_client.post('resource_providers', self.body_json, '') mock_request.assert_called_with('placement/resource_providers', 'POST', body=self.body_json) @mock.patch.object(place_client.NoAuthClient, 'request') def test_put(self, mock_request): self.noauth_client.put('resource_providers/%s' % self.uuid, self.body_json, '') mock_request.assert_called_with( 'placement/resource_providers/%s' % self.uuid, 'PUT', body=self.body_json) @mock.patch.object(place_client.NoAuthClient, 'request') def test_delete(self, mock_request): self.noauth_client.delete('resource_providers/%s' % self.uuid, '') mock_request.assert_called_with( 'placement/resource_providers/%s' % self.uuid, 'DELETE') class TestPlacementAPIClientNoAuth(base.BaseTestCase): def setUp(self): super(TestPlacementAPIClientNoAuth, self).setUp() self.config = mock.Mock() @mock.patch('neutron_lib.placement.client.NoAuthClient', autospec=True) def test__create_client_noauth(self, mock_auth_client): self.config.placement.auth_type = 'noauth' self.config.placement.auth_section = 'placement/' self.placement_api_client = place_client.PlacementAPIClient( self.config) self.placement_api_client._create_client() mock_auth_client.assert_called_once_with('placement/') @mock.patch.object(keystone, 'load_auth_from_conf_options') @mock.patch.object(keystone, 'load_session_from_conf_options') def test__create_client(self, mock_session_from_conf, mock_auth_from_conf): self.config.placement.auth_type = 'password' self.placement_api_client = place_client.PlacementAPIClient( self.config) self.placement_api_client._create_client() mock_auth_from_conf.assert_called_once_with(self.config, 'placement') mock_session_from_conf.assert_called_once() class TestPlacementAPIClient(base.BaseTestCase): def setUp(self): super(TestPlacementAPIClient, self).setUp() config = mock.Mock() config.region_name = 'region_name' self.openstack_api_version = ( place_client.PLACEMENT_API_LATEST_SUPPORTED) self.placement_api_client = place_client.PlacementAPIClient( config, self.openstack_api_version) self.placement_fixture = self.useFixture( fixture.PlacementAPIClientFixture(self.placement_api_client)) def test_create_resource_provider(self): self.placement_api_client.create_resource_provider( RESOURCE_PROVIDER) self.placement_fixture.mock_post.assert_called_once_with( '/resource_providers', RESOURCE_PROVIDER ) def test_update_resource_provider(self): self.placement_api_client.update_resource_provider( RESOURCE_PROVIDER) self.placement_fixture.mock_put.assert_called_once_with( '/resource_providers/%s' % RESOURCE_PROVIDER_UUID, {'name': RESOURCE_PROVIDER_NAME} ) def test_ensure_update_resource_provider(self): self.placement_api_client.ensure_resource_provider( RESOURCE_PROVIDER) self.placement_fixture.mock_put.assert_called_once_with( '/resource_providers/%s' % RESOURCE_PROVIDER_UUID, {'name': RESOURCE_PROVIDER_NAME} ) self.placement_fixture.mock_post.assert_not_called() def test_ensure_create_resource_provider(self): self.placement_fixture.mock_put.side_effect = \ n_exc.PlacementResourceProviderNotFound( resource_provider=RESOURCE_PROVIDER_UUID) self.placement_api_client.ensure_resource_provider( RESOURCE_PROVIDER) self.placement_fixture.mock_post.assert_called_once_with( '/resource_providers', RESOURCE_PROVIDER ) def test_delete_resource_provider(self): self.placement_api_client.delete_resource_provider( RESOURCE_PROVIDER_UUID) self.placement_fixture.mock_delete.assert_called_once_with( '/resource_providers/%s' % RESOURCE_PROVIDER_UUID) def test_get_resource_provider(self): self.placement_api_client.get_resource_provider(RESOURCE_PROVIDER_UUID) self.placement_fixture.mock_get.assert_called_once_with( '/resource_providers/%s' % RESOURCE_PROVIDER_UUID) def test_get_resource_provider_no_resource_provider(self): self.placement_fixture.mock_get.side_effect = ks_exc.NotFound() self.assertRaises(n_exc.PlacementResourceProviderNotFound, self.placement_api_client.get_resource_provider, RESOURCE_PROVIDER_UUID) def test_list_resource_providers(self): filter_1 = {'name': 'name1', 'in_tree': 'tree1_uuid'} self.placement_api_client.list_resource_providers(**filter_1) args = str(self.placement_fixture.mock_get.call_args) self.placement_fixture.mock_get.assert_called_once() self.assertIn('name=name1', args) self.assertIn('in_tree=tree1_uuid', args) filter_2 = {'member_of': ['aggregate_uuid'], 'uuid': 'uuid_1', 'resources': {'r_class1': 'value1'}} self.placement_fixture.mock_get.reset_mock() self.placement_api_client.list_resource_providers(**filter_2) args = str(self.placement_fixture.mock_get.call_args) self.placement_fixture.mock_get.assert_called_once() self.assertIn('member_of', args) self.assertIn('uuid', args) self.assertIn('resources', args) filter_1.update(filter_2) self.placement_fixture.mock_get.reset_mock() self.placement_api_client.list_resource_providers(**filter_1) args = str(self.placement_fixture.mock_get.call_args) self.placement_fixture.mock_get.assert_called_once() for key in filter_1: self.assertIn(key, args) def test_list_resource_providers_placement_api_version_too_low(self): self.placement_api_client._target_version = (1, 1) self.assertRaises( n_exc.PlacementAPIVersionIncorrect, self.placement_api_client.list_resource_providers, member_of=['aggregate_uuid']) self.assertRaises( n_exc.PlacementAPIVersionIncorrect, self.placement_api_client.list_resource_providers, in_tree='tree1_uuid') def test_update_resource_provider_inventories_generation(self): expected_body = { 'resource_provider_generation': RESOURCE_PROVIDER_GENERATION, 'inventories': INVENTORY } self.placement_api_client.update_resource_provider_inventories( RESOURCE_PROVIDER_UUID, INVENTORY, RESOURCE_PROVIDER_GENERATION) self.placement_fixture.mock_put.assert_called_once_with( '/resource_providers/%s/inventories' % RESOURCE_PROVIDER_UUID, expected_body) def test_update_resource_provider_inventories_no_generation(self): expected_body = { 'resource_provider_generation': RESOURCE_PROVIDER_GENERATION, 'inventories': INVENTORY } with mock.patch.object( self.placement_api_client, 'get_resource_provider', return_value={'generation': RESOURCE_PROVIDER_GENERATION}): self.placement_api_client.update_resource_provider_inventories( RESOURCE_PROVIDER_UUID, INVENTORY) self.placement_fixture.mock_put.assert_called_once_with( '/resource_providers/%s/inventories' % RESOURCE_PROVIDER_UUID, expected_body) def test_update_resource_provider_inventories_no_rp(self): self.placement_fixture.mock_put.side_effect = ks_exc.NotFound() self.assertRaises( n_exc.PlacementResourceProviderNotFound, self.placement_api_client.update_resource_provider_inventories, RESOURCE_PROVIDER_UUID, INVENTORY, RESOURCE_PROVIDER_GENERATION) def test_delete_resource_provider_inventory(self): self.placement_api_client.delete_resource_provider_inventory( RESOURCE_PROVIDER_UUID, RESOURCE_CLASS_NAME ) self.placement_fixture.mock_delete.assert_called_once_with( '/resource_providers/%(rp_uuid)s/inventories/%(rc_name)s' % {'rp_uuid': RESOURCE_PROVIDER_UUID, 'rc_name': RESOURCE_CLASS_NAME} ) def test_delete_resource_provider_inventory_no_rp(self): self.placement_fixture.mock_delete.side_effect = ks_exc.NotFound( details='No resource provider with uuid' ) self.assertRaises( n_exc.PlacementResourceProviderNotFound, self.placement_api_client.delete_resource_provider_inventory, RESOURCE_PROVIDER_UUID, RESOURCE_CLASS_NAME ) def test_get_inventory(self): self.placement_api_client.get_inventory(RESOURCE_PROVIDER_UUID, RESOURCE_CLASS_NAME) self.placement_fixture.mock_get.assert_called_once_with( '/resource_providers/%(rp_uuid)s/inventories/%(rc_name)s' % {'rp_uuid': RESOURCE_PROVIDER_UUID, 'rc_name': RESOURCE_CLASS_NAME}) def test_get_inventory_no_resource_provider(self): _exception = ks_exc.NotFound() _exception.details = "No resource provider with uuid" self.placement_fixture.mock_get.side_effect = _exception self.assertRaises(n_exc.PlacementResourceProviderNotFound, self.placement_api_client.get_inventory, RESOURCE_PROVIDER_UUID, RESOURCE_CLASS_NAME) def test_get_inventory_no_inventory(self): _exception = ks_exc.NotFound() _exception.details = _("No inventory of class") self.placement_fixture.mock_get.side_effect = _exception self.assertRaises(n_exc.PlacementInventoryNotFound, self.placement_api_client.get_inventory, RESOURCE_PROVIDER_UUID, RESOURCE_CLASS_NAME) def test_get_inventory_not_found(self): _exception = ks_exc.NotFound() _exception.details = "Any other exception explanation" _exception.response = mock.Mock(text="Some error response body") self.placement_fixture.mock_get.side_effect = _exception self.assertRaises(n_exc.PlacementClientError, self.placement_api_client.get_inventory, RESOURCE_PROVIDER_UUID, RESOURCE_CLASS_NAME) def test_update_resource_provider_inventory_generation(self): expected_body = { 'resource_provider_generation': RESOURCE_PROVIDER_GENERATION, } expected_body.update(INVENTORY) self.placement_api_client.update_resource_provider_inventory( RESOURCE_PROVIDER_UUID, INVENTORY, RESOURCE_CLASS_NAME, resource_provider_generation=1) self.placement_fixture.mock_put.assert_called_once_with( '/resource_providers/%(rp_uuid)s/inventories/%(rc_name)s' % {'rp_uuid': RESOURCE_PROVIDER_UUID, 'rc_name': RESOURCE_CLASS_NAME}, expected_body) def test_update_resource_provider_inventory_no_generation(self): expected_body = { 'resource_provider_generation': RESOURCE_PROVIDER_GENERATION, } expected_body.update(INVENTORY) with mock.patch.object( self.placement_api_client, 'get_resource_provider', return_value={'generation': RESOURCE_PROVIDER_GENERATION}): self.placement_api_client.update_resource_provider_inventory( RESOURCE_PROVIDER_UUID, INVENTORY, RESOURCE_CLASS_NAME) self.placement_fixture.mock_put.assert_called_once_with( '/resource_providers/%(rp_uuid)s/inventories/%(rc_name)s' % {'rp_uuid': RESOURCE_PROVIDER_UUID, 'rc_name': RESOURCE_CLASS_NAME}, expected_body) def test_update_resource_provider_inventory_not_found(self): # Test the resource provider not found case self.placement_fixture.mock_put.side_effect = ks_exc.NotFound( details="No resource provider with uuid") self.assertRaises( n_exc.PlacementResourceNotFound, self.placement_api_client.update_resource_provider_inventory, RESOURCE_PROVIDER_UUID, INVENTORY, RESOURCE_CLASS_NAME, RESOURCE_PROVIDER_GENERATION) def test_associate_aggregates(self): self.placement_api_client.associate_aggregates(RESOURCE_PROVIDER_UUID, mock.ANY) self.placement_fixture.mock_put.assert_called_once_with( '/resource_providers/%s/aggregates' % RESOURCE_PROVIDER_UUID, mock.ANY) def test_list_aggregates(self): self.placement_api_client.list_aggregates(RESOURCE_PROVIDER_UUID) self.placement_fixture.mock_get.assert_called_once_with( '/resource_providers/%s/aggregates' % RESOURCE_PROVIDER_UUID) def test_list_aggregates_no_resource_provider(self): self.placement_fixture.mock_get.side_effect = ks_exc.NotFound() self.assertRaises(n_exc.PlacementAggregateNotFound, self.placement_api_client.list_aggregates, RESOURCE_PROVIDER_UUID) def test_list_traits(self): self.placement_api_client.list_traits() self.placement_fixture.mock_get.assert_called_once_with( '/traits') def test_get_trait(self): self.placement_api_client.get_trait(TRAIT_NAME) self.placement_fixture.mock_get.assert_called_once_with( '/traits/%s' % TRAIT_NAME) def test_get_trait_no_trait(self): self.placement_fixture.mock_get.side_effect = ks_exc.NotFound() self.assertRaises( n_exc.PlacementTraitNotFound, self.placement_api_client.get_trait, TRAIT_NAME) def test_create_trait(self): self.placement_api_client.update_trait(TRAIT_NAME) self.placement_fixture.mock_put.assert_called_once_with( '/traits/%s' % TRAIT_NAME, None) def test_update_resource_provider_traits_generation(self): traits = [TRAIT_NAME] self.placement_api_client.update_resource_provider_traits( RESOURCE_PROVIDER_UUID, traits, resource_provider_generation=RESOURCE_PROVIDER_GENERATION) self.placement_fixture.mock_put.assert_called_once_with( '/resource_providers/%(rp_uuid)s/traits' % {'rp_uuid': RESOURCE_PROVIDER_UUID}, {'resource_provider_generation': RESOURCE_PROVIDER_GENERATION, 'traits': traits}) def test_update_resource_provider_traits_no_generation(self): traits = [TRAIT_NAME] with mock.patch.object( self.placement_api_client, 'get_resource_provider', return_value={'generation': RESOURCE_PROVIDER_GENERATION}): self.placement_api_client.update_resource_provider_traits( RESOURCE_PROVIDER_UUID, traits) self.placement_fixture.mock_put.assert_called_once_with( '/resource_providers/%(rp_uuid)s/traits' % {'rp_uuid': RESOURCE_PROVIDER_UUID}, {'resource_provider_generation': RESOURCE_PROVIDER_GENERATION, 'traits': traits}) def test_update_resource_provider_traits_no_rp(self): traits = [TRAIT_NAME] self.placement_fixture.mock_put.side_effect = ks_exc.NotFound() self.assertRaises( n_exc.PlacementResourceProviderNotFound, self.placement_api_client.update_resource_provider_traits, RESOURCE_PROVIDER_UUID, traits, resource_provider_generation=0) def test_update_resource_provider_traits_trait_not_found(self): traits = [TRAIT_NAME] self.placement_fixture.mock_put.side_effect = ks_exc.BadRequest() self.assertRaises( n_exc.PlacementTraitNotFound, self.placement_api_client.update_resource_provider_traits, RESOURCE_PROVIDER_UUID, traits, resource_provider_generation=0) def test_list_resource_provider_traits(self): self.placement_api_client.list_resource_provider_traits( RESOURCE_PROVIDER_UUID) self.placement_fixture.mock_get.assert_called_once_with( '/resource_providers/%s/traits' % RESOURCE_PROVIDER_UUID) def test_list_resource_provider_traits_no_rp(self): self.placement_fixture.mock_get.side_effect = ks_exc.NotFound() self.assertRaises( n_exc.PlacementResourceProviderNotFound, self.placement_api_client.list_resource_provider_traits, RESOURCE_PROVIDER_UUID) def test_delete_trait(self): self.placement_api_client.delete_trait(TRAIT_NAME) self.placement_fixture.mock_delete.assert_called_once_with( '/traits/%s' % TRAIT_NAME) def test_delete_trait_no_trait(self): self.placement_fixture.mock_delete.side_effect = ks_exc.NotFound() self.assertRaises( n_exc.PlacementTraitNotFound, self.placement_api_client.delete_trait, TRAIT_NAME) def test_delete_resource_provider_traits(self): self.placement_api_client.delete_resource_provider_traits( RESOURCE_PROVIDER_UUID) self.placement_fixture.mock_delete.assert_called_once_with( '/resource_providers/%s/traits' % RESOURCE_PROVIDER_UUID) def test_delete_resource_provider_traits_no_rp(self): self.placement_fixture.mock_delete.side_effect = ks_exc.NotFound() self.assertRaises( n_exc.PlacementResourceProviderNotFound, self.placement_api_client.delete_resource_provider_traits, RESOURCE_PROVIDER_UUID) def test_list_resource_classes(self): self.placement_api_client.list_resource_classes() self.placement_fixture.mock_get.assert_called_once_with( '/resource_classes' ) def test_get_resource_class(self): self.placement_api_client.get_resource_class(RESOURCE_CLASS_NAME) self.placement_fixture.mock_get.assert_called_once_with( '/resource_classes/%s' % RESOURCE_CLASS_NAME ) def test_get_resource_class_no_resource_class(self): self.placement_fixture.mock_get.side_effect = ks_exc.NotFound() self.assertRaises( n_exc.PlacementResourceClassNotFound, self.placement_api_client.get_resource_class, RESOURCE_CLASS_NAME ) def test_create_resource_class(self): self.placement_api_client.create_resource_class(RESOURCE_CLASS_NAME) self.placement_fixture.mock_post.assert_called_once_with( '/resource_classes', {'name': RESOURCE_CLASS_NAME}, ) def test_update_resource_class(self): self.placement_api_client.update_resource_class(RESOURCE_CLASS_NAME) self.placement_fixture.mock_put.assert_called_once_with( '/resource_classes/%s' % RESOURCE_CLASS_NAME, None) def test_delete_resource_class(self): self.placement_api_client.delete_resource_class(RESOURCE_CLASS_NAME) self.placement_fixture.mock_delete.assert_called_once_with( '/resource_classes/%s' % RESOURCE_CLASS_NAME ) def test_delete_resource_class_no_resource_class(self): self.placement_fixture.mock_delete.side_effect = ks_exc.NotFound() self.assertRaises( n_exc.PlacementResourceClassNotFound, self.placement_api_client.delete_resource_class, RESOURCE_CLASS_NAME ) def test_update_rp_traits_caller_handles_generation_conflict(self): mock_resp = mock.Mock() mock_resp.text = '' mock_resp.json = lambda: { 'errors': [{'code': 'placement.concurrent_update'}]} self.placement_fixture.mock_put.side_effect = ks_exc.Conflict( response=mock_resp) self.assertRaises( n_exc.PlacementResourceProviderGenerationConflict, self.placement_api_client.update_resource_provider_traits, resource_provider_uuid='resource provider uuid', traits=['trait a', 'trait b'], resource_provider_generation=3, ) self.placement_fixture.mock_put.assert_called_once() def test_update_rp_traits_callee_handles_generation_conflict(self): mock_resp = mock.Mock() mock_resp.text = '' mock_resp.json = lambda: { 'errors': [{'code': 'placement.concurrent_update'}]} self.placement_fixture.mock_put.side_effect = [ ks_exc.Conflict(response=mock_resp), mock.Mock(), ] self.placement_api_client.update_resource_provider_traits( resource_provider_uuid='resource provider uuid', traits=['trait a', 'trait b'], resource_provider_generation=None, ) self.assertEqual(2, self.placement_fixture.mock_put.call_count) def test_update_rp_traits_reached_max_tries(self): mock_resp = mock.Mock() mock_resp.text = '' mock_resp.json = lambda: { 'errors': [{'code': 'placement.concurrent_update'}]} self.placement_fixture.mock_put.side_effect = 10 * [ ks_exc.Conflict(response=mock_resp), ] self.assertRaises( n_exc.PlacementResourceProviderGenerationConflict, self.placement_api_client.update_resource_provider_traits, resource_provider_uuid='resource provider uuid', traits=['trait a', 'trait b'], resource_provider_generation=None, ) self.assertEqual(10, self.placement_fixture.mock_put.call_count) def test_update_rp_traits_raise_other_conflict(self): mock_resp = mock.Mock() mock_resp.text = '' mock_resp.json = lambda: { 'errors': [{'code': 'some_other_code'}]} self.placement_fixture.mock_put.side_effect = [ ks_exc.Conflict(response=mock_resp), mock.Mock(), ] self.assertRaises( n_exc.PlacementClientError, self.placement_api_client.update_resource_provider_traits, resource_provider_uuid='resource provider uuid', traits=[], resource_provider_generation=None, ) self.assertEqual(1, self.placement_fixture.mock_put.call_count) def test_update_rp_inventory_caller_handles_generation_conflict(self): mock_resp = mock.Mock() mock_resp.text = '' mock_resp.json = lambda: { 'errors': [{'code': 'placement.concurrent_update'}]} self.placement_fixture.mock_put.side_effect = ks_exc.Conflict( response=mock_resp) self.assertRaises( n_exc.PlacementResourceProviderGenerationConflict, self.placement_api_client.update_resource_provider_inventory, resource_provider_uuid='resource provider uuid', inventory={}, resource_class='a resource class', resource_provider_generation=3, ) self.placement_fixture.mock_put.assert_called_once() def test_update_rp_inventory_callee_handles_generation_conflict(self): mock_resp = mock.Mock() mock_resp.text = '' mock_resp.json = lambda: { 'errors': [{'code': 'placement.concurrent_update'}]} self.placement_fixture.mock_put.side_effect = [ ks_exc.Conflict(response=mock_resp), mock.Mock(), ] self.placement_api_client.update_resource_provider_inventory( resource_provider_uuid='resource provider uuid', inventory={}, resource_class='a resource class', resource_provider_generation=None, ) self.assertEqual(2, self.placement_fixture.mock_put.call_count) def test_update_rp_inventory_reached_max_tries(self): mock_resp = mock.Mock() mock_resp.text = '' mock_resp.json = lambda: { 'errors': [{'code': 'placement.concurrent_update'}]} self.placement_fixture.mock_put.side_effect = 10 * [ ks_exc.Conflict(response=mock_resp), ] self.assertRaises( n_exc.PlacementResourceProviderGenerationConflict, self.placement_api_client.update_resource_provider_inventory, resource_provider_uuid='resource provider uuid', inventory={}, resource_class='a resource class', resource_provider_generation=None, ) self.assertEqual(10, self.placement_fixture.mock_put.call_count) def test_update_rp_inventory_raise_other_conflict(self): mock_resp = mock.Mock() mock_resp.text = '' mock_resp.json = lambda: { 'errors': [{'code': 'some_other_code'}]} self.placement_fixture.mock_put.side_effect = [ ks_exc.Conflict(response=mock_resp), mock.Mock(), ] self.assertRaises( n_exc.PlacementClientError, self.placement_api_client.update_resource_provider_inventory, resource_provider_uuid='resource provider uuid', inventory={}, resource_class='a resource class', resource_provider_generation=None, ) self.assertEqual(1, self.placement_fixture.mock_put.call_count) def test_update_rp_inventories_caller_handles_generation_conflict(self): mock_resp = mock.Mock() mock_resp.text = '' mock_resp.json = lambda: { 'errors': [{'code': 'placement.concurrent_update'}]} self.placement_fixture.mock_put.side_effect = ks_exc.Conflict( response=mock_resp) self.assertRaises( n_exc.PlacementResourceProviderGenerationConflict, self.placement_api_client.update_resource_provider_inventories, resource_provider_uuid='resource provider uuid', inventories={}, resource_provider_generation=3, ) self.placement_fixture.mock_put.assert_called_once() def test_update_rp_inventories_callee_handles_generation_conflict(self): mock_resp = mock.Mock() mock_resp.text = '' mock_resp.json = lambda: { 'errors': [{'code': 'placement.concurrent_update'}]} self.placement_fixture.mock_put.side_effect = [ ks_exc.Conflict(response=mock_resp), mock.Mock(), ] self.placement_api_client.update_resource_provider_inventories( resource_provider_uuid='resource provider uuid', inventories={}, resource_provider_generation=None, ) self.assertEqual(2, self.placement_fixture.mock_put.call_count) def test_update_rp_inventories_reached_max_tries(self): mock_resp = mock.Mock() mock_resp.text = '' mock_resp.json = lambda: { 'errors': [{'code': 'placement.concurrent_update'}]} self.placement_fixture.mock_put.side_effect = 10 * [ ks_exc.Conflict(response=mock_resp), ] self.assertRaises( n_exc.PlacementResourceProviderGenerationConflict, self.placement_api_client.update_resource_provider_inventories, resource_provider_uuid='resource provider uuid', inventories={}, resource_provider_generation=None, ) self.assertEqual(10, self.placement_fixture.mock_put.call_count) def test_update_rp_inventories_raise_other_conflict(self): mock_resp = mock.Mock() mock_resp.text = '' mock_resp.json = lambda: { 'errors': [{'code': 'some_other_code'}]} self.placement_fixture.mock_put.side_effect = [ ks_exc.Conflict(response=mock_resp), mock.Mock(), ] self.assertRaises( n_exc.PlacementClientError, self.placement_api_client.update_resource_provider_inventories, resource_provider_uuid='resource provider uuid', inventories={}, resource_provider_generation=None, ) self.assertEqual(1, self.placement_fixture.mock_put.call_count) neutron-lib-2.3.0/neutron_lib/tests/unit/placement/test_utils.py0000664000175000017500000001276213641427107025173 0ustar zuulzuul00000000000000# Copyright 2018 Ericsson # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import uuid from neutron_lib.placement import utils as place_utils from neutron_lib.tests import _base as base class TestPlacementUtils(base.BaseTestCase): def setUp(self): super(TestPlacementUtils, self).setUp() self._uuid_ns = uuid.UUID('94fedd4d-1ce0-4bb3-9c9a-c9c0f56de154') def test_physnet_trait(self): self.assertEqual( 'CUSTOM_PHYSNET_SOME_PHYSNET', place_utils.physnet_trait('some-physnet')) def test_vnic_type_trait(self): self.assertEqual( 'CUSTOM_VNIC_TYPE_SOMEVNICTYPE', place_utils.vnic_type_trait('somevnictype')) def test_six_uuid5_literal(self): try: # assertNotRaises place_utils.six_uuid5( namespace=self._uuid_ns, name='may or may not be a unicode string' + ' depending on Python version') except Exception: self.fail('could not generate uuid') def test_six_uuid5_unicode(self): try: # assertNotRaises place_utils.six_uuid5( namespace=self._uuid_ns, name=u'unicode string') except Exception: self.fail('could not generate uuid') def test_agent_resource_provider_uuid(self): try: # assertNotRaises place_utils.agent_resource_provider_uuid( namespace=self._uuid_ns, host='some host') except Exception: self.fail('could not generate agent resource provider uuid') def test_device_resource_provider_uuid(self): try: # assertNotRaises place_utils.device_resource_provider_uuid( namespace=self._uuid_ns, host='some host', device='some device') except Exception: self.fail('could not generate device resource provider uuid') def test_agent_resource_provider_uuid_stable(self): uuid_a = place_utils.agent_resource_provider_uuid( namespace=self._uuid_ns, host='somehost') uuid_b = place_utils.agent_resource_provider_uuid( namespace=self._uuid_ns, host='somehost') self.assertEqual(uuid_a, uuid_b) def test_device_resource_provider_uuid_stable(self): uuid_a = place_utils.device_resource_provider_uuid( namespace=self._uuid_ns, host='somehost', device='some-device') uuid_b = place_utils.device_resource_provider_uuid( namespace=self._uuid_ns, host='somehost', device='some-device') self.assertEqual(uuid_a, uuid_b) def test_parse_rp_bandwidths(self): self.assertEqual( {}, place_utils.parse_rp_bandwidths([]), ) self.assertEqual( {'eth0': {'egress': None, 'ingress': None}}, place_utils.parse_rp_bandwidths(['eth0']), ) self.assertEqual( {'eth0': {'egress': None, 'ingress': None}}, place_utils.parse_rp_bandwidths(['eth0::']), ) self.assertRaises( ValueError, place_utils.parse_rp_bandwidths, ['eth0::', 'eth0::'], ) self.assertRaises( ValueError, place_utils.parse_rp_bandwidths, ['eth0:not a number:not a number'], ) self.assertEqual( {'eth0': {'egress': 1, 'ingress': None}}, place_utils.parse_rp_bandwidths(['eth0:1:']), ) self.assertEqual( {'eth0': {'egress': None, 'ingress': 1}}, place_utils.parse_rp_bandwidths(['eth0::1']), ) self.assertEqual( {'eth0': {'egress': 1, 'ingress': 1}}, place_utils.parse_rp_bandwidths(['eth0:1:1']), ) self.assertEqual( {'eth0': {'egress': 1, 'ingress': 1}, 'eth1': {'egress': 10, 'ingress': 10}}, place_utils.parse_rp_bandwidths(['eth0:1:1', 'eth1:10:10']), ) def test_parse_rp_inventory_defaults(self): self.assertEqual( {}, place_utils.parse_rp_inventory_defaults({}), ) self.assertRaises( ValueError, place_utils.parse_rp_inventory_defaults, {'allocation_ratio': '-1.0'} ) self.assertEqual( {'allocation_ratio': 1.0}, place_utils.parse_rp_inventory_defaults( {'allocation_ratio': '1.0'}), ) self.assertRaises( ValueError, place_utils.parse_rp_inventory_defaults, {'min_unit': '-1'} ) self.assertEqual( {'min_unit': 1}, place_utils.parse_rp_inventory_defaults( {'min_unit': '1'}), ) self.assertRaises( ValueError, place_utils.parse_rp_inventory_defaults, {'no such inventory parameter': 1} ) neutron-lib-2.3.0/neutron_lib/tests/unit/placement/__init__.py0000664000175000017500000000000013641427107024511 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/plugins/0000775000175000017500000000000013641427200022115 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/plugins/test_utils.py0000664000175000017500000002702713641427107024704 0ustar zuulzuul00000000000000# Copyright (c) 2015 IBM Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import hashlib from unittest import mock from oslo_utils import excutils from oslo_utils import uuidutils from neutron_lib.api.definitions import portbindings_extended as pb_ext from neutron_lib import constants from neutron_lib import exceptions from neutron_lib.plugins import utils from neutron_lib.tests import _base as base LONG_NAME1 = "A_REALLY_LONG_INTERFACE_NAME1" LONG_NAME2 = "A_REALLY_LONG_INTERFACE_NAME2" SHORT_NAME = "SHORT" MOCKED_HASH = "mockedhash" class MockSHA(object): def hexdigest(self): return MOCKED_HASH class TestUtils(base.BaseTestCase): def test_is_valid_vlan_tag(self): for v in [constants.MIN_VLAN_TAG, constants.MIN_VLAN_TAG + 2, constants.MAX_VLAN_TAG, constants.MAX_VLAN_TAG - 2]: self.assertTrue(utils.is_valid_vlan_tag(v)) def test_is_valid_vlan_tag_invalid_data(self): for v in [constants.MIN_VLAN_TAG - 1, constants.MIN_VLAN_TAG - 2, constants.MAX_VLAN_TAG + 1, constants.MAX_VLAN_TAG + 2]: self.assertFalse(utils.is_valid_vlan_tag(v)) def test_verify_vlan_range(self): for v in [(constants.MIN_VLAN_TAG, constants.MIN_VLAN_TAG + 2), (constants.MIN_VLAN_TAG + 2, constants.MAX_VLAN_TAG - 2)]: self.assertIsNone(utils.verify_vlan_range(v)) def test_verify_vlan_range_invalid_range(self): for v in [(constants.MIN_VLAN_TAG, constants.MAX_VLAN_TAG + 2), (constants.MIN_VLAN_TAG + 4, constants.MIN_VLAN_TAG + 1)]: self.assertRaises(exceptions.NetworkVlanRangeError, utils.verify_vlan_range, v) def test_parse_network_vlan_range(self): self.assertEqual( ('n1', (1, 3)), utils.parse_network_vlan_range('n1:1:3')) self.assertEqual( ('n1', (1, 1111)), utils.parse_network_vlan_range('n1:1:1111')) def test_parse_network_vlan_range_invalid_range(self): self.assertRaises(exceptions.NetworkVlanRangeError, utils.parse_network_vlan_range, 'n1:1,4') def test_parse_network_vlan_range_missing_network(self): self.assertRaises(exceptions.PhysicalNetworkNameError, utils.parse_network_vlan_range, ':1:4') def test_parse_network_vlan_range_invalid_min_type(self): self.assertRaises(exceptions.NetworkVlanRangeError, utils.parse_network_vlan_range, 'n1:a:4') def test_parse_network_vlan_ranges(self): ranges = utils.parse_network_vlan_ranges(['n1:1:3', 'n2:2:4']) self.assertEqual(2, len(ranges.keys())) self.assertIn('n1', ranges.keys()) self.assertIn('n2', ranges.keys()) self.assertEqual(2, len(ranges['n1'][0])) self.assertEqual(1, ranges['n1'][0][0]) self.assertEqual(3, ranges['n1'][0][1]) self.assertEqual(2, len(ranges['n2'][0])) self.assertEqual(2, ranges['n2'][0][0]) self.assertEqual(4, ranges['n2'][0][1]) def test_is_valid_gre_id(self): for v in [constants.MIN_GRE_ID, constants.MIN_GRE_ID + 2, constants.MAX_GRE_ID, constants.MAX_GRE_ID - 2]: self.assertTrue(utils.is_valid_gre_id(v)) def test_is_valid_gre_id_invalid_id(self): for v in [constants.MIN_GRE_ID - 1, constants.MIN_GRE_ID - 2, True, 'z', 99.999, []]: self.assertFalse(utils.is_valid_gre_id(v)) def test_is_valid_vxlan_vni(self): for v in [constants.MIN_VXLAN_VNI, constants.MAX_VXLAN_VNI, constants.MIN_VXLAN_VNI + 1, constants.MAX_VXLAN_VNI - 1]: self.assertTrue(utils.is_valid_vxlan_vni(v)) def test_is_valid_vxlan_vni_invalid_values(self): for v in [constants.MIN_VXLAN_VNI - 1, constants.MAX_VXLAN_VNI + 1, True, 'a', False, {}]: self.assertFalse(utils.is_valid_vxlan_vni(v)) def test_is_valid_geneve_vni(self): for v in [constants.MIN_GENEVE_VNI, constants.MAX_GENEVE_VNI, constants.MIN_GENEVE_VNI + 1, constants.MAX_GENEVE_VNI - 1]: self.assertTrue(utils.is_valid_geneve_vni(v)) def test_is_valid_geneve_vni_invalid_values(self): for v in [constants.MIN_GENEVE_VNI - 1, constants.MAX_GENEVE_VNI + 1, True, False, (), 'True']: self.assertFalse(utils.is_valid_geneve_vni(v)) def test_verify_tunnel_range_known_tunnel_type(self): mock_fns = [mock.Mock(return_value=False) for _ in range(3)] mock_map = { constants.TYPE_GRE: mock_fns[0], constants.TYPE_VXLAN: mock_fns[1], constants.TYPE_GENEVE: mock_fns[2] } with mock.patch.dict(utils._TUNNEL_MAPPINGS, mock_map): for t in [constants.TYPE_GRE, constants.TYPE_VXLAN, constants.TYPE_GENEVE]: self.assertRaises( exceptions.NetworkTunnelRangeError, utils.verify_tunnel_range, [0, 1], t) for f in mock_fns: f.assert_called_once_with(0) def test_verify_tunnel_range_invalid_range(self): for r in [[1, 0], [0, -1], [2, 1]]: self.assertRaises( exceptions.NetworkTunnelRangeError, utils.verify_tunnel_range, r, constants.TYPE_FLAT) def test_verify_tunnel_range(self): for r in [[0, 1], [-1, 0], [1, 2]]: self.assertIsNone( utils.verify_tunnel_range(r, constants.TYPE_FLAT)) def test_delete_port_on_error(self): core_plugin = mock.Mock() with mock.patch.object(excutils, 'save_and_reraise_exception'): with mock.patch.object(utils, 'LOG'): with utils.delete_port_on_error(core_plugin, 'ctx', '1'): raise Exception() core_plugin.delete_port.assert_called_once_with( 'ctx', '1', l3_port_check=False) def test_update_port_on_error(self): core_plugin = mock.Mock() with mock.patch.object(excutils, 'save_and_reraise_exception'): with mock.patch.object(utils, 'LOG'): with utils.update_port_on_error(core_plugin, 'ctx', '1', '2'): raise Exception() core_plugin.update_port.assert_called_once_with( 'ctx', '1', {'port': '2'}) @mock.patch.object(hashlib, 'sha1', return_value=MockSHA()) def test_get_interface_name(self, mock_sha1): prefix = "pre-" prefix_long = "long_prefix" prefix_exceeds_max_dev_len = "much_too_long_prefix" hash_used = MOCKED_HASH[0:6] self.assertEqual("A_REALLY_" + hash_used, utils.get_interface_name(LONG_NAME1)) self.assertEqual("SHORT", utils.get_interface_name(SHORT_NAME)) self.assertEqual("pre-A_REA" + hash_used, utils.get_interface_name(LONG_NAME1, prefix=prefix)) self.assertEqual("pre-SHORT", utils.get_interface_name(SHORT_NAME, prefix=prefix)) # len(prefix) > max_device_len - len(hash_used) self.assertRaises(ValueError, utils.get_interface_name, SHORT_NAME, prefix_long) # len(prefix) > max_device_len self.assertRaises(ValueError, utils.get_interface_name, SHORT_NAME, prefix=prefix_exceeds_max_dev_len) def test_get_interface_uniqueness(self): prefix = "prefix-" if_prefix1 = utils.get_interface_name(LONG_NAME1, prefix=prefix) if_prefix2 = utils.get_interface_name(LONG_NAME2, prefix=prefix) self.assertNotEqual(if_prefix1, if_prefix2) @mock.patch.object(hashlib, 'sha1', return_value=MockSHA()) def test_get_interface_max_len(self, mock_sha1): self.assertEqual(constants.DEVICE_NAME_MAX_LEN, len(utils.get_interface_name(LONG_NAME1))) self.assertEqual(10, len(utils.get_interface_name(LONG_NAME1, max_len=10))) self.assertEqual(12, len(utils.get_interface_name(LONG_NAME1, prefix="pre-", max_len=12))) def test_create_network(self): mock_plugin = mock.Mock() mock_plugin.create_network = lambda c, n: n mock_ctx = mock.Mock() mock_ctx.project_id = 'p1' net = utils.create_network( mock_plugin, mock_ctx, {'network': {'name': 'n1'}}) self.assertDictEqual( {'project_id': 'p1', 'admin_state_up': True, 'shared': False, 'tenant_id': 'p1', 'name': 'n1'}, net['network']) def test_create_subnet(self): mock_plugin = mock.Mock() mock_plugin.create_subnet = lambda c, s: s mock_ctx = mock.Mock() mock_ctx.project_id = 'p1' net_id = uuidutils.generate_uuid() snet = utils.create_subnet( mock_plugin, mock_ctx, {'subnet': {'network_id': net_id, 'ip_version': 4}}) self.assertEqual('p1', snet['subnet']['tenant_id']) self.assertEqual('p1', snet['subnet']['project_id']) self.assertEqual(4, snet['subnet']['ip_version']) self.assertEqual(net_id, snet['subnet']['network_id']) def test_create_port(self): mock_plugin = mock.Mock() mock_plugin.create_port = lambda c, p: p mock_ctx = mock.Mock() mock_ctx.project_id = 'p1' net_id = uuidutils.generate_uuid() port = utils.create_port( mock_plugin, mock_ctx, {'port': {'network_id': net_id, 'name': 'aport'}}) self.assertEqual('p1', port['port']['tenant_id']) self.assertEqual('p1', port['port']['project_id']) self.assertEqual('aport', port['port']['name']) self.assertEqual(net_id, port['port']['network_id']) def test_get_port_binding_by_status_and_host(self): bindings = [] self.assertIsNone(utils.get_port_binding_by_status_and_host( bindings, constants.INACTIVE)) bindings.extend([{pb_ext.STATUS: constants.INACTIVE, pb_ext.HOST: 'host-1'}, {pb_ext.STATUS: constants.INACTIVE, pb_ext.HOST: 'host-2'}]) self.assertEqual( 'host-1', utils.get_port_binding_by_status_and_host( bindings, constants.INACTIVE)[pb_ext.HOST]) self.assertEqual( 'host-2', utils.get_port_binding_by_status_and_host( bindings, constants.INACTIVE, host='host-2')[pb_ext.HOST]) self.assertIsNone(utils.get_port_binding_by_status_and_host( bindings, constants.ACTIVE)) self.assertRaises(exceptions.PortBindingNotFound, utils.get_port_binding_by_status_and_host, bindings, constants.ACTIVE, 'host', True, 'port_id') neutron-lib-2.3.0/neutron_lib/tests/unit/plugins/ml2/0000775000175000017500000000000013641427200022607 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/plugins/ml2/__init__.py0000664000175000017500000000000013641427107024714 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/plugins/ml2/test_api.py0000664000175000017500000000246513641427107025006 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.plugins.ml2 import api from neutron_lib.tests import _base as base class _MechanismDriver(api.MechanismDriver): def bind_port(s, c): return c def initialize(self): pass class TestMechanismDriver(base.BaseTestCase): def test__supports_port_binding(self): self.assertTrue(_MechanismDriver()._supports_port_binding) def test_get_workers(self): self.assertEqual((), _MechanismDriver().get_workers()) def test_filter_hosts_with_segment_access(self): dummy_token = ["X"] self.assertEqual( dummy_token, _MechanismDriver().filter_hosts_with_segment_access( dummy_token, dummy_token, dummy_token, dummy_token)) neutron-lib-2.3.0/neutron_lib/tests/unit/plugins/test_directory.py0000664000175000017500000000666513641427107025555 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.plugins import directory from neutron_lib.tests import _base as base def fake_plugin(): pass class DirectoryTestCase(base.BaseTestCase): def test__create_plugin_directory(self): self.assertIsNotNone(directory._create_plugin_directory()) def test__get_plugin_directory(self): self.assertIsNotNone(directory._get_plugin_directory()) def test_add_plugin(self): directory.add_plugin('foo', fake_plugin) self.assertIn('foo', directory.get_plugins()) def test_get_plugin_core_none(self): self.assertIsNone(directory.get_plugin()) def test_get_plugin_alias_none(self): self.assertIsNone(directory.get_plugin('foo')) def test_get_plugin_core(self): directory.add_plugin('CORE', fake_plugin) self.assertIsNotNone(directory.get_plugin()) def test_get_plugin_alias(self): directory.add_plugin('foo', fake_plugin) self.assertIsNotNone(directory.get_plugin('foo')) def test_get_plugins_none(self): self.assertFalse(directory.get_plugins()) def test_get_unique_plugins_none(self): self.assertFalse(directory.get_unique_plugins()) def test_get_plugins(self): directory.add_plugin('CORE', fake_plugin) self.assertIsNotNone(directory.get_plugins()) def test_get_unique_plugins(self): directory.add_plugin('foo1', fake_plugin) directory.add_plugin('foo2', fake_plugin) self.assertEqual(1, len(directory.get_unique_plugins())) def test_is_loaded(self): self.assertFalse(directory.is_loaded()) directory.add_plugin('foo1', fake_plugin) self.assertTrue(directory.is_loaded()) class PluginDirectoryTestCase(base.BaseTestCase): def setUp(self): super(PluginDirectoryTestCase, self).setUp() self.plugin_directory = directory._PluginDirectory() def test_add_plugin(self): self.plugin_directory.add_plugin('foo', 'bar') self.assertEqual(1, len(self.plugin_directory._plugins)) def test_get_plugin_not_found(self): self.assertIsNone(self.plugin_directory.get_plugin('foo')) def test_get_plugin_found(self): self.plugin_directory._plugins = {'foo': lambda *x, **y: 'bar'} plugin = self.plugin_directory.get_plugin('foo') self.assertEqual('bar', plugin()) def test_plugins(self): self.plugin_directory._plugins = {'foo': lambda *x, **y: 'bar'} self.assertIsNotNone(self.plugin_directory.plugins) def test_unique_plugins(self): self.plugin_directory._plugins = { 'foo1': fake_plugin, 'foo2': fake_plugin, } self.assertEqual(1, len(self.plugin_directory.unique_plugins)) def test_is_loaded(self): self.assertFalse(self.plugin_directory.is_loaded) self.plugin_directory._plugins = {'foo': lambda *x, **y: 'bar'} self.assertTrue(self.plugin_directory.is_loaded) neutron-lib-2.3.0/neutron_lib/tests/unit/plugins/__init__.py0000664000175000017500000000000013641427107024222 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/legacy/0000775000175000017500000000000013641427200021700 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/legacy/__init__.py0000664000175000017500000000000013641427107024005 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/test_worker.py0000664000175000017500000001165713641427107023376 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from unittest import mock from neutron_lib.callbacks import events from neutron_lib.callbacks import resources from neutron_lib import fixture from neutron_lib import worker from neutron_lib.tests import _base as base class _BaseWorker(worker.BaseWorker): def reset(self): pass def stop(self): pass def wait(self): pass # Same as _BaseWorker, but looks like a process launch instead of eventlet class _ProcWorker(_BaseWorker): def __init__(self, worker_process_count=1, set_proctitle='on'): super(_ProcWorker, self).__init__(worker_process_count, set_proctitle) self._my_pid = -1 # make it appear to be a separate process class TestBaseWorker(base.BaseTestCase): def setUp(self): super(TestBaseWorker, self).setUp() self._reg = mock.Mock() self.useFixture(fixture.CallbackRegistryFixture( callback_manager=self._reg)) def test_worker_process_count(self): self.assertEqual(9, _BaseWorker( worker_process_count=9).worker_process_count) def test_start_callback_event(self): base_worker = _BaseWorker() base_worker.start() self._reg.notify.assert_called_once_with( resources.PROCESS, events.AFTER_INIT, base_worker.start) # Forked workers, should call setproctitle def test_proctitle_default(self): with mock.patch('setproctitle.setproctitle') as spt: _ProcWorker().start() self.assertRegex(spt.call_args[0][0], '^neutron-server: _ProcWorker \\(.*python.*\\)$') def test_proctitle_custom_desc(self): with mock.patch('setproctitle.setproctitle') as spt: _ProcWorker().start(desc="fancy title") self.assertRegex(spt.call_args[0][0], '^neutron-server: fancy title \\(.*python.*\\)$') def test_proctitle_custom_name(self): with mock.patch('setproctitle.setproctitle') as spt: _ProcWorker().start(name="tardis") self.assertRegex(spt.call_args[0][0], '^tardis: _ProcWorker \\(.*python.*\\)$') def test_proctitle_empty(self): with mock.patch('setproctitle.setproctitle') as spt: _ProcWorker().start(desc="") self.assertRegex(spt.call_args[0][0], '^neutron-server: _ProcWorker \\(.*python.*\\)$') def test_proctitle_nonstring(self): with mock.patch('setproctitle.setproctitle') as spt: _ProcWorker().start(desc=2) self.assertRegex(spt.call_args[0][0], '^neutron-server: 2 \\(.*python.*\\)$') def test_proctitle_both_empty(self): with mock.patch('setproctitle.setproctitle') as spt: _ProcWorker().start(name="", desc="") self.assertRegex(spt.call_args[0][0], '^: _ProcWorker \\(.*python.*\\)$') def test_proctitle_name_none(self): with mock.patch('setproctitle.setproctitle') as spt: _ProcWorker().start(name=None) self.assertRegex(spt.call_args[0][0], '^None: _ProcWorker \\(.*python.*\\)$') # Forked, but proctitle disabled def test_proctitle_off(self): with mock.patch('setproctitle.setproctitle') as spt: _ProcWorker(set_proctitle='off').start() self.assertIsNone(spt.call_args) # Eventlet style worker, should never call setproctitle def test_proctitle_same_process(self): with mock.patch('setproctitle.setproctitle') as spt: _BaseWorker().start() self.assertIsNone(spt.call_args) def test_setproctitle_on(self): with mock.patch('setproctitle.setproctitle') as spt: _ProcWorker(set_proctitle='on').start(name="foo", desc="bar") self.assertRegex(spt.call_args[0][0], '^foo: bar \\(.*python.*\\)$') def test_setproctitle_off(self): with mock.patch('setproctitle.setproctitle') as spt: _ProcWorker(set_proctitle='off').start(name="foo", desc="bar") self.assertIsNone(spt.call_args) def test_setproctitle_brief(self): with mock.patch('setproctitle.setproctitle') as spt: _ProcWorker(set_proctitle='brief').start(name="foo", desc="bar") self.assertEqual(spt.call_args[0][0], 'foo: bar') neutron-lib-2.3.0/neutron_lib/tests/unit/objects/0000775000175000017500000000000013641427200022065 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/objects/test_common_types.py0000664000175000017500000003051713641427107026226 0ustar zuulzuul00000000000000# Copyright 2016 OpenStack Foundation # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import abc import itertools from oslo_serialization import jsonutils from neutron_lib import constants as const from neutron_lib.db import constants as db_const from neutron_lib.objects import common_types from neutron_lib.tests import _base as test_base from neutron_lib.tests import tools from neutron_lib.utils import net class TestField(object): def test_coerce_good_values(self): for in_val, out_val in self.coerce_good_values: self.assertEqual(out_val, self.field.coerce('obj', 'attr', in_val)) def test_coerce_bad_values(self): for in_val in self.coerce_bad_values: self.assertRaises((TypeError, ValueError), self.field.coerce, 'obj', 'attr', in_val) def test_to_primitive(self): for in_val, prim_val in self.to_primitive_values: self.assertEqual(prim_val, self.field.to_primitive('obj', 'attr', in_val)) def test_to_primitive_json_serializable(self): for in_val, _ in self.to_primitive_values: prim = self.field.to_primitive('obj', 'attr', in_val) jsencoded = jsonutils.dumps(prim) self.assertEqual(prim, jsonutils.loads(jsencoded)) def test_from_primitive(self): class ObjectLikeThing(object): _context = 'context' for prim_val, out_val in self.from_primitive_values: from_prim = self.field.from_primitive(ObjectLikeThing, 'attr', prim_val) self.assertEqual(out_val, from_prim) # ensure it's coercable for sanity self.field.coerce('obj', 'attr', from_prim) @abc.abstractmethod def test_stringify(self): '''This test should validate stringify() format for new field types.''' class IPV6ModeEnumFieldTest(test_base.BaseTestCase, TestField): def setUp(self): super(IPV6ModeEnumFieldTest, self).setUp() self.field = common_types.IPV6ModeEnumField() self.coerce_good_values = [(mode, mode) for mode in const.IPV6_MODES] self.coerce_bad_values = ['6', 4, 'type', 'slaacc'] self.to_primitive_values = self.coerce_good_values self.from_primitive_values = self.coerce_good_values def test_stringify(self): for in_val, out_val in self.coerce_good_values: self.assertEqual("'%s'" % in_val, self.field.stringify(in_val)) class DscpMarkFieldTest(test_base.BaseTestCase, TestField): def setUp(self): super(DscpMarkFieldTest, self).setUp() self.field = common_types.DscpMarkField() self.coerce_good_values = [(val, val) for val in const.VALID_DSCP_MARKS] self.coerce_bad_values = ['6', 'str', [], {}, object()] self.to_primitive_values = self.coerce_good_values self.from_primitive_values = self.coerce_good_values def test_stringify(self): for in_val, out_val in self.coerce_good_values: self.assertEqual("%s" % in_val, self.field.stringify(in_val)) class IPNetworkPrefixLenFieldTest(test_base.BaseTestCase, TestField): def setUp(self): super(IPNetworkPrefixLenFieldTest, self).setUp() self.field = common_types.IPNetworkPrefixLenField() self.coerce_good_values = [(x, x) for x in (0, 32, 128, 42)] self.coerce_bad_values = ['len', '1', 129, -1] self.to_primitive_values = self.coerce_good_values self.from_primitive_values = self.coerce_good_values def test_stringify(self): for in_val, out_val in self.coerce_good_values: self.assertEqual("%s" % in_val, self.field.stringify(in_val)) class MACAddressFieldTest(test_base.BaseTestCase, TestField): def setUp(self): super(MACAddressFieldTest, self).setUp() self.field = common_types.MACAddressField() mac1 = tools.get_random_EUI() mac2 = tools.get_random_EUI() self.coerce_good_values = [(mac1, mac1), (mac2, mac2)] self.coerce_bad_values = [ 'XXXX', 'ypp', 'g3:vvv', # the field type is strict and does not allow to pass strings, even # if they represent a valid MAC address net.get_random_mac('fe:16:3e:00:00:00'.split(':')), ] self.to_primitive_values = ((a1, str(a2)) for a1, a2 in self.coerce_good_values) self.from_primitive_values = ((a2, a1) for a1, a2 in self.to_primitive_values) def test_stringify(self): for in_val, out_val in self.coerce_good_values: self.assertEqual('%s' % in_val, self.field.stringify(in_val)) class IPNetworkFieldTest(test_base.BaseTestCase, TestField): def setUp(self): super(IPNetworkFieldTest, self).setUp() self.field = common_types.IPNetworkField() addrs = [ tools.get_random_ip_network(version=ip_version) for ip_version in const.IP_ALLOWED_VERSIONS ] self.coerce_good_values = [(addr, addr) for addr in addrs] self.coerce_bad_values = [ 'ypp', 'g3:vvv', # the field type is strict and does not allow to pass strings, even # if they represent a valid IP network '10.0.0.0/24', ] self.to_primitive_values = ((a1, str(a2)) for a1, a2 in self.coerce_good_values) self.from_primitive_values = ((a2, a1) for a1, a2 in self.to_primitive_values) def test_stringify(self): for in_val, out_val in self.coerce_good_values: self.assertEqual('%s' % in_val, self.field.stringify(in_val)) class IPVersionEnumFieldTest(test_base.BaseTestCase, TestField): def setUp(self): super(IPVersionEnumFieldTest, self).setUp() self.field = common_types.IPVersionEnumField() self.coerce_good_values = [(val, val) for val in const.IP_ALLOWED_VERSIONS] self.coerce_bad_values = [5, 0, -1, 'str'] self.to_primitive_values = self.coerce_good_values self.from_primitive_values = self.coerce_good_values def test_stringify(self): for in_val, out_val in self.coerce_good_values: self.assertEqual("%s" % in_val, self.field.stringify(in_val)) class FlowDirectionEnumFieldTest(test_base.BaseTestCase, TestField): def setUp(self): super(FlowDirectionEnumFieldTest, self).setUp() self.field = common_types.FlowDirectionEnumField() self.coerce_good_values = [(val, val) for val in const.VALID_DIRECTIONS] self.coerce_bad_values = ['test', '8', 10, []] self.to_primitive_values = self.coerce_good_values self.from_primitive_values = self.coerce_good_values def test_stringify(self): for in_val, out_val in self.coerce_good_values: self.assertEqual("'%s'" % in_val, self.field.stringify(in_val)) class DomainNameFieldTest(test_base.BaseTestCase, TestField): def setUp(self): super(DomainNameFieldTest, self).setUp() self.field = common_types.DomainNameField() self.coerce_good_values = [ (val, val) for val in ('www.google.com', 'hostname', '1abc.com') ] self.coerce_bad_values = ['x' * (db_const.FQDN_FIELD_SIZE + 1), 10, []] self.to_primitive_values = self.coerce_good_values self.from_primitive_values = self.coerce_good_values def test_stringify(self): for in_val, out_val in self.coerce_good_values: self.assertEqual("'%s'" % in_val, self.field.stringify(in_val)) class EtherTypeEnumFieldTest(test_base.BaseTestCase, TestField): def setUp(self): super(EtherTypeEnumFieldTest, self).setUp() self.field = common_types.EtherTypeEnumField() self.coerce_good_values = [(val, val) for val in const.VALID_ETHERTYPES] self.coerce_bad_values = ['IpV4', 8, 'str', 'ipv6'] self.to_primitive_values = self.coerce_good_values self.from_primitive_values = self.coerce_good_values def test_stringify(self): for in_val, out_val in self.coerce_good_values: self.assertEqual("'%s'" % in_val, self.field.stringify(in_val)) class IpProtocolEnumFieldTest(test_base.BaseTestCase, TestField): def setUp(self): super(IpProtocolEnumFieldTest, self).setUp() self.field = common_types.IpProtocolEnumField() self.coerce_good_values = [ (val, val) for val in itertools.chain( const.IP_PROTOCOL_MAP.keys(), [str(v) for v in range(256)] ) ] self.coerce_bad_values = ['test', 'Udp', 256] self.to_primitive_values = self.coerce_good_values self.from_primitive_values = self.coerce_good_values def test_stringify(self): for in_val, out_val in self.coerce_good_values: self.assertEqual("'%s'" % in_val, self.field.stringify(in_val)) class UUIDFieldTest(test_base.BaseTestCase, TestField): def setUp(self): super(UUIDFieldTest, self).setUp() self.field = common_types.UUIDField() self.coerce_good_values = [ ('f1d9cb3f-c263-45d3-907c-d12a9ef1629e', 'f1d9cb3f-c263-45d3-907c-d12a9ef1629e'), ('7188f6637cbd4097a3b1d1bb7897c7c0', '7188f6637cbd4097a3b1d1bb7897c7c0')] self.coerce_bad_values = [ 'f1d9cb3f-c263-45d3-907c-d12a9ef16zzz', '7188f6637cbd4097a3b1d1bb7897'] self.to_primitive_values = self.coerce_good_values self.from_primitive_values = self.coerce_good_values def test_stringify(self): for in_val, out_val in self.coerce_good_values: self.assertEqual('%s' % in_val, self.field.stringify(in_val)) class DictOfMiscValuesFieldTest(test_base.BaseTestCase, TestField): def setUp(self): super(DictOfMiscValuesFieldTest, self).setUp() self.field = common_types.DictOfMiscValues test_dict_1 = {'a': True, 'b': 1.23, 'c': ['1', 1.23, True], 'd': {'aa': 'zz'}, 'e': '10.0.0.1'} test_dict_str = jsonutils.dumps(test_dict_1) self.coerce_good_values = [ (test_dict_1, test_dict_1), (test_dict_str, test_dict_1) ] self.coerce_bad_values = [str(test_dict_1), '{"a":}'] self.to_primitive_values = [ (test_dict_1, test_dict_str) ] self.from_primitive_values = [ (test_dict_str, test_dict_1) ] def test_stringify(self): for in_val, out_val in self.coerce_good_values: self.assertEqual(jsonutils.dumps(in_val), self.field.stringify(in_val)) class NetworkSegmentRangeNetworkTypeEnumFieldTest(test_base.BaseTestCase, TestField): def setUp(self): super(NetworkSegmentRangeNetworkTypeEnumFieldTest, self).setUp() self.field = common_types.NetworkSegmentRangeNetworkTypeEnumField() self.coerce_good_values = [(val, val) for val in [const.TYPE_VLAN, const.TYPE_VXLAN, const.TYPE_GRE, const.TYPE_GENEVE]] self.coerce_bad_values = [const.TYPE_FLAT, 'foo-network-type'] self.to_primitive_values = self.coerce_good_values self.from_primitive_values = self.coerce_good_values def test_stringify(self): for in_val, out_val in self.coerce_good_values: self.assertEqual("'%s'" % in_val, self.field.stringify(in_val)) neutron-lib-2.3.0/neutron_lib/tests/unit/objects/test_utils.py0000664000175000017500000000506213641427107024647 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from unittest import mock from neutron_lib.objects import utils as obj_utils from neutron_lib.tests import _base as base class TestUtils(base.BaseTestCase): def test_get_objects_with_filters_not_in(self): class FakeColumn(object): def __init__(self, column): self.column = column def in_(self, value): self.value = value return self def __invert__(self): return list(set(self.column) - set(self.value)) filter_obj = obj_utils.NotIn([1, 2, 3]) fake_column = FakeColumn([1, 2, 4, 5]) self.assertEqual([4, 5], sorted(filter_obj.filter(fake_column))) fake_column = FakeColumn([1, 2]) self.assertEqual([], filter_obj.filter(fake_column)) fake_column = FakeColumn([4, 5]) self.assertEqual([4, 5], sorted(filter_obj.filter(fake_column))) def test_get_objects_with_filters_not_equal(self): class FakeColumn(object): def __init__(self, column): self.column = column def __ne__(self, value): return [item for item in self.column if item != value] filter_obj = obj_utils.NotEqual(1) fake_column = FakeColumn([1, 2, 4, 5]) self.assertEqual([2, 4, 5], sorted(filter_obj.filter(fake_column))) fake_column = FakeColumn([1]) self.assertEqual([], filter_obj.filter(fake_column)) fake_column = FakeColumn([4, 5]) self.assertEqual([4, 5], sorted(filter_obj.filter(fake_column))) def test_get_updatable_fields(self): mock_class = mock.Mock() mock_class.fields_no_update = [0, 2, 6] mock_fields = mock.Mock() mock_fields.copy.return_value = {k: k for k in range(7)} updatable = obj_utils.get_updatable_fields(mock_class, mock_fields) self.assertEqual([1, 3, 4, 5], sorted(list(updatable.keys()))) neutron-lib-2.3.0/neutron_lib/tests/unit/objects/__init__.py0000664000175000017500000000000013641427107024172 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/api/0000775000175000017500000000000013641427200021205 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/api/test_conversions.py0000664000175000017500000003376613641427107025213 0ustar zuulzuul00000000000000# Copyright 2012 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from unittest import mock import netaddr import testtools from neutron_lib.api import converters from neutron_lib import constants from neutron_lib import exceptions as n_exc from neutron_lib.tests import _base as base from neutron_lib.tests import tools class TestConvertToBoolean(base.BaseTestCase): def test_convert_to_boolean_bool(self): self.assertIs(converters.convert_to_boolean(True), True) self.assertIs(converters.convert_to_boolean(False), False) def test_convert_to_boolean_int(self): self.assertIs(converters.convert_to_boolean(0), False) self.assertIs(converters.convert_to_boolean(1), True) self.assertRaises(n_exc.InvalidInput, converters.convert_to_boolean, 7) def test_convert_to_boolean_str(self): self.assertIs(converters.convert_to_boolean('True'), True) self.assertIs(converters.convert_to_boolean('true'), True) self.assertIs(converters.convert_to_boolean('False'), False) self.assertIs(converters.convert_to_boolean('false'), False) self.assertIs(converters.convert_to_boolean('0'), False) self.assertIs(converters.convert_to_boolean('1'), True) self.assertRaises(n_exc.InvalidInput, converters.convert_to_boolean, '7') def test_convert_to_boolean_if_not_none(self): self.assertIsNone(converters.convert_to_boolean_if_not_none(None)) self.assertIs(converters.convert_to_boolean_if_not_none(1), True) class TestConvertToInt(base.BaseTestCase): def test_convert_to_int_int(self): self.assertEqual(-1, converters.convert_to_int(-1)) self.assertEqual(0, converters.convert_to_int(0)) self.assertEqual(1, converters.convert_to_int(1)) def test_convert_to_int_if_not_none(self): self.assertEqual(-1, converters.convert_to_int_if_not_none(-1)) self.assertEqual(0, converters.convert_to_int_if_not_none(0)) self.assertEqual(1, converters.convert_to_int_if_not_none(1)) self.assertIsNone(converters.convert_to_int_if_not_none(None)) def test_convert_to_int_str(self): self.assertEqual(4, converters.convert_to_int('4')) self.assertEqual(6, converters.convert_to_int('6')) self.assertRaises(n_exc.InvalidInput, converters.convert_to_int, 'garbage') def test_convert_to_int_none(self): self.assertRaises(n_exc.InvalidInput, converters.convert_to_int, None) def test_convert_none_to_empty_list_none(self): self.assertEqual([], converters.convert_none_to_empty_list(None)) def test_convert_none_to_empty_dict(self): self.assertEqual({}, converters.convert_none_to_empty_dict(None)) def test_convert_none_to_empty_list_value(self): values = ['1', 3, [], [1], {}, {'a': 3}] for value in values: self.assertEqual( value, converters.convert_none_to_empty_list(value)) class TestConvertToFloat(base.BaseTestCase): # NOTE: the routine being tested here is a plugin-specific extension # module. As the plugin split proceed towards its second phase this # test should either be remove, or the validation routine moved into # neutron.api.v2.attributes def test_convert_to_float_positve_value(self): self.assertEqual( 1.111, converters.convert_to_positive_float_or_none(1.111)) self.assertEqual(1, converters.convert_to_positive_float_or_none(1)) self.assertEqual(0, converters.convert_to_positive_float_or_none(0)) def test_convert_to_float_negative_value(self): self.assertRaises(n_exc.InvalidInput, converters.convert_to_positive_float_or_none, -1.11) def test_convert_to_float_string(self): self.assertEqual(4, converters.convert_to_positive_float_or_none('4')) self.assertEqual( 4.44, converters.convert_to_positive_float_or_none('4.44')) self.assertRaises(n_exc.InvalidInput, converters.convert_to_positive_float_or_none, 'garbage') def test_convert_to_float_none_value(self): self.assertIsNone(converters.convert_to_positive_float_or_none(None)) class TestConvertKvp(base.BaseTestCase): def test_convert_kvp_list_to_dict_succeeds_for_missing_values(self): result = converters.convert_kvp_list_to_dict(['True']) self.assertEqual({}, result) def test_convert_kvp_list_to_dict_succeeds_for_multiple_values(self): result = converters.convert_kvp_list_to_dict( ['a=b', 'a=c', 'a=c', 'b=a']) expected = {'a': tools.UnorderedList(['c', 'b']), 'b': ['a']} self.assertEqual(expected, result) def test_convert_kvp_list_to_dict_succeeds_for_values(self): result = converters.convert_kvp_list_to_dict(['a=b', 'c=d']) self.assertEqual({'a': ['b'], 'c': ['d']}, result) def test_convert_kvp_str_to_list_fails_for_missing_key(self): with testtools.ExpectedException(n_exc.InvalidInput): converters.convert_kvp_str_to_list('=a') def test_convert_kvp_str_to_list_fails_for_missing_equals(self): with testtools.ExpectedException(n_exc.InvalidInput): converters.convert_kvp_str_to_list('a') def test_convert_kvp_str_to_list_succeeds_for_one_equals(self): result = converters.convert_kvp_str_to_list('a=') self.assertEqual(['a', ''], result) def test_convert_kvp_str_to_list_succeeds_for_two_equals(self): result = converters.convert_kvp_str_to_list('a=a=a') self.assertEqual(['a', 'a=a'], result) class TestConvertToList(base.BaseTestCase): def test_convert_to_empty_list(self): for item in (None, [], (), {}): self.assertEqual([], converters.convert_to_list(item)) def test_convert_to_list_string(self): for item in ('', 'foo'): self.assertEqual([item], converters.convert_to_list(item)) def test_convert_to_list_iterable(self): for item in ([None], [1, 2, 3], (1, 2, 3), set([1, 2, 3]), ['foo']): self.assertEqual(list(item), converters.convert_to_list(item)) def test_convert_to_list_non_iterable(self): for item in (True, False, 1, 1.2, object()): self.assertEqual([item], converters.convert_to_list(item)) class TestConvertIPv6AddrCanonicalFormat(base.BaseTestCase): def test_convert_ipv6_address_extended_add_with_zeroes(self): result = converters.convert_ip_to_canonical_format( u'2001:0db8:0:0:0:0:0:0001') self.assertEqual(u'2001:db8::1', result) @testtools.skipIf(tools.is_bsd(), 'bug/1484837') def test_convert_ipv6_compressed_address_OSX_skip(self): result = converters.convert_ip_to_canonical_format( u'2001:db8:0:1:1:1:1:1') self.assertEqual(u'2001:db8:0:1:1:1:1:1', result) def test_convert_ipv6_extended_addr_to_compressed(self): result = converters.convert_ip_to_canonical_format( u"Fe80:0:0:0:0:0:0:1") self.assertEqual(u'fe80::1', result) def test_convert_ipv4_address(self): result = converters.convert_ip_to_canonical_format(u"192.168.1.1") self.assertEqual(u'192.168.1.1', result) def test_convert_None_address(self): result = converters.convert_ip_to_canonical_format(None) self.assertIsNone(result) def test_convert_invalid_address(self): result = converters.convert_ip_to_canonical_format("on") self.assertEqual("on", result) result = converters.convert_ip_to_canonical_format( u'192.168.1.1/32') self.assertEqual(u'192.168.1.1/32', result) result = converters.convert_ip_to_canonical_format( u'2001:db8:0:1:1:1:1:1/128') self.assertEqual(u'2001:db8:0:1:1:1:1:1/128', result) class TestConvertIPv6CIDRCanonicalFormat(base.BaseTestCase): def test_convert_ipv4_address_with_CIDR(self): result = converters.convert_cidr_to_canonical_format(u'192.168.1.1/24') self.assertEqual(u'192.168.1.1/24', result) def test_convert_ipv6_extended_addr_withcidr_to_compressed(self): result = converters.convert_cidr_to_canonical_format( u'Fe80:0:0:0:0:0:0:1/64') self.assertEqual(u'fe80::1/64', result) def test_convert_non_ip_addr_with_slash(self): with testtools.ExpectedException(n_exc.InvalidInput): converters.convert_cidr_to_canonical_format( u"Dormamu/DarkSeid/Vulture") class TestConvertStringToCaseInsensitive(base.BaseTestCase): def test_convert_string_to_lower(self): result = converters.convert_string_to_case_insensitive(u"THIS Is tEsT") self.assertIsInstance(result, str) def test_assert_error_on_non_string(self): for invalid in [[], 123]: with testtools.ExpectedException(n_exc.InvalidInput): converters.convert_string_to_case_insensitive(invalid) class TestConvertProtocol(base.BaseTestCase): def test_tcp_is_valid(self): result = converters.convert_to_protocol(constants.PROTO_NAME_TCP) self.assertEqual(constants.PROTO_NAME_TCP, result) proto_num_str = str(constants.PROTO_NUM_TCP) result = converters.convert_to_protocol(proto_num_str) self.assertEqual(proto_num_str, result) def test_udp_is_valid(self): result = converters.convert_to_protocol(constants.PROTO_NAME_UDP) self.assertEqual(constants.PROTO_NAME_UDP, result) proto_num_str = str(constants.PROTO_NUM_UDP) result = converters.convert_to_protocol(proto_num_str) self.assertEqual(proto_num_str, result) def test_icmp_is_valid(self): result = converters.convert_to_protocol(constants.PROTO_NAME_ICMP) self.assertEqual(constants.PROTO_NAME_ICMP, result) proto_num_str = str(constants.PROTO_NUM_ICMP) result = converters.convert_to_protocol(proto_num_str) self.assertEqual(proto_num_str, result) def test_numeric_is_valid(self): proto_num_str = str(constants.PROTO_NUM_IGMP) result = converters.convert_to_protocol(proto_num_str) self.assertEqual(proto_num_str, result) def test_numeric_too_high(self): with testtools.ExpectedException(n_exc.InvalidInput): converters.convert_to_protocol("300") def test_numeric_too_low(self): with testtools.ExpectedException(n_exc.InvalidInput): converters.convert_to_protocol("-1") def test_unknown_string(self): with testtools.ExpectedException(n_exc.InvalidInput): converters.convert_to_protocol("Invalid") class TestConvertToString(base.BaseTestCase): def test_data_is_string(self): self.assertEqual('10000', converters.convert_to_string('10000')) def test_data_is_integer(self): self.assertEqual('10000', converters.convert_to_string(10000)) def test_data_is_integer_zero(self): self.assertEqual('0', converters.convert_to_string(0)) def test_data_is_none(self): self.assertIsNone(converters.convert_to_string(None)) def test_data_is_empty_list(self): self.assertEqual('[]', converters.convert_to_string([])) def test_data_is_list(self): self.assertEqual("[1, 2, 3]", converters.convert_to_string([1, 2, 3])) def test_data_is_empty_dict(self): self.assertEqual('{}', converters.convert_to_string({})) def test_data_is_dict(self): self.assertEqual("{'foo': 'bar'}", converters.convert_to_string({'foo': 'bar'})) class TestConvertUppercasePrefix(base.BaseTestCase): def test_prefix_not_present(self): self.assertEqual('foobar', converters.convert_prefix_forced_case('foobar', 'bar')) def test_prefix_no_need_to_replace(self): self.assertEqual('FOObar', converters.convert_prefix_forced_case('FOObar', 'FOO')) def test_ucfirst_prefix_converted_1(self): self.assertEqual('Foobar', converters.convert_prefix_forced_case('foobar', 'Foo')) def test_lc_prefix_converted_2(self): self.assertEqual('foobar', converters.convert_prefix_forced_case('fOobar', 'foo')) def test_mixed_prefix_converted_1(self): self.assertEqual('fOoXbar', converters.convert_prefix_forced_case('Fooxbar', 'fOoX')) def test_shorter_string(self): self.assertEqual('fo', converters.convert_prefix_forced_case('fo', 'foo')) class TestConvertPortMacAddress(base.BaseTestCase): def test_mac_address_does_not_convert(self): valid_mac = 'fa:16:3e:b6:78:1f' self.assertEqual(valid_mac, converters.convert_to_mac_if_none(valid_mac)) @mock.patch('oslo_config.cfg.CONF') def test_convert_none_to_mac_address(self, CONF): CONF.base_mac = 'fa:16:3e:00:00:00' self.assertTrue( netaddr.valid_mac(converters.convert_to_mac_if_none(None))) neutron-lib-2.3.0/neutron_lib/tests/unit/api/test_faults.py0000664000175000017500000000164113641427107024124 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import webob.exc from neutron_lib.api import faults from neutron_lib.tests import _base as base class TestFaultMap(base.BaseTestCase): def test_extend_fault_map(self): fault_map_dict = {NotImplemented: webob.exc.HTTPServiceUnavailable} faults.FAULT_MAP.update(fault_map_dict) self.assertIn(NotImplemented, faults.FAULT_MAP) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/0000775000175000017500000000000013641427200023520 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_logging.py0000664000175000017500000000201513641427107026563 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import logging as log_api from neutron_lib.tests.unit.api.definitions import base EXTENSION_ATTRIBUTES = ( 'event', 'target_id', 'resource_type', 'enabled', 'resource_id', 'type', ) class LoggingApiTestCase(base.DefinitionBaseTestCase): extension_module = log_api extension_attributes = EXTENSION_ATTRIBUTES extension_resources = (log_api.LOGS, log_api.LOG_TYPES,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_security_groups_port_filtering.py0000664000175000017500000000152013641427107033512 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import security_groups_port_filtering from neutron_lib.tests.unit.api.definitions import base class SecurityGroupsPortFilteringDefinitionTestCase( base.DefinitionBaseTestCase): extension_module = security_groups_port_filtering neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_subnet_segmentid_enforce.py0000664000175000017500000000172213641427107032201 0ustar zuulzuul00000000000000# Copyright 2018 AT&T Corporation. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import segment from neutron_lib.api.definitions import subnet_segmentid_enforce from neutron_lib.tests.unit.api.definitions import base class SubnetSegmentIDEnforceDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = subnet_segmentid_enforce extension_attributes = (segment.SEGMENT_ID,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_dhcpagentscheduler.py0000664000175000017500000000220013641427107030765 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import dhcpagentscheduler from neutron_lib.tests.unit.api.definitions import base from neutron_lib.tests.unit.api.definitions import test_agent as agent class DHCPAgentSchedulerDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = dhcpagentscheduler extension_resources = agent.AgentDefinitionTestCase.extension_resources extension_attributes = agent.AgentDefinitionTestCase.extension_attributes extension_subresources = (dhcpagentscheduler.DHCP_AGENTS, dhcpagentscheduler.DHCP_NETS) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_agent_resources_synced.py0000664000175000017500000000161013641427107031672 0ustar zuulzuul00000000000000# Copyright (c) 2018 Ericsson # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import agent_resources_synced from neutron_lib.tests.unit.api.definitions import test_agent as base class AgentResourcesSyncedDefinitionTestCase(base.AgentDefinitionTestCase): extension_module = agent_resources_synced extension_attributes = (agent_resources_synced.RESOURCES_SYNCED,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_network_segment_range.py0000664000175000017500000000225613641427107031533 0ustar zuulzuul00000000000000# Copyright (c) 2018 Intel Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import network_segment_range from neutron_lib import constants from neutron_lib.tests.unit.api.definitions import base class NetworkSegmentRangeDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = network_segment_range extension_resources = (network_segment_range.COLLECTION_NAME,) extension_attributes = ('name', 'default', constants.SHARED, 'project_id', 'network_type', 'physical_network', 'minimum', 'maximum', 'used', 'available',) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_trunk_details.py0000664000175000017500000000161113641427107030006 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import trunk_details from neutron_lib.tests.unit.api.definitions import base class TrunkDetailsDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = trunk_details extension_resource = (trunk_details.COLLECTION_NAME,) extension_attributes = (trunk_details.TRUNK_DETAILS,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_l3_port_ip_change_not_allowed.py0000664000175000017500000000150113641427107033102 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import l3_port_ip_change_not_allowed from neutron_lib.tests.unit.api.definitions import base class L3PortIPChangeNotAllowedDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = l3_port_ip_change_not_allowed neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_ip_substring_port_filtering.py0000664000175000017500000000147113641427107032761 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import ip_substring_port_filtering from neutron_lib.tests.unit.api.definitions import base class IPSubstringFilteringDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = ip_substring_port_filtering neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_l3_flavors.py0000664000175000017500000000153413641427107027214 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import l3_flavors from neutron_lib.tests.unit.api.definitions import base class L3FlavorsDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = l3_flavors extension_resources = () extension_attributes = (l3_flavors.FLAVOR_ID,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_subnet_segmentid_writable.py0000664000175000017500000000162113641427107032367 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import segment from neutron_lib.api.definitions import subnet_segmentid_writable from neutron_lib.tests.unit.api.definitions import base class SubnetSegmentIDDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = subnet_segmentid_writable extension_attributes = (segment.SEGMENT_ID,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_logging_resource.py0000664000175000017500000000230113641427107030470 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import logging_resource from neutron_lib.tests.unit.api.definitions import base class LoggingResourceDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = logging_resource extension_resources = (logging_resource.COLLECTION_NAME,) extension_subresources = (logging_resource.FIREWALL_LOGS,) extension_attributes = (logging_resource.ENABLED, logging_resource.FIREWALL_LOGS, logging_resource.LOGGING_RESOURCE_ID, logging_resource.FW_EVENT, logging_resource.FIREWALL_ID,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_network_availability_zone.py0000664000175000017500000000175113641427107032421 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import availability_zone from neutron_lib.api.definitions import network_availability_zone from neutron_lib.tests.unit.api.definitions import base class NetworkAvailabilityZoneDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = network_availability_zone extension_attributes = (availability_zone.AZ_HINTS, availability_zone.COLLECTION_NAME) ././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_floating_ip_port_forwarding_extension.pyneutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_floating_ip_port_forwarding_extension.0000664000175000017500000000177613641427107034456 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import fip_pf_description as pf_description from neutron_lib.api.definitions import floating_ip_port_forwarding as fip_pf from neutron_lib.tests.unit.api.definitions import base class FipPortForwardingNameAndDescriptionTestCase(base.DefinitionBaseTestCase): extension_module = pf_description extension_subresources = (fip_pf.COLLECTION_NAME,) extension_attributes = (pf_description.DESCRIPTION_FIELD,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_metering.py0000664000175000017500000000215613641427107026755 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import metering from neutron_lib.services.qos import constants as qos_consts from neutron_lib.tests.unit.api.definitions import base class MeteringDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = metering extension_resources = (metering.METERING_LABEL_RULES, metering.METERING_LABELS) extension_attributes = ('remote_ip_prefix', 'excluded', 'metering_label_id', qos_consts.DIRECTION) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_multiprovidernet.py0000664000175000017500000000403213641427107030552 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import multiprovidernet from neutron_lib.api.definitions import provider_net from neutron_lib.exceptions import multiprovidernet as mp_exc from neutron_lib.tests.unit.api.definitions import base from neutron_lib.tests.unit.api.validators import test_multiprovidernet \ as test_mpnet class MultiProviderNetworkDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = multiprovidernet extension_attributes = (multiprovidernet.SEGMENTS,) def test_check_duplicate_segments_with_dups(self): self.assertRaises(mp_exc.SegmentsContainDuplicateEntry, multiprovidernet.check_duplicate_segments, [test_mpnet._build_segment('nt0', 'pn0', 2), test_mpnet._build_segment('nt0', 'pn0', 2)]) def test_check_duplicate_segments_with_dups_and_partial(self): def _seg_partial(seg): return seg[provider_net.PHYSICAL_NETWORK] == 'pn0' self.assertIsNone( multiprovidernet.check_duplicate_segments( [test_mpnet._build_segment('nt0', 'pn0', 2), test_mpnet._build_segment('nt1', 'pn1', 2)], is_partial_func=_seg_partial)) def test_check_duplicate_segments_no_dups(self): self.assertIsNone( multiprovidernet.check_duplicate_segments( [test_mpnet._build_segment('nt0', 'pn0', 2), test_mpnet._build_segment('nt0', 'pn0', 3)])) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_l2_adjancency.py0000664000175000017500000000154713641427107027642 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import l2_adjacency from neutron_lib.tests.unit.api.definitions import base class L2AdjacencyDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = l2_adjacency extension_resources = () extension_attributes = (l2_adjacency.L2_ADJACENCY,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_portbindings.py0000664000175000017500000000211613641427107027641 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import portbindings from neutron_lib.tests.unit.api.definitions import base class PortbindingsDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = portbindings extension_resources = (portbindings.COLLECTION_NAME,) extension_attributes = (portbindings.VIF_TYPE, portbindings.VIF_DETAILS, portbindings.VNIC_TYPE, portbindings.HOST_ID, portbindings.PROFILE) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_bgpvpn.py0000664000175000017500000000464513641427107026444 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import bgpvpn from neutron_lib.api import validators from neutron_lib.tests.unit.api.definitions import base class BgpvpnDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = bgpvpn extension_resources = (bgpvpn.COLLECTION_NAME,) extension_attributes = ('type', 'route_targets', 'import_targets', 'export_targets', 'route_distinguishers', 'networks', 'routers', 'router_id', 'network_id') extension_subresources = ('network_associations', 'router_associations') def _data_for_invalid_rtdt(self): values = [[':1'], ['1:'], ['42'], ['65536:123456'], ['123.456.789.123:65535'], ['4294967296:65535'], ['1.1.1.1:655351'], ['4294967295:65536'], [''], ] for value in values: yield value def _data_for_valid_rtdt(self): values = [['1:1'], ['1:4294967295'], ['65535:0'], ['65535:4294967295'], ['1.1.1.1:1'], ['1.1.1.1:65535'], ['4294967295:0'], ['65536:65535'], ['4294967295:65535'], ] for value in values: yield value def test_valid_rtrd(self): for rtrd in self._data_for_valid_rtdt(): msg = validators.validate_list_of_regex_or_none( rtrd, bgpvpn.RTRD_REGEX) self.assertIsNone(msg) def test_invalid_rtrd(self): for rtrd in self._data_for_invalid_rtdt(): msg = validators.validate_list_of_regex_or_none( rtrd, bgpvpn.RTRD_REGEX) self.assertIsNotNone(msg) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_dvr.py0000664000175000017500000000150313641427107025731 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import dvr from neutron_lib.tests.unit.api.definitions import base class DvrDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = dvr extension_resources = () extension_attributes = (dvr.DISTRIBUTED,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_allowedaddresspairs.py0000664000175000017500000000160513641427107031175 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import allowedaddresspairs from neutron_lib.tests.unit.api.definitions import base class AllowedAddressPairsDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = allowedaddresspairs extension_resources = () extension_attributes = (allowedaddresspairs.ADDRESS_PAIRS,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_servicetype.py0000664000175000017500000000161313641427107027502 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import servicetype from neutron_lib.tests.unit.api.definitions import base class ServiceTypeDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = servicetype extension_resources = (servicetype.COLLECTION_NAME,) extension_attributes = ('default', servicetype.SERVICE_ATTR,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_sorting.py0000664000175000017500000000140413641427107026623 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import sorting from neutron_lib.tests.unit.api.definitions import base class SortingDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = sorting neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_bgpvpn_net_assoc_stdattrs.py0000664000175000017500000000146513641427107032427 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import bgpvpn_stdattrs_net_assoc from neutron_lib.tests.unit.api.definitions import base class BGPVPNNetAssocStdAttrDefintionTestCase(base.DefinitionBaseTestCase): extension_module = bgpvpn_stdattrs_net_assoc neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_network.py0000664000175000017500000000144213641427107026631 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import network from neutron_lib.tests.unit.api.definitions import base class NetworkDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = network extension_attributes = () neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_network_mtu_writable.py0000664000175000017500000000150513641427107031407 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import network_mtu_writable from neutron_lib.tests.unit.api.definitions import base class NetworkMtuDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = network_mtu_writable extension_attributes = ('mtu',) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/ip_allocation.py0000664000175000017500000000155413641427107026722 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import ip_allocation from neutron_lib.tests.unit.api.definitions import base class IPAllocationDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = ip_allocation extension_resources = () extension_attributes = (ip_allocation.IP_ALLOCATION,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_extra_dhcp_opt.py0000664000175000017500000000161613641427107030146 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import extra_dhcp_opt from neutron_lib.tests.unit.api.definitions import base class ExtraDHCPOptDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = extra_dhcp_opt extension_resources = (extra_dhcp_opt.COLLECTION_NAME,) extension_attributes = (extra_dhcp_opt.EXTRADHCPOPTS,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_subnet_onboard.py0000664000175000017500000000146613641427107030152 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import subnet_onboard from neutron_lib.tests.unit.api.definitions import base class OnboardSubnetDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = subnet_onboard extension_attributes = () neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_subnet_service_types.py0000664000175000017500000000167113641427107031410 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import subnet as subnet_def from neutron_lib.api.definitions import subnet_service_types from neutron_lib.tests.unit.api.definitions import base class SubnetServiceTypesDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = subnet_service_types extension_resource = (subnet_def.RESOURCE_NAME,) extension_attributes = () neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_l3_ext_ha_mode.py0000664000175000017500000000155013641427107030012 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import l3_ext_ha_mode from neutron_lib.tests.unit.api.definitions import base class L3ExtHAModeDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = l3_ext_ha_mode extension_resources = () extension_attributes = (l3_ext_ha_mode.HA_INFO,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_qos_default.py0000664000175000017500000000165413641427107027453 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import qos_default from neutron_lib.tests.unit.api.definitions import base from neutron_lib.tests.unit.api.definitions import test_qos class QoSDefaultTestCase(base.DefinitionBaseTestCase): extension_module = qos_default extension_resources = test_qos.QoSDefinitionTestCase.extension_resources extension_attributes = () neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_extraroute.py0000664000175000017500000000147513641427107027350 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import extraroute from neutron_lib.tests.unit.api.definitions import base class ExtrarouteDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = extraroute extension_attributes = (extraroute.ROUTES,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_floatingip_autodelete_internal.py0000664000175000017500000000150113641427107033377 0ustar zuulzuul00000000000000# Copyright 2019 Ericsson # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import floatingip_autodelete_internal from neutron_lib.tests.unit.api.definitions import base class FloatingIPAutodeleteInternalTestCase(base.DefinitionBaseTestCase): extension_module = floatingip_autodelete_internal neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_admin_state_down_before_update.py0000664000175000017500000000151713641427107033346 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import router_admin_state_down_before_update from neutron_lib.tests.unit.api.definitions import base class AdminStateDownToUpdateDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = router_admin_state_down_before_update neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_data_plane_status.py0000664000175000017500000000167413641427107030642 0ustar zuulzuul00000000000000# Copyright (c) 2017 NEC Corporation. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import data_plane_status as dps from neutron_lib.tests.unit.api.definitions import base class DataPlaneStatusDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = dps extension_resources = (dps.COLLECTION_NAME,) extension_attributes = (dps.DATA_PLANE_STATUS,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_port_security.py0000664000175000017500000000151313641427107030052 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import port_security from neutron_lib.tests.unit.api.definitions import base class PortSecurityDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = port_security extension_attributes = ('port_security_enabled',) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_revisionifmatch.py0000664000175000017500000000143413641427107030333 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import revisionifmatch from neutron_lib.tests.unit.api.definitions import base class RevisionIfMatchDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = revisionifmatch neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_qos.py0000664000175000017500000000235213641427107025743 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import qos from neutron_lib.services.qos import constants as q_const from neutron_lib.tests.unit.api.definitions import base class QoSDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = qos extension_resources = (qos.POLICIES, qos.RULE_TYPES) extension_subresources = (qos.BANDWIDTH_LIMIT_RULES, qos.DSCP_MARKING_RULES, qos.MIN_BANDWIDTH_RULES) extension_attributes = (q_const.DIRECTION, q_const.MAX_BURST, 'type', q_const.DSCP_MARK, q_const.MIN_KBPS, 'rules', q_const.MAX_KBPS, q_const.QOS_POLICY_ID) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_segment_peer_subnet_host_routes.py0000664000175000017500000000150413641427107033632 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import segments_peer_subnet_host_routes from neutron_lib.tests.unit.api.definitions import base class SegmentPeerHostRoutesDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = segments_peer_subnet_host_routes neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_trunk.py0000664000175000017500000000152613641427107026306 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import trunk from neutron_lib.tests.unit.api.definitions import base class TrunkDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = trunk extension_resources = (trunk.TRUNKS,) extension_attributes = (trunk.SUB_PORTS,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_segment.py0000664000175000017500000000177113641427107026607 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import segment from neutron_lib.tests.unit.api.definitions import base class SegmentDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = segment extension_resources = (segment.COLLECTION_NAME,) extension_attributes = ('network_id', segment.PHYSICAL_NETWORK, segment.NETWORK_TYPE, segment.SEGMENTATION_ID, segment.SEGMENT_ID,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_fip_port_details.py0000664000175000017500000000166013641427107030471 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import fip_port_details from neutron_lib.api.definitions import l3 from neutron_lib.tests.unit.api.definitions import base class FipPortDetailsDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = fip_port_details extension_resources = (l3.FLOATINGIPS,) extension_attributes = (fip_port_details.PORT_DETAILS,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_empty_string_filtering.py0000664000175000017500000000145713641427107031735 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import empty_string_filtering from neutron_lib.tests.unit.api.definitions import base class EmptyStringFilteringDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = empty_string_filtering neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_standard_attr_segment.py0000664000175000017500000000145413641427107031517 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import standard_attr_segment from neutron_lib.tests.unit.api.definitions import base class StandardAttrSegmentDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = standard_attr_segment neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_project_id.py0000664000175000017500000000141413641427107027261 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import project_id from neutron_lib.tests.unit.api.definitions import base class ProjectIdDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = project_id neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test__dummy.py0000664000175000017500000000153613641427107026436 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import _dummy from neutron_lib.tests.unit.api.definitions import base class _DummyDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = _dummy extension_resources = (_dummy.COLLECTION_NAME,) extension_subresources = ('subfoo',) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_rbac_subnetpool.py0000664000175000017500000000143313641427107030321 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import rbac_subnetpool from neutron_lib.tests.unit.api.definitions import base class RbacSubnetPoolDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = rbac_subnetpool neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_sort_key_validation.py0000664000175000017500000000144413641427107031213 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import sort_key_validation as apidef from neutron_lib.tests.unit.api.definitions import base class SortKeyValidationiDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = apidef neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_project_default_networks.py0000664000175000017500000000161513641427107032250 0ustar zuulzuul00000000000000# Copyright (c) 2017 NEC Corporation. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import project_default_networks as dn from neutron_lib.tests.unit.api.definitions import base class DefaultNetworksDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = dn extension_attributes = (dn.PROJECT_DEFAULT,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_network_ip_availability.py0000664000175000017500000000201713641427107032052 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import network_ip_availability from neutron_lib.tests.unit.api.definitions import base class NetworkIPAvailabilityDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = network_ip_availability extension_resources = (network_ip_availability.RESOURCE_PLURAL,) extension_attributes = ('total_ips', 'used_ips', 'subnet_ip_availability', 'network_name',) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_external_net.py0000664000175000017500000000154313641427107027632 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import external_net from neutron_lib.tests.unit.api.definitions import base class ExternalNetDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = external_net extension_resources = () extension_attributes = (external_net.EXTERNAL,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_port_mac_address_regenerate.py0000664000175000017500000000164413641427107032656 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import port as port_def from neutron_lib.api.definitions import port_mac_address_regenerate from neutron_lib.tests.unit.api.definitions import base class PortMacAddressRegenerateTestCase(base.DefinitionBaseTestCase): extension_module = port_mac_address_regenerate extension_attributes = (port_def.PORT_MAC_ADDRESS,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_filter_validation.py0000664000175000017500000000144113641427107030636 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import filter_validation as apidef from neutron_lib.tests.unit.api.definitions import base class FilterValidationiDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = apidef neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_routerservicetype.py0000664000175000017500000000154213641427107030744 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import routerservicetype from neutron_lib.tests.unit.api.definitions import base class RouterServiceTyepDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = routerservicetype extension_attributes = (routerservicetype.SERVICE_TYPE_ID,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_dns_domain_ports.py0000664000175000017500000000165013641427107030503 0ustar zuulzuul00000000000000# Copyright (c) 2017 IBM # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import dns from neutron_lib.api.definitions import dns_domain_ports from neutron_lib.tests.unit.api.definitions import base class DnsDomainPortsDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = dns_domain_ports extension_attributes = (dns.DNSDOMAIN,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_qos_rules_alias.py0000664000175000017500000000242013641427107030322 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import qos_rules_alias from neutron_lib.services.qos import constants as q_const from neutron_lib.tests.unit.api.definitions import base class QoSRulesAliasDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = qos_rules_alias extension_resources = (qos_rules_alias.BANDWIDTH_LIMIT_RULES_ALIAS, qos_rules_alias.DSCP_MARKING_RULES_ALIAS, qos_rules_alias.MIN_BANDWIDTH_RULES_ALIAS) extension_attributes = (q_const.DIRECTION, q_const.MAX_BURST, q_const.DSCP_MARK, q_const.MIN_KBPS, q_const.MAX_KBPS) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_rbac_security_groups.py0000664000175000017500000000145113641427107031375 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import rbac_security_groups from neutron_lib.tests.unit.api.definitions import base class RbacSecurityGroupsDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = rbac_security_groups neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_subnet_dns_publish_fixed_ip.py0000664000175000017500000000161613641427107032704 0ustar zuulzuul00000000000000# Copyright (c) 2019 x-ion GmbH. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import subnet_dns_publish_fixed_ip as sn from neutron_lib.tests.unit.api.definitions import base class SubnetDNSPublishFixedIpTestCase(base.DefinitionBaseTestCase): extension_module = sn extension_attributes = (sn.DNS_PUBLISH_FIXED_IP,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_address_scope.py0000664000175000017500000000177613641427107027770 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import address_scope from neutron_lib.tests.unit.api.definitions import base class AddressScopeDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = address_scope extension_resources = (address_scope.COLLECTION_NAME,) extension_attributes = ('ipv6_address_scope', 'ipv4_address_scope', 'address_scope_id',) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_tag_ports_during_bulk_creation.py0000664000175000017500000000151613641427107033415 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import tag_ports_during_bulk_creation from neutron_lib.tests.unit.api.definitions import base class TagPortsDuringBulkCreationDefinitionTestCase( base.DefinitionBaseTestCase): extension_module = tag_ports_during_bulk_creation neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_vpn_flavors.py0000664000175000017500000000157413641427107027505 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import vpn_flavors from neutron_lib.tests.unit.api.definitions import base class VPNFlavorsDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = vpn_flavors extension_resources = (vpn_flavors.COLLECTION_NAME,) extension_attributes = (vpn_flavors.FLAVOR_ID,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_floating_ip_port_forwarding.py0000664000175000017500000000220213641427107032714 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import floating_ip_port_forwarding as fip_pf from neutron_lib.tests.unit.api.definitions import base class FipPortForwardingDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = fip_pf extension_resources = (fip_pf.PARENT_COLLECTION_NAME,) extension_attributes = (fip_pf.ID, fip_pf.PROJECT_ID, fip_pf.EXTERNAL_PORT, fip_pf.INTERNAL_PORT, fip_pf.INTERNAL_IP_ADDRESS, fip_pf.PROTOCOL, fip_pf.INTERNAL_PORT_ID,) extension_subresources = (fip_pf.COLLECTION_NAME,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_dns.py0000664000175000017500000000163313641427107025726 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import dns from neutron_lib.api.definitions import l3 from neutron_lib.tests.unit.api.definitions import base class DnsDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = dns extension_resources = (l3.FLOATINGIPS,) extension_attributes = (dns.DNSNAME, dns.DNSDOMAIN, dns.DNSASSIGNMENT,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_availability_zone_filter.py0000664000175000017500000000146513641427107032217 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import availability_zone_filter from neutron_lib.tests.unit.api.definitions import base class AvailabilityZoneFilterDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = availability_zone_filter neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_network_mtu.py0000664000175000017500000000146313641427107027521 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import network_mtu from neutron_lib.tests.unit.api.definitions import base class NetworkMtuDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = network_mtu extension_attributes = ('mtu',) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_subnetpool.py0000664000175000017500000000145313641427107027334 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import subnetpool from neutron_lib.tests.unit.api.definitions import base class SubnetPoolDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = subnetpool extension_attributes = () neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_portbindings_extended.py0000664000175000017500000000217313641427107031524 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import portbindings_extended as pbe from neutron_lib.tests.unit.api.definitions import base class PortbindingsExtendedDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = pbe extension_attributes = (pbe.VIF_TYPE, pbe.VIF_DETAILS, pbe.VNIC_TYPE, pbe.HOST, pbe.PROFILE, pbe.STATUS, pbe.PROJECT_ID) extension_subresources = (pbe.COLLECTION_NAME,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/base.py0000664000175000017500000002241413641427107025015 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import imp import os from neutron_lib.api import definitions from neutron_lib.api.definitions import base from neutron_lib.api import validators from neutron_lib import constants from neutron_lib.tests import _base as test_base def assert_bool(tester, attribute, attribute_dict, keyword, value): tester.assertIsInstance( value, bool, '%s must be a boolean for %s.' % (keyword, attribute)) def assert_converter(tester, attribute, attribute_dict, keyword, value): if ('default' not in attribute_dict or attribute_dict['default'] is constants.ATTR_NOT_SPECIFIED or attribute_dict.get(constants.DICT_POPULATE_DEFAULTS)): return try: attribute_dict['convert_to'](attribute_dict['default']) except KeyError: try: attribute_dict['convert_list_to'](attribute_dict['default']) except KeyError: if validators.is_attr_set(value) and not isinstance( value, (str, list)): tester.fail("Default value '%s' cannot be converted for " "attribute %s." % (value, attribute)) def assert_true(tester, attribute, attribute_dict, keyword, value): tester.assertTrue( value, '%s must be True for %s.' % (keyword, attribute)) def assert_validator(tester, attribute, attribute_dict, keyword, value): tester.assertIn(list(value)[0], validators.validators, '%s is not a known validator for %s.' % (value, attribute)) ASSERT_FUNCTIONS = { 'allow_post': assert_bool, 'allow_put': assert_bool, 'convert_to': assert_converter, 'convert_list_to': assert_converter, 'default': assert_converter, 'enforce_policy': assert_bool, 'is_filter': assert_bool, 'is_sort_key': assert_bool, 'is_visible': assert_bool, 'primary_key': assert_true, 'required_by_policy': assert_bool, 'validate': assert_validator, 'default_overrides_none': assert_bool, 'dict_populate_defaults': assert_bool, } class DefinitionBaseTestCase(test_base.BaseTestCase): extension_module = None extension_resources = () extension_subresources = () extension_attributes = () def setUp(self): super(DefinitionBaseTestCase, self).setUp() if not self.extension_module: self.fail("Missing extension module definition.") self.alias = self.extension_module.ALIAS self.is_shim_extension = self.extension_module.IS_SHIM_EXTENSION self.is_standard_attr_extension = ( self.extension_module.IS_STANDARD_ATTR_EXTENSION) self.name = self.extension_module.NAME self.description = self.extension_module.DESCRIPTION self.resource_map = self.extension_module.RESOURCE_ATTRIBUTE_MAP self.subresource_map = self.extension_module.SUB_RESOURCE_ATTRIBUTE_MAP self.action_map = self.extension_module.ACTION_MAP self.action_status = self.extension_module.ACTION_STATUS self.required_extensions = self.extension_module.REQUIRED_EXTENSIONS self.optional_extensions = self.extension_module.OPTIONAL_EXTENSIONS def test_shim_extension(self): if self.is_shim_extension is True: self.assertFalse(self.extension_resources) self.assertFalse(self.extension_attributes) self.assertFalse(self.resource_map) self.assertFalse(self.action_map) self.assertFalse(self.action_status) def test_is_standard_attr_extension(self): if self.is_standard_attr_extension: self.assertIn('standard-attr-', self.alias) else: self.skipTest('API definition is not related to standardattr.') def test_resource_map(self): if (not self.resource_map and not self.subresource_map and not self.is_shim_extension and not self.action_map): self.fail('Missing resource map, subresource map, ' 'and action map, what is this extension doing?') elif self.is_shim_extension: self.skipTest('Shim extension with no API changes.') for resource in self.resource_map: self.assertIn( resource, base.KNOWN_RESOURCES + self.extension_resources, 'Resource is unknown, check for typos.') self.assertParams(self.resource_map[resource]) def assertParams(self, resource): for attribute in resource.keys(): self.assertIn( attribute, base.KNOWN_ATTRIBUTES + self.extension_attributes, 'Attribute is unknown, check for typos.') for keyword in resource[attribute]: self.assertIn(keyword, base.KNOWN_KEYWORDS, 'Keyword is unknown, check for typos.') value = resource[attribute][keyword] assert_f = ASSERT_FUNCTIONS[keyword] assert_f(self, attribute, resource[attribute], keyword, value) def _assert_subresource(self, subresource): self.assertIn( self.subresource_map[subresource]['parent']['collection_name'], base.KNOWN_RESOURCES + self.extension_resources, 'Sub-resource parent is unknown, check for typos.') self.assertIn('member_name', self.subresource_map[subresource]['parent'], 'Incorrect parent definition, check for typos.') self.assertParams(self.subresource_map[subresource]['parameters']) def test_subresource_map(self): if not self.subresource_map: self.skipTest('API extension has no subresource map.') for subresource in self.subresource_map: self.assertIn( subresource, self.extension_subresources + base.KNOWN_RESOURCES, 'Sub-resource is unknown, check for typos.') sub_attrmap = self.subresource_map[subresource] if 'parent' in sub_attrmap: self.assertEqual(2, len(sub_attrmap.keys())) self.assertIn('parent', sub_attrmap) self.assertIn('parameters', sub_attrmap) self._assert_subresource(subresource) else: self.assertEqual( ['parameters'], [p for p in sub_attrmap.keys()], 'When extending sub-resources only use the parameters ' 'keyword') self.assertParams(sub_attrmap['parameters']) def test_action_map(self): self.assertIsInstance(self.action_map, dict) if not self.action_map: self.skipTest('API definition has no action map.') for key in self.action_map: for action in self.action_map[key].values(): self.assertIn(action, base.KNOWN_HTTP_ACTIONS, 'HTTP verb is unknown, check for typos.') def test_action_status(self): if not self.action_status: self.skipTest('API definition has no action status.') for status in self.action_status.values(): self.assertIn(status, base.KNOWN_ACTION_STATUSES, 'HTTP status is unknown, check for typos.') def test_required_extensions(self): self.assertIsInstance(self.required_extensions, list) if not self.required_extensions: self.skipTest('API definition has no required extensions.') for ext in self.required_extensions: self.assertIn(ext, base.KNOWN_EXTENSIONS, 'Required extension is unknown, check for typos.') def test_optional_extensions(self): self.assertIsInstance(self.optional_extensions, list) if not self.optional_extensions: self.skipTest('API definition has no optional extensions.') for ext in self.optional_extensions: self.assertIn(ext, base.KNOWN_EXTENSIONS, 'Optional extension is unknown, check for typos.') def test_all_api_definitions_list(self): # ensure _ALL_API_DEFINITIONS contains all public api-defs ext_aliases = [] api_def_path = 'neutron_lib/api/definitions' for f in sorted(os.listdir(api_def_path)): mod_name, file_ext = os.path.splitext(os.path.split(f)[-1]) ext_path = os.path.join(api_def_path, f) if file_ext.lower() == '.py' and not mod_name.startswith('_'): mod = imp.load_source(mod_name, ext_path) ext_alias = getattr(mod, 'ALIAS', None) if not ext_alias: continue ext_aliases.append(ext_alias) self.assertEqual(sorted(ext_aliases), sorted([d.ALIAS for d in definitions._ALL_API_DEFINITIONS])) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_vpn_endpoint_groups.py0000664000175000017500000000160713641427107031245 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import vpn_endpoint_groups from neutron_lib.tests.unit.api.definitions import base class VPNEndpointGroupsDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = vpn_endpoint_groups extension_resources = ('endpoint_groups',) extension_attributes = ('type', 'endpoints',) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_default_subnetpools.py0000664000175000017500000000161513641427107031223 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import default_subnetpools from neutron_lib.tests.unit.api.definitions import base class DefaultSubnetPoolsDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = default_subnetpools extension_resources = () extension_attributes = (default_subnetpools.USE_DEFAULT_SUBNETPOOL,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_qos_rule_type_details.py0000664000175000017500000000174613641427107031546 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import qos_rule_type_details from neutron_lib.tests.unit.api.definitions import base from neutron_lib.tests.unit.api.definitions import test_qos class QosRuleTypeDetailsTestCase(base.DefinitionBaseTestCase): extension_module = qos_rule_type_details extension_resources = test_qos.QoSDefinitionTestCase.extension_resources extension_attributes = (qos_rule_type_details.DRIVERS,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_auto_allocated_topology.py0000664000175000017500000000164513641427107032061 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import auto_allocated_topology from neutron_lib.tests.unit.api.definitions import base class AutoTopologyDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = auto_allocated_topology extension_resources = (auto_allocated_topology.COLLECTION_NAME,) extension_attributes = () neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_rbac_address_scope.py0000664000175000017500000000144313641427107030746 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import rbac_address_scope from neutron_lib.tests.unit.api.definitions import base class RbacAddressScopeDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = rbac_address_scope neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_l3_conntrack_helper.py0000664000175000017500000000241313641427107031056 0ustar zuulzuul00000000000000# Copyright (c) 2019 OpenStack Foundation # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import l3_conntrack_helper from neutron_lib.tests.unit.api.definitions import base class ConntrackHelperDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = l3_conntrack_helper extension_resources = (l3_conntrack_helper.PARENT_COLLECTION_NAME,) extension_attributes = (l3_conntrack_helper.ID, l3_conntrack_helper.PROTOCOL, l3_conntrack_helper.PORT, l3_conntrack_helper.HELPER, l3_conntrack_helper.PROJECT_ID) extension_subresources = (l3_conntrack_helper.COLLECTION_NAME,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_extraroute_atomic.py0000664000175000017500000000152113641427107030674 0ustar zuulzuul00000000000000# Copyright 2019 Ericsson Software Technology # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import extraroute_atomic from neutron_lib.tests.unit.api.definitions import base class ExtrarouteAtomicDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = extraroute_atomic neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_subnetpool_prefix_ops.py0000664000175000017500000000151213641427107031566 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import subnetpool_prefix_ops from neutron_lib.tests.unit.api.definitions import base class SubnetPoolPrefixOpsDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = subnetpool_prefix_ops extension_attributes = () neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_bgpvpn_vni.py0000664000175000017500000000172213641427107027311 0ustar zuulzuul00000000000000# # Copyright 2017 Ericsson India Global Services Pvt Ltd. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # from neutron_lib.api.definitions import bgpvpn from neutron_lib.api.definitions import bgpvpn_vni from neutron_lib.tests.unit.api.definitions import base class BgpvpnDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = bgpvpn_vni extension_resources = (bgpvpn.COLLECTION_NAME,) extension_attributes = (bgpvpn_vni.VNI,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_availability_zone.py0000664000175000017500000000211313641427107030641 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import agent from neutron_lib.api.definitions import availability_zone from neutron_lib.tests.unit.api.definitions import base class AvailabilityZoneDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = availability_zone extension_resources = (availability_zone.COLLECTION_NAME, agent.COLLECTION_NAME,) extension_attributes = (availability_zone.AZ_HINTS, 'resource', availability_zone.RESOURCE_NAME, 'state',) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_bgpvpn_router_assoc_stdattrs.py0000664000175000017500000000147613641427107033163 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import bgpvpn_stdattrs_router_assoc from neutron_lib.tests.unit.api.definitions import base class BGPVPNRouterAssocStdAttrDefintionTestCase(base.DefinitionBaseTestCase): extension_module = bgpvpn_stdattrs_router_assoc neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_l3_ext_gw_mode.py0000664000175000017500000000152613641427107030042 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import l3_ext_gw_mode from neutron_lib.tests.unit.api.definitions import base class L3ExtendedGatewayModeDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = l3_ext_gw_mode extension_attributes = ('external_gateway_info',) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_agent.py0000664000175000017500000000202613641427107026235 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import agent from neutron_lib.tests.unit.api.definitions import base class AgentDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = agent extension_resources = (agent.COLLECTION_NAME,) extension_attributes = ('topic', 'agent_type', 'created_at', 'configurations', 'heartbeat_timestamp', 'binary', 'started_at', 'host', 'alive',) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_flowclassifier.py0000664000175000017500000000260113641427107030152 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import flowclassifier from neutron_lib.tests.unit.api.definitions import base class FlowClassifierDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = flowclassifier extension_resources = (flowclassifier.COLLECTION_NAME,) extension_attributes = ('ethertype', 'protocol', 'source_port_range_min', 'source_port_range_max', 'destination_port_range_min', 'destination_port_range_max', 'source_ip_prefix', 'destination_ip_prefix', 'logical_destination_port', 'logical_source_port', 'l7_parameters') neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_vlantransparent.py0000664000175000017500000000230013641427107030354 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import vlantransparent from neutron_lib.tests.unit.api.definitions import base class VlantransparentDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = vlantransparent extension_resources = () extension_attributes = (vlantransparent.VLANTRANSPARENT,) def test_get_vlan_transparent(self): self.assertTrue(vlantransparent.get_vlan_transparent( {vlantransparent.VLANTRANSPARENT: True, 'vlan': '1'})) def test_get_vlan_transparent_not_set(self): self.assertFalse(vlantransparent.get_vlan_transparent( {'vlanxtx': True, 'vlan': '1'})) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_expose_l3_conntrack_helper.py0000664000175000017500000000210313641427107032435 0ustar zuulzuul00000000000000# Copyright (c) 2019 OpenStack Foundation # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import expose_l3_conntrack_helper from neutron_lib.api.definitions import l3_conntrack_helper from neutron_lib.tests.unit.api.definitions import base class ExposeL3ConntrackHelperDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = expose_l3_conntrack_helper extension_resources = (expose_l3_conntrack_helper.COLLECTION_NAME,) extension_attributes = (l3_conntrack_helper.COLLECTION_NAME,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_qos_port_network_policy.py0000664000175000017500000000207113641427107032135 0ustar zuulzuul00000000000000# Copyright (c) 2019 Red Hat Inc. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import port from neutron_lib.api.definitions import qos_port_network_policy from neutron_lib.services.qos import constants as qos_const from neutron_lib.tests.unit.api.definitions import base class QosPortNetworkPolicyTestCase(base.DefinitionBaseTestCase): extension_module = qos_port_network_policy extension_resources = (port.RESOURCE_NAME,) extension_attributes = (qos_const.QOS_NETWORK_POLICY_ID,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_firewall_v2.py0000664000175000017500000000300013641427107027344 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import firewall_v2 from neutron_lib import constants from neutron_lib.tests.unit.api.definitions import base class FirewallDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = firewall_v2 extension_resources = ('firewall_groups', 'firewall_policies', 'firewall_rules') extension_attributes = ('action', 'admin_state_up', 'audited', 'destination_ip_address', 'destination_port', 'egress_firewall_policy_id', 'enabled', 'firewall_policy_id', 'firewall_rules', 'ingress_firewall_policy_id', 'ip_version', 'ports', 'position', 'protocol', constants.SHARED, 'source_ip_address', 'source_port', 'source_firewall_group_id', 'destination_firewall_group_id') neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_flavors.py0000664000175000017500000000214513641427107026615 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import flavors from neutron_lib.tests.unit.api.definitions import base class FlavorsDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = flavors extension_resources = (flavors.FLAVORS, flavors.SERVICE_PROFILES,) extension_subresources = (flavors.NEXT_PROVIDERS, flavors.SERVICE_PROFILES,) extension_attributes = ('enabled', 'provider', 'metainfo', 'driver', flavors.SERVICE_PROFILES, 'service_type',) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_fip64.py0000664000175000017500000000147113641427107026072 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import fip64 from neutron_lib.tests.unit.api.definitions import base class Fip64DefinitionTestCase(base.DefinitionBaseTestCase): extension_module = fip64 extension_resources = () extension_attributes = () neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_router_interface_fip.py0000664000175000017500000000154413641427107031341 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import router_interface_fip from neutron_lib.tests.unit.api.definitions import base class RouterInterfaceFipDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = router_interface_fip extension_resources = () extension_attributes = () neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_stateful_security_group.py0000664000175000017500000000156613641427107032141 0ustar zuulzuul00000000000000# Copyright 2018 NOKIA # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import stateful_security_group from neutron_lib.tests.unit.api.definitions import base class StatefulSecurityGroupDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = stateful_security_group extension_attributes = ('stateful',) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_expose_port_forwarding_in_fip.py0000664000175000017500000000201113641427107033246 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import expose_port_forwarding_in_fip from neutron_lib.api.definitions import floating_ip_port_forwarding from neutron_lib.tests.unit.api.definitions import base class ExposePortForwardingInFip(base.DefinitionBaseTestCase): extension_module = expose_port_forwarding_in_fip extension_resources = (expose_port_forwarding_in_fip.COLLECTION_NAME,) extension_attributes = (floating_ip_port_forwarding.COLLECTION_NAME,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_pagination.py0000664000175000017500000000141513641427107027271 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import pagination from neutron_lib.tests.unit.api.definitions import base class PaginationDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = pagination neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_subnet.py0000664000175000017500000000143713641427107026444 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import subnet from neutron_lib.tests.unit.api.definitions import base class SubnetDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = subnet extension_attributes = () neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/__init__.py0000664000175000017500000000000013641427107025625 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_router_availability_zone.py0000664000175000017500000000164513641427107032252 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import availability_zone as az from neutron_lib.api.definitions import router_availability_zone from neutron_lib.tests.unit.api.definitions import base class RouterAZDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = router_availability_zone extension_attributes = (az.AZ_HINTS, az.COLLECTION_NAME,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_sfc.py0000664000175000017500000000250213641427107025711 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import sfc from neutron_lib.tests.unit.api.definitions import base class SFCDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = sfc extension_resources = tuple(sfc.RESOURCE_ATTRIBUTE_MAP.keys()) extension_attributes = ( # from port_pair: 'type', 'ingress', 'egress', 'service_function_parameters', # from port_pair_group: 'group_id', 'port_pairs', 'port_pair_group_parameters', # from port_chain: 'chain_id', 'port_pair_groups', 'flow_classifiers', 'chain_parameters') neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_provider_net.py0000664000175000017500000000156513641427107027646 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import provider_net from neutron_lib.tests.unit.api.definitions import base class ProviderNetTestCase(base.DefinitionBaseTestCase): extension_module = provider_net extension_resources = (provider_net.COLLECTION_NAME,) extension_attributes = provider_net.ATTRIBUTES neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_qos_gateway_ip.py0000664000175000017500000000156613641427107030162 0ustar zuulzuul00000000000000# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import l3 from neutron_lib.api.definitions import qos_gateway_ip from neutron_lib.tests.unit.api.definitions import base class QosGatewayIPDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = qos_gateway_ip extension_attributes = (l3.EXTERNAL_GW_INFO,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_uplink_status_propagation.py0000664000175000017500000000155413641427107032454 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import uplink_status_propagation as apidef from neutron_lib.tests.unit.api.definitions import base class UplinkStatusPropagationDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = apidef extension_attributes = (apidef.PROPAGATE_UPLINK_STATUS,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_l3.py0000664000175000017500000000216313641427107025457 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import l3 from neutron_lib.tests.unit.api.definitions import base class L3DefinitionTestCase(base.DefinitionBaseTestCase): extension_module = l3 extension_resources = (l3.ROUTERS, l3.FLOATINGIPS,) extension_attributes = (l3.FLOATING_IP_ADDRESS, l3.FLOATING_NETWORK_ID, l3.ROUTER_ID, l3.PORT_ID, l3.FIXED_IP_ADDRESS, l3.SUBNET_ID, l3.EXTERNAL_GW_INFO) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_vpn.py0000664000175000017500000000306013641427107025741 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import vpn from neutron_lib.tests.unit.api.definitions import base class VPNDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = vpn extension_resources = ('vpnservices', 'ipsec_site_connections', 'ipsecpolicies', 'ikepolicies',) extension_attributes = ('auth_algorithm', 'auth_mode', 'dpd', 'encapsulation_mode', 'encryption_algorithm', 'external_v4_ip', 'external_v6_ip', 'ike_version', 'ikepolicy_id', 'initiator', 'ipsecpolicy_id', 'lifetime', 'local_ep_group_id', 'local_id', 'mtu', 'peer_address', 'peer_cidrs', 'peer_ep_group_id', 'peer_id', 'pfs', 'phase1_negotiation_mode', 'psk', 'route_mode', 'router_id', 'subnet_id', 'transform_protocol', 'vpnservice_id',) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_port_resource_request.py0000664000175000017500000000162113641427107031602 0ustar zuulzuul00000000000000# Copyright (c) 2018 Ericsson # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import port_resource_request from neutron_lib.tests.unit.api.definitions import base class PortResourceRequestDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = port_resource_request extension_attributes = (port_resource_request.RESOURCE_REQUEST,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_floatingip_pools.py0000664000175000017500000000162513641427107030513 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import floatingip_pools from neutron_lib.tests.unit.api.definitions import base class FloatingIPPoolDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = floatingip_pools extension_resources = (floatingip_pools.FLOATINGIP_POOLS,) extension_attributes = ('subnet_id', 'subnet_name',) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_bgpvpn_port_assoc_stdattrs.py0000664000175000017500000000147013641427107032621 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import bgpvpn_stdattrs_port_assoc from neutron_lib.tests.unit.api.definitions import base class BGPVPNPortAssocStdAttrDefintionTestCase(base.DefinitionBaseTestCase): extension_module = bgpvpn_stdattrs_port_assoc neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_qos_bw_minimum_ingress.py0000664000175000017500000000205013641427107031713 0ustar zuulzuul00000000000000# Copyright (c) 2018 Ericsson # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import qos from neutron_lib.api.definitions import qos_bw_minimum_ingress from neutron_lib.services.qos import constants as qos_constants from neutron_lib.tests.unit.api.definitions import base class QoSBwMinimumIngressDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = qos_bw_minimum_ingress extension_subresources = (qos.MIN_BANDWIDTH_RULES,) extension_attributes = (qos_constants.DIRECTION,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_qos_bw_limit_direction.py0000664000175000017500000000207013641427107031666 0ustar zuulzuul00000000000000# Copyright (c) 2017 OVH SAS # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import qos from neutron_lib.api.definitions import qos_bw_limit_direction from neutron_lib.services.qos import constants as qos_const from neutron_lib.tests.unit.api.definitions import base class QoSBwLimitDirectionDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = qos_bw_limit_direction extension_subresources = (qos.BANDWIDTH_LIMIT_RULES,) extension_attributes = (qos_const.DIRECTION,) neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_port.py0000664000175000017500000000143113641427107026122 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import port from neutron_lib.tests.unit.api.definitions import base class PortDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = port extension_attributes = () neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_bgpvpn_routes_control.py0000664000175000017500000000214613641427107031577 0ustar zuulzuul00000000000000# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import bgpvpn from neutron_lib.api.definitions import bgpvpn_routes_control from neutron_lib.tests.unit.api.definitions import base class BgpvpnRoutesControlDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = bgpvpn_routes_control extension_resources = (bgpvpn.COLLECTION_NAME,) extension_attributes = ('ports', 'routes', 'advertise_fixed_ips', 'advertise_extra_routes', 'local_pref') extension_subresources = ('port_associations', 'router_associations') neutron-lib-2.3.0/neutron_lib/tests/unit/api/definitions/test_bgpvpn_stdattrs.py0000664000175000017500000000143213641427107030363 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api.definitions import bgpvpn_stdattrs from neutron_lib.tests.unit.api.definitions import base class BgpvpnStdAttrDefinitionTestCase(base.DefinitionBaseTestCase): extension_module = bgpvpn_stdattrs neutron-lib-2.3.0/neutron_lib/tests/unit/api/test_extensions.py0000664000175000017500000002013313641427107025022 0ustar zuulzuul00000000000000# Copyright 2016 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib.api import extensions from neutron_lib import fixture from neutron_lib.services import base as service_base from neutron_lib.tests import _base as base class InheritFromExtensionDescriptor(extensions.ExtensionDescriptor): """Class to inherit from ExtensionDescriptor to test its methods Because ExtensionDescriptor is an abstract class, in order to test methods we need to create something to inherit from it so we have something instantiatable. The only things defined here are those that are required because in ExtensionDescriptor they are marked as @abc.abstractmethod. """ def get_name(self): pass def get_alias(self): pass def get_description(self): pass def get_updated(self): pass def update_attributes_map_save(self, extended_attributes, extension_attrs_map=None): """Update attributes map for this extension. This is default method for extending an extension's attributes map. An extension can use this method and supplying its own resource attribute map in extension_attrs_map argument to extend all its attributes that needs to be extended. If an extension does not implement update_attributes_map, the method does nothing and just return. """ if not extension_attrs_map: return for resource, attrs in extension_attrs_map.items(): extended_attrs = extended_attributes.get(resource) if extended_attrs: attrs.update(extended_attrs) class TestExtensionDescriptor(base.BaseTestCase): def _setup_attribute_maps(self): self.extended_attributes = {'resource_one': {'one': 'first'}, 'resource_two': {'two': 'second'}} self.extension_attrs_map = {'resource_one': {'three': 'third'}} def test_update_attributes_map_works(self): self._setup_attribute_maps() extension_description = InheritFromExtensionDescriptor() extension_description.update_attributes_map(self.extended_attributes, self.extension_attrs_map) self.assertEqual(self.extension_attrs_map, {'resource_one': {'one': 'first', 'three': 'third'}}) def test_update_attributes_map_short_circuit_exit(self): self._setup_attribute_maps() extension_description = InheritFromExtensionDescriptor() extension_description.update_attributes_map(self.extended_attributes) self.assertEqual(self.extension_attrs_map, {'resource_one': {'three': 'third'}}) class DummyPlugin(service_base.ServicePluginBase): supported_extension_aliases = ['flash'] def get_plugin_type(self): return 'Flash Gordon' def get_plugin_description(self): return 'Legend!' class TestExtensionIsSupported(base.BaseTestCase): def setUp(self): super(TestExtensionIsSupported, self).setUp() self._plugin = DummyPlugin() def test_extension_exists(self): self.assertTrue(extensions.is_extension_supported(self._plugin, "flash")) def test_extension_does_not_exist(self): self.assertFalse(extensions.is_extension_supported(self._plugin, "gordon")) class TestAPIExtensionDescriptor(base.BaseTestCase): # API definition attributes; acts as an API definition module NAME = 'Test API' ALIAS = 'test-api' DESCRIPTION = 'A test API definition' UPDATED_TIMESTAMP = '2017-02-01T10:00:00-00:00' RESOURCE_ATTRIBUTE_MAP = {'ports': {}} SUB_RESOURCE_ATTRIBUTE_MAP = {'ports': {'debug': {}}} REQUIRED_EXTENSIONS = ['l3'] OPTIONAL_EXTENSIONS = ['fw'] def setUp(self): super(TestAPIExtensionDescriptor, self).setUp() self.extn = _APIDefinition() self.empty_extn = _EmptyAPIDefinition() self.useFixture(fixture.APIDefinitionFixture(self)) def test__assert_api_definition_no_defn(self): self.assertRaises(NotImplementedError, _NoAPIDefinition._assert_api_definition) def test__assert_api_definition_no_attr(self): self.assertRaises( NotImplementedError, self.extn._assert_api_definition, attr='NOPE') def test_get_name(self): self.assertEqual(self.NAME, self.extn.get_name()) def test_get_name_unset(self): self.assertRaises(NotImplementedError, _EmptyAPIDefinition.get_name) def test_get_alias(self): self.assertEqual(self.ALIAS, self.extn.get_alias()) def test_get_alias_unset(self): self.assertRaises(NotImplementedError, _EmptyAPIDefinition.get_alias) def test_get_description(self): self.assertEqual(self.DESCRIPTION, self.extn.get_description()) def test_get_description_unset(self): self.assertRaises(NotImplementedError, _EmptyAPIDefinition.get_description) def test_get_updated(self): self.assertEqual(self.UPDATED_TIMESTAMP, self.extn.get_updated()) def test_get_updated_unset(self): self.assertRaises(NotImplementedError, _EmptyAPIDefinition.get_updated) def test_get_extended_resources_v2(self): self.assertEqual( dict(list(self.RESOURCE_ATTRIBUTE_MAP.items()) + list(self.SUB_RESOURCE_ATTRIBUTE_MAP.items())), self.extn.get_extended_resources('2.0')) def test_get_extended_resources_v2_unset(self): self.assertRaises(NotImplementedError, self.empty_extn.get_extended_resources, '2.0') def test_get_extended_resources_v1(self): self.assertEqual({}, self.extn.get_extended_resources('1.0')) def test_get_extended_resources_v1_unset(self): self.assertEqual({}, self.empty_extn.get_extended_resources('1.0')) def test_get_required_extensions(self): self.assertEqual(self.REQUIRED_EXTENSIONS, self.extn.get_required_extensions()) def test_get_required_extensions_unset(self): self.assertRaises(NotImplementedError, self.empty_extn.get_required_extensions) def test_get_optional_extensions(self): self.assertEqual(self.OPTIONAL_EXTENSIONS, self.extn.get_optional_extensions()) def test_get_optional_extensions_unset(self): self.assertRaises(NotImplementedError, self.empty_extn.get_optional_extensions) def test_update_attributes_map_extensions_unset(self): self.assertRaises(NotImplementedError, self.empty_extn.update_attributes_map, {}) def test_update_attributes_map_with_ext_attrs(self): base_attrs = {'ports': {'a': 'A'}} ext_attrs = {'ports': {'b': 'B'}} self.extn.update_attributes_map(base_attrs, ext_attrs) self.assertEqual({'ports': {'a': 'A', 'b': 'B'}}, ext_attrs) def test_update_attributes_map_without_ext_attrs(self): base_attrs = {'ports': {'a': 'A'}} self.extn.update_attributes_map(base_attrs) self.assertIn('a', self.extn.get_extended_resources('2.0')['ports']) class _APIDefinition(extensions.APIExtensionDescriptor): api_definition = TestAPIExtensionDescriptor class _NoAPIDefinition(extensions.APIExtensionDescriptor): pass class _EmptyAPIDefinition(extensions.APIExtensionDescriptor): api_definition = {} neutron-lib-2.3.0/neutron_lib/tests/unit/api/test_attributes.py0000664000175000017500000003262513641427107025022 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from oslo_utils import uuidutils import testtools from webob import exc from neutron_lib.api import attributes from neutron_lib.api import converters from neutron_lib.api.definitions import network from neutron_lib.api.definitions import port from neutron_lib.api.definitions import subnet from neutron_lib.api.definitions import subnetpool from neutron_lib import constants from neutron_lib import context from neutron_lib import exceptions from neutron_lib.tests import _base as base class TestPopulateProjectInfo(base.BaseTestCase): def test_populate_project_info_add_project(self): attrs_in = {'tenant_id': uuidutils.generate_uuid()} attrs_out = attributes.populate_project_info(attrs_in) self.assertIn('project_id', attrs_out) self.assertEqual(attrs_in['tenant_id'], attrs_out['project_id']) self.assertEqual(2, len(attrs_out)) def test_populate_project_info_add_tenant(self): attrs_in = {'project_id': uuidutils.generate_uuid()} attrs_out = attributes.populate_project_info(attrs_in) self.assertIn('tenant_id', attrs_out) self.assertEqual(attrs_in['project_id'], attrs_out['tenant_id']) self.assertEqual(2, len(attrs_out)) def test_populate_project_info_ids_match(self): project_id = uuidutils.generate_uuid() attrs_in = {'project_id': project_id, 'tenant_id': project_id} attrs_out = attributes.populate_project_info(attrs_in) self.assertEqual(attrs_in, attrs_out) def test_populate_project_info_id_mismatch(self): attrs = { 'project_id': uuidutils.generate_uuid(), 'tenant_id': uuidutils.generate_uuid() } self.assertRaises(exc.HTTPBadRequest, attributes.populate_project_info, attrs) class TestAttributeInfo(base.BaseTestCase): class _MyException(Exception): pass _EXC_CLS = _MyException _RESOURCE_NAME = 'thing' _RESOURCE_ATTRS = {'name': {}, 'type': {}} _RESOURCE_MAP = {_RESOURCE_NAME: _RESOURCE_ATTRS} _ATTRS_INSTANCE = attributes.AttributeInfo(_RESOURCE_MAP) def test_create_from_attribute_info_instance(self): cloned_attrs = attributes.AttributeInfo( TestAttributeInfo._ATTRS_INSTANCE) self.assertEqual(TestAttributeInfo._ATTRS_INSTANCE.attributes, cloned_attrs.attributes) def test_create_from_api_def(self): self.assertEqual( port.RESOURCE_ATTRIBUTE_MAP, attributes.AttributeInfo(port.RESOURCE_ATTRIBUTE_MAP).attributes) def _test_fill_default_value(self, attr_inst, expected, res_dict, check_allow_post=True): attr_inst.fill_post_defaults( res_dict, check_allow_post=check_allow_post) self.assertEqual(expected, res_dict) def test_fill_default_value_ok(self): attr_info = { 'key': { 'allow_post': True, 'default': constants.ATTR_NOT_SPECIFIED, }, } attr_inst = attributes.AttributeInfo(attr_info) self._test_fill_default_value(attr_inst, {'key': 'X'}, {'key': 'X'}) self._test_fill_default_value( attr_inst, {'key': constants.ATTR_NOT_SPECIFIED}, {}) def test_override_no_allow_post(self): attr_info = { 'key': { 'allow_post': False, 'default': constants.ATTR_NOT_SPECIFIED, }, } attr_inst = attributes.AttributeInfo(attr_info) self._test_fill_default_value(attr_inst, {'key': 'X'}, {'key': 'X'}, check_allow_post=False) def test_fill_no_default_value_allow_post(self): attr_info = { 'key': { 'allow_post': True, }, } attr_inst = attributes.AttributeInfo(attr_info) self._test_fill_default_value(attr_inst, {'key': 'X'}, {'key': 'X'}) self.assertRaises(exceptions.InvalidInput, self._test_fill_default_value, attr_inst, {'key': 'X'}, {}) self.assertRaises(self._EXC_CLS, attr_inst.fill_post_defaults, {}, self._EXC_CLS) def test_fill_no_default_value_no_allow_post(self): attr_info = { 'key': { 'allow_post': False, }, } attr_inst = attributes.AttributeInfo(attr_info) self.assertRaises(exceptions.InvalidInput, self._test_fill_default_value, attr_inst, {'key': 'X'}, {'key': 'X'}) self._test_fill_default_value(attr_inst, {}, {}) self.assertRaises(self._EXC_CLS, attr_inst.fill_post_defaults, {'key': 'X'}, self._EXC_CLS) def test_fill_none_overridden_by_default(self): attr_info = { 'key': { 'allow_post': True, 'default': 42, 'default_overrides_none': True, }, } attr_inst = attributes.AttributeInfo(attr_info) self._test_fill_default_value(attr_inst, {'key': 42}, {'key': None}) def _test_convert_value(self, attr_inst, expected, res_dict): attr_inst.convert_values(res_dict) self.assertEqual(expected, res_dict) def test_convert_value(self): attr_info = { 'key': { }, } attr_inst = attributes.AttributeInfo(attr_info) self._test_convert_value(attr_inst, {'key': constants.ATTR_NOT_SPECIFIED}, {'key': constants.ATTR_NOT_SPECIFIED}) self._test_convert_value(attr_inst, {'key': 'X'}, {'key': 'X'}) self._test_convert_value(attr_inst, {'other_key': 'X'}, {'other_key': 'X'}) attr_info = { 'key': { 'convert_to': converters.convert_to_int, }, } attr_inst = attributes.AttributeInfo(attr_info) self._test_convert_value(attr_inst, {'key': constants.ATTR_NOT_SPECIFIED}, {'key': constants.ATTR_NOT_SPECIFIED}) self._test_convert_value(attr_inst, {'key': 1}, {'key': '1'}) self._test_convert_value(attr_inst, {'key': 1}, {'key': 1}) self.assertRaises(exceptions.InvalidInput, self._test_convert_value, attr_inst, {'key': 1}, {'key': 'a'}) attr_info = { 'key': { 'validate': {'type:uuid': None}, }, } attr_inst = attributes.AttributeInfo(attr_info) self._test_convert_value(attr_inst, {'key': constants.ATTR_NOT_SPECIFIED}, {'key': constants.ATTR_NOT_SPECIFIED}) uuid_str = '01234567-1234-1234-1234-1234567890ab' self._test_convert_value(attr_inst, {'key': uuid_str}, {'key': uuid_str}) self.assertRaises(exceptions.InvalidInput, self._test_convert_value, attr_inst, {'key': 1}, {'key': 1}) self.assertRaises(self._EXC_CLS, attr_inst.convert_values, {'key': 1}, self._EXC_CLS) def test_populate_project_id_admin_req(self): tenant_id_1 = uuidutils.generate_uuid() tenant_id_2 = uuidutils.generate_uuid() # non-admin users can't create a res on behalf of another project ctx = context.Context(user_id=None, tenant_id=tenant_id_1) res_dict = {'tenant_id': tenant_id_2} attr_inst = attributes.AttributeInfo({}) self.assertRaises(exc.HTTPBadRequest, attr_inst.populate_project_id, ctx, res_dict, None) # but admin users can ctx.is_admin = True attr_inst.populate_project_id(ctx, res_dict, is_create=False) def test_populate_project_id_from_context(self): tenant_id = uuidutils.generate_uuid() ctx = context.Context(user_id=None, tenant_id=tenant_id) # for each create request, the tenant_id should be added to the # req body res_dict = {} attr_inst = attributes.AttributeInfo({}) attr_inst.populate_project_id(ctx, res_dict, is_create=True) self.assertEqual( {'tenant_id': ctx.tenant_id, 'project_id': ctx.tenant_id}, res_dict) def test_populate_project_id_mandatory_not_specified(self): tenant_id = uuidutils.generate_uuid() ctx = context.Context(user_id=None, tenant_id=tenant_id) # if the tenant_id is mandatory for the resource and not specified # in the request nor in the context, an exception should be raised res_dict = {} attr_info = {'tenant_id': {'allow_post': True}} ctx.tenant_id = None attr_inst = attributes.AttributeInfo(attr_info) self.assertRaises(exc.HTTPBadRequest, attr_inst.populate_project_id, ctx, res_dict, True) def test_populate_project_id_not_mandatory(self): ctx = context.Context(user_id=None) # if the tenant_id is not mandatory for the resource it should be # OK if it is not in the request. res_dict = {'name': 'test_port'} attr_inst = attributes.AttributeInfo({}) ctx.tenant_id = None attr_inst.populate_project_id(ctx, res_dict, True) def test_verify_attributes_null(self): attributes.AttributeInfo({}).verify_attributes({}) def test_verify_attributes_ok_with_project_id(self): attributes.AttributeInfo( {'tenant_id': 'foo', 'project_id': 'foo'}).verify_attributes( {'tenant_id': 'foo'}) def test_verify_attributes_ok_subset(self): attributes.AttributeInfo( {'attr1': 'foo', 'attr2': 'bar'}).verify_attributes( {'attr1': 'foo'}) def test_verify_attributes_unrecognized(self): with testtools.ExpectedException(exc.HTTPBadRequest) as bad_req: attributes.AttributeInfo( {'attr1': 'foo'}).verify_attributes( {'attr1': 'foo', 'attr2': 'bar'}) self.assertEqual(bad_req.message, "Unrecognized attribute(s) 'attr2'") class TestCoreResources(base.BaseTestCase): CORE_DEFS = [network, port, subnet, subnetpool] def test_core_resource_names(self): self.assertEqual( sorted([r.COLLECTION_NAME for r in TestCoreResources.CORE_DEFS]), sorted(attributes.RESOURCES.keys())) def test_core_resource_attrs(self): for r in TestCoreResources.CORE_DEFS: self.assertIs(r.RESOURCE_ATTRIBUTE_MAP[r.COLLECTION_NAME], attributes.RESOURCES[r.COLLECTION_NAME]) class TestValidatePriviliges(base.BaseTestCase): def test__validate_privileges_same_tenant(self): project_id = 'fake_project' ctx = context.Context(project_id=project_id) res_dict = {'project_id': project_id} try: attributes._validate_privileges(ctx, res_dict) except exc.HTTPBadRequest: self.fail("HTTPBadRequest exception should not be raised.") def test__validate_privileges_user_other_tenant(self): project_id = 'fake_project' ctx = context.Context(project_id='fake_project2') res_dict = {'project_id': project_id} self.assertRaises( exc.HTTPBadRequest, attributes._validate_privileges, ctx, res_dict) def test__validate_privileges_admin_other_tenant(self): project_id = 'fake_project' ctx = context.Context(project_id='fake_project2', is_admin=True) res_dict = {'project_id': project_id} try: attributes._validate_privileges(ctx, res_dict) except exc.HTTPBadRequest: self.fail("HTTPBadRequest exception should not be raised.") def test__validate_privileges_advsvc_other_tenant(self): project_id = 'fake_project' ctx = context.Context(project_id='fake_project2', is_advsvc=True) res_dict = {'project_id': project_id} try: attributes._validate_privileges(ctx, res_dict) except exc.HTTPBadRequest: self.fail("HTTPBadRequest exception should not be raised.") class TestRetrieveValidSortKeys(base.BaseTestCase): def test_retrieve_valid_sort_keys(self): attr_info = { "id": { "visible": True, "is_sort_key": True }, "name": { "is_sort_key": True }, "created_at": { "is_sort_key": False }, "tenant_id": { "visible": True, } } expect_val = set(["id", "name"]) actual_val = attributes.retrieve_valid_sort_keys(attr_info) self.assertEqual(expect_val, actual_val) neutron-lib-2.3.0/neutron_lib/tests/unit/api/validators/0000775000175000017500000000000013641427200023355 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/api/validators/test_multiprovidernet.py0000664000175000017500000000357613641427107030423 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from webob import exc from neutron_lib.api.definitions import provider_net from neutron_lib.api.validators import multiprovidernet as mp_validator from neutron_lib import constants from neutron_lib.tests import _base as base def _build_segment(net_type=constants.ATTR_NOT_SPECIFIED, phy_net=constants.ATTR_NOT_SPECIFIED, seg_id=constants.ATTR_NOT_SPECIFIED): return { provider_net.NETWORK_TYPE: net_type, provider_net.PHYSICAL_NETWORK: phy_net, provider_net.SEGMENTATION_ID: seg_id } class TestMultiprovidernetValidators(base.BaseTestCase): def test_convert_and_validate_segments_default_values(self): segs = [{}] mp_validator.convert_and_validate_segments(segs) self.assertEqual( [_build_segment()], segs) def test_convert_and_validate_segments_seg_id_to_int(self): segs = [_build_segment(seg_id="9")] mp_validator.convert_and_validate_segments(segs) self.assertEqual(_build_segment(seg_id=9), segs[0]) def test_convert_and_validate_segments_invalid_key(self): segs = [_build_segment(seg_id=2)] segs[0]['some_key'] = 'some_value' self.assertRaises(exc.HTTPBadRequest, mp_validator.convert_and_validate_segments, segs) neutron-lib-2.3.0/neutron_lib/tests/unit/api/validators/test_allowedaddresspairs.py0000664000175000017500000000771613641427107031043 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from unittest import mock from oslo_config import cfg from webob import exc from neutron_lib.api.validators import allowedaddresspairs as validator from neutron_lib.exceptions import allowedaddresspairs as addr_exc from neutron_lib.tests import _base as base class TestAllowedAddressPairs(base.BaseTestCase): def test__validate_allowed_address_pairs_not_a_list(self): for d in [{}, set(), 'abc', True, 1]: self.assertRaisesRegex( exc.HTTPBadRequest, 'must be a list', validator._validate_allowed_address_pairs, d) @mock.patch.object(cfg, 'CONF') def test__validate_allowed_address_pairs_exhausted(self, mock_conf): mock_conf.max_allowed_address_pair = 1 self.assertRaises( addr_exc.AllowedAddressPairExhausted, validator._validate_allowed_address_pairs, [{}, {}]) @mock.patch.object(cfg, 'CONF') def test__validate_allowed_address_pairs_invalid_mac(self, mock_conf): mock_conf.max_allowed_address_pair = 3 self.assertRaisesRegex( exc.HTTPBadRequest, 'is not a valid MAC address', validator._validate_allowed_address_pairs, [{'mac_address': 1}]) @mock.patch.object(cfg, 'CONF') def test__validate_allowed_address_pairs_missing_ip(self, mock_conf): mock_conf.max_allowed_address_pair = 3 self.assertRaises( addr_exc.AllowedAddressPairsMissingIP, validator._validate_allowed_address_pairs, [{'ip_adress': '192.168.1.11'}]) @mock.patch.object(cfg, 'CONF') def test__validate_allowed_address_pairs_duplicate(self, mock_conf): mock_conf.max_allowed_address_pair = 3 self.assertRaises( addr_exc.DuplicateAddressPairInRequest, validator._validate_allowed_address_pairs, [{'ip_address': '192.168.1.11'}, {'ip_address': '192.168.1.11'}]) @mock.patch.object(cfg, 'CONF') def test__validate_allowed_address_pairs_invalid_attrs(self, mock_conf): mock_conf.max_allowed_address_pair = 3 self.assertRaisesRegex( exc.HTTPBadRequest, 'Unrecognized attribute', validator._validate_allowed_address_pairs, [{'ip_address': '192.168.1.11'}, {'ip_address': '192.168.1.12', 'idk': True}]) @mock.patch.object(cfg, 'CONF') def test__validate_allowed_address_pairs_invalid_subnet(self, mock_conf): mock_conf.max_allowed_address_pair = 3 self.assertRaisesRegex( exc.HTTPBadRequest, 'is not a valid IP subnet', validator._validate_allowed_address_pairs, [{'ip_address': '192.168.1.11'}, {'ip_address': '192.168.1.0/a'}]) @mock.patch.object(cfg, 'CONF') def test__validate_allowed_address_pairs_invalid_ip_address( self, mock_conf): mock_conf.max_allowed_address_pair = 3 self.assertRaisesRegex( exc.HTTPBadRequest, 'is not a valid IP address', validator._validate_allowed_address_pairs, [{'ip_address': '192.168.1.a'}, {'ip_address': '192.168.1.2'}]) @mock.patch.object(cfg, 'CONF') def test__validate_allowed_address_pairs_good_data(self, mock_conf): mock_conf.max_allowed_address_pair = 3 self.assertIsNone(validator._validate_allowed_address_pairs( [{'ip_address': '192.1.1.11'}, {'ip_address': '19.1.1.11'}])) neutron-lib-2.3.0/neutron_lib/tests/unit/api/validators/test_dns.py0000664000175000017500000001526313641427107025567 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from unittest import mock from neutron_lib.api.validators import dns from neutron_lib.db import constants as db_constants from neutron_lib.tests import _base as base class TestDnsValidators(base.BaseTestCase): @mock.patch('oslo_config.cfg.CONF') def test_validate_dns_name(self, CONF): CONF.dns_domain = '' msg = dns.validate_dns_name('') self.assertIsNone(msg) CONF.dns_domain = 'example.org.' dns_name = 'host' msg = dns.validate_dns_name(dns_name) self.assertIsNone(msg) invalid_data = 'A' * 256 max_len = 255 expected = ("'%(data)s' not a valid PQDN or FQDN. Reason: " "'%(data)s' exceeds the %(maxlen)s character FQDN " "limit") % {'data': invalid_data, 'maxlen': max_len} msg = dns.validate_dns_name(invalid_data, max_len) self.assertEqual(expected, msg) invalid_data = '.hostname' expected = ("'%(data)s' not a valid PQDN or FQDN. Reason: " "Encountered an empty component") % {'data': invalid_data} msg = dns.validate_dns_name(invalid_data) self.assertEqual(expected, msg) invalid_data = 'hostname-' expected = ("'%(data)s' not a valid PQDN or FQDN. Reason: " "Name '%(data)s' must not start or end with a " "hyphen") % {'data': invalid_data} msg = dns.validate_dns_name(invalid_data) self.assertEqual(expected, msg) invalid_data = 'hostname@host' expected = ("'%(data)s' not a valid PQDN or FQDN. Reason: " "Name '%(data)s' must be 1-63 characters long, each of " "which can only be alphanumeric or a " "hyphen") % {'data': invalid_data} msg = dns.validate_dns_name(invalid_data) self.assertEqual(expected, msg) invalid_suffix = '1234' invalid_data = 'hostname.' + invalid_suffix expected = ("'%(data)s' not a valid PQDN or FQDN. Reason: " "TLD '%(suffix)s' must not be all " "numeric") % {'data': invalid_data, 'suffix': invalid_suffix} msg = dns.validate_dns_name(invalid_data) self.assertEqual(expected, msg) # len(dns_name + dns_domain) > 255 invalid_domain = 'A' * 250 + '.org.' CONF.dns_domain = invalid_domain dns_name = 'hostname' expected = ("The dns_name passed is a PQDN and its size is " "'%(dns_name_len)s'. The dns_domain option in " "neutron.conf is set to %(dns_domain)s, with a " "length of '%(higher_labels_len)s'. When the two are " "concatenated to form a FQDN (with a '.' at the end), " "the resulting length exceeds the maximum size " "of '%(fqdn_max_len)s'" ) % {'dns_name_len': len(dns_name), 'dns_domain': invalid_domain, 'higher_labels_len': len(invalid_domain) + 1, 'fqdn_max_len': db_constants.FQDN_FIELD_SIZE} msg = dns.validate_dns_name(dns_name) self.assertEqual(expected, msg) dns_name = 'host.' dns_domain = 'example.com.' CONF.dns_domain = dns_domain expected = ("The dns_name passed is a FQDN. Its higher level labels " "must be equal to the dns_domain option in neutron.conf, " "that has been set to '%(dns_domain)s'. It must also " "include one or more valid DNS labels to the left " "of '%(dns_domain)s'") % {'dns_domain': dns_domain} msg = dns.validate_dns_name(dns_name) self.assertEqual(expected, msg) def test_validate_fip_dns_name(self): # Don't run tests duplicated to validate_dns_name() msg = dns.validate_fip_dns_name('') self.assertIsNone(msg) msg = dns.validate_fip_dns_name('host') self.assertIsNone(msg) invalid_data = 1234 expected = "'%s' is not a valid string" % invalid_data msg = dns.validate_fip_dns_name(invalid_data) self.assertEqual(expected, msg) invalid_data = 'host.' expected = ("'%s' is a FQDN. It should be a relative domain " "name") % invalid_data msg = dns.validate_fip_dns_name(invalid_data) self.assertEqual(expected, msg) length = 10 invalid_data = 'a' * length max_len = 12 expected = ("'%(data)s' contains %(length)s characters. Adding a " "domain name will cause it to exceed the maximum length " "of a FQDN of '%(max_len)s'") % {"data": invalid_data, "length": length, "max_len": max_len} msg = dns.validate_fip_dns_name(invalid_data, max_len) self.assertEqual(expected, msg) def test_validate_dns_domain(self): # Don't run tests duplicated to validate_dns_name() msg = dns.validate_dns_domain('') self.assertIsNone(msg) msg = dns.validate_dns_domain('example.com.') self.assertIsNone(msg) invalid_data = 1234 expected = "'%s' is not a valid string" % invalid_data msg = dns.validate_dns_domain(invalid_data) self.assertEqual(expected, msg) invalid_data = 'example.com' expected = "'%s' is not a FQDN" % invalid_data msg = dns.validate_dns_domain(invalid_data) self.assertEqual(expected, msg) length = 9 invalid_data = 'a' * length + '.' max_len = 11 expected = ("'%(data)s' contains %(length)s characters. Adding a " "sub-domain will cause it to exceed the maximum length " "of a FQDN of '%(max_len)s'") % {"data": invalid_data, "length": length + 1, "max_len": max_len} msg = dns.validate_dns_domain(invalid_data, max_len) self.assertEqual(expected, msg) neutron-lib-2.3.0/neutron_lib/tests/unit/api/validators/test_validators.py0000664000175000017500000015150213641427107027150 0ustar zuulzuul00000000000000# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import string from unittest import mock import netaddr from neutron_lib._i18n import _ from neutron_lib.api import converters from neutron_lib.api.definitions import extra_dhcp_opt from neutron_lib.api import validators from neutron_lib import constants from neutron_lib import exceptions as n_exc from neutron_lib import fixture from neutron_lib.plugins import directory from neutron_lib.tests import _base as base def dummy_validator(data, valid_values=None): pass class TestAttributeValidation(base.BaseTestCase): def _construct_dict_and_constraints(self): """Constructs a test dictionary and a definition of constraints. :return: A (dictionary, constraint) tuple """ constraints = {'key1': {'type:values': ['val1', 'val2'], 'required': True}, 'key2': {'type:string': None, 'required': False}, 'key3': {'type:dict': {'k4': {'type:string': None, 'required': True}}, 'required': True}} dictionary = {'key1': 'val1', 'key2': 'a string value', 'key3': {'k4': 'a string value'}} return dictionary, constraints def test_type_prefixing(self): validators.add_validator('type:prefixed_type', dummy_validator) validators.add_validator('unprefixed_type', dummy_validator) self.assertEqual(dummy_validator, validators.get_validator('type:prefixed_type')) self.assertEqual(dummy_validator, validators.get_validator('prefixed_type')) self.assertEqual(dummy_validator, validators.get_validator('type:unprefixed_type')) self.assertEqual(dummy_validator, validators.get_validator('unprefixed_type')) def test_adding_validator(self): validators.add_validator('new_type', dummy_validator) self.assertIn('type:new_type', validators.validators) self.assertEqual(dummy_validator, validators.validators['type:new_type']) def test_get_validator_default(self): self.assertEqual(dummy_validator, validators.get_validator('nope', default=dummy_validator)) def test_fail_adding_duplicate_validator(self): self.assertRaises(KeyError, validators.add_validator, 'dict', lambda x: x) def test_success_adding_duplicate_validator(self): validators.add_validator('dummy', dummy_validator) validators.add_validator('dummy', dummy_validator) self.assertEqual(dummy_validator, validators.get_validator('dummy')) def test_is_attr_set(self): data = constants.ATTR_NOT_SPECIFIED self.assertIs(validators.is_attr_set(data), False) data = None self.assertIs(validators.is_attr_set(data), False) data = "I'm set" self.assertIs(validators.is_attr_set(data), True) def test_validate_values(self): # Check that validation is not performed if valid_values is not set msg = validators.validate_values(4) self.assertIsNone(msg) # Check that value is within valid_values msg = validators.validate_values(4, [4, 6]) self.assertIsNone(msg) # Check that value is within valid_values msg = validators.validate_values(4, (4, 6)) self.assertIsNone(msg) # Check that value is within valid_values with strings msg = validators.validate_values("1", ["2", "1", "4", "5"]) self.assertIsNone(msg) # Check that value is not compatible for comparison response = "'valid_values' does not support membership operations" self.assertRaisesRegex(TypeError, response, validators.validate_values, data=None, valid_values=True) def test_validate_values_display(self): # Check that value is NOT within valid_values and report values msg = validators.validate_values(7, [4, 6], valid_values_display="[4, 6]") self.assertEqual("7 is not in [4, 6]", msg) # Check that value is NOT within valid_values and report values msg = validators.validate_values(7, (4, 6), valid_values_display="(4, 6)") self.assertEqual("7 is not in (4, 6)", msg) # Check values with a range function showing a custom string msg = validators.validate_values(8, range(8), valid_values_display="[0..7]") self.assertEqual("8 is not in [0..7]", msg) # Check that value is not within valid_values and custom string msg = validators.validate_values(1, [2, 3, 4, 5], valid_values_display="[2, 3, 4, 5]") self.assertEqual("1 is not in [2, 3, 4, 5]", msg) # Check that value is not within valid_values and custom string msg = validators.validate_values("1", ["2", "3", "4", "5"], valid_values_display="'valid_values" "_to_show'") self.assertEqual("1 is not in 'valid_values_to_show'", msg) # Check that value is not comparable to valid_values and got Exception data = 1 valid_values = '[2, 3, 4, 5]' response = "'data' of type '%s' and 'valid_values' of type" \ " '%s' are not compatible for comparison" % ( type(data), type(valid_values)) self.assertRaisesRegex(TypeError, response, validators.validate_values, data, valid_values, valid_values_display="[2, 3, 4, 5]") def test_validate_not_empty_string(self): msg = validators.validate_not_empty_string(' ', None) self.assertEqual(u"' ' Blank strings are not permitted", msg) msg = validators.validate_not_empty_string(123, None) self.assertEqual(u"'123' is not a valid string", msg) def test_validate_not_empty_string_or_none(self): msg = validators.validate_not_empty_string_or_none(' ', None) self.assertEqual(u"' ' Blank strings are not permitted", msg) msg = validators.validate_not_empty_string_or_none(None, None) self.assertIsNone(msg) def test_validate_string_or_none(self): msg = validators.validate_string_or_none('test', None) self.assertIsNone(msg) msg = validators.validate_string_or_none(None, None) self.assertIsNone(msg) def test_validate_string(self): msg = validators.validate_string(None, None) self.assertEqual("'None' is not a valid string", msg) # 0 == len(data) == max_len msg = validators.validate_string("", 0) self.assertIsNone(msg) # 0 == len(data) < max_len msg = validators.validate_string("", 9) self.assertIsNone(msg) # 0 < len(data) < max_len msg = validators.validate_string("123456789", 10) self.assertIsNone(msg) # 0 < len(data) == max_len msg = validators.validate_string("123456789", 9) self.assertIsNone(msg) # 0 < max_len < len(data) msg = validators.validate_string("1234567890", 9) self.assertEqual("'1234567890' exceeds maximum length of 9", msg) msg = validators.validate_string("123456789", None) self.assertIsNone(msg) def test_validate_list_of_unique_strings(self): data = "TEST" msg = validators.validate_list_of_unique_strings(data, None) self.assertEqual("'TEST' is not a list", msg) data = ["TEST01", "TEST02", "TEST01"] msg = validators.validate_list_of_unique_strings(data, None) self.assertEqual( "Duplicate items in the list: 'TEST01'", msg) data = ["12345678", "123456789"] msg = validators.validate_list_of_unique_strings(data, 8) self.assertEqual("'123456789' exceeds maximum length of 8", msg) data = ["TEST01", "TEST02", "TEST03"] msg = validators.validate_list_of_unique_strings(data, None) self.assertIsNone(msg) def test_validate_boolean(self): msg = validators.validate_boolean(True) self.assertIsNone(msg) msg = validators.validate_boolean(0) self.assertIsNone(msg) msg = validators.validate_boolean("false") self.assertIsNone(msg) msg = validators.validate_boolean("fasle") self.assertEqual("'fasle' is not a valid boolean value", msg) def test_validate_integer(self): msg = validators.validate_integer(1) self.assertIsNone(msg) msg = validators.validate_integer(0.1) self.assertEqual("'0.1' is not an integer", msg) msg = validators.validate_integer("1") self.assertIsNone(msg) msg = validators.validate_integer("0.1") self.assertEqual("'0.1' is not an integer", msg) msg = validators.validate_integer(True) self.assertEqual("'True' is not an integer:boolean", msg) msg = validators.validate_integer(False) self.assertEqual("'False' is not an integer:boolean", msg) msg = validators.validate_integer(float('Inf')) self.assertEqual("'inf' is not an integer", msg) msg = validators.validate_integer(None) self.assertEqual("'None' is not an integer", msg) def test_validate_integer_values(self): msg = validators.validate_integer(2, [2, 3, 4, 5]) self.assertIsNone(msg) msg = validators.validate_integer(1, [2, 3, 4, 5]) self.assertEqual("1 is not in valid_values", msg) def test_validate_no_whitespace(self): data = 'no_white_space' result = validators.validate_no_whitespace(data) self.assertEqual(data, result) self.assertRaises(n_exc.InvalidInput, validators.validate_no_whitespace, 'i have whitespace') self.assertRaises(n_exc.InvalidInput, validators.validate_no_whitespace, 'i\thave\twhitespace') for ws in string.whitespace: self.assertRaises(n_exc.InvalidInput, validators.validate_no_whitespace, '%swhitespace-at-head' % ws) self.assertRaises(n_exc.InvalidInput, validators.validate_no_whitespace, 'whitespace-at-tail%s' % ws) def test_validate_range(self): msg = validators.validate_range(1, [1, 9]) self.assertIsNone(msg) msg = validators.validate_range(5, [1, 9]) self.assertIsNone(msg) msg = validators.validate_range(9, [1, 9]) self.assertIsNone(msg) msg = validators.validate_range(1, (1, 9)) self.assertIsNone(msg) msg = validators.validate_range(5, (1, 9)) self.assertIsNone(msg) msg = validators.validate_range(9, (1, 9)) self.assertIsNone(msg) msg = validators.validate_range(0, [1, 9]) self.assertEqual("'0' is too small - must be at least '1'", msg) msg = validators.validate_range(10, (1, 9)) self.assertEqual("'10' is too large - must be no larger than '9'", msg) msg = validators.validate_range("bogus", (1, 9)) self.assertEqual("'bogus' is not an integer", msg) msg = validators.validate_range(10, (validators.UNLIMITED, validators.UNLIMITED)) self.assertIsNone(msg) msg = validators.validate_range(10, (1, validators.UNLIMITED)) self.assertIsNone(msg) msg = validators.validate_range(1, (validators.UNLIMITED, 9)) self.assertIsNone(msg) msg = validators.validate_range(-1, (0, validators.UNLIMITED)) self.assertEqual("'-1' is too small - must be at least '0'", msg) msg = validators.validate_range(10, (validators.UNLIMITED, 9)) self.assertEqual("'10' is too large - must be no larger than '9'", msg) @mock.patch("neutron_lib.api.validators.validate_range") def test_validate_range_or_none(self, mock_validate_range): msg = validators.validate_range_or_none(None, [1, 9]) self.assertFalse(mock_validate_range.called) self.assertIsNone(msg) validators.validate_range_or_none(1, [1, 9]) mock_validate_range.assert_called_once_with(1, [1, 9]) def _test_validate_mac_address(self, validator, allow_none=False): mac_addr = "ff:16:3e:4f:00:00" msg = validator(mac_addr) self.assertIsNone(msg) mac_addr = "ffa:16:3e:4f:00:00" msg = validator(mac_addr) err_msg = "'%s' is not a valid MAC address" self.assertEqual(err_msg % mac_addr, msg) for invalid_mac_addr in constants.INVALID_MAC_ADDRESSES: msg = validator(invalid_mac_addr) self.assertEqual(err_msg % invalid_mac_addr, msg) mac_addr = "123" msg = validator(mac_addr) self.assertEqual(err_msg % mac_addr, msg) mac_addr = None msg = validator(mac_addr) if allow_none: self.assertIsNone(msg) else: self.assertEqual(err_msg % mac_addr, msg) mac_addr = "ff:16:3e:4f:00:00\r" msg = validator(mac_addr) self.assertEqual(err_msg % mac_addr, msg) def test_validate_mac_address(self): self._test_validate_mac_address(validators.validate_mac_address) def test_validate_mac_address_or_none(self): self._test_validate_mac_address( validators.validate_mac_address_or_none, allow_none=True) def test_validate_ip_address(self): ip_addr = '1.1.1.1' msg = validators.validate_ip_address(ip_addr) self.assertIsNone(msg) ip_addr = '1111.1.1.1' msg = validators.validate_ip_address(ip_addr) self.assertEqual("'%s' is not a valid IP address" % ip_addr, msg) # Depending on platform to run UTs, this case might or might not be # an equivalent to test_validate_ip_address_bsd. ip_addr = '1' * 59 msg = validators.validate_ip_address(ip_addr) self.assertEqual("'%s' is not a valid IP address" % ip_addr, msg) ip_addr = '1.1.1.1 has whitespace' msg = validators.validate_ip_address(ip_addr) self.assertEqual("'%s' is not a valid IP address" % ip_addr, msg) ip_addr = '111.1.1.1\twhitespace' msg = validators.validate_ip_address(ip_addr) self.assertEqual("'%s' is not a valid IP address" % ip_addr, msg) ip_addr = '111.1.1.1\nwhitespace' msg = validators.validate_ip_address(ip_addr) self.assertEqual("'%s' is not a valid IP address" % ip_addr, msg) for ws in string.whitespace: ip_addr = '%s111.1.1.1' % ws msg = validators.validate_ip_address(ip_addr) self.assertEqual("'%s' is not a valid IP address" % ip_addr, msg) for ws in string.whitespace: ip_addr = '111.1.1.1%s' % ws msg = validators.validate_ip_address(ip_addr) self.assertEqual("'%s' is not a valid IP address" % ip_addr, msg) def test_validate_ip_address_with_leading_zero(self): ip_addr = '1.1.1.01' expected_msg = ("'%(data)s' is not an accepted IP address, " "'%(ip)s' is recommended") msg = validators.validate_ip_address(ip_addr) self.assertEqual(expected_msg % {"data": ip_addr, "ip": '1.1.1.1'}, msg) ip_addr = '1.1.1.011' msg = validators.validate_ip_address(ip_addr) self.assertEqual(expected_msg % {"data": ip_addr, "ip": '1.1.1.11'}, msg) ip_addr = '1.1.1.09' msg = validators.validate_ip_address(ip_addr) self.assertEqual(expected_msg % {"data": ip_addr, "ip": '1.1.1.9'}, msg) ip_addr = "fe80:0:0:0:0:0:0:0001" msg = validators.validate_ip_address(ip_addr) self.assertIsNone(msg) def test_validate_ip_address_bsd(self): # NOTE(yamamoto): On NetBSD and OS X, netaddr.IPAddress() accepts # '1' * 59 as a valid address. The behaviour is inherited from # libc behaviour there. This test ensures that our validator reject # such addresses on such platforms by mocking netaddr to emulate # the behaviour. ip_addr = '1' * 59 with mock.patch('netaddr.IPAddress') as ip_address_cls: msg = validators.validate_ip_address(ip_addr) ip_address_cls.assert_called_once_with(ip_addr, flags=netaddr.core.ZEROFILL) self.assertEqual("'%s' is not a valid IP address" % ip_addr, msg) def test_validate_ip_pools(self): pools = [[{'end': '10.0.0.254'}], [{'start': '10.0.0.254'}], [{'start': '1000.0.0.254', 'end': '1.1.1.1'}], [{'start': '10.0.0.2', 'end': '10.0.0.254', 'forza': 'juve'}], [{'start': '10.0.0.2', 'end': '10.0.0.254'}, {'end': '10.0.0.254'}], [None], None] for pool in pools: msg = validators.validate_ip_pools(pool) self.assertIsNotNone(msg) pools = [[{'end': '10.0.0.254', 'start': '10.0.0.2'}, {'start': '11.0.0.2', 'end': '11.1.1.1'}], [{'start': '11.0.0.2', 'end': '11.0.0.100'}]] for pool in pools: msg = validators.validate_ip_pools(pool) self.assertIsNone(msg) invalid_ip = '10.0.0.2\r' pools = [[{'end': '10.0.0.254', 'start': invalid_ip}]] for pool in pools: msg = validators.validate_ip_pools(pool) self.assertEqual("'%s' is not a valid IP address" % invalid_ip, msg) def test_validate_fixed_ips(self): fixed_ips = [ {'data': [{'subnet_id': '00000000-ffff-ffff-ffff-000000000000', 'ip_address': '1111.1.1.1'}], 'error_msg': "'1111.1.1.1' is not a valid IP address"}, {'data': [{'subnet_id': 'invalid', 'ip_address': '1.1.1.1'}], 'error_msg': "'invalid' is not a valid UUID"}, {'data': None, 'error_msg': "Invalid data format for fixed IP: 'None'"}, {'data': "1.1.1.1", 'error_msg': "Invalid data format for fixed IP: '1.1.1.1'"}, {'data': ['00000000-ffff-ffff-ffff-000000000000', '1.1.1.1'], 'error_msg': "Invalid data format for fixed IP: " "'00000000-ffff-ffff-ffff-000000000000'"}, {'data': [['00000000-ffff-ffff-ffff-000000000000', '1.1.1.1']], 'error_msg': "Invalid data format for fixed IP: " "'['00000000-ffff-ffff-ffff-000000000000', " "'1.1.1.1']'"}, {'data': [{'subnet_id': '00000000-0fff-ffff-ffff-000000000000', 'ip_address': '1.1.1.1'}, {'subnet_id': '00000000-ffff-ffff-ffff-000000000000', 'ip_address': '1.1.1.1'}], 'error_msg': "Duplicate IP address '1.1.1.1'"}] for fixed in fixed_ips: msg = validators.validate_fixed_ips(fixed['data']) self.assertEqual(fixed['error_msg'], msg) fixed_ips = [[{'subnet_id': '00000000-ffff-ffff-ffff-000000000000', 'ip_address': '1.1.1.1'}], [{'subnet_id': '00000000-0fff-ffff-ffff-000000000000', 'ip_address': '1.1.1.1'}, {'subnet_id': '00000000-ffff-ffff-ffff-000000000000', 'ip_address': '1.1.1.2'}]] for fixed in fixed_ips: msg = validators.validate_fixed_ips(fixed) self.assertIsNone(msg) def test_validate_nameservers(self): ns_pools = [['1.1.1.2', '1.1.1.2'], ['www.hostname.com', 'www.hostname.com'], ['1000.0.0.1'], ['www.hostname.com'], ['www.great.marathons.to.travel'], ['valid'], ['77.hostname.com'], ['1' * 59], ['www.internal.hostname.com'], None] for ns in ns_pools: msg = validators.validate_nameservers(ns, None) self.assertIsNotNone(msg) ns_pools = [['100.0.0.2'], ['1.1.1.1', '1.1.1.2']] for ns in ns_pools: msg = validators.validate_nameservers(ns, None) self.assertIsNone(msg) def test_validate_hostroutes(self): hostroute_pools = [[{'destination': '100.0.0.0/24'}], [{'nexthop': '10.0.2.20'}], [{'nexthop': '10.0.2.20', 'forza': 'juve', 'destination': '100.0.0.0/8'}], [{'nexthop': '1110.0.2.20', 'destination': '100.0.0.0/8'}], [{'nexthop': '10.0.2.20', 'destination': '100.0.0.0'}], [{'nexthop': '10.0.2.20', 'destination': '100.0.0.0/8'}, {'nexthop': '10.0.2.20', 'destination': '100.0.0.0/8'}], [None], None] for host_routes in hostroute_pools: msg = validators.validate_hostroutes(host_routes, None) self.assertIsNotNone(msg) hostroute_pools = [[{'destination': '100.0.0.0/24', 'nexthop': '10.0.2.20'}], [{'nexthop': '10.0.2.20', 'destination': '100.0.0.0/8'}, {'nexthop': '10.0.2.20', 'destination': '101.0.0.0/8'}]] for host_routes in hostroute_pools: msg = validators.validate_hostroutes(host_routes, None) self.assertIsNone(msg) def test_validate_ip_address_or_none(self): ip_addr = None msg = validators.validate_ip_address_or_none(ip_addr) self.assertIsNone(msg) ip_addr = '1.1.1.1' msg = validators.validate_ip_address_or_none(ip_addr) self.assertIsNone(msg) ip_addr = '1111.1.1.1' msg = validators.validate_ip_address_or_none(ip_addr) self.assertEqual("'%s' is not a valid IP address" % ip_addr, msg) def test_uuid_pattern(self): data = 'garbage' msg = validators.validate_regex(data, constants.UUID_PATTERN) self.assertIsNotNone(msg) data = '00000000-ffff-ffff-ffff-000000000000' msg = validators.validate_regex(data, constants.UUID_PATTERN) self.assertIsNone(msg) def test_mac_pattern(self): # Valid - 3 octets base_mac = "fa:16:3e:00:00:00" msg = validators.validate_regex(base_mac, validators.MAC_PATTERN) self.assertIsNone(msg) # Valid - 4 octets base_mac = "fa:16:3e:4f:00:00" msg = validators.validate_regex(base_mac, validators.MAC_PATTERN) self.assertIsNone(msg) # Invalid - not unicast base_mac = "01:16:3e:4f:00:00" msg = validators.validate_regex(base_mac, validators.MAC_PATTERN) self.assertIsNotNone(msg) # Invalid - invalid format base_mac = "a:16:3e:4f:00:00" msg = validators.validate_regex(base_mac, validators.MAC_PATTERN) self.assertIsNotNone(msg) # Invalid - invalid format base_mac = "ffa:16:3e:4f:00:00" msg = validators.validate_regex(base_mac, validators.MAC_PATTERN) self.assertIsNotNone(msg) # Invalid - invalid format base_mac = "01163e4f0000" msg = validators.validate_regex(base_mac, validators.MAC_PATTERN) self.assertIsNotNone(msg) # Invalid - invalid format base_mac = "01-16-3e-4f-00-00" msg = validators.validate_regex(base_mac, validators.MAC_PATTERN) self.assertIsNotNone(msg) # Invalid - invalid format base_mac = "00:16:3:f:00:00" msg = validators.validate_regex(base_mac, validators.MAC_PATTERN) self.assertIsNotNone(msg) # Invalid - invalid format base_mac = "12:3:4:5:67:89ab" msg = validators.validate_regex(base_mac, validators.MAC_PATTERN) self.assertIsNotNone(msg) def _test_validate_subnet(self, validator, allow_none=False): # Valid - IPv4 cidr = "10.0.2.0/24" msg = validator(cidr, None) self.assertIsNone(msg) # Valid - IPv6 without final octets cidr = "fe80::/24" msg = validator(cidr, None) self.assertIsNone(msg) # Valid - IPv6 with final octets cidr = "fe80::/24" msg = validator(cidr, None) self.assertIsNone(msg) # Valid - uncompressed ipv6 address cidr = "fe80:0:0:0:0:0:0:0/128" msg = validator(cidr, None) self.assertIsNone(msg) # Valid - ipv6 address with multiple consecutive zero cidr = "2001:0db8:0:0:1::1/128" msg = validator(cidr, None) self.assertIsNone(msg) # Valid - ipv6 address with multiple consecutive zero cidr = "2001:0db8::1:0:0:1/128" msg = validator(cidr, None) self.assertIsNone(msg) # Valid - ipv6 address with multiple consecutive zero cidr = "2001::0:1:0:0:1100/120" msg = validator(cidr, None) self.assertIsNone(msg) # Invalid - abbreviated ipv4 address cidr = "10/24" msg = validator(cidr, None) error = _("'%(data)s' isn't a recognized IP subnet cidr," " '%(cidr)s' is recommended") % {"data": cidr, "cidr": "10.0.0.0/24"} self.assertEqual(error, msg) # Invalid - IPv4 missing mask cidr = "10.0.2.0" msg = validator(cidr, None) error = _("'%(data)s' isn't a recognized IP subnet cidr," " '%(cidr)s' is recommended") % {"data": cidr, "cidr": "10.0.2.0/32"} self.assertEqual(error, msg) # Valid - IPv4 with non-zero masked bits is ok for i in range(1, 255): cidr = "192.168.1.%s/24" % i msg = validator(cidr, None) self.assertIsNone(msg) # Invalid - IPv6 without final octets, missing mask cidr = "fe80::" msg = validator(cidr, None) error = _("'%(data)s' isn't a recognized IP subnet cidr," " '%(cidr)s' is recommended") % {"data": cidr, "cidr": "fe80::/128"} self.assertEqual(error, msg) # Invalid - IPv6 with final octets, missing mask cidr = "fe80::0" msg = validator(cidr, None) error = _("'%(data)s' isn't a recognized IP subnet cidr," " '%(cidr)s' is recommended") % {"data": cidr, "cidr": "fe80::/128"} self.assertEqual(error, msg) # Invalid - Address format error cidr = 'invalid' msg = validator(cidr, None) error = "'%s' is not a valid IP subnet" % cidr self.assertEqual(error, msg) cidr = None msg = validator(cidr, None) if allow_none: self.assertIsNone(msg) else: error = "'%s' is not a valid IP subnet" % cidr self.assertEqual(error, msg) # Invalid - IPv4 with trailing CR cidr = "10.0.2.0/24\r" msg = validator(cidr, None) error = "'%s' is not a valid IP subnet" % cidr self.assertEqual(error, msg) def test_validate_subnet(self): self._test_validate_subnet(validators.validate_subnet) def test_validate_route_cidr(self): # Valid - CIDR cidr = "10.0.0.0/8" msg = validators.validate_route_cidr(cidr, None) self.assertIsNone(msg) # Valid - CIDR cidr = "192.168.1.1/32" msg = validators.validate_route_cidr(cidr, None) self.assertIsNone(msg) # Invalid - CIDR cidr = "192.168.1.1/8" msg = validators.validate_route_cidr(cidr, None) error = _("'%(data)s' is not a recognized CIDR," " '%(cidr)s' is recommended") % {"data": cidr, "cidr": "192.0.0.0/8"} self.assertEqual(error, msg) # Invalid - loopback CIDR cidr = "127.0.0.0/8" msg = validators.validate_route_cidr(cidr, None) error = _("'%(data)s' is not a routable CIDR") % {"data": cidr} self.assertEqual(error, msg) # Invalid - CIDR format error cidr = 'invalid' msg = validators.validate_route_cidr(cidr, None) error = "'%s' is not a valid CIDR" % cidr self.assertEqual(error, msg) def test_validate_subnet_or_none(self): self._test_validate_subnet(validators.validate_subnet_or_none, allow_none=True) def test_validate_subnet_list(self): msg = validators.validate_subnet_list('abc') self.assertEqual(u"'abc' is not a list", msg) msg = validators.validate_subnet_list(['10.1.0.0/24', '10.2.0.0/24', '10.1.0.0/24']) self.assertEqual(u"Duplicate items in the list: '10.1.0.0/24'", msg) msg = validators.validate_subnet_list(['10.1.0.0/24', '10.2.0.0']) self.assertEqual(u"'10.2.0.0' isn't a recognized IP subnet cidr, " u"'10.2.0.0/32' is recommended", msg) def _test_validate_regex(self, validator, allow_none=False): pattern = '[hc]at' data = None msg = validator(data, pattern) if allow_none: self.assertIsNone(msg) else: self.assertEqual("'None' is not a valid input", msg) data = 'bat' msg = validator(data, pattern) self.assertEqual("'%s' is not a valid input" % data, msg) data = 'hat' msg = validator(data, pattern) self.assertIsNone(msg) data = 'cat' msg = validator(data, pattern) self.assertIsNone(msg) def test_validate_regex(self): self._test_validate_regex(validators.validate_regex) def test_validate_regex_or_none(self): self._test_validate_regex(validators.validate_regex_or_none, allow_none=True) def test_validate_list_of_regex_or_none(self): pattern = '[hc]at|^$' list_of_regex = ['hat', 'cat', ''] msg = validators.validate_list_of_regex_or_none(list_of_regex, pattern) self.assertIsNone(msg) list_of_regex = ['bat', 'hat', 'cat', ''] msg = validators.validate_list_of_regex_or_none(list_of_regex, pattern) self.assertEqual("'bat' is not a valid input", msg) empty_list = [] msg = validators.validate_list_of_regex_or_none(empty_list, pattern) def test_validate_subnetpool_id(self): msg = validators.validate_subnetpool_id(constants.IPV6_PD_POOL_ID) self.assertIsNone(msg) msg = validators.validate_subnetpool_id( '00000000-ffff-ffff-ffff-000000000000') self.assertIsNone(msg) def test_validate_subnetpool_id_or_none(self): msg = validators.validate_subnetpool_id_or_none(None) self.assertIsNone(msg) msg = validators.validate_subnetpool_id_or_none( '00000000-ffff-ffff-ffff-000000000000') self.assertIsNone(msg) def test_validate_uuid(self): invalid_uuids = [None, 123, '123', 't5069610-744b-42a7-8bd8-ceac1a229cd4', 'e5069610-744bb-42a7-8bd8-ceac1a229cd4'] for uuid in invalid_uuids: msg = validators.validate_uuid(uuid) error = "'%s' is not a valid UUID" % uuid self.assertEqual(error, msg) msg = validators.validate_uuid('00000000-ffff-ffff-ffff-000000000000') self.assertIsNone(msg) def test_validate_uuid_list(self): bad_uuid_list = ['00000000-ffff-ffff-ffff-000000000000', '00000000-ffff-ffff-ffff-000000000001', '123'] msg = validators.validate_uuid_list(bad_uuid_list, valid_values='parameter not used') error = "'%s' is not a valid UUID" % bad_uuid_list[2] self.assertEqual(error, msg) good_uuid_list = ['00000000-ffff-ffff-ffff-000000000000', '00000000-ffff-ffff-ffff-000000000001'] msg = validators.validate_uuid_list(good_uuid_list, valid_values='parameter not used') self.assertIsNone(msg) def test__validate_list_of_items(self): # check not a list items = [None, 123, 'e5069610-744b-42a7-8bd8-ceac1a229cd4', '12345678123456781234567812345678', {'uuid': 'e5069610-744b-42a7-8bd8-ceac1a229cd4'}] for item in items: msg = validators._validate_list_of_items(mock.Mock(), item) error = "'%s' is not a list" % item self.assertEqual(error, msg) # check duplicate items in a list duplicate_items = ['e5069610-744b-42a7-8bd8-ceac1a229cd4', 'f3eeab00-8367-4524-b662-55e64d4cacb5', 'e5069610-744b-42a7-8bd8-ceac1a229cd4'] msg = validators._validate_list_of_items(mock.Mock(), duplicate_items) error = ("Duplicate items in the list: " "'e5069610-744b-42a7-8bd8-ceac1a229cd4'") self.assertEqual(error, msg) # check valid lists valid_lists = [[], [1, 2, 3], ['a', 'b', 'c']] for list_obj in valid_lists: msg = validators._validate_list_of_items( mock.Mock(return_value=None), list_obj) self.assertIsNone(msg) def test__test__validate_list_of_items_non_empty(self): items = None msg = validators._validate_list_of_items_non_empty(mock.Mock(), items) error = "'%s' is not a list" % items self.assertEqual(error, msg) items = [] msg = validators._validate_list_of_items_non_empty(mock.Mock(), items) self.assertEqual("List should not be empty", msg) def test_validate_dict_type(self): for value in (None, True, '1', []): self.assertEqual("'%s' is not a dictionary" % value, validators.validate_dict(value)) def test_validate_dict_without_constraints(self): msg = validators.validate_dict({}) self.assertIsNone(msg) # Validate a dictionary without constraints. msg = validators.validate_dict({'key': 'value'}) self.assertIsNone(msg) def test_validate_a_valid_dict_with_constraints(self): dictionary, constraints = self._construct_dict_and_constraints() msg = validators.validate_dict(dictionary, constraints) self.assertIsNone(msg, 'Validation of a valid dictionary failed.') def test_validate_dict_with_invalid_validator(self): dictionary, constraints = self._construct_dict_and_constraints() constraints['key1'] = {'type:unsupported': None, 'required': True} msg = validators.validate_dict(dictionary, constraints) self.assertEqual("Validator 'type:unsupported' does not exist", msg) def test_validate_dict_not_required_keys(self): dictionary, constraints = self._construct_dict_and_constraints() del dictionary['key2'] msg = validators.validate_dict(dictionary, constraints) self.assertIsNone(msg, 'Field that was not required by the specs was' 'required by the validator.') def test_validate_dict_required_keys(self): dictionary, constraints = self._construct_dict_and_constraints() del dictionary['key1'] msg = validators.validate_dict(dictionary, constraints) self.assertIn('Expected keys:', msg) def test_validate_dict_wrong_values(self): dictionary, constraints = self._construct_dict_and_constraints() dictionary['key1'] = 'UNSUPPORTED' msg = validators.validate_dict(dictionary, constraints) self.assertIsNotNone(msg) def test_validate_dict_unexpected_keys(self): dictionary, constraints = self._construct_dict_and_constraints() dictionary['unexpected_key'] = 'val' msg = validators.validate_dict(dictionary, constraints) self.assertIn('Unexpected keys supplied:', msg) def test_validate_dict_convert_boolean(self): dictionary, constraints = self._construct_dict_and_constraints() constraints['key_bool'] = { 'type:boolean': None, 'required': False, 'convert_to': converters.convert_to_boolean} dictionary['key_bool'] = 'true' msg = validators.validate_dict(dictionary, constraints) self.assertIsNone(msg) # Explicitly comparing with literal 'True' as assertTrue # succeeds also for 'true' self.assertIs(True, dictionary['key_bool']) def test_subdictionary(self): dictionary, constraints = self._construct_dict_and_constraints() del dictionary['key3']['k4'] dictionary['key3']['k5'] = 'a string value' msg = validators.validate_dict(dictionary, constraints) self.assertIn('Expected keys:', msg) def test_validate_dict_or_none(self): dictionary, constraints = self._construct_dict_and_constraints() # Check whether None is a valid value. msg = validators.validate_dict_or_none(None, constraints) self.assertIsNone(msg, 'Validation of a None dictionary failed.') # Check validation of a regular dictionary. msg = validators.validate_dict_or_none(dictionary, constraints) self.assertIsNone(msg, 'Validation of a valid dictionary failed.') def test_validate_dict_or_empty(self): dictionary, constraints = self._construct_dict_and_constraints() # Check whether an empty dictionary is valid. msg = validators.validate_dict_or_empty({}, constraints) self.assertIsNone(msg, 'Validation of a None dictionary failed.') # Check validation of a regular dictionary. msg = validators.validate_dict_or_empty(dictionary, constraints) self.assertIsNone(msg, 'Validation of a valid dictionary failed.') def test_validate_dict_or_nodata(self): dictionary, constraints = self._construct_dict_and_constraints() # Check whether no data is a valid value. msg = validators.validate_dict_or_nodata(None, constraints) self.assertIsNone(msg, 'Validation of None for no-data failed.') msg = validators.validate_dict_or_nodata({}, constraints) self.assertIsNone(msg, 'Validation of empty dict for no-data failed.') # Check validation of a regular dictionary. msg = validators.validate_dict_or_nodata(dictionary, constraints) self.assertIsNone(msg, 'Validation of a valid dictionary failed.') def test_validate_non_negative(self): msg = validators.validate_non_negative('abc') self.assertEqual("'abc' is not an integer", msg) for value in (-1, '-2'): self.assertEqual("'%s' should be non-negative" % value, validators.validate_non_negative(value)) for value in (0, 1, '2', True, False): msg = validators.validate_non_negative(value) self.assertIsNone(msg) def test_validate_subports_invalid_body(self): self.assertIsNotNone(validators.validate_subports(None)) def test_validate_subports_invalid_subport_object(self): self.assertIsNotNone(validators.validate_subports(['foo_port'])) def test_validate_subports_invalid_port_uuid(self): body = [{'port_id': 'foo_port'}] self.assertIsNotNone(validators.validate_subports(body)) def test_validate_subports_invalid_missing_port_id(self): body = [{'poort_id': 'foo_port'}] self.assertIsNotNone(validators.validate_subports(body)) def test_validate_subports_invalid_duplicate_port_ids(self): body = [ {'port_id': '00000000-ffff-ffff-ffff-000000000000'}, {'port_id': '00000000-ffff-ffff-ffff-000000000000'} ] self.assertIsNotNone(validators.validate_subports(body)) def test_validate_subports_invalid_incomplete_segmentation_details(self): body = [ {'port_id': '00000000-ffff-ffff-ffff-000000000000', 'segmentation_id': '3'} ] self.assertIsNotNone(validators.validate_subports(body)) def test_validate_subports_invalid_unknown_paramenter(self): body = [ {'port_id': '00000000-ffff-ffff-ffff-000000000000', 'segmentation_id': '3', 'segmeNAtion_type': 'vlan'} ] self.assertIsNotNone(validators.validate_subports(body)) def test_validate_subports_invalid_duplicate_segmentation_id(self): body = [ {'port_id': '00000000-ffff-ffff-ffff-000000000000', 'segmentation_id': 0, 'segmentation_type': 'vlan'}, {'port_id': '11111111-ffff-ffff-ffff-000000000000', 'segmentation_id': 0, 'segmentation_type': 'vlan'} ] self.assertIsNotNone(validators.validate_subports(body)) def test_validate_subports_with_segmentation_id_0(self): body = [ {'port_id': '00000000-ffff-ffff-ffff-000000000000', 'segmentation_id': '0', 'segmentation_type': 'vlan'} ] self.assertIsNone(validators.validate_subports(body)) def test_validate_subports_inherit_segmentation_details(self): body = [ {'port_id': '00000000-ffff-ffff-ffff-000000000000', 'segmentation_type': 'inherit'} ] self.assertIsNone(validators.validate_subports(body)) def test_validate_subports_valid_unique_segmentation_id(self): body = [ {'port_id': '00000000-ffff-ffff-ffff-000000000000', 'segmentation_id': '3', 'segmentation_type': 'vlan'}, {'port_id': '11111111-ffff-ffff-ffff-000000000000', 'segmentation_id': '3', 'segmentation_type': 'vxlan'} ] self.assertIsNone(validators.validate_subports(body)) def test_validate_subports_valid_empty_body(self): self.assertIsNone(validators.validate_subports([])) def test_validate_subports_valid_suports_with_segmentation_details(self): body = [ {'port_id': '00000000-ffff-ffff-ffff-000000000000', 'segmentation_id': '3', 'segmentation_type': 'vlan'}, {'port_id': '11111111-ffff-ffff-ffff-000000000000', 'segmentation_id': '5', 'segmentation_type': 'vlan'} ] self.assertIsNone(validators.validate_subports(body)) def test_validate_subports_valid_subports(self): body = [ {'port_id': '00000000-ffff-ffff-ffff-000000000000'}, {'port_id': '11111111-ffff-ffff-ffff-000000000000'}, ] self.assertIsNone(validators.validate_subports(body)) @mock.patch('oslo_config.cfg.CONF') def test_validate_ethertype_valid_string_new(self, CONF): CONF.sg_filter_ethertypes = True self.assertIsNone(validators.validate_ethertype('IPv4')) self.assertIsNone(validators.validate_ethertype('IPv6')) @mock.patch('oslo_config.cfg.CONF') def test_validate_ethertype_valid_string_old(self, CONF): CONF.sg_filter_ethertypes = False self.assertIsNone(validators.validate_ethertype('IPv4')) self.assertIsNone(validators.validate_ethertype('IPv6')) @mock.patch('oslo_config.cfg.CONF') def test_validate_ethertype_invalid_string(self, CONF): CONF.sg_filter_ethertypes = False self.assertEqual(('Ethertype 0x4008 is not a valid ethertype, must be ' 'one of IPv4,IPv6.'), validators.validate_ethertype('0x4008')) @mock.patch('oslo_config.cfg.CONF') def test_validate_ethertype_extended_valid_string(self, CONF): CONF.sg_filter_ethertypes = True self.assertIsNone(validators.validate_ethertype('0x4008')) @mock.patch('oslo_config.cfg.CONF') def test_validate_ethertype_extended_valid_hexint(self, CONF): CONF.sg_filter_ethertypes = True self.assertIsNone(validators.validate_ethertype(0x4008)) @mock.patch('oslo_config.cfg.CONF') def test_validate_ethertype_extended_invalid_negative(self, CONF): CONF.sg_filter_ethertypes = True self.assertEqual(("Ethertype -16392 is not a two octet " "hexadecimal number or ethertype name."), validators.validate_ethertype('-0x4008')) @mock.patch('oslo_config.cfg.CONF') def test_validate_ethertype_extended_invalid_nonhex(self, CONF): CONF.sg_filter_ethertypes = True self.assertEqual(("Ethertype invalid is not a two octet " "hexadecimal number or ethertype name."), validators.validate_ethertype('invalid')) @mock.patch('oslo_config.cfg.CONF') def test_validate_ethertype_extended_invalid_toobig(self, CONF): CONF.sg_filter_ethertypes = True self.assertEqual(("Ethertype 3735928559 is not a two octet " "hexadecimal number or ethertype name."), validators.validate_ethertype('0xdeadbeef')) class TestValidateIPSubnetNone(base.BaseTestCase): def test_validate_none(self): self.assertIsNone(validators.validate_ip_or_subnet_or_none(None)) def test_validate_ipv4(self): testdata = "172.0.0.1" self.assertIsNone(validators.validate_ip_or_subnet_or_none(testdata)) def test_validate_ipv4_subnet(self): testdata = "172.0.0.1/24" self.assertIsNone(validators.validate_ip_or_subnet_or_none(testdata)) def test_validate_ipv6(self): testdata = "2001:0db8:0a0b:12f0:0000:0000:0000:0001" self.assertIsNone(validators.validate_ip_or_subnet_or_none(testdata)) def test_validate_ipv6_subnet(self): testdata = "::1/128" self.assertIsNone(validators.validate_ip_or_subnet_or_none(testdata)) def test_validate_ipv4_invalid(self): testdata = "300.0.0.1" self.assertEqual(("'300.0.0.1' is neither a valid IP address, nor is " "it a valid IP subnet"), validators.validate_ip_or_subnet_or_none(testdata)) def test_validate_ipv4_subnet_invalid(self): testdata = "172.0.0.1/45" self.assertEqual(("'172.0.0.1/45' is neither a valid IP address, nor " "is it a valid IP subnet"), validators.validate_ip_or_subnet_or_none(testdata)) def test_validate_ipv6_invalid(self): testdata = "xxxx:0db8:0a0b:12f0:0000:0000:0000:0001" self.assertEqual(("'xxxx:0db8:0a0b:12f0:0000:0000:0000:0001' is " "neither a valid IP address, nor is it a valid IP " "subnet"), validators.validate_ip_or_subnet_or_none(testdata)) def test_validate_ipv6_subnet_invalid(self): testdata = "::1/2048" self.assertEqual(("'::1/2048' is neither a valid IP address, nor is " "it a valid IP subnet"), validators.validate_ip_or_subnet_or_none(testdata)) class TestPortRangeValidation(base.BaseTestCase): def test_valid_port(self): result = validators.validate_port_range_or_none("80") self.assertIsNone(result) def test_valid_port_integer(self): result = validators.validate_port_range_or_none(80) self.assertIsNone(result) def test_valid_range(self): # NOTE(huntxu): This case would fail when ports are compared as # strings, since '9' > '1111'. result = validators.validate_port_range_or_none("9:1111") self.assertIsNone(result) def test_port_too_high(self): result = validators.validate_port_range_or_none("99999") self.assertEqual(u"Invalid port: 99999", result) def test_port_too_low(self): result = validators.validate_port_range_or_none("-1") self.assertEqual(u"Invalid port: -1", result) def test_range_too_high(self): result = validators.validate_port_range_or_none("80:99999") self.assertEqual(u"Invalid port: 99999", result) def test_range_too_low(self): result = validators.validate_port_range_or_none("-1:8888") self.assertEqual(u"Invalid port: -1", result) def test_range_wrong_way(self): # NOTE(huntxu): This case would fail when ports are compared as # strings, since '1111' < '9'. result = validators.validate_port_range_or_none("1111:9") self.assertEqual(u"First port in a port range must be lower than the " "second port", result) def test_range_invalid(self): result = validators.validate_port_range_or_none("DEAD:BEEF") self.assertEqual(u"Invalid port: DEAD", result) def test_range_bad_input(self): result = validators.validate_port_range_or_none(['a', 'b', 'c']) self.assertEqual(u"Invalid port: ['a', 'b', 'c']", result) def test_range_colon(self): result = validators.validate_port_range_or_none(":") self.assertEqual(u"Port range must be two integers separated by a " "colon", result) def test_too_many_colons(self): result = validators.validate_port_range_or_none("80:888:8888") self.assertEqual(u"Port range must be two integers separated by a " "colon", result) class TestAnyKeySpecs(base.BaseTestCase): def test_data_is_none(self): self.assertIsNone( validators.validate_any_key_specs_or_none(None, key_specs={})) def test_data_is_not_list(self): for t in [dict(), set(), 'abc', 1, True]: self.assertRaises( n_exc.InvalidInput, validators.validate_any_key_specs_or_none, t, key_specs={}) def test_data_invalid_keys(self): data = [{'opt_name': 'a', 'opt_value': 'A'}, {'opt_name': 'b', 'opt_valuee': 'B'}] self.assertRaisesRegex( n_exc.InvalidInput, "No valid key specs", validators.validate_any_key_specs_or_none, data, key_specs=extra_dhcp_opt.EXTRA_DHCP_OPT_KEY_SPECS) def test_data_optional_key(self): data = [{'opt_name': 'a', 'opt_value': 'A'}, {'opt_name': 'b', 'opt_value': 'B', 'ip_version': '4'}] self.assertIsNone( validators.validate_any_key_specs_or_none( data, key_specs=extra_dhcp_opt.EXTRA_DHCP_OPT_KEY_SPECS)) def test_data_optional_key_invalid(self): data = [{'opt_name': 'a', 'opt_value': 'A'}, {'opt_name': 'b', 'opt_value': 'B', 'ip_version': '3'}] self.assertRaisesRegex( n_exc.InvalidInput, "No valid key specs", validators.validate_any_key_specs_or_none, data, key_specs=extra_dhcp_opt.EXTRA_DHCP_OPT_KEY_SPECS) def test_data_conditional_spec(self): data = [{'opt_name': 'router', 'opt_value': None}, {'opt_name': 'b', 'opt_value': 'B', 'ip_version': '4'}] self.assertIsNone( validators.validate_any_key_specs_or_none( data, key_specs=extra_dhcp_opt.EXTRA_DHCP_OPT_KEY_SPECS)) class TestServicePluginType(base.BaseTestCase): def setUp(self): super(TestServicePluginType, self).setUp() self._plugins = directory._PluginDirectory() self._plugins.add_plugin('stype', mock.Mock()) self.useFixture(fixture.PluginDirectoryFixture( plugin_directory=self._plugins)) def test_valid_plugin_type(self): self.assertIsNone(validators.validate_service_plugin_type('stype')) def test_invalid_plugin_type(self): self.assertRaisesRegex( n_exc.InvalidServiceType, 'Invalid service type', validators.validate_service_plugin_type, 'ntype') neutron-lib-2.3.0/neutron_lib/tests/unit/api/validators/test_availability_zone.py0000664000175000017500000000320713641427107030503 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from unittest import mock from neutron_lib.api.validators import availability_zone as az_validator from neutron_lib.db import constants as db_const from neutron_lib import exceptions from neutron_lib.tests import _base as base class TestAvailabilityZoneValidator(base.BaseTestCase): @mock.patch.object(az_validator.validators, 'validate_list_of_unique_strings', return_value='bad') def test__validate_availability_zone_hints_unique_strings( self, mock_unique_strs): self.assertEqual( 'bad', az_validator._validate_availability_zone_hints(['a', 'a'])) def test__validate_availability_zone_hints_excessive_len(self): self.assertRaisesRegex( exceptions.InvalidInput, 'Too many availability_zone_hints', az_validator._validate_availability_zone_hints, ['a' * (db_const.AZ_HINTS_DB_LEN + 1)]) def test__validate_availability_zone_hints_valid_input(self): self.assertIsNone( az_validator._validate_availability_zone_hints(['a', 'b', 'c'])) neutron-lib-2.3.0/neutron_lib/tests/unit/api/validators/__init__.py0000664000175000017500000000000013641427107025462 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/api/__init__.py0000664000175000017500000000000013641427107023312 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/callbacks/0000775000175000017500000000000013641427200022353 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/callbacks/test_registry.py0000664000175000017500000001352213641427107025645 0ustar zuulzuul00000000000000# Copyright 2015 Cisco Systems Inc # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from unittest import mock from oslotest import base import testtools from neutron_lib.callbacks import events from neutron_lib.callbacks import priority_group from neutron_lib.callbacks import registry from neutron_lib.callbacks import resources from neutron_lib import fixture PRI_CALLBACK = 20 @registry.has_registry_receivers class ObjectWithDecoratedCallback(object): def __init__(self): self.counter = 0 @registry.receives(resources.PORT, [events.AFTER_CREATE, events.AFTER_UPDATE]) @registry.receives(resources.NETWORK, [events.AFTER_DELETE]) def callback(self, *args, **kwargs): self.counter += 1 class MixinWithNew(object): def __new__(cls): i = super(MixinWithNew, cls).__new__(cls) i.new_called = True return i @registry.has_registry_receivers class AnotherObjectWithDecoratedCallback(ObjectWithDecoratedCallback, MixinWithNew): def __init__(self): super(AnotherObjectWithDecoratedCallback, self).__init__() self.counter2 = 0 @registry.receives(resources.NETWORK, [events.AFTER_DELETE], PRI_CALLBACK) def callback2(self, *args, **kwargs): self.counter2 += 1 @registry.has_registry_receivers class CallbackClassWithParameters(object): def __init__(self, dummy): pass def my_callback(): pass class CallBacksManagerTestCase(base.BaseTestCase): def test_decorated_inst_method_receives(self): i1 = ObjectWithDecoratedCallback() registry.notify(resources.PORT, events.BEFORE_CREATE, self) self.assertEqual(0, i1.counter) registry.notify(resources.PORT, events.AFTER_CREATE, self) self.assertEqual(1, i1.counter) registry.notify(resources.PORT, events.AFTER_UPDATE, self) self.assertEqual(2, i1.counter) registry.notify(resources.NETWORK, events.AFTER_UPDATE, self) self.assertEqual(2, i1.counter) registry.notify(resources.NETWORK, events.AFTER_DELETE, self) self.assertEqual(3, i1.counter) i2 = ObjectWithDecoratedCallback() self.assertEqual(0, i2.counter) registry.notify(resources.NETWORK, events.AFTER_DELETE, self) self.assertEqual(4, i1.counter) self.assertEqual(1, i2.counter) def test_object_inheriting_others_no_double_subscribe(self): with mock.patch.object(registry, 'subscribe') as sub: callback = AnotherObjectWithDecoratedCallback() # there are 3 methods (2 in parent and one in child) and 1 # subscribes to 2 events, so we expect 4 subscribes priority_call = [mock.call( callback.callback2, resources.NETWORK, events.AFTER_DELETE, PRI_CALLBACK)] self.assertEqual(4, len(sub.mock_calls)) sub.assert_has_calls(priority_call) def test_new_inheritance_not_broken(self): self.assertTrue(AnotherObjectWithDecoratedCallback().new_called) def test_object_new_not_broken(self): CallbackClassWithParameters('dummy') def test_no_strings_in_events_arg(self): with testtools.ExpectedException(AssertionError): registry.receives(resources.PORT, events.AFTER_CREATE) class TestCallbackRegistryDispatching(base.BaseTestCase): def setUp(self): super(TestCallbackRegistryDispatching, self).setUp() self.callback_manager = mock.Mock() self.registry_fixture = fixture.CallbackRegistryFixture( callback_manager=self.callback_manager) self.useFixture(self.registry_fixture) def test_subscribe(self): registry.subscribe(my_callback, 'my-resource', 'my-event') self.callback_manager.subscribe.assert_called_with( my_callback, 'my-resource', 'my-event', priority_group.PRIORITY_DEFAULT) def test_subscribe_explicit_priority(self): registry.subscribe(my_callback, 'my-resource', 'my-event', PRI_CALLBACK) self.callback_manager.subscribe.assert_called_with( my_callback, 'my-resource', 'my-event', PRI_CALLBACK) def test_unsubscribe(self): registry.unsubscribe(my_callback, 'my-resource', 'my-event') self.callback_manager.unsubscribe.assert_called_with( my_callback, 'my-resource', 'my-event') def test_unsubscribe_by_resource(self): registry.unsubscribe_by_resource(my_callback, 'my-resource') self.callback_manager.unsubscribe_by_resource.assert_called_with( my_callback, 'my-resource') def test_unsubscribe_all(self): registry.unsubscribe_all(my_callback) self.callback_manager.unsubscribe_all.assert_called_with( my_callback) def test_notify(self): registry.notify('my-resource', 'my-event', mock.ANY) self.callback_manager.notify.assert_called_with( 'my-resource', 'my-event', mock.ANY) def test_clear(self): registry.clear() self.callback_manager.clear.assert_called_with() def test_publish_payload(self): event_payload = events.EventPayload(mock.ANY) registry.publish('x', 'y', self, payload=event_payload) self.callback_manager.publish.assert_called_with( 'x', 'y', self, payload=event_payload) neutron-lib-2.3.0/neutron_lib/tests/unit/callbacks/test_manager.py0000664000175000017500000003720613641427107025414 0ustar zuulzuul00000000000000# Copyright 2015 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from unittest import mock from oslo_db import exception as db_exc from oslotest import base from neutron_lib.callbacks import events from neutron_lib.callbacks import exceptions from neutron_lib.callbacks import manager from neutron_lib.callbacks import priority_group from neutron_lib.callbacks import resources PRI_HIGH = 0 PRI_MED = 5000 PRI_LOW = 10000 class ObjectWithCallback(object): def __init__(self): self.counter = 0 def callback(self, *args, **kwargs): self.counter += 1 class GloriousObjectWithCallback(ObjectWithCallback): pass def callback_1(*args, **kwargs): callback_1.counter += 1 callback_id_1 = manager._get_id(callback_1) def callback_2(*args, **kwargs): callback_2.counter += 1 callback_id_2 = manager._get_id(callback_2) def callback_raise(*args, **kwargs): raise Exception() def callback_raise_retriable(*args, **kwargs): raise db_exc.DBDeadlock() def callback_3(resource, event, trigger, payload): callback_3.counter += 1 class CallBacksManagerTestCase(base.BaseTestCase): def setUp(self): super(CallBacksManagerTestCase, self).setUp() self.manager = manager.CallbacksManager() callback_1.counter = 0 callback_2.counter = 0 callback_3.counter = 0 def test_subscribe(self): self.manager.subscribe( callback_1, resources.PORT, events.BEFORE_CREATE) self.assertIsNotNone( self.manager._callbacks[resources.PORT][events.BEFORE_CREATE]) self.assertIn(callback_id_1, self.manager._index) self.assertEqual(self.__module__ + '.callback_1-%s' % hash(callback_1), callback_id_1) def test_subscribe_unknown(self): self.manager.subscribe( callback_1, 'my_resource', 'my-event') self.assertIsNotNone( self.manager._callbacks['my_resource']['my-event']) self.assertIn(callback_id_1, self.manager._index) def test_subscribe_is_idempotent(self): self.manager.subscribe( callback_1, resources.PORT, events.BEFORE_CREATE) self.manager.subscribe( callback_1, resources.PORT, events.BEFORE_CREATE) self.assertEqual( 1, len(self.manager._callbacks[resources.PORT][events.BEFORE_CREATE])) callbacks = self.manager._index[callback_id_1][resources.PORT] self.assertEqual(1, len(callbacks)) def test_subscribe_multiple_callbacks(self): self.manager.subscribe( callback_1, resources.PORT, events.BEFORE_CREATE) self.manager.subscribe( callback_2, resources.PORT, events.BEFORE_CREATE) self.assertEqual(2, len(self.manager._index)) self.assertEqual( 1, len(self.manager._callbacks[resources.PORT][events.BEFORE_CREATE])) self.assertEqual( 2, len(self.manager._callbacks [resources.PORT][events.BEFORE_CREATE][0][1])) def test_unsubscribe_during_iteration(self): def unsub(r, e, *a, **k): return self.manager.unsubscribe(unsub, r, e) self.manager.subscribe(unsub, resources.PORT, events.BEFORE_CREATE) self.manager.notify(resources.PORT, events.BEFORE_CREATE, mock.ANY) self.assertNotIn(unsub, self.manager._index) def test_unsubscribe(self): self.manager.subscribe( callback_1, resources.PORT, events.BEFORE_CREATE) self.manager.unsubscribe( callback_1, resources.PORT, events.BEFORE_CREATE) self.assertNotIn( callback_id_1, self.manager._callbacks[resources.PORT][events.BEFORE_CREATE]) self.assertNotIn(callback_id_1, self.manager._index) def test_unsubscribe_unknown_callback(self): self.manager.subscribe( callback_2, resources.PORT, events.BEFORE_CREATE) self.manager.unsubscribe(callback_1, mock.ANY, mock.ANY) self.assertEqual(1, len(self.manager._index)) def test_fail_to_unsubscribe(self): self.manager.subscribe( callback_1, resources.PORT, events.BEFORE_CREATE) self.assertRaises(exceptions.Invalid, self.manager.unsubscribe, callback_1, resources.PORT, None) self.assertRaises(exceptions.Invalid, self.manager.unsubscribe, callback_1, None, events.BEFORE_CREATE) def test_unsubscribe_is_idempotent(self): self.manager.subscribe( callback_1, resources.PORT, events.BEFORE_CREATE) self.manager.unsubscribe( callback_1, resources.PORT, events.BEFORE_CREATE) self.manager.unsubscribe( callback_1, resources.PORT, events.BEFORE_CREATE) self.assertNotIn(callback_id_1, self.manager._index) self.assertNotIn(callback_id_1, self.manager._callbacks[resources.PORT] [events.BEFORE_CREATE]) def test_unsubscribe_by_resource(self): self.manager.subscribe( callback_1, resources.PORT, events.BEFORE_CREATE) self.manager.subscribe( callback_1, resources.PORT, events.BEFORE_DELETE) self.manager.subscribe( callback_2, resources.PORT, events.BEFORE_DELETE) self.manager.unsubscribe_by_resource(callback_1, resources.PORT) self.assertEqual( 0, len(self.manager._callbacks [resources.PORT][events.BEFORE_CREATE])) self.assertEqual( 1, len(self.manager._callbacks[resources.PORT][events.BEFORE_DELETE])) self.assertIn( callback_id_2, self.manager._callbacks [resources.PORT][events.BEFORE_DELETE][0][1]) self.assertNotIn(callback_id_1, self.manager._index) def test_unsubscribe_all(self): self.manager.subscribe( callback_1, resources.PORT, events.BEFORE_CREATE) self.manager.subscribe( callback_1, resources.PORT, events.BEFORE_DELETE) self.manager.subscribe( callback_1, resources.ROUTER, events.BEFORE_CREATE) self.manager.unsubscribe_all(callback_1) self.assertNotIn( callback_id_1, self.manager._callbacks[resources.PORT][events.BEFORE_CREATE]) self.assertNotIn(callback_id_1, self.manager._index) def test_notify_none(self): self.manager.notify(resources.PORT, events.BEFORE_CREATE, mock.ANY) self.assertEqual(0, callback_1.counter) self.assertEqual(0, callback_2.counter) def test_feebly_referenced_callback(self): self.manager.subscribe(lambda *x, **y: None, resources.PORT, events.BEFORE_CREATE) self.manager.notify(resources.PORT, events.BEFORE_CREATE, mock.ANY) def test_notify_with_exception(self): with mock.patch.object(self.manager, '_notify_loop') as n: n.return_value = ['error'] self.assertRaises(exceptions.CallbackFailure, self.manager.notify, mock.ANY, events.BEFORE_CREATE, mock.ANY) expected_calls = [ mock.call(mock.ANY, 'before_create', mock.ANY), mock.call(mock.ANY, 'abort_create', mock.ANY) ] n.assert_has_calls(expected_calls) def test_notify_with_precommit_exception(self): with mock.patch.object(self.manager, '_notify_loop') as n: n.return_value = ['error'] self.assertRaises(exceptions.CallbackFailure, self.manager.notify, mock.ANY, events.PRECOMMIT_UPDATE, mock.ANY) expected_calls = [ mock.call(mock.ANY, 'precommit_update', mock.ANY), ] n.assert_has_calls(expected_calls) def test_notify_handle_exception(self): self.manager.subscribe( callback_raise, resources.PORT, events.BEFORE_CREATE) e = self.assertRaises(exceptions.CallbackFailure, self.manager.notify, resources.PORT, events.BEFORE_CREATE, self) self.assertIsInstance(e.errors[0], exceptions.NotificationError) def test_notify_handle_retriable_exception(self): self.manager.subscribe( callback_raise_retriable, resources.PORT, events.BEFORE_CREATE) self.assertRaises(db_exc.RetryRequest, self.manager.notify, resources.PORT, events.BEFORE_CREATE, self) def test_notify_called_once_with_no_failures(self): with mock.patch.object(self.manager, '_notify_loop') as n: n.return_value = False self.manager.notify(resources.PORT, events.BEFORE_CREATE, mock.ANY) n.assert_called_once_with( resources.PORT, events.BEFORE_CREATE, mock.ANY) def test__notify_loop_single_event(self): self.manager.subscribe( callback_1, resources.PORT, events.BEFORE_CREATE) self.manager.subscribe( callback_2, resources.PORT, events.BEFORE_CREATE) self.manager._notify_loop( resources.PORT, events.BEFORE_CREATE, mock.ANY) self.assertEqual(1, callback_1.counter) self.assertEqual(1, callback_2.counter) def test__notify_loop_multiple_events(self): self.manager.subscribe( callback_1, resources.PORT, events.BEFORE_CREATE) self.manager.subscribe( callback_1, resources.ROUTER, events.BEFORE_DELETE) self.manager.subscribe( callback_2, resources.PORT, events.BEFORE_CREATE) self.manager._notify_loop( resources.PORT, events.BEFORE_CREATE, mock.ANY) self.manager._notify_loop( resources.ROUTER, events.BEFORE_DELETE, mock.ANY) self.assertEqual(2, callback_1.counter) self.assertEqual(1, callback_2.counter) def test_clearing_subscribers(self): self.manager.subscribe( callback_1, resources.PORT, events.BEFORE_CREATE) self.manager.subscribe( callback_2, resources.PORT, events.AFTER_CREATE) self.assertEqual(2, len(self.manager._callbacks[resources.PORT])) self.assertEqual(2, len(self.manager._index)) self.manager.clear() self.assertEqual(0, len(self.manager._callbacks)) self.assertEqual(0, len(self.manager._index)) def test_callback_priority(self): pri_first = priority_group.PRIORITY_DEFAULT - 100 pri_last = priority_group.PRIORITY_DEFAULT + 100 # lowest priority value should be first in the _callbacks self.manager.subscribe(callback_1, 'my-resource', 'my-event') self.manager.subscribe(callback_2, 'my-resource', 'my-event', pri_last) self.manager.subscribe(callback_3, 'my-resource', 'my-event', pri_first) callbacks = self.manager._callbacks['my-resource']['my-event'] # callbacks should be sorted based on priority for resource and event self.assertEqual(3, len(callbacks)) self.assertEqual(pri_first, callbacks[0][0]) self.assertEqual(priority_group.PRIORITY_DEFAULT, callbacks[1][0]) self.assertEqual(pri_last, callbacks[2][0]) @mock.patch('neutron_lib.callbacks.manager.CallbacksManager._del_callback') def test_del_callback_called_on_unsubscribe(self, mock_cb): self.manager.subscribe(callback_1, 'my-resource', 'my-event') callback_id = self.manager._find(callback_1) callbacks = self.manager._callbacks['my-resource']['my-event'] self.assertEqual(1, len(callbacks)) self.manager.unsubscribe(callback_1, 'my-resource', 'my-event') mock_cb.assert_called_once_with(callbacks, callback_id) @mock.patch("neutron_lib.callbacks.manager.LOG") def test_callback_order(self, _logger): self.manager.subscribe(callback_1, 'my-resource', 'my-event', PRI_MED) self.manager.subscribe(callback_2, 'my-resource', 'my-event', PRI_HIGH) self.manager.subscribe(callback_3, 'my-resource', 'my-event', PRI_LOW) self.assertEqual( 3, len(self.manager._callbacks['my-resource']['my-event'])) self.manager.unsubscribe(callback_3, 'my-resource', 'my-event') self.manager.notify('my-resource', 'my-event', mock.ANY) # callback_3 should be deleted and not executed self.assertEqual( 2, len(self.manager._callbacks['my-resource']['my-event'])) self.assertEqual(0, callback_3.counter) # executed callbacks should have counter incremented self.assertEqual(1, callback_2.counter) self.assertEqual(1, callback_1.counter) callback_ids = _logger.debug.mock_calls[4][1][1] # callback_2 should be first in exceution as it has higher priority self.assertEqual(callback_id_2, callback_ids[0]) self.assertEqual(callback_id_1, callback_ids[1]) @mock.patch("neutron_lib.callbacks.manager.LOG") def test__notify_loop_skip_log_errors(self, _logger): self.manager.subscribe( callback_raise, resources.PORT, events.BEFORE_CREATE) self.manager.subscribe( callback_raise, resources.PORT, events.PRECOMMIT_CREATE) self.manager._notify_loop( resources.PORT, events.BEFORE_CREATE, mock.ANY) self.manager._notify_loop( resources.PORT, events.PRECOMMIT_CREATE, mock.ANY) self.assertFalse(_logger.exception.call_count) self.assertTrue(_logger.debug.call_count) def test_object_instances_as_subscribers(self): """Ensures that the manager doesn't think these are equivalent.""" a = GloriousObjectWithCallback() b = ObjectWithCallback() c = ObjectWithCallback() for o in (a, b, c): self.manager.subscribe( o.callback, resources.PORT, events.BEFORE_CREATE) # ensure idempotency remains for a single object self.manager.subscribe( o.callback, resources.PORT, events.BEFORE_CREATE) self.manager.notify(resources.PORT, events.BEFORE_CREATE, mock.ANY) self.assertEqual(1, a.counter) self.assertEqual(1, b.counter) self.assertEqual(1, c.counter) def test_publish_invalid_payload(self): self.assertRaises(exceptions.Invalid, self.manager.publish, resources.PORT, events.AFTER_DELETE, self, payload=object()) def test_publish_empty_payload(self): notify_payload = [] def _memo(resource, event, trigger, payload=None): notify_payload.append(payload) self.manager.subscribe(_memo, 'x', 'y') self.manager.publish('x', 'y', self) self.assertIsNone(notify_payload[0]) def test_publish_payload(self): notify_payload = [] def _memo(resource, event, trigger, payload=None): notify_payload.append(payload) self.manager.subscribe(_memo, 'x', 'y') payload = events.EventPayload(object()) self.manager.publish('x', 'y', self, payload=payload) self.assertEqual(payload, notify_payload[0]) neutron-lib-2.3.0/neutron_lib/tests/unit/callbacks/test_callback_exceptions.py0000664000175000017500000000406013641427107027767 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """ test_callback_exceptions ---------------------------------- Tests for `neutron_lib.callback.exceptions` module. """ import functools import neutron_lib.callbacks.exceptions as ex from neutron_lib.tests.unit.exceptions import test_exceptions class TestCallbackExceptions(test_exceptions.TestExceptions): def _check_exception(self, exc_class, expected_msg, **kwargs): raise_exc_class = functools.partial(test_exceptions._raise, exc_class) e = self.assertRaises(exc_class, raise_exc_class, **kwargs) self.assertEqual(expected_msg, str(e)) def test_invalid(self): self._check_exception( ex.Invalid, "The value 'foo' for bar is not valid.", value='foo', element='bar') def test_callback_failure(self): self._check_exception( ex.CallbackFailure, 'one', errors='one') def test_callback_failure_with_list(self): self._check_exception( ex.CallbackFailure, '1,2,3', errors=[1, 2, 3]) def test_notification_error(self): '''Test that correct message is created for this error class.''' error = ex.NotificationError('abc', 'boom') self.assertEqual('Callback abc failed with "boom"', str(error)) def test_inner_exceptions(self): key_err = KeyError() n_key_err = ex.NotificationError('cb1', key_err) err = ex.CallbackFailure([key_err, n_key_err]) self.assertEqual([key_err, n_key_err.error], err.inner_exceptions) neutron-lib-2.3.0/neutron_lib/tests/unit/callbacks/test_events.py0000664000175000017500000001017613641427107025303 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from unittest import mock from neutron_lib.callbacks import events from oslotest import base class EventPayloadTestCase(base.BaseTestCase): def test_context(self): e = events.EventPayload(mock.ANY) self.assertEqual(mock.ANY, e.context) def test_metadata(self): meta = {'k1': 'v1', 'k2': mock.ANY} e = events.EventPayload(mock.ANY, metadata=meta) self.assertEqual(meta, e.metadata) event_meta = e.metadata event_meta['k3'] = 'v3' self.assertTrue('k3' in e.metadata) def test_request_body(self): e = events.EventPayload(mock.ANY, request_body={'k', 'v'}) self.assertEqual({'k', 'v'}, e.request_body) def test_states(self): e = events.EventPayload(mock.ANY, states=['s1', 's2']) self.assertEqual(['s1', 's2'], e.states) e.states.append('state') self.assertIn('state', e.states) def test_resource_id(self): e = events.EventPayload(mock.ANY, resource_id='id1') self.assertEqual('id1', e.resource_id) def test_has_no_states(self): e = events.EventPayload(mock.ANY) self.assertFalse(e.has_states) def test_has_states(self): e = events.EventPayload(mock.ANY, states=['s1']) self.assertTrue(e.has_states) def test_latest_state_with_states(self): body = object() states = [object(), object()] e = events.EventPayload(mock.ANY, request_body=body, states=states) self.assertEqual(states[-1], e.latest_state) def test_latest_state_without_states(self): body = object() e = events.EventPayload(mock.ANY, request_body=body) self.assertIsNone(e.latest_state) class DataStoreEventPayloadTestCase(base.BaseTestCase): def test_states(self): e = events.DBEventPayload(mock.ANY, states=['s1']) self.assertEqual(['s1'], e.states) def test_desired_state(self): desired_state = {'k': object()} e = events.DBEventPayload(mock.ANY, desired_state=desired_state) self.assertEqual(desired_state, e.desired_state) desired_state['a'] = 'A' self.assertEqual(desired_state, e.desired_state) def test_is_not_persisted(self): e = events.DBEventPayload(mock.ANY, states=['s1']) self.assertFalse(e.is_persisted) e = events.DBEventPayload(mock.ANY, resource_id='1a') self.assertFalse(e.is_persisted) def test_is_persisted(self): e = events.DBEventPayload(mock.ANY, states=['s1'], resource_id='1a') self.assertTrue(e.is_persisted) def test_is_not_to_be_committed(self): e = events.DBEventPayload(mock.ANY, states=['s1'], resource_id='1a') self.assertFalse(e.is_to_be_committed) def test_is_to_be_committed(self): e = events.DBEventPayload(mock.ANY, states=[mock.ANY], resource_id='1a', desired_state=object()) self.assertTrue(e.is_to_be_committed) def test_latest_state_with_desired_state(self): desired_state = object() e = events.DBEventPayload(mock.ANY, states=[object()], desired_state=desired_state) self.assertEqual(desired_state, e.latest_state) class APIEventPayloadTestCase(base.BaseTestCase): def test_action(self): e = events.APIEventPayload(mock.ANY, 'post.end', 'POST') self.assertEqual('POST', e.action) def test_method_name(self): e = events.APIEventPayload(mock.ANY, 'post.end', 'POST') self.assertEqual('post.end', e.method_name) neutron-lib-2.3.0/neutron_lib/tests/unit/callbacks/__init__.py0000664000175000017500000000000013641427107024460 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/services/0000775000175000017500000000000013641427200022257 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/services/qos/0000775000175000017500000000000013641427200023061 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/services/qos/test_base.py0000664000175000017500000000613113641427107025413 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from unittest import mock from neutron_lib.api.definitions import portbindings from neutron_lib import constants from neutron_lib.services.qos import base as qos_base from neutron_lib.services.qos import constants as qos_consts from neutron_lib.tests import _base SUPPORTED_RULES = { qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH: { qos_consts.MIN_KBPS: {'type:values': None}, qos_consts.DIRECTION: {'type:values': ['egress']} } } def _make_rule(rule_type='fake-rule-type', params=None): mock_rule = mock.MagicMock() mock_rule.rule_type = rule_type params = params or {} mock_rule.get = params.get return mock_rule def _make_driver(name='fake-driver', vif_types=[portbindings.VIF_TYPE_OVS], vnic_types=[portbindings.VNIC_NORMAL], supported_rules=SUPPORTED_RULES, requires_rpc_notifications=False): return qos_base.DriverBase( name, vif_types, vnic_types, supported_rules, requires_rpc_notifications=requires_rpc_notifications) class TestDriverBase(_base.BaseTestCase): def test_is_loaded(self): self.assertTrue(_make_driver().is_loaded()) def test_is_vif_type_compatible(self): self.assertTrue( _make_driver().is_vif_type_compatible( portbindings.VIF_TYPE_OVS)) self.assertFalse( _make_driver().is_vif_type_compatible( portbindings.VIF_TYPE_BRIDGE)) def test_is_vnic_compatible(self): self.assertTrue( _make_driver().is_vnic_compatible(portbindings.VNIC_NORMAL)) self.assertFalse( _make_driver().is_vnic_compatible(portbindings.VNIC_BAREMETAL)) def test_is_rule_supported_with_unsupported_rule(self): self.assertFalse(_make_driver().is_rule_supported(_make_rule())) def test_is_rule_supported(self): self.assertTrue( _make_driver().is_rule_supported( _make_rule( rule_type=qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH, params={qos_consts.MIN_KBPS: None, qos_consts.DIRECTION: constants.EGRESS_DIRECTION}))) self.assertFalse( _make_driver().is_rule_supported( _make_rule( rule_type=qos_consts.RULE_TYPE_MINIMUM_BANDWIDTH, params={qos_consts.MIN_KBPS: None, qos_consts.DIRECTION: constants.INGRESS_DIRECTION}))) neutron-lib-2.3.0/neutron_lib/tests/unit/services/qos/__init__.py0000664000175000017500000000000013641427107025166 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/services/test_base.py0000664000175000017500000000503313641427107024611 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import abc from neutron_lib.services import base from neutron_lib.tests import _base as test_base class _Worker(base.WorkerBase): pass class Test_WorkerSupportServiceMixin(test_base.BaseTestCase): def setUp(self): super(Test_WorkerSupportServiceMixin, self).setUp() self.worker = _Worker() def test_allocate_workers(self): self.assertEqual([], self.worker.get_workers()) def test_add_worker(self): workers = [object(), object()] for w in workers: self.worker.add_worker(w) self.assertSequenceEqual(workers, self.worker.get_workers()) def test_add_workers(self): workers = [object(), object(), object()] self.worker.add_workers(workers) self.assertSequenceEqual(workers, self.worker.get_workers()) class TestPluginInterface(test_base.BaseTestCase): class ServicePluginStub(base.ServicePluginBase): def get_plugin_type(self): pass def get_plugin_description(self): pass def test_issubclass_hook(self): class A(TestPluginInterface.ServicePluginStub): def f(self): pass class B(base.ServicePluginBase): @abc.abstractmethod def f(self): pass self.assertTrue(issubclass(A, B)) def test_issubclass_hook_class_without_abstract_methods(self): class A(object): def f(self): pass class B(base.ServicePluginBase): def f(self): pass self.assertFalse(issubclass(A, B)) def test_issubclass_hook_not_all_methods_implemented(self): class A(TestPluginInterface.ServicePluginStub): def f(self): pass class B(base.ServicePluginBase): @abc.abstractmethod def f(self): pass @abc.abstractmethod def g(self): pass self.assertFalse(issubclass(A, B)) neutron-lib-2.3.0/neutron_lib/tests/unit/services/__init__.py0000664000175000017500000000000013641427107024364 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/fake_notifier.py0000664000175000017500000000334413641427107023625 0ustar zuulzuul00000000000000# Copyright 2014 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import collections import functools NOTIFICATIONS = [] def reset(): del NOTIFICATIONS[:] FakeMessage = collections.namedtuple('Message', ['publisher_id', 'priority', 'event_type', 'payload']) class FakeNotifier(object): def __init__(self, transport, publisher_id=None, driver=None, topics=None, serializer=None, retry=None): self.transport = transport self.publisher_id = publisher_id for priority in ('debug', 'info', 'warn', 'error', 'critical'): setattr(self, priority, functools.partial(self._notify, priority=priority.upper())) def prepare(self, publisher_id=None): if publisher_id is None: publisher_id = self.publisher_id return self.__class__(self.transport, publisher_id) def _notify(self, ctxt, event_type, payload, priority): msg = dict(publisher_id=self.publisher_id, priority=priority, event_type=event_type, payload=payload) NOTIFICATIONS.append(msg) neutron-lib-2.3.0/neutron_lib/tests/unit/test_fixture.py0000664000175000017500000001642313641427107023547 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import re from unittest import mock from oslo_config import cfg from oslo_db import options from oslotest import base from neutron_lib.api import attributes from neutron_lib.api.definitions import port from neutron_lib.callbacks import registry from neutron_lib.db import model_base from neutron_lib.db import resource_extend from neutron_lib import fixture from neutron_lib.placement import client as place_client from neutron_lib.plugins import directory from neutron_lib.tests.unit.api import test_attributes class PluginDirectoryFixtureTestCase(base.BaseTestCase): def setUp(self): super(PluginDirectoryFixtureTestCase, self).setUp() self.directory = mock.Mock() self.useFixture(fixture.PluginDirectoryFixture( plugin_directory=self.directory)) def test_fixture(self): directory.add_plugin('foo', 'foo') self.assertTrue(self.directory.add_plugin.called) class CallbackRegistryFixtureTestCase(base.BaseTestCase): def setUp(self): super(CallbackRegistryFixtureTestCase, self).setUp() self.manager = mock.Mock() self.useFixture(fixture.CallbackRegistryFixture( callback_manager=self.manager)) def test_fixture(self): registry.notify('a', 'b', self) self.assertTrue(self.manager.notify.called) class SqlFixtureTestCase(base.BaseTestCase): def setUp(self): super(SqlFixtureTestCase, self).setUp() options.set_defaults( cfg.CONF, connection='sqlite://') self.fixture = fixture.StaticSqlFixture() self.useFixture(self.fixture) def test_fixture(self): self.assertIsNotNone(model_base.BASEV2.metadata.sorted_tables) self.assertIsNotNone(self.fixture.engine) class APIDefinitionFixtureTestCase(base.BaseTestCase): def _test_all_api_definitions_fixture(self, global_cleanup=True): apis = fixture.APIDefinitionFixture.all_api_definitions_fixture() apis.backup_global_resources = global_cleanup apis.setUp() asserteq = self.assertNotEqual if global_cleanup else self.assertEqual asserteq({}, apis._orig_resources) for r in test_attributes.TestCoreResources.CORE_DEFS: attributes.RESOURCES[r.COLLECTION_NAME]['_test_'] = {} r.RESOURCE_ATTRIBUTE_MAP['_test_'] = {} apis.cleanUp() for r in test_attributes.TestCoreResources.CORE_DEFS: self.assertNotIn('_test_', r.RESOURCE_ATTRIBUTE_MAP) global_assert = (self.assertNotIn if global_cleanup else self.assertIn) global_assert('_test_', attributes.RESOURCES[r.COLLECTION_NAME]) # cleanup if not global_cleanup: del attributes.RESOURCES[r.COLLECTION_NAME]['_test_'] def test_all_api_definitions_fixture_no_global_backup(self): self._test_all_api_definitions_fixture(global_cleanup=False) def test_all_api_definitions_fixture_with_global_backup(self): self._test_all_api_definitions_fixture(global_cleanup=True) def test_global_resources_reference_updated(self): resources_ref = attributes.RESOURCES apis = fixture.APIDefinitionFixture() apis.setUp() attributes.RESOURCES['test_resource'] = {} self.assertIn('test_resource', resources_ref) attributes.RESOURCES[port.COLLECTION_NAME]['test_port_attr'] = {} self.assertIn('test_port_attr', attributes.RESOURCES[port.COLLECTION_NAME]) apis.cleanUp() self.assertNotIn('test_port_attr', attributes.RESOURCES[port.COLLECTION_NAME]) self.assertNotIn('test_resource', resources_ref) def test_api_def_reference_updated(self): api_def_ref = port.RESOURCE_ATTRIBUTE_MAP apis = fixture.APIDefinitionFixture() apis.setUp() port.RESOURCE_ATTRIBUTE_MAP[port.COLLECTION_NAME]['test_attr'] = {} self.assertIn('test_attr', api_def_ref[port.COLLECTION_NAME]) apis.cleanUp() self.assertNotIn('test_attr', port.RESOURCE_ATTRIBUTE_MAP[port.COLLECTION_NAME]) self.assertNotIn('test_attr', api_def_ref[port.COLLECTION_NAME]) class PlacementAPIClientFixtureTestCase(base.BaseTestCase): def _create_client_and_fixture(self): placement_client = place_client.PlacementAPIClient(mock.Mock()) placement_fixture = self.useFixture( fixture.PlacementAPIClientFixture(placement_client)) return placement_client, placement_fixture def test_post(self): p_client, p_fixture = self._create_client_and_fixture() p_client.create_resource_provider('resource') p_fixture.mock_post.assert_called_once() def test_put(self): inventory = {'total': 42} p_client, p_fixture = self._create_client_and_fixture() p_client.update_resource_provider_inventory('resource', inventory, 'class_name', 1) p_fixture.mock_put.assert_called_once() def test_delete(self): p_client, p_fixture = self._create_client_and_fixture() p_client.delete_resource_provider('resource') p_fixture.mock_delete.assert_called_once() def test_get(self): p_client, p_fixture = self._create_client_and_fixture() p_client.list_aggregates('resource') p_fixture.mock_get.assert_called_once() class DBResourceExtendFixtureTestCase(base.BaseTestCase): def test_fixture_backup(self): fake_methods = { 'a': 'A', 'b': 'B' } orig_methods = resource_extend._resource_extend_functions self.assertNotEqual(fake_methods, orig_methods) db_fixture = fixture.DBResourceExtendFixture( extended_functions=fake_methods) db_fixture.setUp() resource_extend.register_funcs('C', (lambda x: x,)) self.assertNotEqual( orig_methods, resource_extend._resource_extend_functions) db_fixture.cleanUp() self.assertEqual( orig_methods, resource_extend._resource_extend_functions) class WarningsFixture(base.BaseTestCase): @mock.patch.object(fixture.warnings, 'filterwarnings') def test_fixture_regex(self, mock_filterwarnings): module_re = ['^neutron\\.'] warn_fixture = fixture.WarningsFixture(module_re=module_re) warn_fixture.setUp() call_re = mock_filterwarnings.mock_calls[0][2]['module'] self.assertEqual('^neutron_lib\\.|^neutron\\.', call_re) self.assertIsNotNone(re.compile(call_re)) self.assertIsNotNone(re.search(call_re, 'neutron.db.blah')) self.assertIsNotNone(re.search(call_re, 'neutron_lib.db.blah')) self.assertIsNone(re.search( call_re, 'neutron_dynamic_routing.db.blah')) neutron-lib-2.3.0/neutron_lib/tests/unit/test_neutron_lib.py0000664000175000017500000000172413641427107024377 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import copy from neutron_lib import constants from neutron_lib.tests import _base as base class TestNeutronLib(base.BaseTestCase): def test_sentinel_constant(self): foo = constants.Sentinel() bar = copy.deepcopy(foo) self.assertEqual(id(foo), id(bar)) def test_sentinel_copy(self): singleton = constants.Sentinel() self.assertEqual(copy.deepcopy(singleton), copy.copy(singleton)) neutron-lib-2.3.0/neutron_lib/tests/unit/hacking/0000775000175000017500000000000013641427200022040 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/hacking/__init__.py0000664000175000017500000000000013641427107024145 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/hacking/test_checks.py0000664000175000017500000002075113641427107024724 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import testtools from neutron_lib.hacking import checks from neutron_lib.hacking import translation_checks as tc from neutron_lib.tests import _base as base class HackingTestCase(base.BaseTestCase): def assertLinePasses(self, func, *args): with testtools.ExpectedException(StopIteration): next(func(*args)) def assertLineFails(self, func, *args): self.assertIsInstance(next(func(*args)), tuple) def _get_factory_checks(self, factory): check_fns = [] def _reg(check_fn): self.assertTrue(hasattr(check_fn, '__call__')) self.assertFalse(check_fn in check_fns) check_fns.append(check_fn) factory(_reg) return check_fns def test_factory(self): self.assertGreater(len(self._get_factory_checks(checks.factory)), 0) def test_use_jsonutils(self): def __get_msg(fun): msg = ("N521: jsonutils.%(fun)s must be used instead of " "json.%(fun)s" % {'fun': fun}) return [(0, msg)] for method in ('dump', 'dumps', 'load', 'loads'): self.assertEqual( __get_msg(method), list(checks.use_jsonutils("json.%s(" % method, "./neutron/common/rpc.py"))) self.assertEqual( 0, len(list(checks.use_jsonutils("jsonx.%s(" % method, "./neutron/common/rpc.py")))) self.assertEqual( 0, len(list(checks.use_jsonutils("json.%sx(" % method, "./neutron/common/rpc.py")))) self.assertEqual( 0, len(list(checks.use_jsonutils( "json.%s" % method, "./neutron/plugins/ml2/drivers/openvswitch/agent/xenapi/" "etc/xapi.d/plugins/netwrap")))) def test_check_contextlib_nested(self): f = checks.check_no_contextlib_nested self.assertLineFails(f, 'with contextlib.nested():', '') self.assertLineFails(f, ' with contextlib.nested():', '') self.assertLinePasses(f, '# with contextlib.nested():', '') self.assertLinePasses(f, 'print("with contextlib.nested():")', '') def test_no_mutable_default_args(self): self.assertEqual(1, len(list(checks.no_mutable_default_args( " def fake_suds_context(calls={}):")))) self.assertEqual(1, len(list(checks.no_mutable_default_args( "def get_info_from_bdm(virt_type, bdm, mapping=[])")))) self.assertEqual(0, len(list(checks.no_mutable_default_args( "defined = []")))) self.assertEqual(0, len(list(checks.no_mutable_default_args( "defined, undefined = [], {}")))) def test_check_neutron_namespace_imports(self): f = checks.check_neutron_namespace_imports self.assertLinePasses(f, 'from neutron_lib import constants') self.assertLinePasses(f, 'import neutron_lib.constants') self.assertLineFails(f, 'from neutron.common import rpc') self.assertLineFails(f, 'from neutron import context') self.assertLineFails(f, 'import neutron.common.config') def test_no_log_translations(self): for log in tc._all_log_levels: for hint in tc._all_hints: bad = 'LOG.%s(%s("Bad"))' % (log, hint) self.assertEqual( 1, len(list(tc.no_translate_logs(bad, 'f')))) # Catch abuses when used with a variable and not a literal bad = 'LOG.%s(%s(msg))' % (log, hint) self.assertEqual( 1, len(list(tc.no_translate_logs(bad, 'f')))) # Do not do validations in tests ok = 'LOG.%s(_("OK - unit tests"))' % log self.assertEqual( 0, len(list(tc.no_translate_logs(ok, 'f/tests/f')))) def test_check_log_warn_deprecated(self): bad = "LOG.warn('i am deprecated!')" good = "LOG.warning('zlatan is the best')" f = tc.check_log_warn_deprecated self.assertLineFails(f, bad, '') self.assertLinePasses(f, good, '') def test_check_localized_exception_messages(self): f = tc.check_raised_localized_exceptions self.assertLineFails(f, " raise KeyError('Error text')", '') self.assertLineFails(f, ' raise KeyError("Error text")', '') self.assertLinePasses(f, ' raise KeyError(_("Error text"))', '') self.assertLinePasses(f, ' raise KeyError(_ERR("Error text"))', '') self.assertLinePasses(f, " raise KeyError(translated_msg)", '') self.assertLinePasses(f, '# raise KeyError("Not translated")', '') self.assertLinePasses(f, 'print("raise KeyError("Not ' 'translated")")', '') def test_check_localized_exception_message_skip_tests(self): f = tc.check_raised_localized_exceptions self.assertLinePasses(f, "raise KeyError('Error text')", 'neutron_lib/tests/unit/mytest.py') def test_check_eventlet_imports(self): f = checks.check_no_eventlet_imports self.assertLineFails(f, "import eventlet") self.assertLineFails(f, "import eventlet.timeout") self.assertLineFails(f, "from eventlet import timeout") self.assertLineFails(f, "from eventlet.timeout import Timeout") self.assertLineFails(f, "from eventlet.timeout import (Timeout, X)") self.assertLinePasses(f, "import is.not.eventlet") self.assertLinePasses(f, "from is.not.eventlet") self.assertLinePasses(f, "from mymod import eventlet") self.assertLinePasses(f, "from mymod.eventlet import amod") self.assertLinePasses(f, 'print("eventlet not here")') self.assertLinePasses(f, 'print("eventlet.timeout")') self.assertLinePasses(f, "from mymod.timeout import (eventlet, X)") def test_assert_equal_none(self): self.assertEqual(len(list(checks.assert_equal_none( "self.assertEqual(A, None)"))), 1) self.assertEqual(len(list(checks.assert_equal_none( "self.assertEqual(A, None) # Comment"))), 1) self.assertEqual(len(list(checks.assert_equal_none( "self.assertEqual(None, A)"))), 1) self.assertEqual(len(list(checks.assert_equal_none( "self.assertEqual(None, A) # Comment"))), 1) self.assertEqual(len(list(checks.assert_equal_none( "self.assertEqual((None, None), A)"))), 0) self.assertEqual(len(list(checks.assert_equal_none( "self.assertEqual((None, None), A) # Comment"))), 0) self.assertEqual(len(list(checks.assert_equal_none( "self.assertEqual(A, (None, None))"))), 0) self.assertEqual(len(list(checks.assert_equal_none( "self.assertEqual(A, (None, None)) # Comment"))), 0) self.assertEqual(len(list(checks.assert_equal_none( "assertIsNot(A, None)"))), 1) self.assertEqual(len(list(checks.assert_equal_none( "assertIsNot(A, None) # Comment"))), 1) self.assertEqual(len(list(checks.assert_equal_none( "assertIsNot(None, A)"))), 1) self.assertEqual(len(list(checks.assert_equal_none( "assertIsNot(None, A) # Comment"))), 1) self.assertEqual(len(list(checks.assert_equal_none( "assertIsNot((None, None), A)"))), 0) self.assertEqual(len(list(checks.assert_equal_none( "assertIsNot((None, None), A) # Comment"))), 0) self.assertEqual(len(list(checks.assert_equal_none( "assertIsNot(A, (None, None))"))), 0) self.assertEqual(len(list(checks.assert_equal_none( "assertIsNot(A, (None, None)) # Comment"))), 0) self.assertEqual( len(list(checks.assert_equal_none("self.assertIsNone(A)"))), 0) self.assertEqual( len(list(checks.assert_equal_none("self.assertIsNotNone(A)"))), 0) neutron-lib-2.3.0/neutron_lib/tests/unit/policy/0000775000175000017500000000000013641427200021733 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/policy/test__engine.py0000664000175000017500000000614213641427107024761 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from unittest import mock from neutron_lib import context from neutron_lib.policy import _engine as policy_engine from neutron_lib.tests import _base as base class TestPolicyEnforcer(base.BaseTestCase): def setUp(self): super(TestPolicyEnforcer, self).setUp() # Isolate one _ROLE_ENFORCER per test case mock.patch.object(policy_engine, '_ROLE_ENFORCER', None).start() def test_init_reset(self): self.assertIsNone(policy_engine._ROLE_ENFORCER) policy_engine.init() self.assertIsNotNone(policy_engine._ROLE_ENFORCER) def test_check_user_is_not_admin(self): ctx = context.Context('me', 'my_project') self.assertFalse(policy_engine.check_is_admin(ctx)) def test_check_user_elevated_is_admin(self): ctx = context.Context('me', 'my_project', roles=['user']).elevated() self.assertTrue(policy_engine.check_is_admin(ctx)) def test_check_is_admin_no_roles_no_admin(self): policy_engine.init(policy_file='dummy_policy.json') ctx = context.Context('me', 'my_project', roles=['user']).elevated() # With no admin role, elevated() should not work. self.assertFalse(policy_engine.check_is_admin(ctx)) def test_check_user_elevated_is_admin_with_default_policy(self): policy_engine.init(policy_file='no_policy.json') ctx = context.Context('me', 'my_project', roles=['user']).elevated() self.assertTrue(policy_engine.check_is_admin(ctx)) def test_check_is_advsvc_role(self): ctx = context.Context('me', 'my_project', roles=['advsvc']) self.assertTrue(policy_engine.check_is_advsvc(ctx)) def test_check_is_not_advsvc_user(self): ctx = context.Context('me', 'my_project', roles=['user']) self.assertFalse(policy_engine.check_is_advsvc(ctx)) def test_check_is_not_advsvc_admin(self): ctx = context.Context('me', 'my_project').elevated() self.assertTrue(policy_engine.check_is_admin(ctx)) self.assertFalse(policy_engine.check_is_advsvc(ctx)) def test_check_is_advsvc_no_roles_no_advsvc(self): policy_engine.init(policy_file='dummy_policy.json') ctx = context.Context('me', 'my_project', roles=['advsvc']) # No advsvc role in the policy file, so cannot assume the role. self.assertFalse(policy_engine.check_is_advsvc(ctx)) def test_check_is_advsvc_role_with_default_policy(self): policy_engine.init(policy_file='no_policy.json') ctx = context.Context('me', 'my_project', roles=['advsvc']) self.assertTrue(policy_engine.check_is_advsvc(ctx)) neutron-lib-2.3.0/neutron_lib/tests/unit/policy/__init__.py0000664000175000017500000000000013641427107024040 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/test_context.py0000664000175000017500000002324713641427107023547 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from unittest import mock from oslo_context import context as oslo_context from testtools import matchers from neutron_lib import context from neutron_lib.tests import _base class TestNeutronContext(_base.BaseTestCase): def setUp(self): super(TestNeutronContext, self).setUp() db_api = 'neutron_lib.db.api.get_writer_session' self._db_api_session_patcher = mock.patch(db_api) self.db_api_session = self._db_api_session_patcher.start() def test_neutron_context_create(self): ctx = context.Context('user_id', 'tenant_id') self.assertEqual('user_id', ctx.user_id) self.assertEqual('tenant_id', ctx.project_id) self.assertEqual('tenant_id', ctx.tenant_id) request_id = ctx.request_id if isinstance(request_id, bytes): request_id = request_id.decode('utf-8') self.assertThat(request_id, matchers.StartsWith('req-')) self.assertEqual('user_id', ctx.user) self.assertEqual('tenant_id', ctx.tenant) self.assertIsNone(ctx.user_name) self.assertIsNone(ctx.tenant_name) self.assertIsNone(ctx.project_name) self.assertIsNone(ctx.auth_token) def test_neutron_context_getter_setter(self): ctx = context.Context('Anakin', 'Skywalker') self.assertEqual('Anakin', ctx.user_id) self.assertEqual('Skywalker', ctx.tenant_id) ctx.user_id = 'Darth' ctx.tenant_id = 'Vader' self.assertEqual('Darth', ctx.user_id) self.assertEqual('Vader', ctx.tenant_id) def test_neutron_context_create_with_name(self): ctx = context.Context('user_id', 'tenant_id', tenant_name='tenant_name', user_name='user_name') # Check name is set self.assertEqual('user_name', ctx.user_name) self.assertEqual('tenant_name', ctx.tenant_name) self.assertEqual('tenant_name', ctx.project_name) # Check user/tenant contains its ID even if user/tenant_name is passed self.assertEqual('user_id', ctx.user) self.assertEqual('tenant_id', ctx.tenant) def test_neutron_context_create_with_request_id(self): ctx = context.Context('user_id', 'tenant_id', request_id='req_id_xxx') self.assertEqual('req_id_xxx', ctx.request_id) def test_neutron_context_create_with_timestamp(self): now = "Right Now!" ctx = context.Context('user_id', 'tenant_id', timestamp=now) self.assertEqual(now, ctx.timestamp) def test_neutron_context_create_is_advsvc(self): ctx = context.Context('user_id', 'tenant_id', is_advsvc=True) self.assertFalse(ctx.is_admin) self.assertTrue(ctx.is_advsvc) def test_neutron_context_create_with_auth_token(self): ctx = context.Context('user_id', 'tenant_id', auth_token='auth_token_xxx') self.assertEqual('auth_token_xxx', ctx.auth_token) def test_neutron_context_from_dict(self): owner = {'user_id': 'Luke', 'tenant_id': 'Skywalker'} ctx = context.Context.from_dict(owner) self.assertEqual(owner['user_id'], ctx.user_id) self.assertEqual(owner['tenant_id'], ctx.tenant_id) def test_neutron_context_to_dict(self): ctx = context.Context('user_id', 'tenant_id') ctx_dict = ctx.to_dict() self.assertEqual('user_id', ctx_dict['user_id']) self.assertEqual('tenant_id', ctx_dict['project_id']) self.assertEqual(ctx.request_id, ctx_dict['request_id']) self.assertEqual('user_id', ctx_dict['user']) self.assertEqual('tenant_id', ctx_dict['tenant']) self.assertIsNone(ctx_dict['user_name']) self.assertIsNone(ctx_dict['tenant_name']) self.assertIsNone(ctx_dict['project_name']) self.assertIsNone(ctx_dict['auth_token']) def test_neutron_context_to_dict_with_name(self): ctx = context.Context('user_id', 'tenant_id', tenant_name='tenant_name', user_name='user_name') ctx_dict = ctx.to_dict() self.assertEqual('user_name', ctx_dict['user_name']) self.assertEqual('tenant_name', ctx_dict['tenant_name']) self.assertEqual('tenant_name', ctx_dict['project_name']) def test_neutron_context_to_dict_with_auth_token(self): ctx = context.Context('user_id', 'tenant_id', auth_token='auth_token_xxx') ctx_dict = ctx.to_dict() self.assertEqual('auth_token_xxx', ctx_dict['auth_token']) def test_neutron_context_admin_to_dict(self): self.db_api_session.return_value = 'fakesession' ctx = context.get_admin_context() ctx_dict = ctx.to_dict() self.assertIsNone(ctx_dict['user_id']) self.assertIsNone(ctx_dict['tenant_id']) self.assertIsNone(ctx_dict['auth_token']) self.assertTrue(ctx_dict['is_admin']) self.assertIsNotNone(ctx.session) self.assertNotIn('session', ctx_dict) def test_neutron_context_admin_without_session_to_dict(self): ctx = context.get_admin_context_without_session() ctx_dict = ctx.to_dict() self.assertIsNone(ctx_dict['user_id']) self.assertIsNone(ctx_dict['tenant_id']) self.assertIsNone(ctx_dict['auth_token']) self.assertFalse(hasattr(ctx, 'session')) def test_neutron_context_elevated_retains_request_id(self): ctx = context.Context('user_id', 'tenant_id') self.assertFalse(ctx.is_admin) req_id_before = ctx.request_id elevated_ctx = ctx.elevated() self.assertTrue(elevated_ctx.is_admin) self.assertEqual(req_id_before, elevated_ctx.request_id) def test_neutron_context_elevated_idempotent(self): ctx = context.Context('user_id', 'tenant_id') self.assertFalse(ctx.is_admin) elevated_ctx = ctx.elevated() self.assertTrue(elevated_ctx.is_admin) elevated2_ctx = elevated_ctx.elevated() self.assertTrue(elevated2_ctx.is_admin) def test_neutron_context_overwrite(self): ctx1 = context.Context('user_id', 'tenant_id') self.assertEqual(ctx1.request_id, oslo_context.get_current().request_id) # If overwrite is not specified, request_id should be updated. ctx2 = context.Context('user_id', 'tenant_id') self.assertNotEqual(ctx2.request_id, ctx1.request_id) self.assertEqual(ctx2.request_id, oslo_context.get_current().request_id) # If overwrite is specified, request_id should be kept. ctx3 = context.Context('user_id', 'tenant_id', overwrite=False) self.assertNotEqual(ctx3.request_id, ctx2.request_id) self.assertEqual(ctx2.request_id, oslo_context.get_current().request_id) def test_neutron_context_get_admin_context_not_update_local_store(self): ctx = context.Context('user_id', 'tenant_id') req_id_before = oslo_context.get_current().request_id self.assertEqual(ctx.request_id, req_id_before) ctx_admin = context.get_admin_context() self.assertEqual(req_id_before, oslo_context.get_current().request_id) self.assertNotEqual(req_id_before, ctx_admin.request_id) def test_to_policy_values(self): values = { 'user_id': 'user_id', 'tenant_id': 'tenant_id', 'is_admin': 'is_admin', 'tenant_name': 'tenant_name', 'user_name': 'user_name', 'domain': 'domain', 'user_domain': 'user_domain', 'project_domain': 'project_domain', 'user_name': 'user_name', } additional_values = { 'user': 'user_id', 'tenant': 'tenant_id', 'project_id': 'tenant_id', 'project_name': 'tenant_name', } ctx = context.Context(**values) # apply dict() to get a real dictionary, needed for newer oslo.context # that returns _DeprecatedPolicyValues object instead policy_values = dict(ctx.to_policy_values()) self.assertDictSupersetOf(values, policy_values) self.assertDictSupersetOf(additional_values, policy_values) @mock.patch.object(context.ContextBaseWithSession, 'session') def test_superclass_session(self, mocked_session): ctx = context.Context('user_id', 'tenant_id') # make sure context uses parent class session that is mocked self.assertEqual(mocked_session, ctx.session) def test_session_cached(self): ctx = context.Context('user_id', 'tenant_id') session1 = ctx.session session2 = ctx.session self.assertIs(session1, session2) def test_add_get_remove_constraint(self): ctx = context.Context('user_id', 'tenant_id') self.assertIsNone(ctx.get_transaction_constraint()) ctx.set_transaction_constraint('networks', 'net_id', 44) constraint = ctx.get_transaction_constraint() self.assertEqual(44, constraint.if_revision_match) self.assertEqual('networks', constraint.resource) self.assertEqual('net_id', constraint.resource_id) ctx.clear_transaction_constraint() self.assertIsNone(ctx.get_transaction_constraint()) neutron-lib-2.3.0/neutron_lib/tests/unit/test_rpc.py0000664000175000017500000004624113641427107022646 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from unittest import mock from oslo_config import cfg import oslo_messaging as messaging from oslo_messaging import conffixture as messaging_conffixture from oslo_messaging import exceptions as oslomsg_exc from oslo_messaging.rpc import dispatcher import testtools from neutron_lib import fixture from neutron_lib import rpc from neutron_lib.tests import _base as base CONF = cfg.CONF class TestRPC(base.BaseTestCase): def setUp(self): super(TestRPC, self).setUp() self.useFixture(fixture.RPCFixture()) @mock.patch.object(rpc, 'RequestContextSerializer') @mock.patch.object(messaging, 'get_rpc_transport') @mock.patch.object(messaging, 'get_notification_transport') @mock.patch.object(messaging, 'Notifier') def test_init(self, mock_not, mock_noti_trans, mock_trans, mock_ser): notifier = mock.Mock() transport = mock.Mock() noti_transport = mock.Mock() serializer = mock.Mock() conf = mock.Mock() mock_trans.return_value = transport mock_noti_trans.return_value = noti_transport mock_ser.return_value = serializer mock_not.return_value = notifier rpc.init(conf, rpc_ext_mods=['foo']) expected_mods = list(set(['foo'] + rpc._DFT_EXMODS)) mock_trans.assert_called_once_with( conf, allowed_remote_exmods=expected_mods) mock_noti_trans.assert_called_once_with( conf, allowed_remote_exmods=expected_mods) mock_not.assert_called_once_with(noti_transport, serializer=serializer) self.assertIsNotNone(rpc.TRANSPORT) self.assertIsNotNone(rpc.NOTIFICATION_TRANSPORT) self.assertIsNotNone(rpc.NOTIFIER) def test_cleanup_transport_null(self): rpc.NOTIFIER = mock.Mock() rpc.NOTIFICATION_TRANSPORT = mock.Mock() rpc.TRANSPORT = None self.assertRaises(AssertionError, rpc.cleanup) rpc.TRANSPORT = mock.Mock() def test_cleanup_notification_transport_null(self): rpc.TRANSPORT = mock.Mock() rpc.NOTIFIER = mock.Mock() rpc.NOTIFICATION_TRANSPORT = None self.assertRaises(AssertionError, rpc.cleanup) rpc.NOTIFICATION_TRANSPORT = mock.Mock() def test_cleanup_notifier_null(self): rpc.TRANSPORT = mock.Mock() rpc.NOTIFICATION_TRANSPORT = mock.Mock() rpc.NOTIFIER = None self.assertRaises(AssertionError, rpc.cleanup) rpc.NOTIFIER = mock.Mock() def test_cleanup(self): rpc.NOTIFIER = mock.Mock() rpc.NOTIFICATION_TRANSPORT = mock.Mock() rpc.TRANSPORT = mock.Mock() trans_cleanup = mock.Mock() not_trans_cleanup = mock.Mock() rpc.TRANSPORT.cleanup = trans_cleanup rpc.NOTIFICATION_TRANSPORT.cleanup = not_trans_cleanup rpc.cleanup() trans_cleanup.assert_called_once_with() not_trans_cleanup.assert_called_once_with() self.assertIsNone(rpc.TRANSPORT) self.assertIsNone(rpc.NOTIFICATION_TRANSPORT) self.assertIsNone(rpc.NOTIFIER) rpc.TRANSPORT = mock.Mock() rpc.NOTIFIER = mock.Mock() rpc.NOTIFICATION_TRANSPORT = mock.Mock() @mock.patch.object(rpc, 'RequestContextSerializer') @mock.patch.object(rpc, 'BackingOffClient') def test_get_client(self, mock_client, mock_ser): rpc.TRANSPORT = mock.Mock() tgt = mock.Mock() ser = mock.Mock() mock_client.return_value = 'client' mock_ser.return_value = ser client = rpc.get_client(tgt, version_cap='1.0', serializer='foo') mock_ser.assert_called_once_with('foo') mock_client.assert_called_once_with(rpc.TRANSPORT, tgt, version_cap='1.0', serializer=ser) self.assertEqual('client', client) @mock.patch.object(rpc, 'RequestContextSerializer') @mock.patch.object(messaging, 'get_rpc_server') def test_get_server(self, mock_get, mock_ser): rpc.TRANSPORT = mock.Mock() ser = mock.Mock() tgt = mock.Mock() ends = mock.Mock() mock_ser.return_value = ser mock_get.return_value = 'server' server = rpc.get_server(tgt, ends, serializer='foo') mock_ser.assert_called_once_with('foo') access_policy = dispatcher.DefaultRPCAccessPolicy mock_get.assert_called_once_with(rpc.TRANSPORT, tgt, ends, 'eventlet', ser, access_policy=access_policy) self.assertEqual('server', server) def test_get_notifier(self): rpc.NOTIFIER = mock.Mock() mock_prep = mock.Mock() mock_prep.return_value = 'notifier' rpc.NOTIFIER.prepare = mock_prep notifier = rpc.get_notifier('service', publisher_id='foo') mock_prep.assert_called_once_with(publisher_id='foo') self.assertEqual('notifier', notifier) def test_get_notifier_null_publisher(self): rpc.NOTIFIER = mock.Mock() mock_prep = mock.Mock() mock_prep.return_value = 'notifier' rpc.NOTIFIER.prepare = mock_prep notifier = rpc.get_notifier('service', host='bar') mock_prep.assert_called_once_with(publisher_id='service.bar') self.assertEqual('notifier', notifier) class TestRequestContextSerializer(base.BaseTestCase): def setUp(self): super(TestRequestContextSerializer, self).setUp() self.mock_base = mock.Mock() self.ser = rpc.RequestContextSerializer(self.mock_base) self.ser_null = rpc.RequestContextSerializer(None) def test_serialize_entity(self): self.mock_base.serialize_entity.return_value = 'foo' ser_ent = self.ser.serialize_entity('context', 'entity') self.mock_base.serialize_entity.assert_called_once_with('context', 'entity') self.assertEqual('foo', ser_ent) def test_deserialize_entity(self): self.mock_base.deserialize_entity.return_value = 'foo' deser_ent = self.ser.deserialize_entity('context', 'entity') self.mock_base.deserialize_entity.assert_called_once_with('context', 'entity') self.assertEqual('foo', deser_ent) def test_deserialize_entity_null_base(self): deser_ent = self.ser_null.deserialize_entity('context', 'entity') self.assertEqual('entity', deser_ent) def test_serialize_context(self): context = mock.Mock() self.ser.serialize_context(context) context.to_dict.assert_called_once_with() def test_deserialize_context(self): context_dict = {'foo': 'bar', 'user_id': 1, 'tenant_id': 1, 'is_admin': True} c = self.ser.deserialize_context(context_dict) self.assertEqual(1, c.user_id) self.assertEqual(1, c.project_id) def test_deserialize_context_no_user_id(self): context_dict = {'foo': 'bar', 'user': 1, 'tenant_id': 1, 'is_admin': True} c = self.ser.deserialize_context(context_dict) self.assertEqual(1, c.user_id) self.assertEqual(1, c.project_id) def test_deserialize_context_no_tenant_id(self): context_dict = {'foo': 'bar', 'user_id': 1, 'project_id': 1, 'is_admin': True} c = self.ser.deserialize_context(context_dict) self.assertEqual(1, c.user_id) self.assertEqual(1, c.project_id) def test_deserialize_context_no_ids(self): context_dict = {'foo': 'bar', 'is_admin': True} c = self.ser.deserialize_context(context_dict) self.assertIsNone(c.user_id) self.assertIsNone(c.project_id) class ServiceTestCase(base.BaseTestCase): # the class cannot be based on BaseTestCase since it mocks rpc.Connection def setUp(self): super(ServiceTestCase, self).setUp() self.host = 'foo' self.topic = 'neutron-agent' self.target_mock = mock.patch('oslo_messaging.Target') self.target_mock.start() self.messaging_conf = messaging_conffixture.ConfFixture(CONF) self.messaging_conf.transport_url = 'fake://' self.messaging_conf.response_timeout = 0 self.useFixture(self.messaging_conf) self.addCleanup(rpc.cleanup) rpc.init(CONF) @mock.patch.object(cfg, 'CONF') def test_operations(self, mock_conf): mock_conf.host = self.host with mock.patch('oslo_messaging.get_rpc_server') as get_rpc_server: rpc_server = get_rpc_server.return_value service = rpc.Service(self.host, self.topic) service.start() rpc_server.start.assert_called_once_with() service.stop() rpc_server.stop.assert_called_once_with() rpc_server.wait.assert_called_once_with() class TimeoutTestCase(base.BaseTestCase): def setUp(self): super(TimeoutTestCase, self).setUp() self.messaging_conf = messaging_conffixture.ConfFixture(CONF) self.messaging_conf.transport_url = 'fake://' self.messaging_conf.response_timeout = 0 self.useFixture(self.messaging_conf) self.addCleanup(rpc.cleanup) rpc.init(CONF) rpc.TRANSPORT = mock.MagicMock() rpc.TRANSPORT._send.side_effect = messaging.MessagingTimeout target = messaging.Target(version='1.0', topic='testing') self.client = rpc.get_client(target) self.call_context = mock.Mock() self.sleep = mock.patch('time.sleep').start() rpc.TRANSPORT.conf.rpc_response_timeout = 10 rpc.TRANSPORT.conf.rpc_response_max_timeout = 300 def test_timeout_unaffected_when_explicitly_set(self): rpc.TRANSPORT.conf.rpc_response_timeout = 5 ctx = self.client.prepare(topic='sandwiches', timeout=77) with testtools.ExpectedException(messaging.MessagingTimeout): ctx.call(self.call_context, 'create_pb_and_j') # ensure that the timeout was not increased and the back-off sleep # wasn't called self.assertEqual( 5, rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['create_pb_and_j']) self.assertFalse(self.sleep.called) def test_timeout_store_defaults(self): # any method should default to the configured timeout self.assertEqual( rpc.TRANSPORT.conf.rpc_response_timeout, rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['method_1']) self.assertEqual( rpc.TRANSPORT.conf.rpc_response_timeout, rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['method_2']) # a change to an existing should not affect new or existing ones rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['method_2'] = 7000 self.assertEqual( rpc.TRANSPORT.conf.rpc_response_timeout, rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['method_1']) self.assertEqual( rpc.TRANSPORT.conf.rpc_response_timeout, rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['method_3']) def test_method_timeout_sleep(self): rpc.TRANSPORT.conf.rpc_response_timeout = 2 for i in range(100): with testtools.ExpectedException(messaging.MessagingTimeout): self.client.call(self.call_context, 'method_1') # sleep value should always be between 0 and configured timeout self.assertGreaterEqual(self.sleep.call_args_list[0][0][0], 0) self.assertLessEqual(self.sleep.call_args_list[0][0][0], 2) self.sleep.reset_mock() def test_method_timeout_increases_on_timeout_exception(self): rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['method_1'] = 1 for i in range(5): with testtools.ExpectedException(messaging.MessagingTimeout): self.client.call(self.call_context, 'method_1') # we only care to check the timeouts sent to the transport timeouts = [call[1]['timeout'] for call in rpc.TRANSPORT._send.call_args_list] self.assertEqual([1, 2, 4, 8, 16], timeouts) def test_method_timeout_config_ceiling(self): rpc.TRANSPORT.conf.rpc_response_timeout = 10 # 5 doublings should max out at the 10xdefault ceiling for i in range(5): with testtools.ExpectedException(messaging.MessagingTimeout): self.client.call(self.call_context, 'method_1') self.assertEqual( rpc.TRANSPORT.conf.rpc_response_max_timeout, rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['method_1']) with testtools.ExpectedException(messaging.MessagingTimeout): self.client.call(self.call_context, 'method_1') self.assertEqual( rpc.TRANSPORT.conf.rpc_response_max_timeout, rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['method_1']) def test_timeout_unchanged_on_other_exception(self): rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['method_1'] = 1 rpc.TRANSPORT._send.side_effect = ValueError with testtools.ExpectedException(ValueError): self.client.call(self.call_context, 'method_1') rpc.TRANSPORT._send.side_effect = messaging.MessagingTimeout with testtools.ExpectedException(messaging.MessagingTimeout): self.client.call(self.call_context, 'method_1') timeouts = [call[1]['timeout'] for call in rpc.TRANSPORT._send.call_args_list] self.assertEqual([1, 1], timeouts) def test_timeouts_for_methods_tracked_independently(self): rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['method_1'] = 1 rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['method_2'] = 1 for method in ('method_1', 'method_1', 'method_2', 'method_1', 'method_2'): with testtools.ExpectedException(messaging.MessagingTimeout): self.client.call(self.call_context, method) timeouts = [call[1]['timeout'] for call in rpc.TRANSPORT._send.call_args_list] self.assertEqual([1, 2, 1, 4, 2], timeouts) def test_timeouts_for_namespaces_tracked_independently(self): rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['ns1.method'] = 1 rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['ns2.method'] = 1 for ns in ('ns1', 'ns2'): self.client.target.namespace = ns for i in range(4): with testtools.ExpectedException(messaging.MessagingTimeout): self.client.call(self.call_context, 'method') timeouts = [call[1]['timeout'] for call in rpc.TRANSPORT._send.call_args_list] self.assertEqual([1, 2, 4, 8, 1, 2, 4, 8], timeouts) def test_method_timeout_increases_with_prepare(self): rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['method_1'] = 1 ctx = self.client.prepare(version='1.4') with testtools.ExpectedException(messaging.MessagingTimeout): ctx.call(self.call_context, 'method_1') with testtools.ExpectedException(messaging.MessagingTimeout): ctx.call(self.call_context, 'method_1') # we only care to check the timeouts sent to the transport timeouts = [call[1]['timeout'] for call in rpc.TRANSPORT._send.call_args_list] self.assertEqual([1, 2], timeouts) def test_set_max_timeout_caps_all_methods(self): rpc.TRANSPORT.conf.rpc_response_timeout = 300 rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['method_1'] = 100 rpc.BackingOffClient.set_max_timeout(50) # both explicitly tracked self.assertEqual( 50, rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['method_1']) # as well as new methods self.assertEqual( 50, rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['method_2']) def test_set_max_timeout_retains_lower_timeouts(self): rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['method_1'] = 10 rpc.BackingOffClient.set_max_timeout(50) self.assertEqual( 10, rpc._BackingOffContextWrapper._METHOD_TIMEOUTS['method_1']) def test_set_max_timeout_overrides_default_timeout(self): rpc.TRANSPORT.conf.rpc_response_timeout = 10 self.assertEqual( rpc.TRANSPORT.conf.rpc_response_max_timeout, rpc._BackingOffContextWrapper.get_max_timeout()) rpc._BackingOffContextWrapper.set_max_timeout(10) self.assertEqual(10, rpc._BackingOffContextWrapper.get_max_timeout()) class CastExceptionTestCase(base.BaseTestCase): def setUp(self): super(CastExceptionTestCase, self).setUp() self.messaging_conf = messaging_conffixture.ConfFixture(CONF) self.messaging_conf.transport_url = 'fake://' self.messaging_conf.response_timeout = 0 self.useFixture(self.messaging_conf) self.addCleanup(rpc.cleanup) rpc.init(CONF) rpc.TRANSPORT = mock.MagicMock() rpc.TRANSPORT._send.side_effect = oslomsg_exc.MessageDeliveryFailure target = messaging.Target(version='1.0', topic='testing') self.client = rpc.get_client(target) self.cast_context = mock.Mock() def test_cast_catches_exception(self): self.client.cast(self.cast_context, 'method_1') class TestConnection(base.BaseTestCase): def setUp(self): super(TestConnection, self).setUp() self.conn = rpc.Connection() @mock.patch.object(messaging, 'Target') @mock.patch.object(cfg, 'CONF') @mock.patch.object(rpc, 'get_server') def test_create_consumer(self, mock_get, mock_cfg, mock_tgt): mock_cfg.host = 'foo' server = mock.Mock() target = mock.Mock() mock_get.return_value = server mock_tgt.return_value = target self.conn.create_consumer('topic', 'endpoints', fanout=True) mock_tgt.assert_called_once_with(topic='topic', server='foo', fanout=True) mock_get.assert_called_once_with(target, 'endpoints') self.assertEqual([server], self.conn.servers) def test_consume_in_threads(self): self.conn.servers = [mock.Mock(), mock.Mock()] servs = self.conn.consume_in_threads() for serv in self.conn.servers: serv.start.assert_called_once_with() self.assertEqual(servs, self.conn.servers) def test_close(self): self.conn.servers = [mock.Mock(), mock.Mock()] self.conn.close() for serv in self.conn.servers: serv.stop.assert_called_once_with() serv.wait.assert_called_once_with() neutron-lib-2.3.0/neutron_lib/tests/unit/__init__.py0000664000175000017500000000000013641427107022541 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/utils/0000775000175000017500000000000013641427200021574 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/utils/test_runtime.py0000664000175000017500000001114613641427107024701 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from unittest import mock from stevedore import enabled from neutron_lib.tests import _base as base from neutron_lib.utils import runtime class _DummyDriver(object): driver = mock.sentinel.dummy_driver class TestRunTime(base.BaseTestCase): @mock.patch.object(runtime, 'LOG') def test_load_class_by_alias_or_classname_no_name(self, mock_log): self.assertRaises( ImportError, runtime.load_class_by_alias_or_classname, 'ns', None) @mock.patch.object(runtime.driver, 'DriverManager', return_value=_DummyDriver) @mock.patch.object(runtime, 'LOG') def test_load_class_by_alias_or_classname_dummy_driver( self, mock_log, mock_driver): self.assertEqual(_DummyDriver.driver, runtime.load_class_by_alias_or_classname('ns', 'n')) @mock.patch.object(runtime, 'LOG') def test_load_class_by_alias_or_classname_bad_classname(self, mock_log): self.assertRaises( ImportError, runtime.load_class_by_alias_or_classname, 'ns', '_NoClass') @mock.patch.object(runtime.importutils, 'import_class', return_value=mock.sentinel.dummy_class) @mock.patch.object(runtime, 'LOG') def test_load_class_by_alias_or_classname_with_classname( self, mock_log, mock_import): self.assertEqual( mock.sentinel.dummy_class, runtime.load_class_by_alias_or_classname('ns', 'n')) class TestNamespacedPlugins(base.BaseTestCase): @mock.patch.object(enabled, 'EnabledExtensionManager') def test_init_reload(self, mock_mgr): plugins = runtime.NamespacedPlugins('_test_ns_') mock_mgr.assert_called_with( '_test_ns_', mock.ANY, invoke_on_load=False) mock_mgr().map.assert_called_with(plugins._add_extension) @mock.patch.object(runtime, 'LOG') @mock.patch.object(enabled, 'EnabledExtensionManager') def test_init_reload_no_plugins(self, mock_mgr, mock_log): mock_mgr().names.return_value = [] plugins = runtime.NamespacedPlugins('_test_ns_') mock_log.debug.assert_called_once() mock_mgr().map.assert_not_called() self.assertDictEqual({}, plugins._extensions) @mock.patch.object(enabled, 'EnabledExtensionManager') def test_add_duplicate_names(self, mock_mgr): mock_ep = mock.Mock() mock_ep.name = 'a' mock_mgr().names.return_value = ['a', 'a'] # return 2 EPs with the same name mock_mgr().map = lambda f: [f(ep) for ep in [mock_ep, mock_ep]] self.assertRaises(KeyError, runtime.NamespacedPlugins, '_test_ns_') @mock.patch.object(enabled, 'EnabledExtensionManager') def test_get_plugin_class(self, mock_mgr): mock_epa = mock.Mock() mock_epa.name = 'a' mock_epa.plugin = 'A' mock_epb = mock.Mock() mock_epb.name = 'b' mock_epb.plugin = 'B' mock_mgr().names.return_value = ['a', 'b'] mock_mgr().map = lambda f: [f(ep) for ep in [mock_epa, mock_epb]] plugins = runtime.NamespacedPlugins('_test_ns_') self.assertEqual('A', plugins.get_plugin_class('a')) self.assertEqual('B', plugins.get_plugin_class('b')) @mock.patch.object(enabled, 'EnabledExtensionManager') def test_new_plugin_instance(self, mock_mgr): mock_epa = mock.Mock() mock_epa.name = 'a' mock_epb = mock.Mock() mock_epb.name = 'b' mock_mgr().names.return_value = ['a', 'b'] mock_mgr().map = lambda f: [f(ep) for ep in [mock_epa, mock_epb]] plugins = runtime.NamespacedPlugins('_test_ns_') plugins.new_plugin_instance('a', 'c', 'd', karg='kval') plugins.new_plugin_instance('b') mock_epa.plugin.assert_called_once_with('c', 'd', karg='kval') mock_epb.plugin.assert_called_once_with() class TestListPackageModules(base.BaseTestCase): def test_list_package_modules(self): # mainly just to ensure we can import modules for both PY2/PY3 self.assertGreater( len(runtime.list_package_modules('neutron_lib.exceptions')), 3) neutron-lib-2.3.0/neutron_lib/tests/unit/utils/test_test.py0000664000175000017500000000157613641427107024203 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from neutron_lib.tests import _base as base from neutron_lib.utils import test class TestUnstableTestDecorator(base.BaseTestCase): @test.unstable_test("some bug") def test_unstable_pass(self): self.assertIsNone(None) @test.unstable_test("some other bug") def test_unstable_fail(self): self.assertIsNotNone(None) neutron-lib-2.3.0/neutron_lib/tests/unit/utils/test_helpers.py0000664000175000017500000001734713641427107024671 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import collections import re import testtools from neutron_lib.tests import _base as base from neutron_lib.utils import helpers class TestParseMappings(base.BaseTestCase): def parse(self, mapping_list, unique_values=True, unique_keys=True): return helpers.parse_mappings(mapping_list, unique_values, unique_keys) def test_parse_mappings_fails_for_missing_separator(self): with testtools.ExpectedException(ValueError): self.parse(['key']) def test_parse_mappings_fails_for_missing_key(self): with testtools.ExpectedException(ValueError): self.parse([':val']) def test_parse_mappings_fails_for_missing_value(self): with testtools.ExpectedException(ValueError): self.parse(['key:']) def test_parse_mappings_fails_for_extra_separator(self): with testtools.ExpectedException(ValueError): self.parse(['key:val:junk']) def test_parse_mappings_fails_for_duplicate_key(self): with testtools.ExpectedException(ValueError): self.parse(['key:val1', 'key:val2']) def test_parse_mappings_fails_for_duplicate_value(self): with testtools.ExpectedException(ValueError): self.parse(['key1:val', 'key2:val']) def test_parse_mappings_succeeds_for_one_mapping(self): self.assertEqual({'key': 'val'}, self.parse(['key:val'])) def test_parse_mappings_succeeds_for_n_mappings(self): self.assertEqual({'key1': 'val1', 'key2': 'val2'}, self.parse(['key1:val1', 'key2:val2'])) def test_parse_mappings_succeeds_for_duplicate_value(self): self.assertEqual({'key1': 'val', 'key2': 'val'}, self.parse(['key1:val', 'key2:val'], False)) def test_parse_mappings_succeeds_for_no_mappings(self): self.assertEqual({}, self.parse([''])) def test_parse_mappings_succeeds_for_nonuniq_key(self): self.assertEqual({'key': ['val1', 'val2']}, self.parse(['key:val1', 'key:val2', 'key:val2'], unique_keys=False)) def test_parse_mappings_succeeds_for_nonuniq_key_duplicate_value(self): self.assertEqual({'key': ['val']}, self.parse(['key:val', 'key:val', 'key:val'], unique_keys=False)) class TestCompareElements(base.BaseTestCase): def test_compare_elements(self): self.assertFalse(helpers.compare_elements([], ['napoli'])) self.assertFalse(helpers.compare_elements(None, ['napoli'])) self.assertFalse(helpers.compare_elements(['napoli'], [])) self.assertFalse(helpers.compare_elements(['napoli'], None)) self.assertFalse(helpers.compare_elements(['napoli', 'juve'], ['juve'])) self.assertTrue(helpers.compare_elements(['napoli', 'juve'], ['napoli', 'juve'])) self.assertTrue(helpers.compare_elements(['napoli', 'juve'], ['juve', 'napoli'])) class TestDictUtils(base.BaseTestCase): def test_dict2str(self): dic = {"key1": "value1", "key2": "value2", "key3": "value3"} expected = "key1=value1,key2=value2,key3=value3" self.assertEqual(expected, helpers.dict2str(dic)) def test_str2dict(self): string = "key1=value1,key2=value2,key3=value3" expected = {"key1": "value1", "key2": "value2", "key3": "value3"} self.assertEqual(expected, helpers.str2dict(string)) def test_dict_str_conversion(self): dic = {"key1": "value1", "key2": "value2"} self.assertEqual(dic, helpers.str2dict(helpers.dict2str(dic))) def test_diff_list_of_dict(self): old_list = [{"key1": "value1"}, {"key2": "value2"}, {"key3": "value3"}] new_list = [{"key1": "value1"}, {"key2": "value2"}, {"key4": "value4"}] added, removed = helpers.diff_list_of_dict(old_list, new_list) self.assertEqual(added, [dict(key4="value4")]) self.assertEqual(removed, [dict(key3="value3")]) class TestDict2Tuples(base.BaseTestCase): def test_dict(self): input_dict = {'foo': 'bar', '42': 'baz', 'aaa': 'zzz'} expected = (('42', 'baz'), ('aaa', 'zzz'), ('foo', 'bar')) output_tuple = helpers.dict2tuple(input_dict) self.assertEqual(expected, output_tuple) class TestCamelize(base.BaseTestCase): def test_camelize(self): data = {'bandwidth_limit': 'BandwidthLimit', 'test': 'Test', 'some__more__dashes': 'SomeMoreDashes', 'a_penguin_walks_into_a_bar': 'APenguinWalksIntoABar'} for s, expected in data.items(): self.assertEqual(expected, helpers.camelize(s)) class TestRoundVal(base.BaseTestCase): def test_round_val_ok(self): for expected, value in ((0, 0), (0, 0.1), (1, 0.5), (1, 1.49), (2, 1.5)): self.assertEqual(expected, helpers.round_val(value)) class TestGetRandomString(base.BaseTestCase): def test_get_random_string(self): length = 127 random_string = helpers.get_random_string(length) self.assertEqual(length, len(random_string)) regex = re.compile('^[0-9a-fA-F]+$') self.assertIsNotNone(regex.match(random_string)) class TestSafeDecodeUtf8(base.BaseTestCase): def test_py3_decoded_valid_bytes(self): s = bytes('test-py2', 'utf-8') decoded_str = helpers.safe_decode_utf8(s) self.assertIsInstance(decoded_str, str) self.assertEqual(s, decoded_str.encode('utf-8')) def test_py3_decoded_invalid_bytes(self): s = bytes('test-py2', 'utf_16') decoded_str = helpers.safe_decode_utf8(s) self.assertIsInstance(decoded_str, str) class TestSafeSortKey(base.BaseTestCase): def test_safe_sort_key(self): data1 = {'k1': 'v1', 'k2': 'v2'} data2 = {'k2': 'v2', 'k1': 'v1'} self.assertEqual(helpers.safe_sort_key(data1), helpers.safe_sort_key(data2)) def _create_dict_from_list(self, list_data): d = collections.defaultdict(list) for k, v in list_data: d[k].append(v) return d def test_safe_sort_key_mapping_ne(self): list1 = [('yellow', 1), ('blue', 2), ('yellow', 3), ('blue', 4), ('red', 1)] data1 = self._create_dict_from_list(list1) list2 = [('yellow', 3), ('blue', 4), ('yellow', 1), ('blue', 2), ('red', 1)] data2 = self._create_dict_from_list(list2) self.assertNotEqual(helpers.safe_sort_key(data1), helpers.safe_sort_key(data2)) def test_safe_sort_key_mapping(self): list1 = [('yellow', 1), ('blue', 2), ('red', 1)] data1 = self._create_dict_from_list(list1) list2 = [('blue', 2), ('red', 1), ('yellow', 1)] data2 = self._create_dict_from_list(list2) self.assertEqual(helpers.safe_sort_key(data1), helpers.safe_sort_key(data2)) neutron-lib-2.3.0/neutron_lib/tests/unit/utils/test_file.py0000664000175000017500000000352613641427107024140 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import os.path import stat from neutron_lib.tests import _base as base from neutron_lib.utils import file class TestReplaceFile(base.BaseTestCase): def setUp(self): super(TestReplaceFile, self).setUp() temp_dir = self.get_default_temp_dir().path self.file_name = os.path.join(temp_dir, "new_file") self.data = "data to copy" def _verify_result(self, file_mode): self.assertTrue(os.path.exists(self.file_name)) with open(self.file_name) as f: content = f.read() self.assertEqual(self.data, content) mode = os.stat(self.file_name).st_mode self.assertEqual(file_mode, stat.S_IMODE(mode)) def test_replace_file_default_mode(self): file_mode = 0o644 file.replace_file(self.file_name, self.data) self._verify_result(file_mode) def test_replace_file_custom_mode(self): file_mode = 0o722 file.replace_file(self.file_name, self.data, file_mode) self._verify_result(file_mode) def test_replace_file_custom_mode_twice(self): file_mode = 0o722 file.replace_file(self.file_name, self.data, file_mode) self.data = "new data to copy" file_mode = 0o777 file.replace_file(self.file_name, self.data, file_mode) self._verify_result(file_mode) neutron-lib-2.3.0/neutron_lib/tests/unit/utils/test_net.py0000664000175000017500000000727513641427107024014 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import itertools import random import socket from unittest import mock from neutron_lib import constants from neutron_lib.tests import _base as base from neutron_lib.utils import net class TestGetHostname(base.BaseTestCase): @mock.patch.object(socket, 'gethostname', return_value='fake-host-name') def test_get_hostname(self, mock_gethostname): self.assertEqual('fake-host-name', net.get_hostname()) mock_gethostname.assert_called_once_with() class TestGetRandomMac(base.BaseTestCase): @mock.patch.object(random, 'getrandbits', return_value=0xa2) def test_first_4_octets_unchanged(self, mock_rnd): mac = net.get_random_mac(['aa', 'bb', '00', 'dd', 'ee', 'ff']) self.assertEqual('aa:bb:00:dd:a2:a2', mac) mock_rnd.assert_called_with(8) @mock.patch.object(random, 'getrandbits', return_value=0xa2) def test_first_4th_octet_generated(self, mock_rnd): mac = net.get_random_mac(['aa', 'bb', 'cc', '00', 'ee', 'ff']) self.assertEqual('aa:bb:cc:a2:a2:a2', mac) mock_rnd.assert_called_with(8) class TestRandomMacGenerator(base.BaseTestCase): def test_all_macs_generated(self): mac = ['aa', 'bb', 'cc', 'dd', 'ee', 'ff'] generator = itertools.islice(net.random_mac_generator(mac), 70000) self.assertEqual(2**16, len(list(generator))) @mock.patch.object(random, 'getrandbits', return_value=0xa2) def test_first_generated_mac(self, mock_rnd): mac = ['aa', 'bb', 'cc', '00', 'ee', 'ff'] generator = itertools.islice(net.random_mac_generator(mac), 1) self.assertEqual(['aa:bb:cc:a2:a2:a2'], list(generator)) mock_rnd.assert_called_with(8) @mock.patch.object(random, 'getrandbits', return_value=0xa2) def test_respected_early_zeroes_generated_mac(self, mock_rnd): mac1 = ['00', 'bb', 'cc', '00', 'ee', 'ff'] generator = itertools.islice(net.random_mac_generator(mac1), 1) self.assertEqual(['00:bb:cc:a2:a2:a2'], list(generator)) mac2 = ['aa', '00', 'cc', '00', 'ee', 'ff'] generator = itertools.islice(net.random_mac_generator(mac2), 1) self.assertEqual(['aa:00:cc:a2:a2:a2'], list(generator)) mac3 = ['aa', 'bb', '00', '00', 'ee', 'ff'] generator = itertools.islice(net.random_mac_generator(mac3), 1) self.assertEqual(['aa:bb:00:a2:a2:a2'], list(generator)) mock_rnd.assert_called_with(8) @mock.patch.object(random, 'getrandbits', return_value=0xa2) def test_short_supplied_mac(self, mock_rnd): mac_base = '12:34:56:78' mac = mac_base.split(':') generator = itertools.islice(net.random_mac_generator(mac), 1) self.assertEqual(['12:34:56:78:a2:a2'], list(generator)) mock_rnd.assert_called_with(8) class TestPortDeviceOwner(base.BaseTestCase): def test_is_port_trusted(self): self.assertTrue(net.is_port_trusted( {'device_owner': constants.DEVICE_OWNER_NETWORK_PREFIX + 'dev'})) def test_is_port_not_trusted(self): self.assertFalse(net.is_port_trusted( {'device_owner': constants.DEVICE_OWNER_COMPUTE_PREFIX + 'dev'})) neutron-lib-2.3.0/neutron_lib/tests/unit/utils/test_host.py0000664000175000017500000000230313641427107024166 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import multiprocessing from unittest import mock from neutron_lib.tests import _base as base from neutron_lib.utils import host class TestCpuCount(base.BaseTestCase): @mock.patch.object(multiprocessing, 'cpu_count', return_value=7) def test_cpu_count(self, mock_cpu_count): self.assertEqual(7, host.cpu_count()) mock_cpu_count.assert_called_once_with() @mock.patch.object(multiprocessing, 'cpu_count', side_effect=NotImplementedError()) def test_cpu_count_not_implemented(self, mock_cpu_count): self.assertEqual(1, host.cpu_count()) mock_cpu_count.assert_called_once_with() neutron-lib-2.3.0/neutron_lib/tests/unit/utils/__init__.py0000664000175000017500000000000013641427107023701 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/db/0000775000175000017500000000000013641427200021021 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/db/test_model_query.py0000664000175000017500000000536313641427107024774 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from unittest import mock from neutron_lib.db import model_query from neutron_lib import fixture from neutron_lib.tests import _base from neutron_lib.utils import helpers # TODO(boden): find a way to test other model_query functions class TestHooks(_base.BaseTestCase): def setUp(self): super(TestHooks, self).setUp() self.useFixture(fixture.DBQueryHooksFixture()) def _mock_hook(self, x): return x def test_register_hook(self): mock_model = mock.Mock() model_query.register_hook( mock_model, 'hook1', self._mock_hook, self._mock_hook, result_filters=self._mock_hook) self.assertEqual(1, len(model_query._model_query_hooks.keys())) hook_ref = helpers.make_weak_ref(self._mock_hook) registered_hooks = model_query.get_hooks(mock_model) self.assertEqual(1, len(registered_hooks)) for d in registered_hooks: for k in d.keys(): self.assertEqual(hook_ref, d.get(k)) def test_register_hook_non_callables(self): mock_model = mock.Mock() model_query.register_hook( mock_model, 'hook1', self._mock_hook, {}, result_filters={}) self.assertEqual(1, len(model_query._model_query_hooks.keys())) hook_ref = helpers.make_weak_ref(self._mock_hook) registered_hooks = model_query.get_hooks(mock_model) self.assertEqual(1, len(registered_hooks)) for d in registered_hooks: for k in d.keys(): if k == 'query': self.assertEqual(hook_ref, d.get(k)) else: self.assertEqual({}, d.get(k)) def test_get_values(self): mock_model = mock.Mock() mock_context = mock.Mock() with mock.patch.object( model_query, 'query_with_hooks') as query_with_hooks: query_with_hooks.return_value = [['value1'], ['value2']] values = model_query.get_values(mock_context, mock_model, 'fake_field') self.assertEqual(['value1', 'value2'], values) query_with_hooks.assert_called_with( mock_context, mock_model, field='fake_field') neutron-lib-2.3.0/neutron_lib/tests/unit/db/test_resource_extend.py0000664000175000017500000000364213641427107025643 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from oslotest import base from neutron_lib.db import resource_extend from neutron_lib import fixture @resource_extend.has_resource_extenders class _DBExtender(object): @resource_extend.extends('ExtendedA') def _extend_a(self, resp, db_obj): pass @resource_extend.extends('ExtendedB') def _extend_b(self, resp, db_obj): pass class TestResourceExtendClass(base.BaseTestCase): def test_extends(self): self.assertIsNotNone(resource_extend.get_funcs('ExtendedA')) self.assertIsNotNone(resource_extend.get_funcs('ExtendedB')) class TestResourceExtend(base.BaseTestCase): def setUp(self): super(TestResourceExtend, self).setUp() self.useFixture(fixture.DBResourceExtendFixture()) def test_register_funcs(self): resources = ['A', 'B', 'C'] for r in resources: resource_extend.register_funcs(r, (lambda x: x,)) for r in resources: self.assertIsNotNone(resource_extend.get_funcs(r)) def test_apply_funcs(self): resources = ['A', 'B', 'C'] callbacks = [] def _cb(resp, db_obj): callbacks.append(resp) for r in resources: resource_extend.register_funcs(r, (_cb,)) for r in resources: resource_extend.apply_funcs(r, None, None) self.assertEqual(3, len(callbacks)) neutron-lib-2.3.0/neutron_lib/tests/unit/db/test_utils.py0000664000175000017500000000645213641427107023607 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from unittest import mock from oslo_db.sqlalchemy import models import sqlalchemy as sa from sqlalchemy.ext import declarative from sqlalchemy import orm from neutron_lib.api import attributes from neutron_lib.db import utils from neutron_lib import exceptions as n_exc from neutron_lib.tests import _base as base class FakePort(declarative.declarative_base(cls=models.ModelBase)): __tablename__ = 'fakeports' port_id = sa.Column(sa.String(36), primary_key=True) name = sa.Column(sa.String(64)) status = sa.Column(sa.String(16), nullable=False) class FakeRouter(declarative.declarative_base(cls=models.ModelBase)): __tablename__ = 'fakerouters' router_id = sa.Column(sa.String(36), primary_key=True) gw_port_id = sa.Column(sa.String(36), sa.ForeignKey(FakePort.port_id)) gw_port = orm.relationship(FakePort, lazy='joined') class TestUtils(base.BaseTestCase): def test_get_sort_dirs(self): sorts = [(1, True), (2, False), (3, True)] self.assertEqual(['asc', 'desc', 'asc'], utils.get_sort_dirs(sorts)) def test_get_sort_dirs_reversed(self): sorts = [(1, True), (2, False), (3, True)] self.assertEqual(['desc', 'asc', 'desc'], utils.get_sort_dirs(sorts, page_reverse=True)) def test_get_and_validate_sort_keys(self): sorts = [('name', False), ('status', True)] self.assertEqual(['name', 'status'], utils.get_and_validate_sort_keys(sorts, FakePort)) def test_get_and_validate_sort_keys_bad_key_fails(self): sorts = [('master', True)] self.assertRaises(n_exc.BadRequest, utils.get_and_validate_sort_keys, sorts, FakePort) def test_get_and_validate_sort_keys_by_relationship_fails(self): sorts = [('gw_port', True)] self.assertRaises(n_exc.BadRequest, utils.get_and_validate_sort_keys, sorts, FakeRouter) def test_get_marker_obj(self): plugin = mock.Mock() plugin._get_myr.return_value = 'obj' obj = utils.get_marker_obj(plugin, 'ctx', 'myr', 10, mock.ANY) self.assertEqual('obj', obj) plugin._get_myr.assert_called_once_with('ctx', mock.ANY) def test_get_marker_obj_no_limit_and_marker(self): self.assertIsNone(utils.get_marker_obj( mock.Mock(), 'ctx', 'myr', 0, mock.ANY)) self.assertIsNone(utils.get_marker_obj( mock.Mock(), 'ctx', 'myr', 10, None)) @mock.patch.object(attributes, 'populate_project_info') def test_resource_fields(self, mock_populate): r = { 'name': 'n', 'id': '1', 'desc': None } utils.resource_fields(r, ['name']) mock_populate.assert_called_once_with({'name': 'n'}) neutron-lib-2.3.0/neutron_lib/tests/unit/db/test_sqlalchemytypes.py0000664000175000017500000002230613641427107025672 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import abc import netaddr from oslo_db import exception from oslo_db.sqlalchemy import enginefacade from oslo_db.sqlalchemy import test_fixtures from oslo_utils import timeutils from oslo_utils import uuidutils import sqlalchemy as sa from neutron_lib import context from neutron_lib.db import sqlalchemytypes from neutron_lib.tests import _base as test_base from neutron_lib.tests import tools from neutron_lib.utils import net class SqlAlchemyTypesBaseTestCase(test_fixtures.OpportunisticDBTestMixin, test_base.BaseTestCase, metaclass=abc.ABCMeta): def setUp(self): super(SqlAlchemyTypesBaseTestCase, self).setUp() self.engine = enginefacade.writer.get_engine() meta = sa.MetaData(bind=self.engine) self.test_table = self._get_test_table(meta) self.test_table.create() self.addCleanup(meta.drop_all) self.ctxt = context.get_admin_context() @abc.abstractmethod def _get_test_table(self, meta): """Returns a new sa.Table() object for this test case.""" def _add_row(self, **kargs): self.engine.execute(self.test_table.insert().values(**kargs)) def _get_all(self): rows_select = self.test_table.select() return self.engine.execute(rows_select).fetchall() def _update_row(self, **kargs): self.engine.execute(self.test_table.update().values(**kargs)) def _delete_rows(self): self.engine.execute(self.test_table.delete()) def _validate_crud(self, data_field_name, expected=None): objs = self._get_all() self.assertEqual(len(expected) if expected else 0, len(objs)) if expected: for obj in objs: name = obj['id'] self.assertEqual(expected[name], obj[data_field_name]) class IPAddressTestCase(SqlAlchemyTypesBaseTestCase): def _get_test_table(self, meta): return sa.Table( 'fakeipaddressmodels', meta, sa.Column('id', sa.String(36), primary_key=True, nullable=False), sa.Column('ip', sqlalchemytypes.IPAddress)) def _validate_ip_address(self, data_field_name, expected=None): objs = self._get_all() self.assertEqual(len(expected) if expected else 0, len(objs)) if expected: for obj in objs: name = obj['id'] self.assertEqual(expected[name], obj[data_field_name]) def _test_crud(self, ip_addresses): ip = netaddr.IPAddress(ip_addresses[0]) self._add_row(id='fake_id', ip=ip) self._validate_ip_address(data_field_name='ip', expected={'fake_id': ip}) ip2 = netaddr.IPAddress(ip_addresses[1]) self._update_row(ip=ip2) self._validate_ip_address(data_field_name='ip', expected={'fake_id': ip2}) self._delete_rows() self._validate_ip_address(data_field_name='ip', expected=None) def test_crud(self): ip_addresses = ["10.0.0.1", "10.0.0.2"] self._test_crud(ip_addresses) ip_addresses = ["2210::ffff:ffff:ffff:ffff", "2120::ffff:ffff:ffff:ffff"] self._test_crud(ip_addresses) def test_wrong_type(self): self.assertRaises(exception.DBError, self._add_row, id='fake_id', ip="") self.assertRaises(exception.DBError, self._add_row, id='fake_id', ip="10.0.0.5") def _test_multiple_create(self, entries): reference = {} for entry in entries: ip = netaddr.IPAddress(entry['ip']) name = entry['name'] self._add_row(id=name, ip=ip) reference[name] = ip self._validate_ip_address(data_field_name='ip', expected=reference) self._delete_rows() self._validate_ip_address(data_field_name='ip', expected=None) def test_multiple_create(self): ip_addresses = [ {'name': 'fake_id1', 'ip': "10.0.0.5"}, {'name': 'fake_id2', 'ip': "10.0.0.1"}, {'name': 'fake_id3', 'ip': "2210::ffff:ffff:ffff:ffff"}, {'name': 'fake_id4', 'ip': "2120::ffff:ffff:ffff:ffff"}] self._test_multiple_create(ip_addresses) class CIDRTestCase(SqlAlchemyTypesBaseTestCase): def _get_test_table(self, meta): return sa.Table( 'fakecidrmodels', meta, sa.Column('id', sa.String(36), primary_key=True, nullable=False), sa.Column('cidr', sqlalchemytypes.CIDR) ) def _get_one(self, value): row_select = self.test_table.select().\ where(self.test_table.c.cidr == value) return self.engine.execute(row_select).first() def _update_row(self, key, cidr): self.engine.execute( self.test_table.update().values(cidr=cidr). where(self.test_table.c.cidr == key)) def test_crud(self): cidrs = ["10.0.0.0/24", "10.123.250.9/32", "2001:db8::/42", "fe80::21e:67ff:fed0:56f0/64"] for cidr_str in cidrs: cidr = netaddr.IPNetwork(cidr_str) self._add_row(id=uuidutils.generate_uuid(), cidr=cidr) obj = self._get_one(cidr) self.assertEqual(cidr, obj['cidr']) random_cidr = netaddr.IPNetwork(tools.get_random_cidr()) self._update_row(cidr, random_cidr) obj = self._get_one(random_cidr) self.assertEqual(random_cidr, obj['cidr']) objs = self._get_all() self.assertEqual(len(cidrs), len(objs)) self._delete_rows() objs = self._get_all() self.assertEqual(0, len(objs)) def test_wrong_cidr(self): wrong_cidrs = ["10.500.5.0/24", "10.0.0.1/40", "10.0.0.10.0/24", "cidr", "", '2001:db8:5000::/64', '2001:db8::/130'] for cidr in wrong_cidrs: self.assertRaises(exception.DBError, self._add_row, id=uuidutils.generate_uuid(), cidr=cidr) class MACAddressTestCase(SqlAlchemyTypesBaseTestCase): def _get_test_table(self, meta): return sa.Table( 'fakemacaddressmodels', meta, sa.Column('id', sa.String(36), primary_key=True, nullable=False), sa.Column('mac', sqlalchemytypes.MACAddress) ) def _get_one(self, value): row_select = self.test_table.select().\ where(self.test_table.c.mac == value) return self.engine.execute(row_select).first() def _get_all(self): rows_select = self.test_table.select() return self.engine.execute(rows_select).fetchall() def _update_row(self, key, mac): self.engine.execute( self.test_table.update().values(mac=mac). where(self.test_table.c.mac == key)) def _delete_row(self): self.engine.execute( self.test_table.delete()) def test_crud(self): mac_addresses = ['FA:16:3E:00:00:01', 'FA:16:3E:00:00:02'] for mac in mac_addresses: mac = netaddr.EUI(mac) self._add_row(id=uuidutils.generate_uuid(), mac=mac) obj = self._get_one(mac) self.assertEqual(mac, obj['mac']) random_mac = netaddr.EUI(net.get_random_mac( ['fe', '16', '3e', '00', '00', '00'])) self._update_row(mac, random_mac) obj = self._get_one(random_mac) self.assertEqual(random_mac, obj['mac']) objs = self._get_all() self.assertEqual(len(mac_addresses), len(objs)) self._delete_rows() objs = self._get_all() self.assertEqual(0, len(objs)) def test_wrong_mac(self): wrong_macs = ["fake", "", -1, "FK:16:3E:00:00:02", "FA:16:3E:00:00:020"] for mac in wrong_macs: self.assertRaises(exception.DBError, self._add_row, id=uuidutils.generate_uuid(), mac=mac) class TruncatedDateTimeTestCase(SqlAlchemyTypesBaseTestCase): def _get_test_table(self, meta): return sa.Table( 'timetable', meta, sa.Column('id', sa.String(36), primary_key=True, nullable=False), sa.Column('thetime', sqlalchemytypes.TruncatedDateTime) ) def test_microseconds_truncated(self): tstamp = timeutils.utcnow() tstamp_low = tstamp.replace(microsecond=111111) tstamp_high = tstamp.replace(microsecond=999999) self._add_row(id=1, thetime=tstamp_low) self._add_row(id=2, thetime=tstamp_high) rows = self._get_all() self.assertEqual(2, len(rows)) self.assertEqual(rows[0].thetime, rows[1].thetime) neutron-lib-2.3.0/neutron_lib/tests/unit/db/_base.py0000664000175000017500000000160013641427107022447 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """ Base classes for unit tests needing DB backend. Only sqlite is supported in neutron-lib. """ from neutron_lib import fixture from neutron_lib.tests import _base as base class SqlTestCase(base.BaseTestCase): def setUp(self): super(SqlTestCase, self).setUp() self.useFixture(fixture.SqlFixture()) neutron-lib-2.3.0/neutron_lib/tests/unit/db/test_standard_attr.py0000664000175000017500000001024513641427107025274 0ustar zuulzuul00000000000000# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import gc from sqlalchemy.ext import declarative import testtools from neutron_lib.db import standard_attr from neutron_lib.tests import _base as base class StandardAttrTestCase(base.BaseTestCase): def setUp(self): super(StandardAttrTestCase, self).setUp() self.addCleanup(gc.collect) def _make_decl_base(self): # construct a new base so we don't interfere with the main # base used in the sql test fixtures return declarative.declarative_base( cls=standard_attr.model_base.NeutronBaseV2) def test_standard_attr_resource_model_map(self): rs_map = standard_attr.get_standard_attr_resource_model_map() base = self._make_decl_base() class MyModel(standard_attr.HasStandardAttributes, standard_attr.model_base.HasId, base): api_collections = ['my_resource', 'my_resource2'] api_sub_resources = ['my_subresource'] rs_map = standard_attr.get_standard_attr_resource_model_map() self.assertEqual(MyModel, rs_map['my_resource']) self.assertEqual(MyModel, rs_map['my_resource2']) self.assertEqual(MyModel, rs_map['my_subresource']) sub_rs_map = standard_attr.get_standard_attr_resource_model_map( include_resources=False, include_sub_resources=True) self.assertNotIn('my_resource', sub_rs_map) self.assertNotIn('my_resource2', sub_rs_map) self.assertEqual(MyModel, sub_rs_map['my_subresource']) nosub_rs_map = standard_attr.get_standard_attr_resource_model_map( include_resources=True, include_sub_resources=False) self.assertEqual(MyModel, nosub_rs_map['my_resource']) self.assertEqual(MyModel, nosub_rs_map['my_resource2']) self.assertNotIn('my_subresource', nosub_rs_map) class Dup(standard_attr.HasStandardAttributes, standard_attr.model_base.HasId, base): api_collections = ['my_resource'] with testtools.ExpectedException(RuntimeError): standard_attr.get_standard_attr_resource_model_map() def test_standard_attr_resource_parent_map(self): base = self._make_decl_base() class TagSupportModel(standard_attr.HasStandardAttributes, standard_attr.model_base.HasId, base): collection_resource_map = {'collection_name': 'member_name'} tag_support = True class TagUnsupportModel(standard_attr.HasStandardAttributes, standard_attr.model_base.HasId, base): collection_resource_map = {'collection_name2': 'member_name2'} tag_support = False class TagUnsupportModel2(standard_attr.HasStandardAttributes, standard_attr.model_base.HasId, base): collection_resource_map = {'collection_name3': 'member_name3'} parent_map = standard_attr.get_tag_resource_parent_map() self.assertEqual('member_name', parent_map['collection_name']) self.assertNotIn('collection_name2', parent_map) self.assertNotIn('collection_name3', parent_map) class DupTagSupportModel(standard_attr.HasStandardAttributes, standard_attr.model_base.HasId, base): collection_resource_map = {'collection_name': 'member_name'} tag_support = True with testtools.ExpectedException(RuntimeError): standard_attr.get_tag_resource_parent_map() neutron-lib-2.3.0/neutron_lib/tests/unit/db/__init__.py0000664000175000017500000000000013641427107023126 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/db/test_api.py0000664000175000017500000002101713641427107023212 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from unittest import mock from oslo_db import exception as db_exc import osprofiler import sqlalchemy from sqlalchemy.orm import exc import testtools from neutron_lib.db import api as db_api from neutron_lib import exceptions from neutron_lib import fixture from neutron_lib.tests import _base class TestExceptionToRetryContextManager(_base.BaseTestCase): def test_translates_single_exception(self): with testtools.ExpectedException(db_exc.RetryRequest): with db_api.exc_to_retry(ValueError): raise ValueError() def test_translates_multiple_exception_types(self): with testtools.ExpectedException(db_exc.RetryRequest): with db_api.exc_to_retry((ValueError, TypeError)): raise TypeError() def test_translates_DBerror_inner_exception(self): with testtools.ExpectedException(db_exc.RetryRequest): with db_api.exc_to_retry(ValueError): raise db_exc.DBError(ValueError()) def test_passes_other_exceptions(self): with testtools.ExpectedException(ValueError): with db_api.exc_to_retry(TypeError): raise ValueError() def test_inner_exception_preserved_in_retryrequest(self): try: exc = ValueError('test') with db_api.exc_to_retry(ValueError): raise exc except db_exc.RetryRequest as e: self.assertEqual(exc, e.inner_exc) def test_retries_on_multi_exception_containing_target(self): with testtools.ExpectedException(db_exc.RetryRequest): with db_api.exc_to_retry(ValueError): e = exceptions.MultipleExceptions([ValueError(), TypeError()]) raise e class TestDeadLockDecorator(_base.BaseTestCase): @db_api.retry_db_errors def _decorated_function(self, fail_count, exc_to_raise): self.fail_count = getattr(self, 'fail_count', fail_count + 1) - 1 if self.fail_count: raise exc_to_raise def test_regular_exception_excluded(self): with testtools.ExpectedException(ValueError): self._decorated_function(1, ValueError) def test_staledata_error_caught(self): e = exc.StaleDataError() self.assertIsNone(self._decorated_function(1, e)) def test_dbconnection_error_caught(self): e = db_exc.DBConnectionError() self.assertIsNone(self._decorated_function(1, e)) def test_multi_exception_contains_retry(self): e = exceptions.MultipleExceptions( [ValueError(), db_exc.RetryRequest(TypeError())]) self.assertIsNone(self._decorated_function(1, e)) def test_multi_exception_contains_deadlock(self): e = exceptions.MultipleExceptions([ValueError(), db_exc.DBDeadlock()]) self.assertIsNone(self._decorated_function(1, e)) def test_multi_nested_exception_contains_deadlock(self): i = exceptions.MultipleExceptions([ValueError(), db_exc.DBDeadlock()]) e = exceptions.MultipleExceptions([ValueError(), i]) self.assertIsNone(self._decorated_function(1, e)) def test_multi_exception_raised_on_exceed(self): # limit retries so this doesn't take 40 seconds retry_fixture = fixture.DBRetryErrorsFixture(max_retries=2) retry_fixture.setUp() e = exceptions.MultipleExceptions([ValueError(), db_exc.DBDeadlock()]) with testtools.ExpectedException(exceptions.MultipleExceptions): self._decorated_function(db_api.MAX_RETRIES + 1, e) retry_fixture.cleanUp() def test_mysql_savepoint_error(self): e = db_exc.DBError("(pymysql.err.InternalError) (1305, u'SAVEPOINT " "sa_savepoint_1 does not exist')") self.assertIsNone(self._decorated_function(1, e)) @db_api.retry_if_session_inactive('alt_context') def _alt_context_function(self, alt_context, *args, **kwargs): return self._decorated_function(*args, **kwargs) @db_api.retry_if_session_inactive() def _context_function(self, context, list_arg, dict_arg, fail_count, exc_to_raise): list_arg.append(1) dict_arg[max(dict_arg.keys()) + 1] = True self.fail_count = getattr(self, 'fail_count', fail_count + 1) - 1 if self.fail_count: raise exc_to_raise return list_arg, dict_arg def test_stacked_retries_dont_explode_retry_count(self): context = mock.Mock() context.session.is_active = False e = db_exc.DBConnectionError() mock.patch('time.sleep').start() with testtools.ExpectedException(db_exc.DBConnectionError): # after 20 failures, the inner retry should give up and # the exception should be tagged to prevent the outer retry self._alt_context_function(context, db_api.MAX_RETRIES + 1, e) def _test_retry_time_cost(self, exc_to_raise): worst_case = [0.5, 1, 2, 4, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10] class FakeTime(object): def __init__(self): self.counter = 0 def sleep(self, t): self.counter += t fake_timer = FakeTime() def fake_sleep(t): fake_timer.sleep(t) e = exc_to_raise() mock.patch('time.sleep', side_effect=fake_sleep).start() with testtools.ExpectedException(exc_to_raise): self._decorated_function(db_api.MAX_RETRIES + 1, e) if exc_to_raise == db_exc.DBDeadlock: self.assertEqual(True, (fake_timer.counter <= sum(worst_case))) else: self.assertGreaterEqual(sum(worst_case), fake_timer.counter) def test_all_deadlock_time_elapsed(self): self._test_retry_time_cost(db_exc.DBDeadlock) def test_not_deadlock_time_elapsed(self): self._test_retry_time_cost(db_exc.DBConnectionError) def test_retry_if_session_inactive_args_not_mutated_after_retries(self): context = mock.Mock() context.session.is_active = False list_arg = [1, 2, 3, 4] dict_arg = {1: 'a', 2: 'b'} l, d = self._context_function(context, list_arg, dict_arg, 5, db_exc.DBDeadlock()) # even though we had 5 failures the list and dict should only # be mutated once self.assertEqual(5, len(l)) self.assertEqual(3, len(d)) def test_retry_if_session_inactive_kwargs_not_mutated_after_retries(self): context = mock.Mock() context.session.is_active = False list_arg = [1, 2, 3, 4] dict_arg = {1: 'a', 2: 'b'} l, d = self._context_function(context, list_arg=list_arg, dict_arg=dict_arg, fail_count=5, exc_to_raise=db_exc.DBDeadlock()) # even though we had 5 failures the list and dict should only # be mutated once self.assertEqual(5, len(l)) self.assertEqual(3, len(d)) def test_retry_if_session_inactive_no_retry_in_active_session(self): context = mock.Mock() context.session.is_active = True with testtools.ExpectedException(db_exc.DBDeadlock): # retry decorator should have no effect in an active session self._context_function(context, [], {1: 2}, fail_count=1, exc_to_raise=db_exc.DBDeadlock()) class TestDBProfiler(_base.BaseTestCase): @mock.patch.object(osprofiler.opts, 'is_trace_enabled', return_value=True) @mock.patch.object(osprofiler.opts, 'is_db_trace_enabled', return_value=True) def test_set_hook(self, _mock_dbt, _mock_t): with mock.patch.object( osprofiler.sqlalchemy, 'add_tracing') as add_tracing: engine_mock = mock.Mock() db_api._set_hook(engine_mock) add_tracing.assert_called_once_with( sqlalchemy, mock.ANY, "neutron.db") neutron-lib-2.3.0/neutron_lib/tests/unit/db/test_model_base.py0000664000175000017500000000430413641427107024533 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import sqlalchemy as sa from neutron_lib import context from neutron_lib.db import model_base from neutron_lib.tests.unit.db import _base as db_base class TestTable(model_base.BASEV2, model_base.HasProject, model_base.HasId, model_base.HasStatusDescription): name = sa.Column(sa.String(8), primary_key=True) class TestModelBase(db_base.SqlTestCase): def setUp(self): super(TestModelBase, self).setUp() self.ctx = context.Context('user', 'project') self.session = self.ctx.session def test_model_base(self): foo = TestTable(name='meh') self.assertEqual('meh', foo.name) self.assertIn('meh', str(foo)) # test foo.__repr__ cols = [k for k, _v in foo] # test foo.__iter__ and foo.next self.assertIn('name', cols) def test_get_set_tenant_id_tenant(self): foo = TestTable(tenant_id='tenant') self.assertEqual('tenant', foo.get_tenant_id()) foo.set_tenant_id('project') self.assertEqual('project', foo.get_tenant_id()) def test_get_set_tenant_id_project(self): foo = TestTable(project_id='project') self.assertEqual('project', foo.get_tenant_id()) foo.set_tenant_id('tenant') self.assertEqual('tenant', foo.get_tenant_id()) def test_project_id_attribute(self): foo = TestTable(project_id='project') self.assertEqual('project', foo.project_id) self.assertEqual('project', foo.tenant_id) def test_tenant_id_attribute(self): foo = TestTable(tenant_id='tenant') self.assertEqual('tenant', foo.project_id) self.assertEqual('tenant', foo.tenant_id) neutron-lib-2.3.0/neutron_lib/tests/unit/clients/0000775000175000017500000000000013641427200022075 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/clients/__init__.py0000664000175000017500000000000013641427107024202 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/exceptions/0000775000175000017500000000000013641427200022615 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/exceptions/__init__.py0000664000175000017500000000000013641427107024722 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/tests/unit/exceptions/test_exceptions.py0000664000175000017500000002416413641427107026424 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """ test_exceptions ---------------------------------- Tests for `neutron_lib.exception` module. """ import functools from neutron_lib._i18n import _ import neutron_lib.exceptions as ne from neutron_lib.tests import _base as base def _raise(exc_class, **kwargs): raise exc_class(**kwargs) class TestExceptions(base.BaseTestCase): def _check_nexc(self, exc_class, expected_msg, **kwargs): raise_exc_class = functools.partial(_raise, exc_class) e = self.assertRaises(exc_class, raise_exc_class, **kwargs) self.assertEqual(expected_msg, str(e)) def test_base(self): self._check_nexc( ne.NeutronException, _('An unknown exception occurred.')) def test_not_found(self): self._check_nexc( ne.NotFound, _('An unknown exception occurred.')) def test_conflict(self): self._check_nexc( ne.Conflict, _('An unknown exception occurred.')) def test_bad_request(self): self._check_nexc( ne.BadRequest, _('Bad A request: B.'), resource='A', msg='B') def test_bad_request_misused(self): try: self._check_nexc( ne.BadRequest, _('Bad A request: B.'), resource='A', msg='B') except AttributeError: pass def test_not_authorized(self): self._check_nexc( ne.NotAuthorized, _("Not authorized.")) def test_service_unavailable(self): self._check_nexc( ne.ServiceUnavailable, _("The service is unavailable.")) def test_admin_required(self): self._check_nexc( ne.AdminRequired, _("User does not have admin privileges: hoser."), reason="hoser") def test_object_not_found(self): self._check_nexc( ne.ObjectNotFound, _("Object fallout tato not found."), id="fallout tato") def test_network_not_found(self): self._check_nexc( ne.NetworkNotFound, _("Network spam could not be found."), net_id="spam") def test_subnet_not_found(self): self._check_nexc( ne.SubnetNotFound, _("Subnet root could not be found."), subnet_id="root") def test_port_not_found(self): self._check_nexc( ne.PortNotFound, _("Port harbor could not be found."), port_id="harbor") def test_port_not_found_on_network(self): self._check_nexc( ne.PortNotFoundOnNetwork, _("Port serial could not be found on network USB."), port_id="serial", net_id="USB") def test_device_not_found_error(self): self._check_nexc( ne.DeviceNotFoundError, _("Device 'device' does not exist."), device_name="device") def test_in_use(self): self._check_nexc( ne.InUse, _("The resource is in use.")) def test_network_in_use(self): self._check_nexc( ne.NetworkInUse, _("Unable to complete operation on network foo. " "There are one or more ports still in use on the network."), net_id="foo") def test_subnet_in_use(self): self._check_nexc( ne.SubnetInUse, _("Unable to complete operation on subnet garbage: not full."), subnet_id="garbage", reason="not full") def test_subnet_in_use_no_reason(self): self._check_nexc( ne.SubnetInUse, _("Unable to complete operation on subnet garbage: " "One or more ports have an IP allocation from this subnet."), subnet_id="garbage") def test_subnet_pool_in_use(self): self._check_nexc( ne.SubnetPoolInUse, _("Unable to complete operation on subnet pool ymca. because."), subnet_pool_id="ymca", reason="because") def test_subnet_pool_in_use_no_reason(self): self._check_nexc( ne.SubnetPoolInUse, _("Unable to complete operation on subnet pool ymca. " "Two or more concurrent subnets allocated."), subnet_pool_id="ymca") def test_port_in_use(self): self._check_nexc( ne.PortInUse, _("Unable to complete operation on port a for network c. " "Port already has an attached device b."), port_id='a', device_id='b', net_id='c') def test_service_port_in_use(self): self._check_nexc( ne.ServicePortInUse, _("Port harbor cannot be deleted directly via the " "port API: docking."), port_id='harbor', reason='docking') def test_port_bound(self): self._check_nexc( ne.PortBound, _("Unable to complete operation on port bigmac, " "port is already bound, port type: ketchup, " "old_mac onions, new_mac salt."), port_id='bigmac', vif_type='ketchup', old_mac='onions', new_mac='salt') def test_mac_address_in_use(self): self._check_nexc( ne.MacAddressInUse, _("Unable to complete operation for network nutters. " "The mac address grill is in use."), net_id='nutters', mac='grill') def test_invalid_ip_for_network(self): self._check_nexc( ne.InvalidIpForNetwork, _("IP address shazam! is not a valid IP " "for any of the subnets on the specified network."), ip_address='shazam!') def test_invalid_ip_for_subnet(self): self._check_nexc( ne.InvalidIpForSubnet, _("IP address 300.400.500.600 is not a valid IP " "for the specified subnet."), ip_address='300.400.500.600') def test_ip_address_in_use(self): self._check_nexc( ne.IpAddressInUse, _("Unable to complete operation for network boredom. " "The IP address crazytown is in use."), net_id='boredom', ip_address='crazytown') def test_vlan_id_in_use(self): self._check_nexc( ne.VlanIdInUse, _("Unable to create the network. The VLAN virtual on physical " "network phys is in use."), vlan_id='virtual', physical_network='phys') def test_tunnel_id_in_use(self): self._check_nexc( ne.TunnelIdInUse, _("Unable to create the network. The tunnel ID sewer is in use."), tunnel_id='sewer') def test_resource_exhausted(self): self._check_nexc( ne.ResourceExhausted, _("The service is unavailable.")) def test_no_network_available(self): self._check_nexc( ne.NoNetworkAvailable, _("Unable to create the network. " "No tenant network is available for allocation.")) def test_subnet_mismatch_for_port(self): self._check_nexc( ne.SubnetMismatchForPort, _("Subnet on port porter does not match " "the requested subnet submit."), port_id='porter', subnet_id='submit') def test_invalid(self): try: raise ne.Invalid("hello world") except ne.Invalid as e: self.assertEqual(e.msg, "hello world") def test_invalid_input(self): self._check_nexc( ne.InvalidInput, _("Invalid input for operation: warp core breach."), error_message='warp core breach') def test_ip_address_generation_failure(self): self._check_nexc( ne.IpAddressGenerationFailure, _("No more IP addresses available on network nuke."), net_id='nuke') def test_preexisting_device_failure(self): self._check_nexc( ne.PreexistingDeviceFailure, _("Creation failed. hal9000 already exists."), dev_name='hal9000') def test_over_quota(self): self._check_nexc( ne.OverQuota, _("Quota exceeded for resources: tube socks."), overs='tube socks') def test_invalid_content_type(self): self._check_nexc( ne.InvalidContentType, _("Invalid content type porn."), content_type='porn') def test_external_ip_address_exhausted(self): self._check_nexc( ne.ExternalIpAddressExhausted, _("Unable to find any IP address on external network darpanet."), net_id='darpanet') def test_invalid_configuration_option(self): self._check_nexc( ne.InvalidConfigurationOption, _("An invalid value was provided for which muppet: big bird."), opt_name='which muppet', opt_value='big bird') def test_network_tunnel_range_error(self): self._check_nexc( ne.NetworkTunnelRangeError, _("Invalid network tunnel range: 'rats' - present."), tunnel_range='rats', error='present') def test_network_tunnel_range_error_tuple(self): self._check_nexc( ne.NetworkTunnelRangeError, _("Invalid network tunnel range: '3:4' - present."), tunnel_range=(3, 4), error='present') def test_policy_init_error(self): self._check_nexc( ne.PolicyInitError, _("Failed to initialize policy policy because reason."), policy='policy', reason='reason') def test_policy_check_error(self): self._check_nexc( ne.PolicyCheckError, _("Failed to check policy policy because reason."), policy='policy', reason='reason') neutron-lib-2.3.0/neutron_lib/tests/_base.py0000664000175000017500000002022413641427107021106 0ustar zuulzuul00000000000000# Copyright 2010-2011 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import logging as std_logging import os import os.path import random from unittest import mock import fixtures from oslo_config import cfg from oslo_db import options as db_options from oslo_utils import strutils import pbr.version import testtools from neutron_lib._i18n import _ from neutron_lib import constants from neutron_lib import exceptions from neutron_lib import fixture from neutron_lib.tests import _post_mortem_debug as post_mortem_debug CONF = cfg.CONF LOG_FORMAT = "%(asctime)s %(levelname)8s [%(name)s] %(message)s" ROOTDIR = os.path.dirname(__file__) ETCDIR = os.path.join(ROOTDIR, 'etc') def etcdir(*p): return os.path.join(ETCDIR, *p) def fake_use_fatal_exceptions(*args): return True def get_rand_name(max_length=None, prefix='test'): """Return a random string. The string will start with 'prefix' and will be exactly 'max_length'. If 'max_length' is None, then exactly 8 random characters, each hexadecimal, will be added. In case len(prefix) <= len(max_length), ValueError will be raised to indicate the problem. """ if max_length: length = max_length - len(prefix) if length <= 0: raise ValueError("'max_length' must be bigger than 'len(prefix)'.") suffix = ''.join(str(random.randint(0, 9)) for i in range(length)) else: suffix = hex(random.randint(0x10000000, 0x7fffffff))[2:] return prefix + suffix def get_rand_device_name(prefix='test'): return get_rand_name( max_length=constants.DEVICE_NAME_MAX_LEN, prefix=prefix) def bool_from_env(key, strict=False, default=False): value = os.environ.get(key) return strutils.bool_from_string(value, strict=strict, default=default) def get_test_timeout(default=0): return int(os.environ.get('OS_TEST_TIMEOUT', default)) def sanitize_log_path(path): # Sanitize the string so that its log path is shell friendly return path.replace(' ', '-').replace('(', '_').replace(')', '_') class AttributeDict(dict): """Provide attribute access (dict.key) to dictionary values.""" def __getattr__(self, name): """Allow attribute access for all keys in the dict.""" if name in self: return self[name] raise AttributeError(_("Unknown attribute '%s'.") % name) class BaseTestCase(testtools.TestCase): @staticmethod def config_parse(conf=None, args=None): """Create the default configurations.""" if args is None: args = [] args += ['--config-file', etcdir('neutron_lib.conf')] if conf is None: version_info = pbr.version.VersionInfo('neutron-lib') cfg.CONF(args=args, project='neutron_lib', version='%%(prog)s %s' % version_info.release_string()) else: conf(args) def setUp(self): super(BaseTestCase, self).setUp() self.useFixture(fixture.PluginDirectoryFixture()) # Enabling 'use_fatal_exceptions' allows us to catch string # substitution format errors in exception messages. mock.patch.object(exceptions.NeutronException, 'use_fatal_exceptions', return_value=True).start() db_options.set_defaults(cfg.CONF, connection='sqlite://') self.useFixture(fixtures.MonkeyPatch( 'oslo_config.cfg.find_config_files', lambda project=None, prog=None, extension=None: [])) self.setup_config() # Configure this first to ensure pm debugging support for setUp() debugger = os.environ.get('OS_POST_MORTEM_DEBUGGER') if debugger: self.addOnException(post_mortem_debug.get_exception_handler( debugger)) # Make sure we see all relevant deprecation warnings when running tests self.useFixture(fixture.WarningsFixture()) if bool_from_env('OS_DEBUG'): _level = std_logging.DEBUG else: _level = std_logging.INFO capture_logs = bool_from_env('OS_LOG_CAPTURE') if not capture_logs: std_logging.basicConfig(format=LOG_FORMAT, level=_level) self.log_fixture = self.useFixture( fixtures.FakeLogger( format=LOG_FORMAT, level=_level, nuke_handlers=capture_logs, )) test_timeout = get_test_timeout() if test_timeout == -1: test_timeout = 0 if test_timeout > 0: self.useFixture(fixtures.Timeout(test_timeout, gentle=True)) # If someone does use tempfile directly, ensure that it's cleaned up self.useFixture(fixtures.NestedTempfile()) self.useFixture(fixtures.TempHomeDir()) self.addCleanup(mock.patch.stopall) if bool_from_env('OS_STDOUT_CAPTURE'): stdout = self.useFixture(fixtures.StringStream('stdout')).stream self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout)) if bool_from_env('OS_STDERR_CAPTURE'): stderr = self.useFixture(fixtures.StringStream('stderr')).stream self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr)) self.addOnException(self.check_for_systemexit) self.orig_pid = os.getpid() def get_new_temp_dir(self): """Create a new temporary directory. :returns fixtures.TempDir """ return self.useFixture(fixtures.TempDir()) def get_default_temp_dir(self): """Create a default temporary directory. Returns the same directory during the whole test case. :returns fixtures.TempDir """ if not hasattr(self, '_temp_dir'): self._temp_dir = self.get_new_temp_dir() return self._temp_dir def check_for_systemexit(self, exc_info): if isinstance(exc_info[1], SystemExit): if os.getpid() != self.orig_pid: # Subprocess - let it just exit raise # This makes sys.exit(0) still a failure self.force_failure = True def assertOrderedEqual(self, expected, actual): expect_val = self.sort_dict_lists(expected) actual_val = self.sort_dict_lists(actual) self.assertEqual(expect_val, actual_val) def sort_dict_lists(self, dic): for key, value in dic.items(): if isinstance(value, list): dic[key] = sorted(value) elif isinstance(value, dict): dic[key] = self.sort_dict_lists(value) return dic def assertDictSupersetOf(self, expected_subset, actual_superset): """Checks that actual dict contains the expected dict. After checking that the arguments are of the right type, this checks that each item in expected_subset is in, and matches, what is in actual_superset. Separate tests are done, so that detailed info can be reported upon failure. """ if not isinstance(expected_subset, dict): self.fail("expected_subset (%s) is not an instance of dict" % type(expected_subset)) if not isinstance(actual_superset, dict): self.fail("actual_superset (%s) is not an instance of dict" % type(actual_superset)) for k, v in expected_subset.items(): self.assertIn(k, actual_superset) self.assertEqual(v, actual_superset[k], "Key %(key)s expected: %(exp)r, actual %(act)r" % {'key': k, 'exp': v, 'act': actual_superset[k]}) def setup_config(self, args=None): """Tests that need a non-default config can override this method.""" self.config_parse(args=args) neutron-lib-2.3.0/neutron_lib/tests/__init__.py0000664000175000017500000000000013641427107021562 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/locale/0000775000175000017500000000000013641427200017552 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/locale/zh_CN/0000775000175000017500000000000013641427200020553 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/locale/zh_CN/LC_MESSAGES/0000775000175000017500000000000013641427200022340 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/locale/zh_CN/LC_MESSAGES/neutron_lib.po0000664000175000017500000012440213641427107025231 0ustar zuulzuul00000000000000# Lucas Palm , 2015. #zanata # OpenStack Infra , 2015. #zanata # Andreas Jaeger , 2016. #zanata # Lucas Palm , 2016. #zanata # Frank Wang , 2018. #zanata msgid "" msgstr "" "Project-Id-Version: neutron-lib VERSION\n" "Report-Msgid-Bugs-To: https://bugs.launchpad.net/openstack-i18n/\n" "POT-Creation-Date: 2018-02-19 22:57+0000\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "PO-Revision-Date: 2018-01-19 11:13+0000\n" "Last-Translator: Frank Wang \n" "Language-Team: Chinese (China)\n" "Language: zh_CN\n" "X-Generator: Zanata 4.3.3\n" "Plural-Forms: nplurals=1; plural=0\n" #, python-format msgid "%(child)s does not define a foreign key for %(parent)s" msgstr "%(child)s 没有为 %(parent)s定义外键" #, python-format msgid "%(data)s is not in %(valid_values)s" msgstr "“%(data)s”不在 %(valid_values)s 中" #, python-format msgid "%(driver)s: Internal driver error." msgstr "%(driver)s:内部驱动错误。" #, python-format msgid "%(id)s is not a valid %(type)s identifier" msgstr "%(id)s 是无效 %(type)s 标识" #, python-format msgid "%(param)s are not allowed when protocol is set to ICMP." msgstr "协议设为ICMP时%(param)s不被允许。" #, python-format msgid "%s is not a valid VLAN tag" msgstr "%s 是无效 VLAN 标记" #, python-format msgid "%s is not in a CIDR format" msgstr "%s不是CIDR格式" #, python-format msgid "" "'%(data)s' contains %(length)s characters. Adding a domain name will cause " "it to exceed the maximum length of a FQDN of '%(max_len)s'" msgstr "" "“%(data)s”包含%(length)s个字符。添加域名将导致它超出 FQDN 的最大长" "度“%(max_len)s”" #, python-format msgid "" "'%(data)s' contains %(length)s characters. Adding a sub-domain will cause it " "to exceed the maximum length of a FQDN of '%(max_len)s'" msgstr "" "“%(data)s”包含%(length)s个字符。添加子域将导致它超出 FQDN 的最大长" "度“%(max_len)s”" #, python-format msgid "'%(data)s' exceeds maximum length of %(max_len)s" msgstr "“%(data)s”超过最大长度 %(max_len)s" #, python-format msgid "'%(data)s' is neither a valid IP address, nor is it a valid IP subnet" msgstr "“%(data)s”不是一个合法的IP地址,也不是一个合法的IP子网" #, python-format msgid "'%(data)s' is not an accepted IP address, '%(ip)s' is recommended" msgstr "“%(data)s”并非已接受 IP 地址。建议使用“%(ip)s”" #, python-format msgid "'%(data)s' is too large - must be no larger than '%(limit)d'" msgstr "'%(data)s' 太大 - 必须不能大于 '%(limit)d'" #, python-format msgid "'%(data)s' is too small - must be at least '%(limit)d'" msgstr "'%(data)s' 太小 - 必须至少 '%(limit)d'" #, python-format msgid "'%(data)s' isn't a recognized IP subnet cidr, '%(cidr)s' is recommended" msgstr "'%(data)s' 不是一个可识别的IP子网CIDR, 建议'%(cidr)s' " #, python-format msgid "'%(data)s' not a valid PQDN or FQDN. Reason: %(reason)s" msgstr "“%(data)s”是无效 PQDN 或 FQDN。原因:%(reason)s" #, python-format msgid "'%(host)s' is not a valid nameserver. %(msg)s" msgstr "'%(host)s' 不是合法的nameserver %(msg)s" #, python-format msgid "'%(trimmed)s' exceeds the %(maxlen)s character FQDN limit" msgstr "“%(trimmed)s”超过了 %(maxlen)s字符这一 FQDN 限制" #, python-format msgid "'%s' Blank strings are not permitted" msgstr "'%s' 不允许空白字符串" #, python-format msgid "'%s' cannot be converted to boolean" msgstr "无法将“%s”转换为布尔值" #, python-format msgid "'%s' contains whitespace" msgstr "'%s' 包含空格" #, python-format msgid "'%s' is a FQDN. It should be a relative domain name" msgstr "“%s”为 FQDN。它应该是相对域名" #, python-format msgid "'%s' is an invalid attribute for sort key" msgstr "%s 对于 sort_keys 是无效属性" #, python-format msgid "'%s' is not a FQDN" msgstr "“%s”并非 FQDN" #, python-format msgid "'%s' is not a dictionary" msgstr "“%s”不是字典" #, python-format msgid "'%s' is not a list" msgstr "“%s”不是列表" #, python-format msgid "'%s' is not a valid IP address" msgstr "“%s”是无效 IP 地址" #, python-format msgid "'%s' is not a valid IP subnet" msgstr "“%s”是无效 IP 子网" #, python-format msgid "'%s' is not a valid MAC address" msgstr "“%s”是无效 MAC 地址" #, python-format msgid "'%s' is not a valid UUID" msgstr "“%s”是无效 UUID" #, python-format msgid "'%s' is not a valid boolean value" msgstr "'%s' 不是一个有效的布尔值" #, python-format msgid "'%s' is not a valid input" msgstr "“%s”不是有效的输入" #, python-format msgid "'%s' is not a valid string" msgstr "“%s”是无效字符串" #, python-format msgid "'%s' is not an integer" msgstr "“%s”不是整数" #, python-format msgid "'%s' is not an integer:boolean" msgstr "“%s”不是一个整数:布尔" #, python-format msgid "'%s' is not of the form =[value]" msgstr "“%s”没有采用格式 =[value]" #, python-format msgid "'%s' must be a non negative decimal" msgstr "“%s”必须为非负十进制数" #, python-format msgid "'%s' should be non-negative" msgstr "“%s”应该为非负" #, python-format msgid "" "'data' of type '%(typedata)s' and 'valid_values'of type '%(typevalues)s' are " "not compatible for comparison" msgstr "" "“%(typedata)s”的“data”类型和“%(typevalues)s”的“valid_values”的类型是不兼容的" "比较" msgid "'project_id' and 'tenant_id' do not match" msgstr "“project_id”与“tenant_id”不匹配" msgid "'valid_values' does not support membership operations" msgstr "“valid_values”不支持会员操作" msgid "A valid port UUID must be specified" msgstr "必须指定一个有效的端口UUID" #, python-format msgid "" "Action %(action)s is not supported. Only action values %(values)s are " "supported." msgstr "行为%(action)s不被支持。仅行为数值%(values)s被支持。" #, python-format msgid "Address scope %(address_scope_id)s could not be found." msgstr "找不到地址范围 %(address_scope_id)s。" #, python-format msgid "Agent %(id)s could not be found." msgstr "找不到 Agent %(id)s" #, python-format msgid "" "Agent with agent_type=%(agent_type)s and host=%(host)s could not be found." msgstr "找不到符合以下条件的代理:agent_type=%(agent_type)s 且 host=%(host)s。" #, python-format msgid "Aggregate not found for resource provider %(resource_provider)s." msgstr "资源提供者 %(resource_provider)s没有发现聚合。" msgid "Allowed address pairs must be a list." msgstr "允许的地址对必须是列表。" msgid "AllowedAddressPair must contain ip_address" msgstr "AllowedAddressPair 必须包含 ip_address" #, python-format msgid "An invalid value was provided for %(opt_name)s: %(opt_value)s." msgstr "对于 %(opt_name)s,已提供的值无效:%(opt_value)s。" msgid "An invalid value was provided for which muppet: big bird." msgstr "对于 muppet,已提供的值无效:big brid。" msgid "An unknown exception occurred." msgstr "发生未知异常。" #, python-format msgid "" "Attribute '%(attr)s' references another resource and cannot be used to sort " "'%(resource)s' resources" msgstr "属性“%(attr)s”是对其他资源的引用,无法由排序“%(resource)s”使用" #, python-format msgid "Attribute '%s' not allowed in POST" msgstr "属性“%s”不允许进行POST操作" #, python-format msgid "AvailabilityZone %(availability_zone)s could not be found." msgstr "找不到 AvailabilityZone %(availability_zone)s。" msgid "Backend does not support VLAN Transparency." msgstr "后端不支持 VLAN 透明。" #, python-format msgid "Bad %(resource)s request: %(msg)s." msgstr "%(resource)s 请求不正确:%(msg)s。" msgid "Bad A request: B." msgstr "错误请求" #, python-format msgid "" "Cannot associate floating IP %(floating_ip_address)s (%(fip_id)s) with port " "%(port_id)s using fixed IP %(fixed_ip)s, as that fixed IP already has a " "floating IP on external network %(net_id)s." msgstr "" "无法使浮动 IP %(floating_ip_address)s (%(fip_id)s) 与使用固定 IP " "%(fixed_ip)s 的端口 %(port_id)s 关联,因为该固定 IP 已具有外部网络 " "%(net_id)s 上的浮动 IP。" msgid "Class not found." msgstr "找不到类。" #, python-format msgid "Creation failed. %(dev_name)s already exists." msgstr "创建失败。%(dev_name)s 已存在。" msgid "Creation failed. hal9000 already exists." msgstr "创建失败。hal9000已存在。" msgid "" "Default firewall group already exists. 'default' is the reserved name for " "firewall group." msgstr "默认防火墙组已经存在。“default”已经被防火墙组预留。" msgid "Deleting default firewall group not allowed." msgstr "正在删除的缺省安全组内容不被允许。" #, python-format msgid "Device '%(device_name)s' does not exist." msgstr "设备“%(device_name)s”不存在。" msgid "Device 'device' does not exist." msgstr "设备“device”不存在。" #, python-format msgid "" "Distributed Virtual Router Mac Address for host %(host)s does not exist." msgstr "主机 %(host)s 的分布式虚拟路由器 MAC 地址不存在。" #, python-format msgid "Domain %(dns_domain)s not found in the external DNS service" msgstr "在外部 DNS 服务中找不到域 %(dns_domain)s" #, python-format msgid "Duplicate IP address '%s'" msgstr "IP 地址“%s”重复" msgid "Duplicate Metering Rule in POST." msgstr "POST 中的测量规则重复。" #, python-format msgid "Duplicate hostroute '%s'" msgstr "主机路由“%s”重复" #, python-format msgid "Duplicate items in the list: '%s'" msgstr "列表“%s”中的项重复" #, python-format msgid "Duplicate nameserver '%s'" msgstr "名称服务器“%s”重复" msgid "Duplicate segment entry in request." msgstr "请求中的分段条目重复。" msgid "Empty physical network name." msgstr "空的物理网络名。" msgid "Encountered an empty component" msgstr "遇到空组件" msgid "End of VLAN range is less than start of VLAN range" msgstr "VLAN 范围结束值比开始值小" msgid "End of tunnel range is less than start of tunnel range" msgstr "隧道范围的结束小于隧道范围的起始" #, python-format msgid "Error %(reason)s while attempting the operation." msgstr "尝试执行该操作时发生错误 %(reason)s。" #, python-format msgid "Extension module API definition does not define '%s'" msgstr "扩展模块API中没有定义“%s”" msgid "Extension module API definition not set." msgstr "扩展模块API定义未设置" #, python-format msgid "External DNS driver %(driver)s could not be found." msgstr "找不到外部 DNS 驱动程序 %(driver)s。" #, python-format msgid "" "External network %(external_network_id)s is not reachable from subnet " "%(subnet_id)s. Therefore, cannot associate Port %(port_id)s with a Floating " "IP." msgstr "" "无法从子网 %(subnet_id)s 访问外部网络 %(external_network_id)s。因此,无法使端" "口 %(port_id)s 与浮动 IP 关联。" #, python-format msgid "" "External network %(net_id)s cannot be updated to be made non-external, since " "it has existing gateway ports." msgstr "无法将外部网络 %(net_id)s 更新为非外部网络,因为它包含现有的网关端口。" #, python-format msgid "" "Failed to allocate a VRID in the network %(network_id)s for the router " "%(router_id)s after %(max_tries)s tries." msgstr "" "在 %(max_tries)s 次尝试之后,未能在网络 %(network_id)s 中为路由器 " "%(router_id)s 分配 VRID。" #, python-format msgid "Failed to check policy %(policy)s because %(reason)s." msgstr "无法检查策略 %(policy)s,因为 %(reason)s。" msgid "Failed to check policy policy because reason." msgstr "无法检查策略 policy,因为reason。" #, python-format msgid "" "Failed to create a duplicate %(object_type)s: for attribute(s) " "%(attributes)s with value(s) %(values)s" msgstr "" "对于具有值 %(values)s 的属性 %(attributes)s,未能创建重复的 %(object_type)s" #, python-format msgid "Failed to initialize policy %(policy)s because %(reason)s." msgstr "无法初始化策略 %(policy)s,因为 %(reason)s。" msgid "Failed to initialize policy policy because reason." msgstr "无法初始化策略 policy,因为reason。" #, python-format msgid "Failed to parse request. Required attribute '%s' not specified" msgstr "未能解析请求。未指定必需属性“%s”" #, python-format msgid "Firewall %(firewall_id)s could not be found." msgstr "防火墙%(firewall_id)s没有找到。" #, python-format msgid "Firewall %(firewall_id)s is still active." msgstr "防火墙%(firewall_id)s仍处于active状态。" #, python-format msgid "Firewall group %(firewall_id)s could not be found." msgstr "没有发现防火墙组%(firewall_id)s。" #, python-format msgid "Firewall group %(firewall_id)s is still active." msgstr "防火墙组%(firewall_id)s仍处于active状态。" #, python-format msgid "Firewall policy %(firewall_policy_id)s could not be found." msgstr "没有发现防火墙策略%(firewall_policy_id)s。" #, python-format msgid "Firewall policy %(firewall_policy_id)s is being used." msgstr "防火墙%(firewall_policy_id)s正在使用" #, python-format msgid "Firewall rule %(firewall_rule_id)s could not be found." msgstr "没有发现防火墙规则%(firewall_rule_id)s。" #, python-format msgid "Firewall rule %(firewall_rule_id)s is being used." msgstr "防火墙规则%(firewall_rule_id)s正在使用。" #, python-format msgid "" "Firewall rule %(firewall_rule_id)s is not associated with firewall policy " "%(firewall_policy_id)s." msgstr "" "防火墙规则%(firewall_rule_id)s没有关联防火墙策略%(firewall_policy_id)s。" #, python-format msgid "" "Firewall rule action %(action)s is not supported. Only action values " "%(values)s are supported." msgstr "防火墙规则行为%(action)s不被支持。仅行为数值%(values)s被支持。" #, python-format msgid "" "Firewall rule protocol %(protocol)s is not supported. Only protocol values " "%(values)s and their integer representation (0 to 255) are supported." msgstr "" "防火墙规则协议%(protocol)s不被支持。仅支持协议数值%(values)s的整数类型范围" "(0-255)。" msgid "First port in a port range must be lower than the second port" msgstr "端口范围的第一个端口必须小于第二个端口" #, python-format msgid "Flavor %(flavor_id)s could not be found." msgstr "找不到 flavor %(flavor_id)s。" #, python-format msgid "Flavor %(flavor_id)s is used by some service instance." msgstr "类型 %(flavor_id)s 已被某个服务实例使用。" msgid "Flavor is not enabled." msgstr "类型未启用。" #, python-format msgid "Floating IP %(floatingip_id)s could not be found" msgstr "找不到浮动 IP %(floatingip_id)s" #, python-format msgid "For class %(object_type)s missing primary keys: %(missing_keys)s" msgstr "对于类 %(object_type)s,缺少主键:%(missing_keys)s" #, python-format msgid "" "Gateway cannot be updated for router %(router_id)s, since a gateway to " "external network %(net_id)s is required by one or more floating IPs." msgstr "" "无法为路由器 %(router_id)s 更新网关,因为一个或多个浮动 IP 需要指向外部网络 " "%(net_id)s 的网关。" #, python-format msgid "" "IP address %(ip_address)s is not a valid IP for any of the subnets on the " "specified network." msgstr "对于所指定网络上的任何子网,IP 地址 %(ip_address)s 不是有效 IP。" #, python-format msgid "IP address %(ip_address)s is not a valid IP for the specified subnet." msgstr "对于所指定子网,IP 地址 %(ip_address)s 是无效 IP。" msgid "IP address 300.400.500.600 is not a valid IP for the specified subnet." msgstr "对于所指定子网,IP 地址300.400.500.600 是无效 IP。" msgid "" "IP address shazam! is not a valid IP for any of the subnets on the specified " "network." msgstr "对于所指定网络上的任何子网,IP 地址shazam是无效 IP。" #, python-format msgid "" "IP protocol '%s' is not supported. Only protocol names and their integer " "representation (0 to 255) are supported" msgstr "不支持IP协议“%s”。仅支持协议名称及它们的整数类型表示(0-255)。" #, python-format msgid "Incorrect range limits specified: start = %(start)s, end = %(end)s" msgstr "指定了错误的限制范围:开始= %(start)s,结束= %(end)s" #, python-format msgid "Input value %s must be string type" msgstr "输入值%s必须为字符串" #, python-format msgid "Invalid UUID for subport: '%s'" msgstr "无效的子端口UUID:“%s”" #, python-format msgid "Invalid content type %(content_type)s." msgstr "无效的内容类型 %(content_type)s。" msgid "Invalid content type porn." msgstr "无效的内容类型 porn。" #, python-format msgid "Invalid data format for IP pool: '%s'" msgstr "IP 池的数据格式无效:“%s”" #, python-format msgid "Invalid data format for fixed IP: '%s'" msgstr "固定 IP 的数据格式无效:“%s”" #, python-format msgid "Invalid data format for hostroute: '%s'" msgstr "主机路由“%s”的数据格式无效" #, python-format msgid "Invalid data format for nameserver: '%s'" msgstr "名称服务器“%s”的数据格式无效" #, python-format msgid "Invalid data format for subport: '%s' is not a dict" msgstr "子端口无效的数据格式:“%s”不是一个字典" #, python-format msgid "Invalid data format for subports: '%s' is not a list" msgstr "子端口无效的数据格式:“%s”不是一个列表" #, python-format msgid "Invalid format for routes: %(routes)s, %(reason)s" msgstr "路由 %(routes)s 的格式无效,%(reason)s" msgid "Invalid input - IP addresses do not agree with IP Version." msgstr "无效输入-IP地址与IP版本不一致。" #, python-format msgid "Invalid input for %(attr)s. Reason: %(reason)s." msgstr "输入对于 %(attr)s 无效。原因:%(reason)s。" #, python-format msgid "Invalid input for operation: %(error_message)s." msgstr "针对操作的输入无效:%(error_message)s。" msgid "Invalid input for operation: warp core breach." msgstr "针对操作的输入无效:warp core breach。" #, python-format msgid "" "Invalid input. '%(target_dict)s' must be a dictionary with keys: " "%(expected_keys)s" msgstr "输入无效。“%(target_dict)s”必须是具有以下键的字典:%(expected_keys)s" #, python-format msgid "Invalid mapping: '%s'" msgstr "映射无效:“%s”" #, python-format msgid "Invalid network VLAN range: '%(vlan_range)s' - '%(error)s'." msgstr "无效网络 VLAN 范围:“%(vlan_range)s”-“%(error)s”。" #, python-format msgid "Invalid network tunnel range: '%(tunnel_range)s' - %(error)s." msgstr "网络隧道范围“%(tunnel_range)s”无效 - %(error)s。" msgid "Invalid network tunnel range: '3:4' - present." msgstr "网络隧道范围“3:4”无效。" msgid "Invalid network tunnel range: 'rats' - present." msgstr "网络隧道范围“rats”无效。" #, python-format msgid "Invalid port: %s" msgstr "无效端口:'%s'" #, python-format msgid "Invalid service type: %(service_type)s." msgstr "无效服务类型: %(service_type)s 。" #, python-format msgid "" "Invalid subport details '%s': missing segmentation information. Must specify " "both segmentation_id and segmentation_type" msgstr "" "无效的子端口信息“%s”:没有的段信息。必须指定segmentation_id和" "segmentation_type" #, python-format msgid "Invalid value for port %(port)s." msgstr "端口%(port)s数值无效。" #, python-format msgid "Key %(key)s in mapping: '%(mapping)s' not unique" msgstr "映射“%(mapping)s”中的键 %(key)s 不唯一" #, python-format msgid "Metering label '%(label_id)s' does not exist." msgstr "测量标签规则 “%(label_id)s ” 不存在" #, python-format msgid "Metering label rule '%(rule_id)s' does not exist." msgstr "测量标签规则 “%(rule_id)s ” 不存在" #, python-format msgid "" "Metering label rule with remote_ip_prefix '%(remote_ip_prefix)s' overlaps " "another." msgstr "" "带有 remote_ip_prefix “%(remote_ip_prefix)s” 的测量标签规则与另一测量标签规则" "重叠" #, python-format msgid "Missing key in mapping: '%s'" msgstr "映射中缺少键:“%s”" msgid "Missing rule info argument for insert/remove rule operation." msgstr "插入/删除规则操作缺省规则信息参数。" #, python-format msgid "Missing value in mapping: '%s'" msgstr "映射中缺少值:“%s”" msgid "More than one external network exists." msgstr "存在多个外部网络。" #, python-format msgid "Multiple agents with agent_type=%(agent_type)s and host=%(host)s found." msgstr "" "找到多个符合以下条件的代理:agent_type=%(agent_type)s 且 host=%(host)s。" #, python-format msgid "Name %(dns_name)s is duplicated in the external DNS service" msgstr "名称 %(dns_name)s 在外部 DNS 服务中重复" #, python-format msgid "" "Name '%s' must be 1-63 characters long, each of which can only be " "alphanumeric or a hyphen" msgstr "" "名称“%s”的长度必须在 1 到 63 个字符之间,其中每个字符只能是字母数字或连字符" #, python-format msgid "Name '%s' must not start or end with a hyphen" msgstr "名称“%s”不能以连字符开头或结尾" msgid "Need exactly two values for VLAN range" msgstr "VLAN范围需要两个数值" #, python-format msgid "Network %(net_id)s could not be found." msgstr "找不到网络 %(net_id)s。" #, python-format msgid "Network for tenant %(tenant_id)s concurrently deleted." msgstr "租户 %(tenant_id)s网络被并发删除。" msgid "Network spam could not be found." msgstr "网络未找到。" #, python-format msgid "NeutronDbObject not found by model %(model)s." msgstr "NeutronDbObject 未通过模型 %(model)s发现。" msgid "No inventory of class" msgstr "无库存类" #, python-format msgid "No more IP addresses available on network %(net_id)s." msgstr "在网络 %(net_id)s 上,没有更多 IP 地址可用。" msgid "No more IP addresses available on network nuke." msgstr "在网络 nuke上,没有更多 IP 地址可用。" #, python-format msgid "" "No more Virtual Router Identifier (VRID) available when creating router " "%(router_id)s. The limit of number of HA Routers per tenant is 254." msgstr "" "当创建路由器 %(router_id)s 时,没有更多虚拟路由器标识 (VRID) 可用。每个租户" "的 HA 路由器数的限制为 254。" #, python-format msgid "No valid key specs matched for: %s" msgstr "“%s”没有匹配的有效使用者" #, python-format msgid "Non unique UUID for subport: '%s'" msgstr "不唯一的子端口UUID:“%s”" msgid "Not authorized." msgstr "未授权。" #, python-format msgid "Object %(id)s not found." msgstr "找不到对象 %(id)s。" msgid "Object fallout tato not found." msgstr "相关对象未找到。" msgid "One or more ports have an IP allocation from this subnet" msgstr "一个或多个端口具有从此子网进行的 IP 分配" #, python-format msgid "" "Operation cannot be performed as port %(port_id)s is in an invalid project " "%(project_id)s." msgstr "" "相关操作不能执行,因为端口 %(port_id)s在一个无效的租户 %(project_id)s中" #, python-format msgid "" "Operation cannot be performed since associated firewall %(firewall_id)s is " "in %(pending_state)s." msgstr "相关联防火墙%(firewall_id)s处于%(pending_state)s,因此操作不会执行。" #, python-format msgid "" "Operation cannot be performed since associated firewall group " "%(firewall_id)s is in %(pending_state)s." msgstr "相关联防火墙组%(firewall_id)s处于%(pending_state)s,因此操作不会执行。" #, python-format msgid "" "Operation cannot be performed since firewall policy %(firewall_policy_id)s " "could not find the firewall rule %(firewall_rule_id)s. Please confirm if the " "firewall rule exists and is shared." msgstr "" "相关操作不能执行,因为租户的防火墙策略 %(firewall_policy_id)s找不到防火墙规" "则 %(firewall_rule_id)s。请确认防火墙规则是否存在并且是共享的 。" #, python-format msgid "" "Operation cannot be performed since firewall policy %(firewall_policy_id)s " "for your project could not be found. Please confirm if the firewall policy " "exists and is shared." msgstr "" "相关操作不能执行,因为租户的防火墙策略 %(firewall_policy_id)s未找到。请确认防" "火墙策略是否存在并且是共享的 。" #, python-format msgid "" "Operation cannot be performed since firewall policy %(firewall_policy_id)s " "is not shared and does not belong to your project." msgstr "" "由于防火墙策略%(firewall_policy_id)s不共享,不属于您的租户,因此操作无法执" "行。" #, python-format msgid "" "Operation cannot be performed since firewall policy %(firewall_policy_id)s " "is shared but firewall rule %(firewall_rule_id)s is not shared." msgstr "" "防火墙策略%(firewall_policy_id)s共享,但防火墙规则%(firewall_rule_id)s不共" "享,因此操作无法执行。" #, python-format msgid "" "Operation cannot be performed since firewall rule %(firewall_rule_id)s is " "already associated with firewall policy %(firewall_policy_id)s." msgstr "" "由于防火墙规则%(firewall_rule_id)s已关联至防火墙策略%(firewall_policy_id)s," "因此操作无法执行。" #, python-format msgid "" "Operation cannot be performed since firewall rule %(firewall_rule_id)s is " "not shared and belongs to another project %(project_id)s." msgstr "" "操作无法执行,防火墙规则%(firewall_rule_id)s属于另一租户%(project_id)s不被共" "享。" #, python-format msgid "" "Operation cannot be performed. Before sharing firewall policy " "%(firewall_policy_id)s, share associated firewall rule %(firewall_rule_id)s." msgstr "" "操作无法执行。共享防火墙策略%(firewall_policy_id)s前首先共享关联的防火墙规" "则%(firewall_rule_id)s。" msgid "Placement API endpoint not found." msgstr "没有发现Placement API服务站点。" #, python-format msgid "" "Placement inventory not found for resource provider %(resource_provider)s, " "resource class %(resource_class)s." msgstr "" "Placement库存没有发现对应的资源提供者 %(resource_provider)s,资源类 " "%(resource_class)s。" #, python-format msgid "" "Placement inventory update conflict for resource provider " "%(resource_provider)s, resource class %(resource_class)s." msgstr "" "Placement库存对应的资源提供者 %(resource_provider)s更新冲突,资源类 " "%(resource_class)s。" #, python-format msgid "Placement resource provider not found %(resource_provider)s." msgstr "没有发现Placement资源提供者 %(resource_provider)s。" #, python-format msgid "" "Port %(port_id)s cannot be deleted directly via the port API: %(reason)s." msgstr "无法直接通过端口 API 删除端口 %(port_id)s:%(reason)s。" #, python-format msgid "Port %(port_id)s could not be found on network %(net_id)s." msgstr "在网络 %(net_id)s 上找不到端口 %(port_id)s。" #, python-format msgid "Port %(port_id)s could not be found." msgstr "端口 %(port_id)s 无法被发现。" #, python-format msgid "Port %(port_id)s of firewall group is invalid." msgstr "防火墙组的端口 %(port_id)s无效 。" msgid "" "Port Security must be enabled in order to have allowed address pairs on a " "port." msgstr "必须启用端口安全性,以便在端口上具有所允许的地址对。" msgid "Port harbor cannot be deleted directly via the port API: docking." msgstr "端口不能直接通过API删除。" msgid "Port harbor could not be found." msgstr "端口未找到。" msgid "" "Port has security group associated. Cannot disable port security or IP " "address until security group is removed." msgstr "端口已使安全组关联。直到除去安全组,才能禁用端口安全性或 IP 地址。" msgid "Port range must be two integers separated by a colon" msgstr "端口范围必须是用冒号分隔的两个整数。" msgid "" "Port security must be enabled and port must have an IP address in order to " "use security groups." msgstr "必须启用端口安全性,并且端口必须具有 IP 地址以使用安全组。" msgid "Port serial could not be found on network USB." msgstr "网络USB上找不到端口" #, python-format msgid "" "Port(s) %(port_ids)s provided already associated with other firewall " "group(s)." msgstr "提供的端口%(port_ids)s已关联至其他防火墙组。" #, python-format msgid "" "Protocol %(protocol)s is not supported. Only protocol values %(values)s and " "their integer representation (0 to 255) are supported." msgstr "" "协议%(protocol)s不被支持。仅支持协议数值%(values)s的整数类型范围(0-255)。" #, python-format msgid "Quota exceeded for resources: %(overs)s." msgstr "资源超过了配额:%(overs)s。" msgid "Quota exceeded for resources: tube socks." msgstr "资源超过了配额:tube socks。" #, python-format msgid "" "Request contains duplicate address pair: mac_address %(mac_address)s " "ip_address %(ip_address)s." msgstr "" "请求包含重复地址对:mac_address %(mac_address)s ip_address %(ip_address)s。" #, python-format msgid "Router %(router_id)s %(reason)s" msgstr "路由器 %(router_id)s %(reason)s" #, python-format msgid "Router %(router_id)s could not be found" msgstr "找不到路由器 %(router_id)s" #, python-format msgid "Router %(router_id)s does not have an interface with id %(port_id)s" msgstr "路由器 %(router_id)s 没有具有标识 %(port_id)s 的接口" #, python-format msgid "Router %(router_id)s has no interface on subnet %(subnet_id)s" msgstr "路由器 %(router_id)s 在子网 %(subnet_id)s 上没有任何接口" #, python-format msgid "" "Router interface for subnet %(subnet_id)s on router %(router_id)s cannot be " "deleted, as it is required by one or more floating IPs." msgstr "" "无法删除路由器 %(router_id)s 上用于子网 %(subnet_id)s 的路由器接口,因为一个" "或多个浮动 IP 需要该接口。" #, python-format msgid "" "Router interface for subnet %(subnet_id)s on router %(router_id)s cannot be " "deleted, as it is required by one or more routes." msgstr "" "无法删除路由器 %(router_id)s 上用于子网 %(subnet_id)s 的路由器接口,因为一个" "或多个路由需要该接口。" #, python-format msgid "" "Router(s) %(router_ids)s provided already associated with other firewall(s)." msgstr "路由%(router_ids)s已关联至其他防火墙。" msgid "Running without keystone AuthN requires that tenant_id is specified" msgstr "在没有 keystone AuthN 的情况下运行要求指定 tenant_id" #, python-format msgid "Segmentation ID '%(seg_id)s' for '%(subport)s' is not unique" msgstr "“%(subport)s” 的段ID “%(seg_id)s”不是唯一的" msgid "Segments and provider values cannot both be set." msgstr "无法同时设置段和提供程序值。" #, python-format msgid "Service Profile %(sp_id)s could not be found." msgstr "找不到服务概要文件 %(sp_id)s。" #, python-format msgid "Service Profile %(sp_id)s is already associated with flavor %(fl_id)s." msgstr "服务概要文件 %(sp_id)s 已与类型 %(fl_id)s 相关联。" #, python-format msgid "Service Profile %(sp_id)s is not associated with flavor %(fl_id)s." msgstr "服务概要文件 %(sp_id)s 未与类型 %(fl_id)s 相关联。" #, python-format msgid "Service Profile %(sp_id)s is used by some service instance." msgstr "服务概要文件 %(sp_id)s 已被某个服务实例使用。" #, python-format msgid "Service Profile driver %(driver)s could not be found." msgstr "找不到服务概要文件驱动程序 %(driver)s。" msgid "Service Profile is not enabled." msgstr "服务概要文件未启用。" msgid "Service Profile needs either a driver or metainfo." msgstr "服务概要文件需要驱动程序或元信息。" msgid "Source/destination port requires a protocol." msgstr "源/目的端口需要一个协议。" msgid "" "Specifying 'project_id' or 'tenant_id' other than the authenticated project " "in request requires admin privileges" msgstr "在请求中指定除了已认证租户之外的“project_id”或“tenant_id”需要管理特权" #, python-format msgid "Subnet %(subnet_id)s could not be found." msgstr "找不到子网 %(subnet_id)s。" #, python-format msgid "" "Subnet on port %(port_id)s does not match the requested subnet %(subnet_id)s." msgstr "端口 %(port_id)s 上的子网与所请求子网 %(subnet_id)s 不匹配。" msgid "Subnet on port porter does not match the requested subnet submit." msgstr "端口 porter上的子网与所请求子网 submit不匹配。" msgid "Subnet root could not be found." msgstr "根子网未找到。" #, python-format msgid "Synthetic field %(field)s shouldn't have more than one foreign key" msgstr "合成域 %(field)s 最多有一个外键" #, python-format msgid "" "Synthetic field(s) %(fields)s undefined, misspelled, or otherwise invalid" msgstr "合成域 %(fields)s 未定义,未定义或者无效" #, python-format msgid "TLD '%s' must not be all numeric" msgstr "TLD“%s”不能全部为数字" #, python-format msgid "" "The HA Network CIDR specified in the configuration file isn't valid; " "%(cidr)s." msgstr "配置文件中指定的 HA 网络 CIDR 无效;%(cidr)s。" #, python-format msgid "" "The dns_name passed is a FQDN. Its higher level labels must be equal to the " "dns_domain option in neutron.conf, that has been set to '%(dns_domain)s'. It " "must also include one or more valid DNS labels to the left of " "'%(dns_domain)s'" msgstr "" "所传递的 dns_name 为 FQDN。它的更高级别的标签必须与neutron.conf 中的 " "dns_domain 选项相同,该选项已设置为“%(dns_domain)s”。它还必须" "在“%(dns_domain)s”的左边包括一个或多个有效 DNS 标签" #, python-format msgid "" "The dns_name passed is a PQDN and its size is '%(dns_name_len)s'. The " "dns_domain option in neutron.conf is set to %(dns_domain)s, with a length of " "'%(higher_labels_len)s'. When the two are concatenated to form a FQDN (with " "a '.' at the end), the resulting length exceeds the maximum size of " "'%(fqdn_max_len)s'" msgstr "" "所传递的 dns_name 为 PQDN,其大小为“%(dns_name_len)s”。neutron.conf 中的 " "dns_domain 选项设置为 %(dns_domain)s,长度为“%(higher_labels_len)s”。当这两者" "合并以组成 FQDN 时(末尾为“.”),最终获得的长度超过了最大大" "小“%(fqdn_max_len)s”" #, python-format msgid "The number of allowed address pair exceeds the maximum %(quota)s." msgstr "允许的地址对数超过最大值 %(quota)s。" msgid "The resource is in use." msgstr "资源正在使用。" msgid "The service is unavailable." msgstr "服务不可用。" #, python-format msgid "The value '%(value)s' for %(element)s is not valid." msgstr "%(element)s 的值“%(value)s”无效。" msgid "" "Too long prefix provided. New name would exceed given length for an " "interface name." msgstr "提供的前缀太长。新名称将超出接口名称的给定长度。" msgid "Too many availability_zone_hints specified" msgstr "指定了过多 availability_zone_hints" msgid "Two or more concurrent subnets allocated" msgstr "两个或多个子网并发申请" #, python-format msgid "" "Unable to complete operation for %(router_id)s. The number of routes exceeds " "the maximum %(quota)s." msgstr "对于 %(router_id)s,无法完成操作。路由数超过最大值 %(quota)s。" #, python-format msgid "" "Unable to complete operation for network %(net_id)s. The IP address " "%(ip_address)s is in use." msgstr "对于网络 %(net_id)s,无法完成操作。IP 地址 %(ip_address)s 在使用中。" #, python-format msgid "" "Unable to complete operation for network %(net_id)s. The mac address %(mac)s " "is in use." msgstr "对于网络 %(net_id)s,无法完成操作。MAC 地址 %(mac)s 在使用中。" msgid "" "Unable to complete operation for network boredom. The IP address crazytown " "is in use." msgstr "对于网络 boredom,无法完成操作。IP 地址 crazytown 在使用中。" msgid "" "Unable to complete operation for network nutters. The mac address grill is " "in use." msgstr "对于网络 nutter,无法完成操作。MAC 地址grill 在使用中。" #, python-format msgid "" "Unable to complete operation on address scope %(address_scope_id)s. There " "are one or more subnet pools in use on the address scope." msgstr "" "无法对地址范围 %(address_scope_id)s 完成操作。在该地址范围内,正在使用一个或" "多个子网池。" #, python-format msgid "" "Unable to complete operation on network %(net_id)s. There are one or more " "ports still in use on the network." msgstr "" "无法在网络 %(net_id)s 上完成操作。在该网络上,一个或多个端口仍然在使用中。" msgid "" "Unable to complete operation on network foo. There are one or more ports " "still in use on the network." msgstr "无法在网络 foo上完成操作。在该网络上,一个或多个端口仍然在使用中。" #, python-format msgid "" "Unable to complete operation on port %(port_id)s for network %(net_id)s. " "Port already has an attached device %(device_id)s." msgstr "" "对于网络 %(net_id)s,无法在端口 %(port_id)s 上完成操作。端口已具有连接的设备 " "%(device_id)s。" #, python-format msgid "" "Unable to complete operation on port %(port_id)s, port is already bound, " "port type: %(vif_type)s, old_mac %(old_mac)s, new_mac %(new_mac)s." msgstr "" "无法在端口 %(port_id)s 上完成操作,端口已绑定,端口类型:%(vif_type)s," "old_mac %(old_mac)s,new_mac %(new_mac)s。" msgid "" "Unable to complete operation on port a for network c. Port already has an " "attached device b." msgstr "无法完成对在网络c上的端口a的操作:端口已经添加到设备b上。" msgid "" "Unable to complete operation on port bigmac, port is already bound, port " "type: ketchup, old_mac onions, new_mac salt." msgstr "" "无法完成对端口bigmac操作,端口已经绑定,端口类型:ketchup,旧mac:onions,新" "mac: salt。" #, python-format msgid "Unable to complete operation on subnet %(subnet_id)s: %(reason)s." msgstr "无法在子网 %(subnet_id)s上完成操作:%(reason)s。" msgid "" "Unable to complete operation on subnet garbage: One or more ports have an IP " "allocation from this subnet." msgstr "无法在子网garbage上完成操作:有多个端口从这个子网申请了IP地址" msgid "Unable to complete operation on subnet garbage: not full." msgstr "无法在子网garbage上完成操作。" #, python-format msgid "" "Unable to complete operation on subnet pool %(subnet_pool_id)s. %(reason)s." msgstr "无法在子网 %(subnet_pool_id)s上完成操作:%(reason)s。" msgid "" "Unable to complete operation on subnet pool ymca. Two or more concurrent " "subnets allocated." msgstr "无法在子网池ymca完成操作:有两个以上的子网被申请了。" msgid "Unable to complete operation on subnet pool ymca. because." msgstr "无法在子网池ymca完成操作。" msgid "" "Unable to create the network. No tenant network is available for allocation." msgstr "无法创建该网络。没有任何租户网络可用于分配。" #, python-format msgid "" "Unable to create the network. The VLAN %(vlan_id)s on physical network " "%(physical_network)s is in use." msgstr "" "无法创建该网络。物理网络 %(physical_network)s 上的 VLAN %(vlan_id)s 在使用" "中。" msgid "" "Unable to create the network. The VLAN virtual on physical network phys is " "in use." msgstr "无法创建该网络。物理网络 phys上的 VLAN virtual在使用中。" #, python-format msgid "Unable to create the network. The tunnel ID %(tunnel_id)s is in use." msgstr "无法创建该网络。隧道标识 %(tunnel_id)s 在使用中。" msgid "Unable to create the network. The tunnel ID sewer is in use." msgstr "无法创建该网络。隧道标识 sewer 在使用中。" #, python-format msgid "Unable to find any IP address on external network %(net_id)s." msgstr "在外部网络上找不到任何 IP 地址%(net_id)s." msgid "Unable to find any IP address on external network darpanet." msgstr "在外部网络darpanet上找不到任何 IP 地址。" #, python-format msgid "Unable to generate unique mac for host %(host)s." msgstr "无法为主机 %(host)s 生成唯一 MAC。" #, python-format msgid "Unable to generate unique mac on network %(net_id)s." msgstr "无法在网络 %(net_id)s 上生成唯一 MAC。" #, python-format msgid "Unable to update address scope %(address_scope_id)s : %(reason)s." msgstr "无法更新地址范围 %(address_scope_id)s:%(reason)s。" #, python-format msgid "Unable to update the following object fields: %(fields)s" msgstr "无法更新下列对象字段:%(fields)s" #, python-format msgid "Unexpected keys supplied: %s" msgstr "提供未预期keys:%s" #, python-format msgid "Unknown attribute '%s'." msgstr "属性“%s”未知。" #, python-format msgid "Unrecognized attribute(s) '%s'" msgstr "无法识别属性“%s”" msgid "Updating default firewall group not allowed." msgstr "正在更新的缺省防火墙内容不被允许。" #, python-format msgid "User does not have admin privileges: %(reason)s." msgstr "用户没有管理员特权:%(reason)s。" msgid "User does not have admin privileges: hoser." msgstr "用户没有管理员特权" #, python-format msgid "" "Validation of dictionary's keys failed. Expected keys: %(expected_keys)s " "Provided keys: %(provided_keys)s" msgstr "" "对字典的键进行的验证失败。期望的键是 %(expected_keys)s,提供的键是 " "%(provided_keys)s" #, python-format msgid "Validator '%s' does not exist" msgstr "验证器“%s”不存在" #, python-format msgid "Validator type %s is already defined" msgstr "验证器类型 %s已经定义" #, python-format msgid "Value %(value)s in mapping: '%(mapping)s' not unique" msgstr "映射“%(mapping)s”中的值 %(value)s 不唯一" #, python-format msgid "" "Value of %(parameter)s has to be multiple of %(number)s, with maximum value " "of %(maximum)s and minimum value of %(minimum)s" msgstr "" "%(parameter)s 的值必须是 %(number)s 的倍数,最大值为 %(maximum)s,最小值为 " "%(minimum)s" #, python-format msgid "" "max_l3_agents_per_router %(max_agents)s config parameter is not valid as it " "cannot be negative. It must be 1 or greater. Alternatively, it can be 0 to " "mean unlimited." msgstr "" "max_l3_agents_per_router %(max_agents)s 配置参数无效。因为它不能为负数。它必" "须大于等于1。另外,如果它为0意味着不限制。" neutron-lib-2.3.0/neutron_lib/context.py0000664000175000017500000001542113641427107020362 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """Context: context for security/db session.""" import collections import copy import datetime import warnings from oslo_context import context as oslo_context from oslo_db.sqlalchemy import enginefacade from neutron_lib.db import api as db_api from neutron_lib.policy import _engine as policy_engine class ContextBase(oslo_context.RequestContext): """Security context and request information. Represents the user taking a given action within the system. """ def __init__(self, user_id=None, tenant_id=None, is_admin=None, timestamp=None, tenant_name=None, user_name=None, is_advsvc=None, **kwargs): # NOTE(jamielennox): We maintain this argument in order for tests that # pass arguments positionally. kwargs.setdefault('project_id', tenant_id) # prefer project_name, as that's what's going to be set by # keystone. Fall back to tenant_name if for some reason it's blank. kwargs.setdefault('project_name', tenant_name) super(ContextBase, self).__init__( is_admin=is_admin, user_id=user_id, **kwargs) self.user_name = user_name if not timestamp: timestamp = datetime.datetime.utcnow() self.timestamp = timestamp self.is_advsvc = is_advsvc if self.is_advsvc is None: self.is_advsvc = (self.is_admin or policy_engine.check_is_advsvc(self)) if self.is_admin is None: self.is_admin = policy_engine.check_is_admin(self) @property def tenant_id(self): return self.project_id @tenant_id.setter def tenant_id(self, tenant_id): self.project_id = tenant_id @property def tenant_name(self): return self.project_name @tenant_name.setter def tenant_name(self, tenant_name): self.project_name = tenant_name def to_dict(self): context = super(ContextBase, self).to_dict() context.update({ 'user_id': self.user_id, 'tenant_id': self.project_id, 'project_id': self.project_id, 'timestamp': str(self.timestamp), 'tenant_name': self.project_name, 'project_name': self.project_name, 'user_name': self.user_name, }) return context def to_policy_values(self): values = super(ContextBase, self).to_policy_values() values['tenant_id'] = self.project_id values['is_admin'] = self.is_admin # NOTE(jamielennox): These are almost certainly unused and non-standard # but kept for backwards compatibility. Remove them in Pike # (oslo.context from Ocata release already issues deprecation warnings # for non-standard keys). values['user'] = self.user_id values['tenant'] = self.project_id values['domain'] = self.domain_id values['user_domain'] = self.user_domain_id values['project_domain'] = self.project_domain_id values['tenant_name'] = self.project_name values['project_name'] = self.project_name values['user_name'] = self.user_name return values @classmethod def from_dict(cls, values): return cls(user_id=values.get('user_id', values.get('user')), tenant_id=values.get('tenant_id', values.get('project_id')), is_admin=values.get('is_admin'), roles=values.get('roles'), timestamp=values.get('timestamp'), request_id=values.get('request_id'), tenant_name=values.get('tenant_name'), user_name=values.get('user_name'), auth_token=values.get('auth_token')) def elevated(self): """Return a version of this context with admin flag set.""" context = copy.copy(self) context.is_admin = True if 'admin' not in [x.lower() for x in context.roles]: context.roles = context.roles + ["admin"] return context @enginefacade.transaction_context_provider class ContextBaseWithSession(ContextBase): pass _TransactionConstraint = collections.namedtuple( 'TransactionConstraint', ['if_revision_match', 'resource', 'resource_id']) class Context(ContextBaseWithSession): def __init__(self, *args, **kwargs): super(Context, self).__init__(*args, **kwargs) self._session = None self._txn_constraint = None @property def session(self): # TODO(akamyshnikova): checking for session attribute won't be needed # when reader and writer will be used if hasattr(super(Context, self), 'session'): if self._session: warnings.warn('context.session is used with and without ' 'new enginefacade. Please update the code to ' 'use new enginefacede consistently.', DeprecationWarning) return super(Context, self).session if self._session is None: self._session = db_api.get_writer_session() return self._session def set_transaction_constraint(self, resource, resource_id, rev_number): """Set a revision constraint to enforce before resource_id is changed. :param resource: Collection name of resource (e.g. ports or networks) :param resource_id: The primary key ID of the individual resource that should have its revision number matched before allowing the transaction to proceed. :param rev_number: The revision_number that the resource should be at. """ self._txn_constraint = _TransactionConstraint( if_revision_match=rev_number, resource=resource, resource_id=resource_id) def clear_transaction_constraint(self): self._txn_constraint = None def get_transaction_constraint(self): return self._txn_constraint def get_admin_context(): return Context(user_id=None, tenant_id=None, is_admin=True, overwrite=False) def get_admin_context_without_session(): return ContextBase(user_id=None, tenant_id=None, is_admin=True) neutron-lib-2.3.0/neutron_lib/version.py0000664000175000017500000000126213641427107020361 0ustar zuulzuul00000000000000# Copyright 2011 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import pbr.version version_info = pbr.version.VersionInfo('neutron-lib') neutron-lib-2.3.0/neutron_lib/__init__.py0000664000175000017500000000167113641427107020437 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import gettext import pbr.version from neutron_lib.db import api # noqa gettext.install('neutron_lib') # NOTE(boden): neutron_lib.db.api is imported to ensure the ORM event listeners # are registered upon importing any neutron-lib module. For more details see # defect https://bugs.launchpad.net/networking-ovn/+bug/1802369 __version__ = pbr.version.VersionInfo( 'neutron_lib').version_string() neutron-lib-2.3.0/neutron_lib/worker.py0000664000175000017500000000733313641427107020212 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import os from oslo_service import service import setproctitle from neutron_lib.callbacks import events from neutron_lib.callbacks import registry from neutron_lib.callbacks import resources class BaseWorker(service.ServiceBase): """Partial implementation of the ServiceBase ABC. Subclasses will still need to add the other abstract methods defined in service.ServiceBase. See oslo_service for more details. If a plugin needs to handle synchronization with the Neutron database and do this only once instead of in every API worker, for instance, it would define a BaseWorker class and the plugin would have get_workers return an array of BaseWorker instances. For example: .. code-block:: python class MyPlugin(...): def get_workers(self): return [MyPluginWorker()] class MyPluginWorker(BaseWorker): def start(self): super(MyPluginWorker, self).start() do_sync() """ # default class value for case when super().__init__ is not called _default_process_count = 1 def __init__(self, worker_process_count=_default_process_count, set_proctitle='on'): """Initialize a worker instance. :param worker_process_count: Defines how many processes to spawn for worker: 0 - spawn 1 new worker thread, 1..N - spawn N new worker processes set_proctitle: 'off' - do not change process title 'on' - set process title to descriptive string and parent 'brief' - set process title to descriptive string """ self._worker_process_count = worker_process_count self._my_pid = os.getpid() self._set_proctitle = set_proctitle if set_proctitle == 'on': self._parent_proctitle = setproctitle.getproctitle() @property def worker_process_count(self): """The worker's process count. :returns: The number of processes to spawn for this worker. """ return self._worker_process_count def setproctitle(self, name="neutron-server", desc=None): if self._set_proctitle == "off" or os.getpid() == self._my_pid: return if not desc: desc = self.__class__.__name__ proctitle = "%s: %s" % (name, desc) if self._set_proctitle == "on": proctitle += " (%s)" % self._parent_proctitle setproctitle.setproctitle(proctitle) def start(self, name="neutron-server", desc=None): """Start the worker. If worker_process_count is greater than 0, a callback notification is sent. Subclasses should call this method before doing their own start() work. Automatically sets the process title to indicate that this is a child worker, customizable via the name and desc arguments. :returns: None """ # If we are a child process, set our proctitle to something useful self.setproctitle(name, desc) if self.worker_process_count > 0: registry.notify(resources.PROCESS, events.AFTER_INIT, self.start) neutron-lib-2.3.0/neutron_lib/utils/0000775000175000017500000000000013641427200017453 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/utils/net.py0000664000175000017500000000771713641427107020635 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import random import socket import netaddr from neutron_lib import constants def get_hostname(): """Get the hostname of the system. :returns: The hostname of the system. """ return socket.gethostname() def get_random_mac(base_mac): """Get a random MAC address string of the specified base format. The first 3 octets will remain unchanged. If the 4th octet is not 00, it will also be used. The others will be randomly generated. :param base_mac: Base MAC address represented by an array of 6 strings/int :returns: The MAC address string. """ mac = [int(base_mac[0], 16), int(base_mac[1], 16), int(base_mac[2], 16), random.getrandbits(8), random.getrandbits(8), random.getrandbits(8)] if base_mac[3] != '00': mac[3] = int(base_mac[3], 16) return ':'.join(["%02x" % x for x in mac]) def random_mac_generator(base_mac): """Generates random mac addresses from a specified base format. The first 3 octets of each MAC address will remain unchanged. If the 4th octet is not 00, it will also be used. The others will be randomly generated. :param base_mac: Base mac address represented by an array of 6 strings. :returns: A mac address string generator. """ fixed = list(base_mac[0:3]) to_generate = 3 if base_mac[3] != '00': fixed = list(base_mac[0:4]) to_generate = 2 beginning = ':'.join(fixed) + ':' form = '{}' + ':'.join('{:02x}' for _ in range(to_generate)) max_macs = 2 ** (to_generate * 8) seen = set() while len(seen) < max_macs: numbers = [random.getrandbits(8) for _ in range(to_generate)] mac = form.format(beginning, *numbers) if mac in seen: continue else: seen.add(mac) yield mac def is_port_trusted(port): """Used to determine if port can be trusted not to attack network. Trust is currently based on the device_owner field starting with 'network:' since we restrict who can use that in the default policy.json file. :param port: The port dict to inspect the 'device_owner' for. :returns: True if the port dict's 'device_owner' value starts with the networking prefix. False otherwise. """ return port['device_owner'].startswith( constants.DEVICE_OWNER_NETWORK_PREFIX) class _AuthenticBase(object): def __init__(self, addr, **kwargs): super(_AuthenticBase, self).__init__(addr, **kwargs) self._initial_value = addr def __str__(self): if isinstance(self._initial_value, str): return self._initial_value return super(_AuthenticBase, self).__str__() # NOTE(ihrachys): override deepcopy because netaddr.* classes are # slot-based and hence would not copy _initial_value def __deepcopy__(self, memo): return self.__class__(self._initial_value) class AuthenticIPNetwork(_AuthenticBase, netaddr.IPNetwork): '''AuthenticIPNetwork class This class retains the format of the IP network string passed during initialization. This is useful when we want to make sure that we retain the format passed by a user through API. ''' class AuthenticEUI(_AuthenticBase, netaddr.EUI): '''AuthenticEUI class This class retains the format of the MAC address string passed during initialization. This is useful when we want to make sure that we retain the format passed by a user through API. ''' neutron-lib-2.3.0/neutron_lib/utils/test.py0000664000175000017500000000223313641427107021012 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. """Test functions.""" import functools def unstable_test(reason): """Decorator used to mark test as unstable, on failure test will be skipped :param reason: String used in explanation, for example, 'bug 123456'. """ def decor(f): @functools.wraps(f) def inner(self, *args, **kwargs): try: return f(self, *args, **kwargs) except Exception as e: msg = ("%s was marked as unstable because of %s, " "failure was: %s") % (self.id(), reason, e) raise self.skipTest(msg) return inner return decor neutron-lib-2.3.0/neutron_lib/utils/host.py0000664000175000017500000000157113641427107021014 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import multiprocessing def cpu_count(): """Get the system CPU count. :returns: The number of CPUs on the system as an int. If there's an issue fetching the CPU count on the system, a default value of 1 is returned. """ try: return multiprocessing.cpu_count() except NotImplementedError: return 1 neutron-lib-2.3.0/neutron_lib/utils/file.py0000664000175000017500000000267413641427107020763 0ustar zuulzuul00000000000000# Copyright 2011, VMware, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import os import tempfile def replace_file(file_name, data, file_mode=0o644): """Replaces the contents of file_name with data in a safe manner. First write to a temp file and then rename. Since POSIX renames are atomic, the file is unlikely to be corrupted by competing writes. We create the tempfile on the same device to ensure that it can be renamed. :param file_name: Path to the file to replace. :param data: The data to write to the file. :param file_mode: The mode to use for the replaced file. :returns: None. """ base_dir = os.path.dirname(os.path.abspath(file_name)) with tempfile.NamedTemporaryFile('w+', dir=base_dir, delete=False) as tmp_file: tmp_file.write(data) os.chmod(tmp_file.name, file_mode) os.rename(tmp_file.name, file_name) neutron-lib-2.3.0/neutron_lib/utils/upgrade_checks.py0000664000175000017500000000212413641427107023001 0ustar zuulzuul00000000000000# Copyright 2018 Red Hat Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import abc class BaseChecks(object, metaclass=abc.ABCMeta): """Base class providing upgrade checks. Stadium projects which want to provide their own upgrade checks to neutron-status CLI tool should inherit from this class. Each check method have to accept neutron.cmd.status.Checker class as an argument because all checkes will be run in context of this class. """ @abc.abstractmethod def get_checks(self): """Get tuple with check methods and check names to run.""" pass neutron-lib-2.3.0/neutron_lib/utils/helpers.py0000664000175000017500000001424113641427107021477 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import collections import decimal import random import weakref from neutron_lib._i18n import _ def parse_mappings(mapping_list, unique_values=True, unique_keys=True): """Parse a list of mapping strings into a dictionary. :param mapping_list: A list of strings of the form ':'. :param unique_values: Values must be unique if True. :param unique_keys: Keys must be unique if True, else implies that keys and values are not unique. :returns: A dict mapping keys to values or to list of values. :raises ValueError: Upon malformed data or duplicate keys. """ mappings = {} for mapping in mapping_list: mapping = mapping.strip() if not mapping: continue split_result = mapping.split(':') if len(split_result) != 2: raise ValueError(_("Invalid mapping: '%s'") % mapping) key = split_result[0].strip() if not key: raise ValueError(_("Missing key in mapping: '%s'") % mapping) value = split_result[1].strip() if not value: raise ValueError(_("Missing value in mapping: '%s'") % mapping) if unique_keys: if key in mappings: raise ValueError(_("Key %(key)s in mapping: '%(mapping)s' not " "unique") % {'key': key, 'mapping': mapping}) if unique_values and value in mappings.values(): raise ValueError(_("Value %(value)s in mapping: '%(mapping)s' " "not unique") % {'value': value, 'mapping': mapping}) mappings[key] = value else: mappings.setdefault(key, []) if value not in mappings[key]: mappings[key].append(value) return mappings def compare_elements(a, b): """Compare elements if a and b have same elements. This method doesn't consider ordering. :param a: The first item to compare. :param b: The second item to compare. :returns: True if a and b have the same elements, False otherwise. """ return set(a or []) == set(b or []) def safe_sort_key(value): """Return value hash or build one for dictionaries. :param value: The value to build a hash for. :returns: The value sorted. """ if isinstance(value, collections.Mapping): return sorted(value.items()) return value def dict2str(dic): """Build a str representation of a dict. :param dic: The dict to build a str representation for. :returns: The dict in str representation that is a k=v command list for each item in dic. """ return ','.join("%s=%s" % (key, val) for key, val in sorted(dic.items())) def str2dict(string): """Parse a str representation of a dict into its dict form. This is the inverse of dict2str() :param string: The string to parse. :returns: A dict constructed from the str representation in string. """ res_dict = {} for keyvalue in string.split(','): (key, value) = keyvalue.split('=', 1) res_dict[key] = value return res_dict def dict2tuple(d): """Build a tuple from a dict. :param d: The dict to coherence into a tuple. :returns: The dict d in tuple form. """ items = list(d.items()) items.sort() return tuple(items) def diff_list_of_dict(old_list, new_list): """Given 2 lists of dicts, return a tuple containing the diff. :param old_list: The old list of dicts to diff. :param new_list: The new list of dicts to diff. :returns: A tuple where the first item is a list of the added dicts in the diff and the second item is the removed dicts. """ new_set = set([dict2str(l) for l in new_list]) old_set = set([dict2str(l) for l in old_list]) added = new_set - old_set removed = old_set - new_set return [str2dict(a) for a in added], [str2dict(r) for r in removed] def get_random_string(length): """Get a random hex string of the specified length. :param length: The length for the hex string. :returns: A random hex string of the said length. """ return "{0:0{1}x}".format(random.getrandbits(length * 4), length) def camelize(s): """Camelize a str that uses _ as a camelize token. :param s: The str to camelize that contains a _ at each index where a new camelized word starts. :returns: The camelized str. """ return ''.join(s.replace('_', ' ').title().split()) def round_val(val): """Round the value. :param val: The value to round. :returns: The value rounded using the half round up scheme. """ # we rely on decimal module since it behaves consistently across Python # versions (2.x vs. 3.x) return int(decimal.Decimal(val).quantize(decimal.Decimal('1'), rounding=decimal.ROUND_HALF_UP)) def safe_decode_utf8(s): """Safe decode a str from UTF. :param s: The str to decode. :returns: The decoded str. """ if isinstance(s, bytes): return s.decode('utf-8', 'surrogateescape') return s weak_method = weakref.WeakMethod def make_weak_ref(f): """Make a weak reference to a function accounting for bound methods. :param f: The callable to make a weak ref for. :returns: A weak ref to f. """ return weak_method(f) if hasattr(f, '__self__') else weakref.ref(f) def resolve_ref(ref): """Handles dereference of weakref. :param ref: The weak ref to resolve. :returns: The resolved reference. """ if isinstance(ref, weakref.ref): ref = ref() return ref neutron-lib-2.3.0/neutron_lib/utils/runtime.py0000664000175000017500000001166113641427107021523 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. import pkgutil import sys from oslo_concurrency import lockutils from oslo_log import log as logging from oslo_utils import importutils from stevedore import driver from stevedore import enabled from neutron_lib._i18n import _ LOG = logging.getLogger(__name__) SYNCHRONIZED_PREFIX = 'neutron-' # common synchronization decorator synchronized = lockutils.synchronized_with_prefix(SYNCHRONIZED_PREFIX) class NamespacedPlugins(object): """Wraps a stevedore plugin namespace to load/access its plugins.""" def __init__(self, namespace): self.namespace = namespace self._extension_manager = None self._extensions = {} self.reload() def reload(self): """Force a reload of the plugins for this instances namespace. :returns: None. """ self._extensions = {} self._extension_manager = enabled.EnabledExtensionManager( self.namespace, lambda x: True, invoke_on_load=False) if not self._extension_manager.names(): LOG.debug("No plugins found in namespace: ", self.namespace) return self._extension_manager.map(self._add_extension) def _add_extension(self, ext): if ext.name in self._extensions: msg = _("Plugin '%(p)s' already in namespace: %(ns)s") % { 'p': ext.name, 'ns': self.namespace} raise KeyError(msg) LOG.debug("Loaded plugin '%s' from namespace: %s", ext.name, self.namespace) self._extensions[ext.name] = ext def _assert_plugin_loaded(self, plugin_name): if plugin_name not in self._extensions: msg = _("Plugin '%(p)s' not in namespace: %(ns)s") % { 'p': plugin_name, 'ns': self.namespace} raise KeyError(msg) def get_plugin_class(self, plugin_name): """Gets a reference to a loaded plugin's class. :param plugin_name: The name of the plugin to get the class for. :returns: A reference to the loaded plugin's class. :raises: KeyError if plugin_name is not loaded. """ self._assert_plugin_loaded(plugin_name) return self._extensions[plugin_name].plugin def new_plugin_instance(self, plugin_name, *args, **kwargs): """Create a new instance of a plugin. :param plugin_name: The name of the plugin to instantiate. :param args: Any args to pass onto the constructor. :param kwargs: Any kwargs to pass onto the constructor. :returns: A new instance of plugin_name. :raises: KeyError if plugin_name is not loaded. """ self._assert_plugin_loaded(plugin_name) return self.get_plugin_class(plugin_name)(*args, **kwargs) @property def loaded_plugin_names(self): return self._extensions.keys() def load_class_by_alias_or_classname(namespace, name): """Load a class using stevedore alias or the class name. :param namespace: The namespace where the alias is defined. :param name: The alias or class name of the class to be loaded. :returns: Class if it can be loaded. :raises ImportError: if class cannot be loaded. """ if not name: LOG.error("Alias or class name is not set") raise ImportError(_("Class not found.")) try: # Try to resolve class by alias mgr = driver.DriverManager( namespace, name, warn_on_missing_entrypoint=False) class_to_load = mgr.driver except RuntimeError: e1_info = sys.exc_info() # Fallback to class name try: class_to_load = importutils.import_class(name) except (ImportError, ValueError): LOG.error("Error loading class by alias", exc_info=e1_info) LOG.error("Error loading class by class name", exc_info=True) raise ImportError(_("Class not found.")) return class_to_load def list_package_modules(package_name): """Get a list of the modules for a given package. :param package_name: The package name to get modules for. :returns: A list of module objects for the said package name. """ pkg_mod = importutils.import_module(package_name) modules = [pkg_mod] for mod in pkgutil.walk_packages(pkg_mod.__path__): _, mod_name, _ = mod fq_name = pkg_mod.__name__ + "." + mod_name modules.append(importutils.import_module(fq_name)) return modules neutron-lib-2.3.0/neutron_lib/utils/__init__.py0000664000175000017500000000000013641427107021560 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/db/0000775000175000017500000000000013641427200016700 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/db/constants.py0000664000175000017500000000236613641427107021303 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # Database field sizes NAME_FIELD_SIZE = 255 LONG_DESCRIPTION_FIELD_SIZE = 1024 DESCRIPTION_FIELD_SIZE = 255 PROJECT_ID_FIELD_SIZE = 255 DEVICE_ID_FIELD_SIZE = 255 DEVICE_OWNER_FIELD_SIZE = 255 UUID_FIELD_SIZE = 36 STATUS_FIELD_SIZE = 16 IP_ADDR_FIELD_SIZE = 64 # large enough to hold a v4 or v6 address MAC_ADDR_FIELD_SIZE = 32 RESOURCE_TYPE_FIELD_SIZE = 255 FQDN_FIELD_SIZE = 255 AZ_HINTS_DB_LEN = 255 # Alembic branches EXPAND_BRANCH = 'expand' CONTRACT_BRANCH = 'contract' # Maximum value integer can take in MySQL and PostgreSQL # In SQLite integer can be stored in 1, 2, 3, 4, 6, or 8 bytes, # but here it will be limited by this value for consistency. DB_INTEGER_MAX_VALUE = 2 ** 31 - 1 neutron-lib-2.3.0/neutron_lib/db/standard_attr.py0000664000175000017500000002461313641427107022120 0ustar zuulzuul00000000000000# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from oslo_utils import timeutils import sqlalchemy as sa from sqlalchemy import event # noqa from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy.ext import declarative from sqlalchemy.orm import attributes from sqlalchemy.orm import session as se from neutron_lib._i18n import _ from neutron_lib.db import constants as db_const from neutron_lib.db import model_base from neutron_lib.db import sqlalchemytypes class StandardAttribute(model_base.BASEV2): """Common table to associate all Neutron API resources. By having Neutron objects related to this table, we can associate new tables that apply to many Neutron objects (e.g. timestamps, rbac entries) to this table to avoid schema duplication while maintaining referential integrity. NOTE(kevinbenton): This table should not have more columns added to it unless we are absolutely certain the new column will have a value for every single type of Neutron resource. Otherwise this table will be filled with NULL entries for combinations that don't make sense. Additionally, by keeping this table small we can ensure that performance isn't adversely impacted for queries on objects. """ # sqlite doesn't support auto increment on big integers so we use big int # for everything but sqlite id = sa.Column(sa.BigInteger().with_variant(sa.Integer(), 'sqlite'), primary_key=True, autoincrement=True) # NOTE(kevinbenton): this column is redundant information, but it allows # operators/devs to look at the contents of this table and know which table # the corresponding object is in. # 255 was selected as a max just because it's the varchar ceiling in mysql # before a 2-byte prefix is required. We shouldn't get anywhere near this # limit with our table names... resource_type = sa.Column(sa.String(255), nullable=False) description = sa.Column(sa.String(db_const.DESCRIPTION_FIELD_SIZE)) revision_number = sa.Column( sa.BigInteger().with_variant(sa.Integer(), 'sqlite'), server_default='0', nullable=False) created_at = sa.Column(sqlalchemytypes.TruncatedDateTime, default=timeutils.utcnow) updated_at = sa.Column(sqlalchemytypes.TruncatedDateTime, onupdate=timeutils.utcnow) __mapper_args__ = { # see http://docs.sqlalchemy.org/en/latest/orm/versioning.html for # details about how this works "version_id_col": revision_number, "version_id_generator": False # revision plugin increments manually } def bump_revision(self): if self.revision_number is None: # this is a brand new object uncommitted so we don't bump now return self.revision_number += 1 def _set_updated_revision_number(self, revision_number, updated_at): attributes.set_committed_value( self, "revision_number", revision_number) attributes.set_committed_value( self, "updated_at", updated_at) @property def _effective_standard_attribute_id(self): return self.id class HasStandardAttributes(object): @classmethod def get_api_collections(cls): """Define the API collection this object will appear under. This should return a list of API collections that the object will be exposed under. Most should be exposed in just one collection (e.g. the network model is just exposed under 'networks'). This is used by the standard attr extensions to discover which resources need to be extended with the standard attr fields (e.g. created_at/updated_at/etc). """ # NOTE(kevinbenton): can't use abc because the metaclass conflicts # with the declarative base others inherit from. if hasattr(cls, 'api_collections'): return cls.api_collections raise NotImplementedError(_("%s must define api_collections") % cls) @classmethod def get_api_sub_resources(cls): """Define the API sub-resources this object will appear under. This should return a list of API sub-resources that the object will be exposed under. This is used by the standard attr extensions to discover which sub-resources need to be extended with the standard attr fields (e.g. created_at/updated_at/etc). """ try: return cls.api_sub_resources except AttributeError: return [] @classmethod def get_collection_resource_map(cls): try: return cls.collection_resource_map except AttributeError: raise NotImplementedError(_("%s must define " "collection_resource_map") % cls) @classmethod def validate_tag_support(cls): return getattr(cls, 'tag_support', False) @declarative.declared_attr def standard_attr_id(cls): return sa.Column( sa.BigInteger().with_variant(sa.Integer(), 'sqlite'), sa.ForeignKey(StandardAttribute.id, ondelete="CASCADE"), unique=True, nullable=False ) # NOTE(kevinbenton): we have to disable the following pylint check because # it thinks we are overriding this method in the __init__ method. # pylint: disable=method-hidden @declarative.declared_attr def standard_attr(cls): return sa.orm.relationship(StandardAttribute, lazy='joined', cascade='all, delete-orphan', single_parent=True, uselist=False) @property def _effective_standard_attribute_id(self): return self.standard_attr_id def __init__(self, *args, **kwargs): standard_attr_keys = ['description', 'created_at', 'updated_at', 'revision_number'] standard_attr_kwargs = {} for key in standard_attr_keys: if key in kwargs: standard_attr_kwargs[key] = kwargs.pop(key) super(HasStandardAttributes, self).__init__(*args, **kwargs) # here we automatically create the related standard attribute object self.standard_attr = StandardAttribute( resource_type=self.__tablename__, **standard_attr_kwargs) @declarative.declared_attr def description(cls): return association_proxy('standard_attr', 'description') @declarative.declared_attr def created_at(cls): return association_proxy('standard_attr', 'created_at') @declarative.declared_attr def updated_at(cls): return association_proxy('standard_attr', 'updated_at') def update(self, new_dict): # ignore the timestamps if they were passed in. For example, this # happens if code calls update_port with modified results of get_port new_dict.pop('created_at', None) new_dict.pop('updated_at', None) super(HasStandardAttributes, self).update(new_dict) @declarative.declared_attr def revision_number(cls): return association_proxy('standard_attr', 'revision_number') def bump_revision(self): # SQLAlchemy will bump the version for us automatically if the # standard attr record is being modified, but we must call this # for all other modifications or when relevant children are being # modified (e.g. fixed_ips change should bump port revision) self.standard_attr.bump_revision() def _set_updated_revision_number(self, revision_number, updated_at): self.standard_attr._set_updated_revision_number( revision_number, updated_at) def _resource_model_map_helper(rs_map, resource, subclass): if resource in rs_map: raise RuntimeError(_("Model %(sub)s tried to register for API " "resource %(res)s which conflicts with model " "%(other)s.") % dict(sub=subclass, other=rs_map[resource], res=resource)) rs_map[resource] = subclass def get_standard_attr_resource_model_map(include_resources=True, include_sub_resources=True): rs_map = {} for subclass in HasStandardAttributes.__subclasses__(): if include_resources: for resource in subclass.get_api_collections(): _resource_model_map_helper(rs_map, resource, subclass) if include_sub_resources: for sub_resource in subclass.get_api_sub_resources(): _resource_model_map_helper(rs_map, sub_resource, subclass) return rs_map def get_tag_resource_parent_map(): parent_map = {} for subclass in HasStandardAttributes.__subclasses__(): if subclass.validate_tag_support(): for collection, resource in (subclass.get_collection_resource_map() .items()): if collection in parent_map: msg = (_("API parent %(collection)s/%(resource)s for " "model %(subclass)s is already registered.") % dict(collection=collection, resource=resource, subclass=subclass)) raise RuntimeError(msg) parent_map[collection] = resource return parent_map @event.listens_for(se.Session, 'after_bulk_delete') def throw_exception_on_bulk_delete_of_listened_for_objects(delete_context): if hasattr(delete_context.mapper.class_, 'revises_on_change'): raise RuntimeError(_("%s may not be deleted in bulk because it " "bumps the revision of other resources via " "SQLAlchemy event handlers, which are not " "compatible with bulk deletes.") % delete_context.mapper.class_) neutron-lib-2.3.0/neutron_lib/db/sqlalchemytypes.py0000664000175000017500000000541513641427107022514 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """Custom SQLAlchemy types.""" import netaddr from sqlalchemy import types from neutron_lib._i18n import _ class IPAddress(types.TypeDecorator): impl = types.String(64) def process_result_value(self, value, dialect): return netaddr.IPAddress(value) def process_bind_param(self, value, dialect): if not isinstance(value, netaddr.IPAddress): raise AttributeError(_("Received type '%(type)s' and value " "'%(value)s'. Expecting netaddr.IPAddress " "type.") % {'type': type(value), 'value': value}) return str(value) class CIDR(types.TypeDecorator): impl = types.String(64) def process_result_value(self, value, dialect): return netaddr.IPNetwork(value) def process_bind_param(self, value, dialect): if not isinstance(value, netaddr.IPNetwork): raise AttributeError(_("Received type '%(type)s' and value " "'%(value)s'. Expecting netaddr.IPNetwork " "type.") % {'type': type(value), 'value': value}) return str(value) class MACAddress(types.TypeDecorator): impl = types.String(64) def process_result_value(self, value, dialect): return netaddr.EUI(value) def process_bind_param(self, value, dialect): if not isinstance(value, netaddr.EUI): raise AttributeError(_("Received type '%(type)s' and value " "'%(value)s'. Expecting netaddr.EUI " "type.") % {'type': type(value), 'value': value}) return str(value) class TruncatedDateTime(types.TypeDecorator): """Truncates microseconds. Use this for datetime fields so we don't have to worry about DB-specific behavior when it comes to rounding/truncating microseconds off of timestamps. """ impl = types.DateTime def process_bind_param(self, value, dialect): return value.replace(microsecond=0) if value else value process_result_value = process_bind_param neutron-lib-2.3.0/neutron_lib/db/utils.py0000664000175000017500000001624213641427107020425 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import functools from oslo_db import exception as db_exc from oslo_utils import excutils import sqlalchemy from sqlalchemy.ext.associationproxy import ASSOCIATION_PROXY from sqlalchemy.orm import exc from sqlalchemy.orm import properties from neutron_lib._i18n import _ from neutron_lib.api import attributes from neutron_lib import exceptions as n_exc def get_and_validate_sort_keys(sorts, model): """Extract sort keys from sorts and ensure they are valid for the model. :param sorts: A list of (key, direction) tuples. :param model: A sqlalchemy ORM model class. :returns: A list of the extracted sort keys. :raises BadRequest: If a sort key attribute references another resource and cannot be used in the sort. """ sort_keys = [s[0] for s in sorts] for sort_key in sort_keys: try: sort_key_attr = getattr(model, sort_key) except AttributeError: # Extension attributes don't support sorting. Because it # existed in attr_info, it will be caught here. msg = _("'%s' is an invalid attribute for sort key") % sort_key raise n_exc.BadRequest(resource=model.__tablename__, msg=msg) if isinstance(sort_key_attr.property, properties.RelationshipProperty): msg = _("Attribute '%(attr)s' references another resource and " "cannot be used to sort '%(resource)s' resources" ) % {'attr': sort_key, 'resource': model.__tablename__} raise n_exc.BadRequest(resource=model.__tablename__, msg=msg) return sort_keys def get_sort_dirs(sorts, page_reverse=False): """Extract sort directions from sorts, possibly reversed. :param sorts: A list of (key, direction) tuples. :param page_reverse: True if sort direction is reversed. :returns: The list of extracted sort directions optionally reversed. """ if page_reverse: return ['desc' if s[1] else 'asc' for s in sorts] return ['asc' if s[1] else 'desc' for s in sorts] def _is_nested_instance(exception, etypes): """Check if exception or its inner excepts are an instance of etypes.""" return (isinstance(exception, etypes) or isinstance(exception, n_exc.MultipleExceptions) and any(_is_nested_instance(i, etypes) for i in exception.inner_exceptions)) def is_retriable(exception): """Determine if the said exception is retriable. :param exception: The exception to check. :returns: True if 'exception' is retriable, otherwise False. """ if _is_nested_instance(exception, (db_exc.DBDeadlock, exc.StaleDataError, db_exc.DBConnectionError, db_exc.DBDuplicateEntry, db_exc.RetryRequest)): return True # Look for savepoints mangled by deadlocks. See bug/1590298 for details. return (_is_nested_instance(exception, db_exc.DBError) and '1305' in str(exception)) def reraise_as_retryrequest(function): """Wrap the said function with a RetryRequest upon error. :param function: The function to wrap/decorate. :returns: The 'function' wrapped in a try block that will reraise any Exception's as a RetryRequest. :raises RetryRequest: If the wrapped function raises retriable exception. """ @functools.wraps(function) def _wrapped(*args, **kwargs): try: return function(*args, **kwargs) except Exception as e: with excutils.save_and_reraise_exception() as ctx: if is_retriable(e): ctx.reraise = False raise db_exc.RetryRequest(e) return _wrapped def get_marker_obj(plugin, context, resource, limit, marker): """Retrieve a resource marker object. This function is used to invoke plugin._get_(context, marker) and is used for pagination. :param plugin: The plugin processing the request. :param context: The request context. :param resource: The resource name. :param limit: Indicates if pagination is in effect. :param marker: The id of the marker object. :returns: The marker object associated with the plugin if limit and marker are given. """ if limit and marker: return getattr(plugin, '_get_%s' % resource)(context, marker) def resource_fields(resource, fields): """Return only the resource items that are in fields. :param resource: A resource dict. :param fields: A list of fields to select from the resource. :returns: A new dict that contains only fields from resource as well as its attribute project info. """ if fields: resource = {key: item for key, item in resource.items() if key in fields} return attributes.populate_project_info(resource) def filter_non_model_columns(data, model): """Return the attributes from data which are model columns. :param data: The dict containing the data to filter. :param model: The model who's column names are used when filtering data. :returns: A new dict who's keys are columns in model or are association proxies of the model. """ mapper = sqlalchemy.inspect(model) columns = set(c.name for c in mapper.columns) columns.update(d.value_attr for d in mapper.all_orm_descriptors if d.extension_type is ASSOCIATION_PROXY) return dict((k, v) for (k, v) in data.items() if k in columns) def model_query_scope_is_project(context, model): """Determine if a model should be scoped to a project. :param context: The context to check for admin and advsvc rights. :param model: The model to check the project_id of. :returns: True if the context is not admin and not advsvc and the model has a project_id. False otherwise. """ # Unless a context has 'admin' or 'advanced-service' rights the # query will be scoped to a single project_id return ((not context.is_admin and hasattr(model, 'project_id')) and (not context.is_advsvc and hasattr(model, 'project_id'))) def model_query(context, model): """Query the context for the said model. :param context: The context to use for the query. :param model: The model to query for. :returns: A query from the said context for the said model. """ query = context.session.query(model) # define basic filter condition for model query query_filter = None if model_query_scope_is_project(context, model): query_filter = (model.tenant_id == context.tenant_id) if query_filter is not None: query = query.filter(query_filter) return query neutron-lib-2.3.0/neutron_lib/db/api.py0000664000175000017500000004155013641427107020036 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import contextlib import copy import functools import weakref from oslo_concurrency import lockutils from oslo_config import cfg from oslo_db import api as oslo_db_api from oslo_db import exception as db_exc from oslo_db.sqlalchemy import enginefacade from oslo_log import log as logging from oslo_utils import excutils from osprofiler import opts as profiler_opts import osprofiler.sqlalchemy from pecan import util as p_util import sqlalchemy from sqlalchemy import event # noqa from sqlalchemy import exc as sql_exc from sqlalchemy import orm from sqlalchemy.orm import exc from neutron_lib._i18n import _ from neutron_lib.db import model_base from neutron_lib import exceptions from neutron_lib.objects import exceptions as obj_exc MAX_RETRIES = 20 LOG = logging.getLogger(__name__) _synchronized = lockutils.synchronized_with_prefix("neutron-") _CTX_MANAGER = None @_synchronized("context-manager") def _create_context_manager(): global _CTX_MANAGER if _CTX_MANAGER is None: _CTX_MANAGER = enginefacade.transaction_context() _CTX_MANAGER.configure(sqlite_fk=True, flush_on_subtransaction=True) return _CTX_MANAGER def get_context_manager(): """Transaction Context Manager accessor. :returns: The transaction context manager. """ if _CTX_MANAGER is None: return _create_context_manager() return _CTX_MANAGER def _set_hook(engine): if (profiler_opts.is_trace_enabled() and profiler_opts.is_db_trace_enabled()): osprofiler.sqlalchemy.add_tracing( sqlalchemy, engine, "neutron.db") # TODO(ihrachys) the hook assumes options defined by osprofiler, and the only # public function that is provided by osprofiler that will register them is # set_defaults, that's why we call it here even though we don't need to change # defaults profiler_opts.set_defaults(cfg.CONF) get_context_manager().append_on_engine_create(_set_hook) def get_reader_session(): """Helper to get reader session. :returns: The reader session. """ return get_context_manager().reader.get_sessionmaker()() def get_writer_session(): """Helper to get writer session. :returns: The writer session. """ return get_context_manager().writer.get_sessionmaker()() def _is_nested_instance(e, etypes): """Check if exception or its inner excepts are an instance of etypes.""" if isinstance(e, etypes): return True if isinstance(e, exceptions.MultipleExceptions): return any(_is_nested_instance(i, etypes) for i in e.inner_exceptions) if isinstance(e, db_exc.DBError): return _is_nested_instance(e.inner_exception, etypes) return False def is_retriable(e): """Determine if the exception is retriable. :param e: The exception to check. :returns: True if e is retriable and False otherwise. """ if getattr(e, '_RETRY_EXCEEDED', False): return False if _is_nested_instance(e, (db_exc.DBDeadlock, exc.StaleDataError, db_exc.DBConnectionError, db_exc.DBDuplicateEntry, db_exc.RetryRequest, obj_exc.NeutronDbObjectDuplicateEntry)): return True # looking savepoints mangled by deadlocks. see bug/1590298 for details. return _is_nested_instance(e, db_exc.DBError) and '1305' in str(e) def _tag_retriables_as_unretriable(f): """Puts a flag on retriable exceptions so is_retriable returns False. This decorator can be used outside of a retry decorator to prevent decorators higher up from retrying again. """ @functools.wraps(f) def wrapped(*args, **kwargs): try: return f(*args, **kwargs) except Exception as e: with excutils.save_and_reraise_exception(): if is_retriable(e): setattr(e, '_RETRY_EXCEEDED', True) return wrapped def _copy_if_lds(item): """Deepcopy lists/dicts/sets, leave everything else alone.""" return copy.deepcopy(item) if isinstance(item, (list, dict, set)) else item _retry_db_errors = oslo_db_api.wrap_db_retry( max_retries=MAX_RETRIES, retry_interval=0.5, inc_retry_interval=True, exception_checker=is_retriable, jitter=True ) def retry_db_errors(f): """Nesting-safe retry decorator with auto-arg-copy and logging. Retry decorator for all functions which do not accept a context as an argument. If the function accepts a context, use 'retry_if_session_inactive' below. If retriable errors are retried and exceed the count, they will be tagged with a flag so is_retriable will no longer recognize them as retriable. This prevents multiple applications of this decorator (and/or the one below) from retrying the same exception. """ @_tag_retriables_as_unretriable @_retry_db_errors @functools.wraps(f) def wrapped(*args, **kwargs): try: # copy mutable args and kwargs to make retries safe. this doesn't # prevent mutations of complex objects like the context or 'self' dup_args = [_copy_if_lds(a) for a in args] dup_kwargs = {k: _copy_if_lds(v) for k, v in kwargs.items()} return f(*dup_args, **dup_kwargs) except Exception as e: with excutils.save_and_reraise_exception(): if is_retriable(e): LOG.debug("Retry wrapper got retriable exception: %s", e) return wrapped @contextlib.contextmanager def autonested_transaction(sess): """This is a convenience context to not bother with 'nested' parameter. :param sess: The database session. :returns: Yields the context transaction from sess. """ if sess.is_active: session_context = sess.begin(nested=True) else: session_context = sess.begin(subtransactions=True) with session_context as tx: yield tx def retry_if_session_inactive(context_var_name='context'): """Retries only if the session in the context is inactive. Calls a retry_db_errors wrapped version of the function if the context's session passed in is inactive, otherwise it just calls the function directly. This is useful to avoid retrying things inside of a transaction which is ineffective for DB races/errors. This should be used in all cases where retries are desired and the method accepts a context. """ def decorator(f): try: # NOTE(kevinbenton): we use pecan's util function here because it # deals with the horrors of finding args of already decorated # functions ctx_arg_index = p_util.getargspec(f).args.index(context_var_name) except ValueError: msg = _("Could not find position of var %s") % context_var_name raise RuntimeError(msg) f_with_retry = retry_db_errors(f) @functools.wraps(f) def wrapped(*args, **kwargs): # only use retry wrapper if we aren't nested in an active # transaction if context_var_name in kwargs: context = kwargs[context_var_name] else: context = args[ctx_arg_index] method = f if context.session.is_active else f_with_retry return method(*args, **kwargs) return wrapped return decorator @contextlib.contextmanager def exc_to_retry(etypes): """Contextually reraise Exceptions as a RetryRequests. :param etypes: The class type to check the exception for. :returns: None :raises: A RetryRequest if any exception is caught in the context is a nested instance of etypes. """ try: yield except Exception as e: with excutils.save_and_reraise_exception() as ctx: if _is_nested_instance(e, etypes): ctx.reraise = False raise db_exc.RetryRequest(e) # for convenient access as decorators CONTEXT_READER = get_context_manager().reader CONTEXT_WRITER = get_context_manager().writer _REGISTERED_SQLA_EVENTS = [] def sqla_listen(*args): """Wrapper to track subscribers for test teardowns. SQLAlchemy has no "unsubscribe all" option for its event listener framework so we need to keep track of the subscribers by having them call through here for test teardowns. :param args: The arguments to pass onto the listen call. :returns: None """ event.listen(*args) _REGISTERED_SQLA_EVENTS.append(args) def sqla_remove(*args): """Remove SQLA listeners. :param args: The args to pass onto remove. :returns: None. """ event.remove(*args) _REGISTERED_SQLA_EVENTS.remove(args) def sqla_remove_all(): """Removes all SQLA listeners. :returns: None. """ for args in _REGISTERED_SQLA_EVENTS: try: event.remove(*args) except sql_exc.InvalidRequestError: # already removed pass del _REGISTERED_SQLA_EVENTS[:] @event.listens_for(orm.session.Session, "after_flush") def _add_to_rel_load_list(session, flush_context=None): # keep track of new items to load relationships on during commit session.info.setdefault('_load_rels', weakref.WeakSet()).update( session.new) @event.listens_for(orm.session.Session, "before_commit") def _load_one_to_manys(session): # TODO(kevinbenton): we should be able to remove this after we # have eliminated all places where related objects are constructed # using a key rather than a relationship. # capture any new objects if session.new: session.flush() if session.transaction.nested: # wait until final commit return for new_object in session.info.pop('_load_rels', []): if new_object not in session: # don't load detached objects because that brings them back into # session continue state = sqlalchemy.inspect(new_object) # set up relationship loading so that we can call lazy # loaders on the object even though the ".key" is not set up yet # (normally happens by in after_flush_postexec, but we're trying # to do this more succinctly). in this context this is only # setting a simple flag on the object's state. session.enable_relationship_loading(new_object) # look for eager relationships and do normal load. # For relationships where the related object is also # in the session these lazy loads will pull from the # identity map and not emit SELECT. Otherwise, we are still # local in the transaction so a normal SELECT load will work fine. for relationship_attr in state.mapper.relationships: if relationship_attr.lazy not in ('joined', 'subquery'): # we only want to automatically load relationships that would # automatically load during a lookup operation continue if relationship_attr.key not in state.dict: getattr(new_object, relationship_attr.key) if relationship_attr.key not in state.dict: msg = ("Relationship %s attributes must be loaded in db " "object %s" % (relationship_attr.key, state.dict)) raise AssertionError(msg) # Expire relationships when foreign key changes. # # NOTE(ihrachys) Arguably, it's a sqlalchemy anti-pattern to access child # models directly and through parent relationships in the same session. But # since OVO mechanism is built around synthetic fields that assume this mixed # access is possible, we keep it here until we find a way to migrate OVO # synthetic fields to better mechanism that would update child models via # parents. Even with that, there are multiple places in plugin code where we # mix access when using models directly; those occurrences would need to be # fixed too to be able to remove this hook and explicit expire() calls. # # Adopted from the following recipe: # https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageRecipes # /ExpireRelationshipOnFKChange # # ...then massively changed to actually work for all neutron backref cases. # # TODO(ihrachys) at some point these event handlers should be extended to also # automatically refresh values for expired attributes def _expire_for_fk_change(target, fk_value, relationship_prop, column_attr): """Expire relationship attributes when a many-to-one column changes.""" sess = orm.object_session(target) # subnets and network's many-to-one relationship is used as example in the # comments in this function if sess is not None: # optional behavior #1 - expire the "Network.subnets" # collection on the existing "network" object if relationship_prop.back_populates and \ relationship_prop.key in target.__dict__: obj = getattr(target, relationship_prop.key) if obj is not None and sqlalchemy.inspect(obj).persistent: sess.expire(obj, [relationship_prop.back_populates]) # optional behavior #2 - expire the "Subnet.network" if sqlalchemy.inspect(target).persistent: sess.expire(target, [relationship_prop.key]) # optional behavior #3 - "trick" the ORM by actually # setting the value ahead of time, then emitting a load # for the attribute so that the *new* Subnet.network # is loaded. Then, expire Network.subnets on *that*. # Other techniques here including looking in the identity # map for "value", if this is a simple many-to-one get. if relationship_prop.back_populates: target.__dict__[column_attr] = fk_value new = getattr(target, relationship_prop.key) if new is not None: if sqlalchemy.inspect(new).persistent: sess.expire(new, [relationship_prop.back_populates]) else: # no Session yet, do it later. This path is reached from the 'expire' # listener setup by '_expire_prop_on_col' below, when a foreign key # is directly assigned to in the many to one side of a relationship. # i.e. assigning directly to Subnet.network_id before Subnet is added # to the session if target not in _emit_on_pending: _emit_on_pending[target] = [] _emit_on_pending[target].append( (fk_value, relationship_prop, column_attr)) _emit_on_pending = weakref.WeakKeyDictionary() @event.listens_for(orm.session.Session, "pending_to_persistent") def _pending_callables(session, obj): """Expire relationships when a new object w/ a FK becomes persistent""" if obj is None: return args = _emit_on_pending.pop(obj, []) for a in args: if a is not None: _expire_for_fk_change(obj, *a) @event.listens_for(orm.session.Session, "persistent_to_deleted") def _persistent_to_deleted(session, obj): """Expire relationships when an object w/ a foreign key becomes deleted""" mapper = sqlalchemy.inspect(obj).mapper for prop in mapper.relationships: if prop.direction is orm.interfaces.MANYTOONE: for col in prop.local_columns: colkey = mapper.get_property_by_column(col).key _expire_for_fk_change(obj, None, prop, colkey) @event.listens_for(model_base.BASEV2, "attribute_instrument", propagate=True) def _listen_for_changes(cls, key, inst): mapper = sqlalchemy.inspect(cls) if key not in mapper.relationships: return prop = inst.property if prop.direction is orm.interfaces.MANYTOONE: for col in prop.local_columns: colkey = mapper.get_property_by_column(col).key _expire_prop_on_col(cls, prop, colkey) elif prop.direction is orm.interfaces.ONETOMANY: remote_mapper = prop.mapper # the collection *has* to have a MANYTOONE backref so we # can look up the parent. so here we make one if it doesn't # have it already, as is the case in this example if not prop.back_populates: name = "_%s_backref" % prop.key backref_prop = orm.relationship( prop.parent, back_populates=prop.key) remote_mapper.add_property(name, backref_prop) prop.back_populates = name def _expire_prop_on_col(cls, prop, colkey): @event.listens_for(getattr(cls, colkey), "set") def expire(target, value, oldvalue, initiator): """Expire relationships when FK attribute on an object changes""" _expire_for_fk_change(target, value, prop, colkey) neutron-lib-2.3.0/neutron_lib/db/resource_extend.py0000664000175000017500000001240113641427107022454 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """ NOTE: This module shall not be used by external projects. It will be moved to neutron-lib in due course, and then it can be used from there. """ import collections import inspect from neutron_lib.utils import helpers # This dictionary will store methods for extending API resources. # Extensions can add their own methods by invoking register_funcs(). _resource_extend_functions = { # : [, , ...], # : [, , ...], # ... } # This dictionary will store @extends decorated methods with a list of # resources that each method will extend on class initialization. _DECORATED_EXTEND_METHODS = collections.defaultdict(list) _DECORATED_METHODS_REGISTERED = '_DECORATED_METHODS_REGISTERED' def register_funcs(resource, funcs): """Add functions to extend a resource. :param resource: A resource collection name. :type resource: str :param funcs: A list of functions. :type funcs: list of callable These functions take a resource dict and a resource object and update the resource dict with extension data (possibly retrieved from the resource db object). def _extend_foo_with_bar(foo_res, foo_db): foo_res['bar'] = foo_db.bar_info # example return foo_res """ funcs = [helpers.make_weak_ref(f) if callable(f) else f for f in funcs] _resource_extend_functions.setdefault(resource, []).extend(funcs) def get_funcs(resource): """Retrieve a list of functions extending a resource. :param resource: A resource collection name. :type resource: str :return: A list (possibly empty) of functions extending resource. :rtype: list of callable """ return _resource_extend_functions.get(resource, []) def apply_funcs(resource_type, response, db_object): """Appy registered functions for the said resource type. :param resource_type: The resource type to apply funcs for. :param response: The response object. :param db_object: The Database object. :returns: None """ for func in get_funcs(resource_type): resolved_func = helpers.resolve_ref(func) if resolved_func: resolved_func(response, db_object) def extends(resources): """Use to decorate methods on classes before initialization. Any classes that use this must themselves be decorated with the @has_resource_extenders decorator to setup the __new__ method to actually register the instance methods after initialization. :param resources: Resource collection names. The decorated method will be registered with each resource as an extend function. :type resources: list of str """ def decorator(method): _DECORATED_EXTEND_METHODS[method].extend(resources) return method return decorator def has_resource_extenders(klass): """Decorator to setup __new__ method in classes to extend resources. Any method decorated with @extends above is an unbound method on a class. This decorator sets up the class __new__ method to add the bound method to _resource_extend_functions after object instantiation. """ orig_new = klass.__new__ new_inherited = '__new__' not in klass.__dict__ @staticmethod def replacement_new(cls, *args, **kwargs): if new_inherited: # class didn't define __new__ so we need to call inherited __new__ super_new = super(klass, cls).__new__ if super_new is object.__new__: # object.__new__ doesn't accept args nor kwargs instance = super_new(cls) else: instance = super_new(cls, *args, **kwargs) else: instance = orig_new(cls, *args, **kwargs) if getattr(instance, _DECORATED_METHODS_REGISTERED, False): # Avoid running this logic twice for classes inheriting other # classes with this same decorator. Only one needs to execute # to subscribe all decorated methods. return instance for name, unbound_method in inspect.getmembers(cls): if (not inspect.ismethod(unbound_method) and not inspect.isfunction(unbound_method)): continue # Handle py27/py34 difference method = getattr(unbound_method, 'im_func', unbound_method) if method not in _DECORATED_EXTEND_METHODS: continue for resource in _DECORATED_EXTEND_METHODS[method]: # Register the bound method for the resourse register_funcs(resource, [method]) setattr(instance, _DECORATED_METHODS_REGISTERED, True) return instance klass.__new__ = replacement_new return klass neutron-lib-2.3.0/neutron_lib/db/model_query.py0000664000175000017500000003410613641427107021611 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """ NOTE: This module is a temporary shim until networking projects move to versioned objects at which point this module shouldn't be needed. """ from oslo_db.sqlalchemy import utils as sa_utils from sqlalchemy import sql, or_, and_ from neutron_lib._i18n import _ from neutron_lib.api import attributes from neutron_lib.db import utils as db_utils from neutron_lib import exceptions as n_exc from neutron_lib.objects import utils as obj_utils from neutron_lib.utils import helpers # Classes implementing extensions will register hooks into this dictionary # for "augmenting" the "core way" of building a query for retrieving objects # from a model class. Hooks are registered by invoking register_hook(). _model_query_hooks = { # model1 : { # hook1: { # 'query': query_hook, # 'filter': filter_hook, # 'result_filters': result_filters # }, # hook2: { # 'query': query_hook, # 'filter': filter_hook, # 'result_filters': result_filters # }, # ... # }, # model2 : { # hook1: { # 'query': query_hook, # 'filter': filter_hook, # 'result_filters': result_filters # }, # hook2: { # 'query': query_hook, # 'filter': filter_hook, # 'result_filters': result_filters # }, # ... # }, # ... } def register_hook(model, name, query_hook, filter_hook, result_filters=None): """Register a hook to be invoked when a query is executed. Adds the hook components to the _model_query_hooks dict. Models are the keys of this dict, whereas the value is another dict mapping hook names to callables performing the hook. :param model: The DB Model that the hook applies to. :param name: A name for the hook. :param query_hook: The method to be called to augment the query. :param filter_hook: A method to be called to augment the query filter. :param result_filters: A Method to be called to filter the query result. :returns: None. """ if callable(query_hook): query_hook = helpers.make_weak_ref(query_hook) if callable(filter_hook): filter_hook = helpers.make_weak_ref(filter_hook) if callable(result_filters): result_filters = helpers.make_weak_ref(result_filters) _model_query_hooks.setdefault(model, {})[name] = { 'query': query_hook, 'filter': filter_hook, 'result_filters': result_filters } def get_hooks(model): """Retrieve the model query hooks for a model. :param model: The DB Model to look up for query hooks. :returns: list of hooks """ return _model_query_hooks.get(model, {}).values() def query_with_hooks(context, model, field=None): """Query with hooks using the said context and model. :param context: The context to use for the DB session. :param model: The model to query. :param field: The column. :returns: The query with hooks applied to it. """ if field: if hasattr(model, field): field = getattr(model, field) else: msg = _("'%s' is not supported as field") % field raise n_exc.InvalidInput(error_message=msg) query = context.session.query(field) else: query = context.session.query(model) # define basic filter condition for model query query_filter = None if db_utils.model_query_scope_is_project(context, model): if hasattr(model, 'rbac_entries'): query = query.outerjoin(model.rbac_entries) rbac_model = model.rbac_entries.property.mapper.class_ query_filter = ( (model.tenant_id == context.tenant_id) | ((rbac_model.action == 'access_as_shared') & ((rbac_model.target_tenant == context.tenant_id) | (rbac_model.target_tenant == '*')))) elif hasattr(model, 'shared'): query_filter = ((model.tenant_id == context.tenant_id) | (model.shared == sql.true())) else: query_filter = (model.tenant_id == context.tenant_id) # Execute query hooks registered from mixins and plugins for hook in get_hooks(model): query_hook = helpers.resolve_ref(hook.get('query')) if query_hook: query = query_hook(context, model, query) filter_hook = helpers.resolve_ref(hook.get('filter')) if filter_hook: query_filter = filter_hook(context, model, query_filter) # NOTE(salvatore-orlando): 'if query_filter' will try to evaluate the # condition, raising an exception if query_filter is not None: query = query.filter(query_filter) return query def get_by_id(context, model, object_id): """Query the said model with the given context for a specific object. :param context: The context to use in the query. :param model: The model to query. :param object_id: The ID of the object to query for. :returns: The object with the give object_id for the said model. """ query = query_with_hooks(context=context, model=model) return query.filter(model.id == object_id).one() def apply_filters(query, model, filters, context=None): """Apply filters to a query. :param query: The query to apply filters to. :param model: The model for the query. :param filters: The filters to apply. :param context: The context to use for the DB session. :returns: The query with filters applied to it. """ if filters: for key, value in filters.items(): column = getattr(model, key, None) # NOTE(kevinbenton): if column is a hybrid property that # references another expression, attempting to convert to # a boolean will fail so we must compare to None. # See "An Important Expression Language Gotcha" in: # docs.sqlalchemy.org/en/rel_0_9/changelog/migration_06.html if column is not None: if not value: query = query.filter(sql.false()) return query if not hasattr(column, 'in_'): # NOTE(ralonsoh): since SQLAlchemy==1.3.0, a column is an # AssociationProxyInstance and inherits in_() method from # ColumnOperators. # association proxies don't support in_ so we have to # do multiple equals matches query = query.filter( or_(*[column == v for v in value])) elif isinstance(value, obj_utils.FilterObj): query = query.filter(value.filter(column)) elif None in value: # in_() operator does not support NULL element so we have # to do multiple equals matches query = query.filter( or_(*[column == v for v in value])) else: # NOTE(frickler): in_() isn't implemented for relations # yet, let this pass so it can be handled by the # result_filter hook try: query = query.filter(column.in_(value)) except NotImplementedError: pass elif key == 'shared' and hasattr(model, 'rbac_entries'): # translate a filter on shared into a query against the # object's rbac entries rbac = model.rbac_entries.property.mapper.class_ matches = [rbac.target_tenant == '*'] if context: matches.append(rbac.target_tenant == context.tenant_id) # any 'access_as_shared' records that match the # wildcard or requesting tenant is_shared = and_(rbac.action == 'access_as_shared', or_(*matches)) if not value[0]: # NOTE(kevinbenton): we need to find objects that don't # have an entry that matches the criteria above so # we use a subquery to exclude them. # We can't just filter the inverse of the query above # because that will still give us a network shared to # our tenant (or wildcard) if it's shared to another # tenant. # This is the column joining the table to rbac via # the object_id. We can't just use model.id because # subnets join on network.id so we have to inspect the # relationship. join_cols = model.rbac_entries.property.local_columns oid_col = list(join_cols)[0] is_shared = ~oid_col.in_( query.session.query(rbac.object_id).filter(is_shared) ) elif (not context or not db_utils.model_query_scope_is_project( context, model)): # we only want to join if we aren't using the subquery # and if we aren't already joined because this is a # scoped query query = query.outerjoin(model.rbac_entries) query = query.filter(is_shared) for hook in get_hooks(model): result_filter = helpers.resolve_ref( hook.get('result_filters', None)) if result_filter: query = result_filter(query, filters) return query def get_collection_query(context, model, filters=None, sorts=None, limit=None, marker_obj=None, page_reverse=False): """Get a collection query. :param context: The context to use for the DB session. :param model: The model to use. :param filters: The filters to apply in the query. :param sorts: The sort keys to use. :param limit: The limit associated with the query. :param marker_obj: The marker object if applicable. :param page_reverse: If reverse paging should be used. :returns: A paginated query for the said model. """ collection = query_with_hooks(context, model) collection = apply_filters(collection, model, filters, context) if sorts: sort_keys = db_utils.get_and_validate_sort_keys(sorts, model) sort_dirs = db_utils.get_sort_dirs(sorts, page_reverse) # we always want deterministic results for sorted queries # so add unique keys to limit queries when present. # (http://docs.sqlalchemy.org/en/latest/orm/ # loading_relationships.html#subqueryload-ordering) # (http://docs.sqlalchemy.org/en/latest/faq/ # ormconfiguration.html#faq-subqueryload-limit-sort) for k in _unique_keys(model): if k not in sort_keys: sort_keys.append(k) sort_dirs.append('asc') collection = sa_utils.paginate_query(collection, model, limit, marker=marker_obj, sort_keys=sort_keys, sort_dirs=sort_dirs) return collection def _unique_keys(model): # just grab first set of unique keys and use them. # if model has no unqiue sets, 'paginate_query' will # warn if sorting is unstable uk_sets = sa_utils.get_unique_keys(model) return uk_sets[0] if uk_sets else [] def get_collection(context, model, dict_func, filters=None, fields=None, sorts=None, limit=None, marker_obj=None, page_reverse=False): """Get a collection for a said model. :param context: The context to use for the DB session. :param model: The model for the collection. :param dict_func: The function used to build the collection dict. :param filters: The filters to apply. :param fields: The fields to collect. :param sorts: The sort keys to use. :param limit: The limit for the query if applicable. :param marker_obj: The marker object if applicable. :param page_reverse: If reverse paging should be used. :returns: A list of dicts where each dict is an object in the collection. """ query = get_collection_query(context, model, filters=filters, sorts=sorts, limit=limit, marker_obj=marker_obj, page_reverse=page_reverse) items = [ attributes.populate_project_info( dict_func(c, fields) if dict_func else c) for c in query ] if limit and page_reverse: items.reverse() return items def get_values(context, model, field, filters=None): query = query_with_hooks(context, model, field=field) query = apply_filters(query, model, filters, context) return [c[0] for c in query] def get_collection_count(context, model, filters=None): """Get the count for a specific collection. :param context: The context to use for the DB session. :param model: The model for the query. :param filters: The filters to apply. :returns: The number of objects for said model with filters applied. """ return get_collection_query(context, model, filters).count() neutron-lib-2.3.0/neutron_lib/db/__init__.py0000664000175000017500000000000013641427107021005 0ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/db/model_base.py0000664000175000017500000000711213641427107021353 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from oslo_db.sqlalchemy import models from oslo_utils import uuidutils import sqlalchemy as sa from sqlalchemy.ext import declarative from sqlalchemy import orm from neutron_lib.db import constants as db_const class HasProject(object): """Project mixin, add to subclasses that have a user.""" # NOTE: project_id is just a free form string project_id = sa.Column(sa.String(db_const.PROJECT_ID_FIELD_SIZE), index=True) def get_tenant_id(self): return self.project_id def set_tenant_id(self, value): self.project_id = value @declarative.declared_attr def tenant_id(cls): return orm.synonym( 'project_id', descriptor=property(cls.get_tenant_id, cls.set_tenant_id)) class HasProjectNoIndex(HasProject): """Project mixin, add to subclasses that have a user.""" # NOTE: project_id is just a free form string project_id = sa.Column(sa.String(db_const.PROJECT_ID_FIELD_SIZE)) class HasProjectPrimaryKeyIndex(HasProject): """Project mixin, add to subclasses that have a user.""" # NOTE: project_id is just a free form string project_id = sa.Column(sa.String(db_const.PROJECT_ID_FIELD_SIZE), nullable=False, primary_key=True, index=True) class HasProjectPrimaryKey(HasProject): """Project mixin, add to subclasses that have a user.""" # NOTE: project_id is just a free form string project_id = sa.Column(sa.String(db_const.PROJECT_ID_FIELD_SIZE), nullable=False, primary_key=True) class HasId(object): """id mixin, add to subclasses that have an id.""" id = sa.Column(sa.String(db_const.UUID_FIELD_SIZE), primary_key=True, default=uuidutils.generate_uuid) class HasStatusDescription(object): """Status with description mixin.""" status = sa.Column(sa.String(db_const.STATUS_FIELD_SIZE), nullable=False) status_description = sa.Column(sa.String(db_const.DESCRIPTION_FIELD_SIZE)) class _NeutronBase(models.ModelBase): """Base class for Neutron Models.""" __table_args__ = {'mysql_engine': 'InnoDB'} def __iter__(self): self._i = iter(orm.object_mapper(self).columns) return self def next(self): n = next(self._i).name return n, getattr(self, n) __next__ = next def __repr__(self): """sqlalchemy based automatic __repr__ method.""" items = ['%s=%r' % (col.name, getattr(self, col.name)) for col in self.__table__.columns] return "<%s.%s[object at %x] {%s}>" % (self.__class__.__module__, self.__class__.__name__, id(self), ', '.join(items)) class NeutronBaseV2(_NeutronBase): @declarative.declared_attr def __tablename__(cls): # Use the pluralized name of the class as the table name. return cls.__name__.lower() + 's' BASEV2 = declarative.declarative_base(cls=NeutronBaseV2) neutron-lib-2.3.0/neutron_lib/exceptions/0000775000175000017500000000000013641427200020474 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib/exceptions/external_net.py0000664000175000017500000000160613641427107023547 0ustar zuulzuul00000000000000# Copyright (c) 2013 OpenStack Foundation. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class ExternalNetworkInUse(exceptions.InUse): message = _("External network %(net_id)s cannot be updated to be made " "non-external, since it has existing gateway ports.") neutron-lib-2.3.0/neutron_lib/exceptions/vlantransparent.py0000664000175000017500000000160613641427107024301 0ustar zuulzuul00000000000000# Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class VlanTransparencyDriverError(exceptions.NeutronException): """Vlan Transparency not supported by all mechanism drivers.""" message = _("Backend does not support VLAN Transparency.") neutron-lib-2.3.0/neutron_lib/exceptions/multiprovidernet.py0000664000175000017500000000170713641427107024475 0ustar zuulzuul00000000000000# Copyright (c) 2013 OpenStack Foundation. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class SegmentsSetInConjunctionWithProviders(exceptions.InvalidInput): message = _("Segments and provider values cannot both be set.") class SegmentsContainDuplicateEntry(exceptions.InvalidInput): message = _("Duplicate segment entry in request.") neutron-lib-2.3.0/neutron_lib/exceptions/l3.py0000664000175000017500000000677113641427107021405 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions # L3 Exceptions class RouterNotFound(exceptions.NotFound): message = _("Router %(router_id)s could not be found") class RouterInUse(exceptions.InUse): message = _("Router %(router_id)s %(reason)s") def __init__(self, **kwargs): if 'reason' not in kwargs: kwargs['reason'] = "still has ports" super(RouterInUse, self).__init__(**kwargs) class RouterInterfaceNotFound(exceptions.NotFound): message = _("Router %(router_id)s does not have " "an interface with id %(port_id)s") class RouterInterfaceNotFoundForSubnet(exceptions.NotFound): message = _("Router %(router_id)s has no interface " "on subnet %(subnet_id)s") class RouterInterfaceInUseByFloatingIP(exceptions.InUse): message = _("Router interface for subnet %(subnet_id)s on router " "%(router_id)s cannot be deleted, as it is required " "by one or more floating IPs.") class FloatingIPNotFound(exceptions.NotFound): message = _("Floating IP %(floatingip_id)s could not be found") class ExternalGatewayForFloatingIPNotFound(exceptions.NotFound): message = _("External network %(external_network_id)s is not reachable " "from subnet %(subnet_id)s. Therefore, cannot associate " "Port %(port_id)s with a Floating IP.") class FloatingIPPortAlreadyAssociated(exceptions.InUse): message = _("Cannot associate floating IP %(floating_ip_address)s " "(%(fip_id)s) with port %(port_id)s " "using fixed IP %(fixed_ip)s, as that fixed IP already " "has a floating IP on external network %(net_id)s.") class RouterExternalGatewayInUseByFloatingIp(exceptions.InUse): message = _("Gateway cannot be updated for router %(router_id)s, since a " "gateway to external network %(net_id)s is required by one or " "more floating IPs.") class RouterInterfaceAttachmentConflict(exceptions.Conflict): message = _("Error %(reason)s while attempting the operation.") class RouterNotCompatibleWithAgent(exceptions.NeutronException): message = _("Router '%(router_id)s' is not compatible with this agent.") class RouterNotFoundInRouterFactory(exceptions.NeutronException): message = _("Router '%(router_id)s' with features '%(features)s' could " "not be found in the router factory.") class FloatingIpSetupException(exceptions.NeutronException): def __init__(self, message=None): self.message = message super(FloatingIpSetupException, self).__init__() class AbortSyncRouters(exceptions.NeutronException): message = _("Aborting periodic_sync_routers_task due to an error.") class IpTablesApplyException(exceptions.NeutronException): def __init__(self, message=None): self.message = message super(IpTablesApplyException, self).__init__() neutron-lib-2.3.0/neutron_lib/exceptions/l3_ext_ha_mode.py0000664000175000017500000000331013641427107023723 0ustar zuulzuul00000000000000# Copyright (C) 2014 eNovance SAS # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class MaxVRIDAllocationTriesReached(exceptions.NeutronException): message = _("Failed to allocate a VRID in the network %(network_id)s " "for the router %(router_id)s after %(max_tries)s tries.") class NoVRIDAvailable(exceptions.Conflict): message = _("No more Virtual Router Identifier (VRID) available when " "creating router %(router_id)s. The limit of number " "of HA Routers per tenant is 254.") class HANetworkConcurrentDeletion(exceptions.Conflict): message = _("Network for tenant %(tenant_id)s concurrently deleted.") class HANetworkCIDRNotValid(exceptions.NeutronException): message = _("The HA Network CIDR specified in the configuration file " "isn't valid; %(cidr)s.") class HAMaximumAgentsNumberNotValid(exceptions.NeutronException): message = _("max_l3_agents_per_router %(max_agents)s config parameter " "is not valid as it cannot be negative. It must be 1 or " "greater. Alternatively, it can be 0 to mean unlimited.") neutron-lib-2.3.0/neutron_lib/exceptions/agent.py0000664000175000017500000000211113641427107022145 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class AgentNotFound(exceptions.NotFound): message = _("Agent %(id)s could not be found.") class AgentNotFoundByTypeHost(exceptions.NotFound): message = _("Agent with agent_type=%(agent_type)s and host=%(host)s " "could not be found.") class MultipleAgentFoundByTypeHost(exceptions.Conflict): message = _("Multiple agents with agent_type=%(agent_type)s and " "host=%(host)s found.") neutron-lib-2.3.0/neutron_lib/exceptions/flavors.py0000664000175000017500000000362213641427107022533 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class FlavorNotFound(exceptions.NotFound): message = _("Flavor %(flavor_id)s could not be found.") class FlavorInUse(exceptions.InUse): message = _("Flavor %(flavor_id)s is used by some service instance.") class ServiceProfileNotFound(exceptions.NotFound): message = _("Service Profile %(sp_id)s could not be found.") class ServiceProfileInUse(exceptions.InUse): message = _("Service Profile %(sp_id)s is used by some service instance.") class FlavorServiceProfileBindingExists(exceptions.Conflict): message = _("Service Profile %(sp_id)s is already associated " "with flavor %(fl_id)s.") class FlavorServiceProfileBindingNotFound(exceptions.NotFound): message = _("Service Profile %(sp_id)s is not associated " "with flavor %(fl_id)s.") class ServiceProfileDriverNotFound(exceptions.NotFound): message = _("Service Profile driver %(driver)s could not be found.") class ServiceProfileEmpty(exceptions.InvalidInput): message = _("Service Profile needs either a driver or metainfo.") class FlavorDisabled(exceptions.ServiceUnavailable): message = _("Flavor is not enabled.") class ServiceProfileDisabled(exceptions.ServiceUnavailable): message = _("Service Profile is not enabled.") neutron-lib-2.3.0/neutron_lib/exceptions/vpn.py0000664000175000017500000001455513641427107021671 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions # VPNaaS Exceptions class VPNServiceNotFound(exceptions.NotFound): message = _("VPNService %(vpnservice_id)s could not be found") class IPsecSiteConnectionNotFound(exceptions.NotFound): message = _("ipsec_site_connection %(ipsec_site_conn_id)s not found") class IPsecSiteConnectionDpdIntervalValueError(exceptions.InvalidInput): message = _("ipsec_site_connection %(attr)s is " "equal to or less than dpd_interval") class IPsecSiteConnectionMtuError(exceptions.InvalidInput): message = _("ipsec_site_connection MTU %(mtu)d is too small " "for ipv%(version)s") class IPsecSiteConnectionPeerCidrError(exceptions.InvalidInput): message = _("ipsec_site_connection peer cidr %(peer_cidr)s is " "invalid CIDR") class IKEPolicyNotFound(exceptions.NotFound): message = _("IKEPolicy %(ikepolicy_id)s could not be found") class IPsecPolicyNotFound(exceptions.NotFound): message = _("IPsecPolicy %(ipsecpolicy_id)s could not be found") class IKEPolicyInUse(exceptions.InUse): message = _("IKEPolicy %(ikepolicy_id)s is in use by existing " "IPsecSiteConnection and can't be updated or deleted") class VPNServiceInUse(exceptions.InUse): message = _("VPNService %(vpnservice_id)s is still in use") class SubnetInUseByVPNService(exceptions.InUse): message = _("Subnet %(subnet_id)s is used by VPNService %(vpnservice_id)s") class SubnetInUseByEndpointGroup(exceptions.InUse): message = _("Subnet %(subnet_id)s is used by endpoint group %(group_id)s") class SubnetInUseByIPsecSiteConnection(exceptions.InUse): message = _("Subnet %(subnet_id)s is used by ipsec site connection " "%(ipsec_site_connection_id)s") class VPNStateInvalidToUpdate(exceptions.BadRequest): message = _("Invalid state %(state)s of vpnaas resource %(id)s " "for updating") class IPsecPolicyInUse(exceptions.InUse): message = _("IPsecPolicy %(ipsecpolicy_id)s is in use by existing " "IPsecSiteConnection and can't be updated or deleted") class DeviceDriverImportError(exceptions.NeutronException): message = _("Can not load driver :%(device_driver)s") class SubnetIsNotConnectedToRouter(exceptions.BadRequest): message = _("Subnet %(subnet_id)s is not " "connected to Router %(router_id)s") class RouterIsNotExternal(exceptions.BadRequest): message = _("Router %(router_id)s has no external network gateway set") class VPNPeerAddressNotResolved(exceptions.InvalidInput): message = _("Peer address %(peer_address)s cannot be resolved") class ExternalNetworkHasNoSubnet(exceptions.BadRequest): message = _("Router's %(router_id)s external network has " "no %(ip_version)s subnet") # VPN Endpoint Group Exceptions class VPNEndpointGroupNotFound(exceptions.NotFound): message = _("Endpoint group %(endpoint_group_id)s could not be found") class InvalidEndpointInEndpointGroup(exceptions.InvalidInput): message = _("Endpoint '%(endpoint)s' is invalid for group " "type '%(group_type)s': %(why)s") class MissingEndpointForEndpointGroup(exceptions.BadRequest): message = _("No endpoints specified for endpoint group '%(group)s'") class NonExistingSubnetInEndpointGroup(exceptions.InvalidInput): message = _("Subnet %(subnet)s in endpoint group does not exist") class MixedIPVersionsForIPSecEndpoints(exceptions.BadRequest): message = _("Endpoints in group %(group)s do not have the same IP " "version, as required for IPSec site-to-site connection") class MixedIPVersionsForPeerCidrs(exceptions.BadRequest): message = _("Peer CIDRs do not have the same IP version, as required " "for IPSec site-to-site connection") class MixedIPVersionsForIPSecConnection(exceptions.BadRequest): message = _("IP versions are not compatible between peer and local " "endpoints") class InvalidEndpointGroup(exceptions.BadRequest): message = _("Endpoint group%(suffix)s %(which)s cannot be specified, " "when VPN Service has subnet specified") class WrongEndpointGroupType(exceptions.BadRequest): message = _("Endpoint group %(which)s type is '%(group_type)s' and " "should be '%(expected)s'") class PeerCidrsInvalid(exceptions.BadRequest): message = _("Peer CIDRs cannot be specified, when using endpoint " "groups") class MissingPeerCidrs(exceptions.BadRequest): message = _("Missing peer CIDRs for IPsec site-to-site connection") class MissingRequiredEndpointGroup(exceptions.BadRequest): message = _("Missing endpoint group%(suffix)s %(which)s for IPSec " "site-to-site connection") class EndpointGroupInUse(exceptions.BadRequest): message = _("Endpoint group %(group_id)s is in use and cannot be deleted") # VPN Flavors Exceptions class FlavorsPluginNotLoaded(exceptions.NotFound): message = _("Flavors plugin not found") class NoProviderFoundForFlavor(exceptions.NotFound): message = _("No service provider found for flavor %(flavor_id)s") # IPsec Service Driver Validator Exceptions class IpsecValidationFailure(exceptions.BadRequest): message = _("IPSec does not support %(resource)s attribute %(key)s " "with value '%(value)s'") class IkeValidationFailure(exceptions.BadRequest): message = _("IKE does not support %(resource)s attribute %(key)s " "with value '%(value)s'") # Cisco Csr Driver Exceptions class CsrInternalError(exceptions.NeutronException): message = _("Fatal - %(reason)s") # Cisco CSR Driver Validator Exceptions class CsrValidationFailure(exceptions.BadRequest): message = _("Cisco CSR does not support %(resource)s attribute %(key)s " "with value '%(value)s'") neutron-lib-2.3.0/neutron_lib/exceptions/dns.py0000664000175000017500000000240513641427107021641 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class DNSDomainNotFound(exceptions.NotFound): message = _("Domain %(dns_domain)s not found in the external DNS service") class DuplicateRecordSet(exceptions.Conflict): message = _("Name %(dns_name)s is duplicated in the external DNS service") class ExternalDNSDriverNotFound(exceptions.NotFound): message = _("External DNS driver %(driver)s could not be found.") class InvalidPTRZoneConfiguration(exceptions.Conflict): message = _("Value of %(parameter)s has to be multiple of %(number)s, " "with maximum value of %(maximum)s and minimum value of " "%(minimum)s") neutron-lib-2.3.0/neutron_lib/exceptions/dhcpagentscheduler.py0000664000175000017500000000232613641427107024713 0ustar zuulzuul00000000000000# Copyright (c) 2013 OpenStack Foundation. # All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions from neutron_lib.exceptions import agent as agent_exc class InvalidDHCPAgent(agent_exc.AgentNotFound): message = _("Agent %(id)s is not a valid DHCP Agent or has been disabled.") class NetworkHostedByDHCPAgent(exceptions.Conflict): message = _("The network %(network_id)s has been already hosted" " by the DHCP Agent %(agent_id)s.") class NetworkNotHostedByDhcpAgent(exceptions.Conflict): message = _("The network %(network_id)s is not hosted" " by the DHCP Agent %(agent_id)s.") neutron-lib-2.3.0/neutron_lib/exceptions/dvr.py0000664000175000017500000000154613641427107021655 0ustar zuulzuul00000000000000# Copyright (c) 2014 OpenStack Foundation. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class DVRMacAddressNotFound(exceptions.NotFound): message = _("Distributed Virtual Router Mac Address for " "host %(host)s does not exist.") neutron-lib-2.3.0/neutron_lib/exceptions/extraroute.py0000664000175000017500000000234213641427107023257 0ustar zuulzuul00000000000000# Copyright 2013, Nachi Ueno, NTT MCL, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class InvalidRoutes(exceptions.InvalidInput): message = _("Invalid format for routes: %(routes)s, %(reason)s") class RouterInterfaceInUseByRoute(exceptions.InUse): message = _("Router interface for subnet %(subnet_id)s on router " "%(router_id)s cannot be deleted, as it is required " "by one or more routes.") class RoutesExhausted(exceptions.BadRequest): message = _("Unable to complete operation for %(router_id)s. " "The number of routes exceeds the maximum %(quota)s.") neutron-lib-2.3.0/neutron_lib/exceptions/qos.py0000664000175000017500000000726513641427107021670 0ustar zuulzuul00000000000000# Copyright 2011 VMware, Inc # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions as e class QosPolicyNotFound(e.NotFound): message = _("QoS policy %(policy_id)s could not be found.") class QosRuleNotFound(e.NotFound): message = _("QoS rule %(rule_id)s for policy %(policy_id)s " "could not be found.") class QoSPolicyDefaultAlreadyExists(e.Conflict): message = _("A default QoS policy exists for project %(project_id)s.") class PortQosBindingNotFound(e.NotFound): message = _("QoS binding for port %(port_id)s and policy %(policy_id)s " "could not be found.") class PortQosBindingError(e.NeutronException): message = _("QoS binding for port %(port_id)s and policy %(policy_id)s " "could not be created: %(db_error)s.") class NetworkQosBindingNotFound(e.NotFound): message = _("QoS binding for network %(net_id)s and policy %(policy_id)s " "could not be found.") class FloatingIPQosBindingNotFound(e.NotFound): message = _("QoS binding for floating IP %(fip_id)s and policy " "%(policy_id)s could not be found.") class QosPolicyInUse(e.InUse): message = _("QoS Policy %(policy_id)s is used by " "%(object_type)s %(object_id)s.") class FloatingIPQosBindingError(e.NeutronException): message = _("QoS binding for floating IP %(fip_id)s and policy " "%(policy_id)s could not be created: %(db_error)s.") class NetworkQosBindingError(e.NeutronException): message = _("QoS binding for network %(net_id)s and policy %(policy_id)s " "could not be created: %(db_error)s.") class QosRuleNotSupported(e.Conflict): message = _("Rule %(rule_type)s is not supported by port %(port_id)s") class QoSRuleParameterConflict(e.Conflict): message = _("Unable to add the rule with value %(rule_value)s to the " "policy %(policy_id)s as the existing rule of type " "%(existing_rule)s restricts the bandwidth to " "%(existing_value)s.") class QoSRulesConflict(e.Conflict): message = _("Rule %(new_rule_type)s conflicts with " "rule %(rule_id)s which already exists in " "QoS Policy %(policy_id)s.") class PolicyRemoveAuthorizationError(e.NotAuthorized): message = _("Failed to remove provided policy %(policy_id)s " "because you are not authorized.") class TcLibQdiscTypeError(e.NeutronException): message = _("TC Qdisc type %(qdisc_type)s is not supported; supported " "types: %(supported_qdisc_types)s.") class TcLibQdiscNeededArguments(e.NeutronException): message = _("TC Qdisc type %(qdisc_type)s needs following arguments: " "%(needed_arguments)s.") class RouterQosBindingNotFound(e.NotFound): message = _("QoS binding for router %(router_id)s gateway and policy " "%(policy_id)s could not be found.") class RouterQosBindingError(e.NeutronException): message = _("QoS binding for router %(router_id)s gateway and policy " "%(policy_id)s could not be created: %(db_error)s.") neutron-lib-2.3.0/neutron_lib/exceptions/port_security.py0000664000175000017500000000207613641427107023774 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class PortSecurityPortHasSecurityGroup(exceptions.InUse): message = _("Port has security group associated. Cannot disable port " "security or IP address until security group is removed.") class PortSecurityAndIPRequiredForSecurityGroups(exceptions.InvalidInput): message = _("Port security must be enabled and port must have an IP " "address in order to use security groups.") neutron-lib-2.3.0/neutron_lib/exceptions/address_scope.py0000664000175000017500000000256513641427107023702 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class AddressScopeNotFound(exceptions.NotFound): message = _("Address scope %(address_scope_id)s could not be found.") class AddressScopeInUse(exceptions.InUse): message = _("Unable to complete operation on " "address scope %(address_scope_id)s. There are one or more " "subnet pools in use on the address scope.") class AddressScopeUpdateError(exceptions.BadRequest): message = _("Unable to update address scope %(address_scope_id)s : " "%(reason)s.") class NetworkAddressScopeAffinityError(exceptions.BadRequest): message = _("Subnets of the same address family hosted on the same " "network must all participate in the same address scope.") neutron-lib-2.3.0/neutron_lib/exceptions/allowedaddresspairs.py0000664000175000017500000000252413641427107025113 0ustar zuulzuul00000000000000# Copyright 2013 VMware, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class AllowedAddressPairsMissingIP(exceptions.InvalidInput): message = _("AllowedAddressPair must contain ip_address") class AddressPairAndPortSecurityRequired(exceptions.Conflict): message = _("Port Security must be enabled in order to have allowed " "address pairs on a port.") class DuplicateAddressPairInRequest(exceptions.InvalidInput): message = _("Request contains duplicate address pair: " "mac_address %(mac_address)s ip_address %(ip_address)s.") class AllowedAddressPairExhausted(exceptions.BadRequest): message = _("The number of allowed address pair " "exceeds the maximum %(quota)s.") neutron-lib-2.3.0/neutron_lib/exceptions/metering.py0000664000175000017500000000226013641427107022666 0ustar zuulzuul00000000000000# Copyright (C) 2013 eNovance SAS # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class MeteringLabelNotFound(exceptions.NotFound): message = _("Metering label '%(label_id)s' does not exist.") class DuplicateMeteringRuleInPost(exceptions.InUse): message = _("Duplicate Metering Rule in POST.") class MeteringLabelRuleNotFound(exceptions.NotFound): message = _("Metering label rule '%(rule_id)s' does not exist.") class MeteringLabelRuleOverlaps(exceptions.Conflict): message = _("Metering label rule with remote_ip_prefix " "'%(remote_ip_prefix)s' overlaps another.") neutron-lib-2.3.0/neutron_lib/exceptions/network_segment_range.py0000664000175000017500000000300313641427107025437 0ustar zuulzuul00000000000000# Copyright (c) 2018 Intel Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class NetworkSegmentRangeNetTypeNotSupported(exceptions.BadRequest): message = _("Network type %(type)s does not support " "network segment ranges.") class NetworkSegmentRangeNotFound(exceptions.NotFound): message = _("Network Segment Range %(range_id)s could not be found.") class NetworkSegmentRangeReferencedByProject(exceptions.InUse): message = _("Network Segment Range %(range_id)s is referenced by " "one or more tenant networks.") class NetworkSegmentRangeDefaultReadOnly(exceptions.BadRequest): message = _("Network Segment Range %(range_id)s is a " "default segment range which could not be updated or deleted.") class NetworkSegmentRangeOverlaps(exceptions.Conflict): message = _("Network segment range overlaps with range(s) " "with id %(range_id)s") neutron-lib-2.3.0/neutron_lib/exceptions/firewall_v2.py0000664000175000017500000001420413641427107023271 0ustar zuulzuul00000000000000# Copyright (c) 2016 Mirantis, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class FirewallGroupNotFound(exceptions.NotFound): message = _("Firewall group %(firewall_id)s could not be found.") class FirewallGroupInUse(exceptions.InUse): message = _("Firewall group %(firewall_id)s is still active.") class FirewallGroupInPendingState(exceptions.Conflict): message = _("Operation cannot be performed since associated firewall " "group %(firewall_id)s is in %(pending_state)s.") class FirewallGroupPortInvalid(exceptions.Conflict): message = _("Port %(port_id)s of firewall group is invalid.") class FirewallGroupPortInvalidProject(exceptions.Conflict): message = _("Operation cannot be performed as port %(port_id)s " "is in an invalid project %(project_id)s.") class FirewallGroupPortInUse(exceptions.InUse): message = _("Port(s) %(port_ids)s provided already associated with " "other firewall group(s).") class FirewallPolicyNotFound(exceptions.NotFound): message = _("Firewall policy %(firewall_policy_id)s could not be found.") class FirewallPolicyInUse(exceptions.InUse): message = _("Firewall policy %(firewall_policy_id)s is being used.") class FirewallPolicyConflict(exceptions.NotFound): """FWaaS exception raised for firewall policy conflict Raised when user tries to use another project's unshared policy. """ message = _("Operation cannot be performed since firewall policy " "%(firewall_policy_id)s for your project could not be found. " "Please confirm if the firewall policy exists and is shared.") class FirewallRuleSharingConflict(exceptions.NotFound): """FWaaS exception for sharing policies Raised when shared policy uses unshared rules. """ message = _("Operation cannot be performed since firewall policy " "%(firewall_policy_id)s could not find the firewall rule " "%(firewall_rule_id)s. Please confirm if the firewall rule " "exists and is shared.") class FirewallPolicySharingConflict(exceptions.Conflict): """FWaaS exception raised for sharing policies Raised if policy is 'shared' but its associated rules are not. """ message = _("Operation cannot be performed. Before sharing firewall " "policy %(firewall_policy_id)s, share associated firewall " "rule %(firewall_rule_id)s.") class FirewallRuleNotFound(exceptions.NotFound): message = _("Firewall rule %(firewall_rule_id)s could not be found.") class FirewallRuleInUse(exceptions.InUse): message = _("Firewall rule %(firewall_rule_id)s is being used.") class FirewallRuleNotAssociatedWithPolicy(exceptions.InvalidInput): message = _("Firewall rule %(firewall_rule_id)s is not associated " "with firewall policy %(firewall_policy_id)s.") class FirewallRuleInvalidProtocol(exceptions.InvalidInput): message = _("Protocol %(protocol)s is not supported. " "Only protocol values %(values)s and their integer " "representation (0 to 255) are supported.") class FirewallRuleInvalidAction(exceptions.InvalidInput): message = _("Action %(action)s is not supported. " "Only action values %(values)s are supported.") class FirewallRuleInvalidICMPParameter(exceptions.InvalidInput): message = _("%(param)s are not allowed when protocol " "is set to ICMP.") class FirewallRuleWithPortWithoutProtocolInvalid(exceptions.InvalidInput): message = _("Source/destination port requires a protocol.") class FirewallRuleInvalidPortValue(exceptions.InvalidInput): message = _("Invalid value for port %(port)s.") class FirewallRuleInfoMissing(exceptions.InvalidInput): message = _("Missing rule info argument for insert/remove " "rule operation.") class FirewallIpAddressConflict(exceptions.InvalidInput): message = _("Invalid input - IP addresses do not agree with IP Version.") class FirewallInternalDriverError(exceptions.NeutronException): """FWaaS exception for all driver errors On any failure or exception in the driver, driver should log it and raise this exception to the agent """ message = _("%(driver)s: Internal driver error.") class FirewallRuleConflict(exceptions.Conflict): """FWaaS rule conflict exception Occurs when admin policy tries to use another project's rule that is not shared. """ message = _("Operation cannot be performed since firewall rule " "%(firewall_rule_id)s is not shared and belongs to " "another project %(project_id)s.") class FirewallRuleAlreadyAssociated(exceptions.Conflict): """FWaaS exception for an already associated rule Occurs when there is an attempt to assign a rule to a policy that the rule is already associated with. """ message = _("Operation cannot be performed since firewall rule " "%(firewall_rule_id)s is already associated with firewall " "policy %(firewall_policy_id)s.") class FirewallGroupCannotRemoveDefault(exceptions.InUse): message = _("Deleting default firewall group not allowed.") class FirewallGroupCannotUpdateDefault(exceptions.InUse): message = _("Updating default firewall group not allowed.") class FirewallGroupDefaultAlreadyExists(exceptions.InUse): """Default firewall group conflict exception Occurs when a user creates firewall group named 'default'. """ message = _("Default firewall group already exists. 'default' is the " "reserved name for firewall group.") neutron-lib-2.3.0/neutron_lib/exceptions/placement.py0000664000175000017500000000604313641427107023027 0ustar zuulzuul00000000000000# All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class PlacementEndpointNotFound(exceptions.NotFound): message = _("Placement API endpoint not found.") class PlacementResourceNotFound(exceptions.NotFound): message = _("Placement resource not found on url: %(url)s.") class PlacementResourceProviderNotFound(exceptions.NotFound): message = _("Placement resource provider not found %(resource_provider)s.") class PlacementResourceProviderGenerationConflict(exceptions.Conflict): message = _("Placement resource provider generation does not match with " "the server side for resource provider: " "%(resource_provider)s with generation %(generation)s.") class PlacementInventoryNotFound(exceptions.NotFound): message = _("Placement inventory not found for resource provider " "%(resource_provider)s, resource class %(resource_class)s.") class PlacementInventoryUpdateConflict(exceptions.Conflict): message = _("Placement inventory update conflict for resource provider " "%(resource_provider)s, resource class %(resource_class)s.") class PlacementAggregateNotFound(exceptions.NotFound): message = _("Aggregate not found for resource provider " "%(resource_provider)s.") class PlacementTraitNotFound(exceptions.NotFound): message = _("Placement trait not found %(trait)s.") class PlacementResourceClassNotFound(exceptions.NotFound): message = _("Placement resource class not found %(resource_class)s") class PlacementAPIVersionIncorrect(exceptions.NotFound): message = _("Placement API version %(current_version)s, do not meet the " "needed version %(needed_version)s.") class PlacementResourceProviderNameNotUnique(exceptions.Conflict): message = _("Another resource provider exists with the provided name: " "%(name)s.") class PlacementClientError(exceptions.NeutronException): message = _("Placement Client Error (4xx): %(msg)s") class UnknownResourceProvider(exceptions.BadRequest): """Resource provider not known by neutron backends.""" message = _("No such resource provider known by Neutron: %(rsc_provider)s") class AmbiguousResponsibilityForResourceProvider(exceptions.NeutronException): """Not clear who's responsible for resource provider.""" message = _("Expected one driver to be responsible for resource provider " "%(rsc_provider)s, but got many: %(drivers)s") neutron-lib-2.3.0/neutron_lib/exceptions/__init__.py0000664000175000017500000006425213641427107022624 0ustar zuulzuul00000000000000# Copyright 2011 VMware, Inc, 2015 A10 Networks, Inc # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. """ Neutron base exception handling. """ from oslo_utils import excutils from neutron_lib._i18n import _ class NeutronException(Exception): """Base Neutron Exception. To correctly use this class, inherit from it and define a 'message' property. That message will get printf'd with the keyword arguments provided to the constructor. """ message = _("An unknown exception occurred.") def __init__(self, **kwargs): try: super(NeutronException, self).__init__(self.message % kwargs) self.msg = self.message % kwargs except Exception: with excutils.save_and_reraise_exception() as ctxt: if not self.use_fatal_exceptions(): ctxt.reraise = False # at least get the core message out if something happened super(NeutronException, self).__init__(self.message) def __str__(self): return self.msg def use_fatal_exceptions(self): """Is the instance using fatal exceptions. :returns: Always returns False. """ return False class BadRequest(NeutronException): """An exception indicating a generic bad request for a said resource. A generic exception indicating a bad request for a specified resource. :param resource: The resource requested. :param msg: A message indicating why the request is bad. """ message = _('Bad %(resource)s request: %(msg)s.') class NotFound(NeutronException): """A generic not found exception.""" pass class Conflict(NeutronException): """A generic conflict exception.""" pass class NotAuthorized(NeutronException): """A generic not authorized exception.""" message = _("Not authorized.") class ServiceUnavailable(NeutronException): """A generic service unavailable exception.""" message = _("The service is unavailable.") class AdminRequired(NotAuthorized): """A not authorized exception indicating an admin is required. A specialization of the NotAuthorized exception that indicates and admin is required to carry out the operation or access a resource. :param reason: A message indicating additional details on why admin is required for the operation access. """ message = _("User does not have admin privileges: %(reason)s.") class ObjectNotFound(NotFound): """A not found exception indicating an identifiable object isn't found. A specialization of the NotFound exception indicating an object with a said ID doesn't exist. :param id: The ID of the (not found) object. """ message = _("Object %(id)s not found.") class NetworkNotFound(NotFound): """An exception indicating a network was not found. A specialization of the NotFound exception indicating a requested network could not be found. :param net_id: The UUID of the (not found) network requested. """ message = _("Network %(net_id)s could not be found.") class SubnetNotFound(NotFound): """An exception for a requested subnet that's not found. A specialization of the NotFound exception indicating a requested subnet could not be found. :param subnet_id: The UUID of the (not found) subnet that was requested. """ message = _("Subnet %(subnet_id)s could not be found.") class PortNotFound(NotFound): """An exception for a requested port that's not found. A specialization of the NotFound exception indicating a requested port could not be found. :param port_id: The UUID of the (not found) port that was requested. """ message = _("Port %(port_id)s could not be found.") class PortNotFoundOnNetwork(NotFound): """An exception for a requested port on a network that's not found. A specialization of the NotFound exception that indicates a specified port on a specified network doesn't exist. :param port_id: The UUID of the (not found) port that was requested. :param net_id: The UUID of the network that was requested for the port. """ message = _("Port %(port_id)s could not be found " "on network %(net_id)s.") class DeviceNotFoundError(NotFound): """An exception for a requested device that's not found. A specialization of the NotFound exception indicating a requested device could not be found. :param device_name: The name of the (not found) device that was requested. """ message = _("Device '%(device_name)s' does not exist.") class InUse(NeutronException): """A generic exception indicating a resource is already in use.""" message = _("The resource is in use.") class NetworkInUse(InUse): """An operational error indicating the network still has ports in use. A specialization of the InUse exception indicating a network operation was requested, but failed because there are still ports in use on the said network. :param net_id: The UUID of the network requested. """ message = _("Unable to complete operation on network %(net_id)s. " "There are one or more ports still in use on the network.") class SubnetInUse(InUse): """An operational error indicating a subnet is still in use. A specialization of the InUse exception indicating an operation failed on a subnet because the subnet is still in use. :param subnet_id: The UUID of the subnet requested. :param reason: Details on why the operation failed. If None, a default reason is used indicating one or more ports still have IP allocations on the subnet. """ message = _("Unable to complete operation on subnet %(subnet_id)s: " "%(reason)s.") def __init__(self, **kwargs): if 'reason' not in kwargs: kwargs['reason'] = _("One or more ports have an IP allocation " "from this subnet") super(SubnetInUse, self).__init__(**kwargs) class SubnetPoolInUse(InUse): """An operational error indicating a subnet pool is still in use. A specialization of the InUse exception indicating an operation failed on a subnet pool because it's still in use. :param subnet_pool_id: The UUID of the subnet pool requested. :param reason: Details on why the operation failed. If None a default reason is used indicating two or more concurrent subnets are allocated. """ message = _("Unable to complete operation on subnet pool " "%(subnet_pool_id)s. %(reason)s.") def __init__(self, **kwargs): if 'reason' not in kwargs: kwargs['reason'] = _("Two or more concurrent subnets allocated") super(SubnetPoolInUse, self).__init__(**kwargs) class PortInUse(InUse): """An operational error indicating a requested port is already attached. A specialization of the InUse exception indicating an operation failed on a port because it already has an attached device. :param port_id: The UUID of the port requested. :param net_id: The UUID of the requested port's network. :param device_id: The UUID of the device already attached to the port. """ message = _("Unable to complete operation on port %(port_id)s " "for network %(net_id)s. Port already has an attached " "device %(device_id)s.") class ServicePortInUse(InUse): """An error indicating a service port can't be deleted. A specialization of the InUse exception indicating a requested service port can't be deleted via the APIs. :param port_id: The UUID of the port requested. :param reason: Details on why the operation failed. """ message = _("Port %(port_id)s cannot be deleted directly via the " "port API: %(reason)s.") class PortBound(InUse): """An operational error indicating a port is already bound. A specialization of the InUse exception indicating an operation can't complete because the port is already bound. :param port_id: The UUID of the port requested. :param vif_type: The VIF type associated with the bound port. :param old_mac: The old MAC address of the port. :param net_mac: The new MAC address of the port. """ message = _("Unable to complete operation on port %(port_id)s, " "port is already bound, port type: %(vif_type)s, " "old_mac %(old_mac)s, new_mac %(new_mac)s.") class MacAddressInUse(InUse): """An network operational error indicating a MAC address is already in use. A specialization of the InUse exception indicating an operation failed on a network because a specified MAC address is already in use on that network. :param net_id: The UUID of the network. :param mac: The requested MAC address that's already in use. """ message = _("Unable to complete operation for network %(net_id)s. " "The mac address %(mac)s is in use.") class InvalidIpForNetwork(BadRequest): """An exception indicating an invalid IP was specified for a network. A specialization of the BadRequest exception indicating a specified IP address is invalid for a network. :param ip_address: The IP address that's invalid on the network. """ message = _("IP address %(ip_address)s is not a valid IP " "for any of the subnets on the specified network.") class InvalidIpForSubnet(BadRequest): """An exception indicating an invalid IP was specified for a subnet. A specialization of the BadRequest exception indicating a specified IP address is invalid for a subnet. :param ip_address: The IP address that's invalid on the subnet. """ message = _("IP address %(ip_address)s is not a valid IP " "for the specified subnet.") class IpAddressInUse(InUse): """An network operational error indicating an IP address is already in use. A specialization of the InUse exception indicating an operation can't complete because an IP address is in use. :param net_id: The UUID of the network. :param ip_address: The IP address that's already in use on the network. """ message = _("Unable to complete operation for network %(net_id)s. " "The IP address %(ip_address)s is in use.") class VlanIdInUse(InUse): """A network operational error indicating a VLAN ID is already in use. A specialization of the InUse exception indicating network creation failed because a specified VLAN is already in use on the physical network. :param vlan_id: The VLAN ID. :param physical_network: The physical network. """ message = _("Unable to create the network. " "The VLAN %(vlan_id)s on physical network " "%(physical_network)s is in use.") class TunnelIdInUse(InUse): """A network creation failure due to tunnel ID already in use. A specialization of the InUse exception indicating network creation failed because a said tunnel ID is already in use. :param tunnel_id: The ID of the tunnel that's already in use. """ message = _("Unable to create the network. " "The tunnel ID %(tunnel_id)s is in use.") class ResourceExhausted(ServiceUnavailable): """A service unavailable error indicating a resource is exhausted.""" pass class NoNetworkAvailable(ResourceExhausted): """A failure to create a network due to no tenant networks for allocation. A specialization of the ResourceExhausted exception indicating network creation failed because no tenant network are available for allocation. """ message = _("Unable to create the network. " "No tenant network is available for allocation.") class SubnetMismatchForPort(BadRequest): """A bad request error indicating a specified subnet isn't on a port. A specialization of the BadRequest exception indicating a subnet on a port doesn't match a specified subnet. :param port_id: The UUID of the port. :param subnet_id: The UUID of the requested subnet. """ message = _("Subnet on port %(port_id)s does not match " "the requested subnet %(subnet_id)s.") class Invalid(NeutronException): """A generic base class for invalid errors.""" def __init__(self, message=None): self.message = message super(Invalid, self).__init__() class InvalidInput(BadRequest): """A bad request due to invalid input. A specialization of the BadRequest error indicating bad input was specified. :param error_message: Details on the operation that failed due to bad input. """ message = _("Invalid input for operation: %(error_message)s.") class IpAddressGenerationFailure(Conflict): """A conflict error due to no more IP addresses on a said network. :param net_id: The UUID of the network that has no more IP addresses. """ message = _("No more IP addresses available on network %(net_id)s.") class PreexistingDeviceFailure(NeutronException): """A creation error due to an already existing device. An exception indication creation failed due to an already existing device. :param dev_name: The device name that already exists. """ message = _("Creation failed. %(dev_name)s already exists.") class OverQuota(Conflict): """A error due to exceeding quota limits. A specialization of the Conflict exception indicating quota has been exceeded. :param overs: The resources that have exceeded quota. """ message = _("Quota exceeded for resources: %(overs)s.") class InvalidContentType(NeutronException): """An error due to invalid content type. :param content_type: The invalid content type. """ message = _("Invalid content type %(content_type)s.") class ExternalIpAddressExhausted(BadRequest): """An error due to not finding IP addresses on an external network. A specialization of the BadRequest exception indicating no IP addresses can be found on a network. :param net_id: The UUID of the network. """ message = _("Unable to find any IP address on external " "network %(net_id)s.") class InvalidConfigurationOption(NeutronException): """An error due to an invalid configuration option value. :param opt_name: The name of the configuration option that has an invalid value. :param opt_value: The value that's invalid for the configuration option. """ message = _("An invalid value was provided for %(opt_name)s: " "%(opt_value)s.") class NetworkTunnelRangeError(NeutronException): """An error due to an invalid network tunnel range. An exception indicating an invalid network tunnel range was specified. :param tunnel_range: The invalid tunnel range. If specified in the start:end' format, they will be converted automatically. :param error: Additional details on why the range is invalid. """ message = _("Invalid network tunnel range: " "'%(tunnel_range)s' - %(error)s.") def __init__(self, **kwargs): # Convert tunnel_range tuple to 'start:end' format for display if isinstance(kwargs['tunnel_range'], tuple): kwargs['tunnel_range'] = "%d:%d" % kwargs['tunnel_range'] super(NetworkTunnelRangeError, self).__init__(**kwargs) class PolicyInitError(NeutronException): """An error due to policy initialization failure. :param policy: The policy that failed to initialize. :param reason: Details on why the policy failed to initialize. """ message = _("Failed to initialize policy %(policy)s because %(reason)s.") class PolicyCheckError(NeutronException): """An error due to a policy check failure. :param policy: The policy that failed to check. :param reason: Additional details on the failure. """ message = _("Failed to check policy %(policy)s because %(reason)s.") class MultipleExceptions(Exception): """Container for multiple exceptions encountered. The API layer of Neutron will automatically unpack, translate, filter, and combine the inner exceptions in any exception derived from this class. """ def __init__(self, exceptions, *args, **kwargs): """Create a new instance wrapping the exceptions. :param exceptions: The inner exceptions this instance is composed of. :param args: Passed onto parent constructor. :param kwargs: Passed onto parent constructor. """ super(MultipleExceptions, self).__init__(*args, **kwargs) self.inner_exceptions = exceptions class HostMacAddressGenerationFailure(ServiceUnavailable): """MAC address generation failure for a host. :param host: The host MAC address generation failed for. """ message = _("Unable to generate unique mac for host %(host)s.") class NetworkMacAddressGenerationFailure(ServiceUnavailable): """An error related to MAC address generation on a network. :param net_id: The ID of the network MAC address generation failed on. """ message = _("Unable to generate unique mac on network %(net_id)s.") class InvalidServiceType(InvalidInput): """An error due to an invalid service type. :param service_type: The service type that's invalid. """ message = _("Invalid service type: %(service_type)s.") class NetworkVlanRangeError(NeutronException): message = _("Invalid network VLAN range: '%(vlan_range)s' - '%(error)s'.") def __init__(self, **kwargs): # Convert vlan_range tuple to 'start:end' format for display if isinstance(kwargs['vlan_range'], tuple): kwargs['vlan_range'] = "%d:%d" % kwargs['vlan_range'] super(NetworkVlanRangeError, self).__init__(**kwargs) class PhysicalNetworkNameError(NeutronException): message = _("Empty physical network name.") class TenantIdProjectIdFilterConflict(BadRequest): message = _("Both tenant_id and project_id passed as filters.") class SubnetPoolNotFound(NotFound): message = _("Subnet pool %(subnetpool_id)s could not be found.") class StateInvalid(BadRequest): message = _("Unsupported port state: %(port_state)s.") class DhcpPortInUse(InUse): message = _("Port %(port_id)s is already acquired by another DHCP agent") class HostRoutesExhausted(BadRequest): # NOTE(xchenum): probably make sense to use quota exceeded exception? message = _("Unable to complete operation for %(subnet_id)s. " "The number of host routes exceeds the limit %(quota)s.") class DNSNameServersExhausted(BadRequest): # NOTE(xchenum): probably make sense to use quota exceeded exception? message = _("Unable to complete operation for %(subnet_id)s. " "The number of DNS nameservers exceeds the limit %(quota)s.") class FlatNetworkInUse(InUse): message = _("Unable to create the flat network. " "Physical network %(physical_network)s is in use.") class NoNetworkFoundInMaximumAllowedAttempts(ServiceUnavailable): message = _("Unable to create the network. " "No available network found in maximum allowed attempts.") class MalformedRequestBody(BadRequest): message = _("Malformed request body: %(reason)s.") class InvalidAllocationPool(BadRequest): message = _("The allocation pool %(pool)s is not valid.") class UnsupportedPortDeviceOwner(Conflict): message = _("Operation %(op)s is not supported for device_owner " "%(device_owner)s on port %(port_id)s.") class OverlappingAllocationPools(Conflict): message = _("Found overlapping allocation pools: " "%(pool_1)s %(pool_2)s for subnet %(subnet_cidr)s.") class OutOfBoundsAllocationPool(BadRequest): message = _("The allocation pool %(pool)s spans " "beyond the subnet cidr %(subnet_cidr)s.") class BridgeDoesNotExist(NeutronException): message = _("Bridge %(bridge)s does not exist.") class QuotaResourceUnknown(NotFound): message = _("Unknown quota resources %(unknown)s.") class QuotaMissingTenant(BadRequest): message = _("Tenant-id was missing from quota request.") class InvalidQuotaValue(Conflict): message = _("Change would make usage less than 0 for the following " "resources: %(unders)s.") class InvalidSharedSetting(Conflict): message = _("Unable to reconfigure sharing settings for network " "%(network)s. Multiple tenants are using it.") class ExtensionsNotFound(NotFound): message = _("Extensions not found: %(extensions)s.") class GatewayConflictWithAllocationPools(InUse): message = _("Gateway ip %(ip_address)s conflicts with " "allocation pool %(pool)s.") class GatewayIpInUse(InUse): message = _("Current gateway ip %(ip_address)s already in use " "by port %(port_id)s. Unable to update.") class NetworkVxlanPortRangeError(NeutronException): message = _("Invalid network VXLAN port range: '%(vxlan_range)s'.") class VxlanNetworkUnsupported(NeutronException): message = _("VXLAN network unsupported.") class DuplicatedExtension(NeutronException): message = _("Found duplicate extension: %(alias)s.") class DriverCallError(MultipleExceptions): def __init__(self, exc_list=None): super(DriverCallError, self).__init__(exc_list or []) class DeviceIDNotOwnedByTenant(Conflict): message = _("The following device_id %(device_id)s is not owned by your " "tenant or matches another tenants router.") class InvalidCIDR(BadRequest): message = _("Invalid CIDR %(input)s given as IP prefix.") class FailToDropPrivilegesExit(SystemExit): """Exit exception raised when a drop privileges action fails.""" code = 99 class NetworkIdOrRouterIdRequiredError(NeutronException): message = _('Both network_id and router_id are None. ' 'One must be provided.') class EmptySubnetPoolPrefixList(BadRequest): message = _("Empty subnet pool prefix list.") class PrefixVersionMismatch(BadRequest): message = _("Cannot mix IPv4 and IPv6 prefixes in a subnet pool.") class UnsupportedMinSubnetPoolPrefix(BadRequest): message = _("Prefix '%(prefix)s' not supported in IPv%(version)s pool.") class IllegalSubnetPoolPrefixBounds(BadRequest): message = _("Illegal prefix bounds: %(prefix_type)s=%(prefixlen)s, " "%(base_prefix_type)s=%(base_prefixlen)s.") class IllegalSubnetPoolPrefixUpdate(BadRequest): message = _("Illegal update to prefixes: %(msg)s.") class SubnetAllocationError(NeutronException): message = _("Failed to allocate subnet: %(reason)s.") class AddressScopePrefixConflict(Conflict): message = _("Failed to associate address scope: subnetpools " "within an address scope must have unique prefixes.") class IllegalSubnetPoolAssociationToAddressScope(BadRequest): message = _("Illegal subnetpool association: subnetpool %(subnetpool_id)s " "cannot be associated with address scope " "%(address_scope_id)s.") class IllegalSubnetPoolIpVersionAssociationToAddressScope(BadRequest): message = _("Illegal subnetpool association: subnetpool %(subnetpool_id)s " "cannot associate with address scope %(address_scope_id)s " "because subnetpool ip_version is not %(ip_version)s.") class IllegalSubnetPoolUpdate(BadRequest): message = _("Illegal subnetpool update : %(reason)s.") class MinPrefixSubnetAllocationError(BadRequest): message = _("Unable to allocate subnet with prefix length %(prefixlen)s, " "minimum allowed prefix is %(min_prefixlen)s.") class MaxPrefixSubnetAllocationError(BadRequest): message = _("Unable to allocate subnet with prefix length %(prefixlen)s, " "maximum allowed prefix is %(max_prefixlen)s.") class SubnetPoolDeleteError(BadRequest): message = _("Unable to delete subnet pool: %(reason)s.") class SubnetPoolQuotaExceeded(OverQuota): message = _("Per-tenant subnet pool prefix quota exceeded.") class NetworkSubnetPoolAffinityError(BadRequest): message = _("Subnets hosted on the same network must be allocated from " "the same subnet pool.") class ObjectActionError(NeutronException): message = _('Object action %(action)s failed because: %(reason)s.') class CTZoneExhaustedError(NeutronException): message = _("IPtables conntrack zones exhausted, iptables rules cannot " "be applied.") class TenantQuotaNotFound(NotFound): message = _("Quota for tenant %(tenant_id)s could not be found.") class MultipleFilterIDForIPFound(Conflict): message = _("Multiple filter IDs for IP %(ip)s found.") class FilterIDForIPNotFound(NotFound): message = _("Filter ID for IP %(ip)s could not be found.") class FailedToAddQdiscToDevice(NeutronException): message = _("Failed to add %(direction)s qdisc " "to device %(device)s.") class PortBindingNotFound(NotFound): message = _("Binding for port %(port_id)s for host %(host)s could not be " "found.") class PortBindingAlreadyActive(Conflict): message = _("Binding for port %(port_id)s on host %(host)s is already " "active.") class PortBindingAlreadyExists(Conflict): message = _("Binding for port %(port_id)s on host %(host)s already " "exists.") class PortBindingError(NeutronException): message = _("Binding for port %(port_id)s on host %(host)s could not be " "created or updated.") class ProcessExecutionError(RuntimeError): def __init__(self, message, returncode): super(ProcessExecutionError, self).__init__(message) self.returncode = returncode class InvalidSubnetServiceType(InvalidInput): message = _("Subnet service type %(service_type)s does not correspond " "to a valid device owner.") class InvalidInputSubnetServiceType(InvalidInput): message = _("Subnet service type %(service_type)s is not a string.") neutron-lib-2.3.0/neutron_lib/exceptions/availability_zone.py0000664000175000017500000000135213641427107024562 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from neutron_lib._i18n import _ from neutron_lib import exceptions class AvailabilityZoneNotFound(exceptions.NotFound): message = _("AvailabilityZone %(availability_zone)s could not be found.") neutron-lib-2.3.0/neutron_lib/fixture.py0000664000175000017500000003437513641427107020375 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. import copy from unittest import mock import warnings import fixtures from oslo_config import cfg from oslo_db.sqlalchemy import enginefacade from oslo_db.sqlalchemy import provision from oslo_db.sqlalchemy import session from oslo_messaging import conffixture from neutron_lib.api import attributes from neutron_lib.api import definitions from neutron_lib.callbacks import manager from neutron_lib.callbacks import registry from neutron_lib.db import api as db_api from neutron_lib.db import model_base from neutron_lib.db import model_query from neutron_lib.db import resource_extend from neutron_lib.plugins import directory from neutron_lib import rpc from neutron_lib.tests.unit import fake_notifier CONF = cfg.CONF class PluginDirectoryFixture(fixtures.Fixture): def __init__(self, plugin_directory=None): super(PluginDirectoryFixture, self).__init__() self.plugin_directory = ( plugin_directory or directory._PluginDirectory()) def _setUp(self): self._orig_directory = directory._PLUGIN_DIRECTORY directory._PLUGIN_DIRECTORY = self.plugin_directory self.addCleanup(self._restore) def _restore(self): directory._PLUGIN_DIRECTORY = self._orig_directory class CallbackRegistryFixture(fixtures.Fixture): """Callback registry fixture. This class is intended to be used as a fixture within unit tests and therefore consumers must register it using useFixture() within their unit test class. The implementation optionally allows consumers to pass in the CallbacksManager manager to use for your tests. """ def __init__(self, callback_manager=None): """Creates a new RegistryFixture. :param callback_manager: If specified, the return value to use for _get_callback_manager(). Otherwise a new instance of CallbacksManager is used. """ super(CallbackRegistryFixture, self).__init__() self.callback_manager = callback_manager or manager.CallbacksManager() self.patcher = None def _setUp(self): self._orig_manager = registry._get_callback_manager() self.patcher = mock.patch.object( registry, '_get_callback_manager', return_value=self.callback_manager) self.patcher.start() self.addCleanup(self._restore) def _restore(self): registry._CALLBACK_MANAGER = self._orig_manager self.patcher.stop() class _EnableSQLiteFKsFixture(fixtures.Fixture): """Turn SQLite PRAGMA foreign keys on and off for tests. FIXME(zzzeek): figure out some way to get oslo.db test_base to honor oslo_db.engines.create_engine() arguments like sqlite_fks as well as handling that it needs to be turned off during drops. """ def __init__(self, engine): self.engine = engine def _setUp(self): if self.engine.name == 'sqlite': self.engine.execute("PRAGMA foreign_keys=ON") def disable_fks(): with self.engine.connect() as conn: conn.connection.rollback() conn.execute("PRAGMA foreign_keys=OFF") self.addCleanup(disable_fks) class SqlFixture(fixtures.Fixture): @classmethod def _generate_schema(cls, engine): model_base.BASEV2.metadata.create_all(engine) def _delete_from_schema(self, engine): with engine.begin() as conn: for table in reversed( model_base.BASEV2.metadata.sorted_tables): conn.execute(table.delete()) def _init_resources(self): pass def _setUp(self): self._init_resources() # check if the fixtures failed to get # an engine. The test setUp() itself should also be checking # this and raising skipTest. if not hasattr(self, 'engine'): return engine = self.engine self.addCleanup(lambda: self._delete_from_schema(engine)) self.sessionmaker = session.get_maker(engine) _restore_factory = db_api.get_context_manager()._root_factory self.enginefacade_factory = enginefacade._TestTransactionFactory( self.engine, self.sessionmaker, from_factory=_restore_factory, apply_global=False) db_api.get_context_manager()._root_factory = self.enginefacade_factory engine = db_api.CONTEXT_WRITER.get_engine() self.addCleanup( lambda: setattr( db_api.get_context_manager(), "_root_factory", _restore_factory)) self.useFixture(_EnableSQLiteFKsFixture(engine)) class StaticSqlFixture(SqlFixture): _GLOBAL_RESOURCES = False @classmethod def _init_resources(cls): # this is a classlevel version of what testresources # does w/ the resources attribute as well as the # setUpResources() step (which requires a test instance, that # SqlFixture does not have). Because this is a SQLite memory # database, we don't actually tear it down, so we can keep # it running throughout all tests. if cls._GLOBAL_RESOURCES: return else: cls._GLOBAL_RESOURCES = True cls.schema_resource = provision.SchemaResource( provision.DatabaseResource( "sqlite", db_api.get_context_manager()), cls._generate_schema, teardown=False) dependency_resources = {} for name, resource in cls.schema_resource.resources: dependency_resources[name] = resource.getResource() cls.schema_resource.make(dependency_resources) cls.engine = dependency_resources['database'].engine class APIDefinitionFixture(fixtures.Fixture): """Test fixture for testing neutron-lib API definitions. Extension API definition RESOURCE_ATTRIBUTE_MAP dicts get updated as part of standard extension processing/handling. While this behavior is fine for service runtime, it can impact testing scenarios whereby test1 updates the attribute map (globally) and test2 doesn't expect the test1 updates. This fixture saves and restores 1 or more neutron-lib API definitions attribute maps. It should be used anywhere multiple tests can be run that might update an extension attribute map. In addition the fixture backs up and restores the global attribute RESOURCES base on the boolean value of its backup_global_resources attribute. """ def __init__(self, *api_definitions): """Create a new instance. Consumers can also control if the fixture should handle the global attribute RESOURCE map using the backup_global_resources of the fixture instance. If True the fixture will also handle neutron_lib.api.attributes.RESOURCES. :param api_definitions: Zero or more API definitions the fixture should handle. If no api_definitions are passed, the default is to handle all neutron_lib API definitions as well as the global RESOURCES attribute map. """ self.definitions = api_definitions or definitions._ALL_API_DEFINITIONS self._orig_attr_maps = {} self._orig_resources = {} self.backup_global_resources = True def _setUp(self): for api_def in self.definitions: self._orig_attr_maps[api_def.ALIAS] = ( api_def, {k: copy.deepcopy(v) for k, v in api_def.RESOURCE_ATTRIBUTE_MAP.items()}) if self.backup_global_resources: for resource, attrs in attributes.RESOURCES.items(): self._orig_resources[resource] = copy.deepcopy(attrs) self.addCleanup(self._restore) def _restore(self): # clear + repopulate so consumer refs don't change for alias, def_and_map in self._orig_attr_maps.items(): api_def, attr_map = def_and_map[0], def_and_map[1] api_def.RESOURCE_ATTRIBUTE_MAP.clear() api_def.RESOURCE_ATTRIBUTE_MAP.update(attr_map) if self.backup_global_resources: attributes.RESOURCES.clear() attributes.RESOURCES.update(self._orig_resources) @classmethod def all_api_definitions_fixture(cls): """Return a fixture that handles all neutron-lib api-defs.""" return APIDefinitionFixture(*tuple(definitions._ALL_API_DEFINITIONS)) class PlacementAPIClientFixture(fixtures.Fixture): """Placement API client fixture. This class is intended to be used as a fixture within unit tests and therefore consumers must register it using useFixture() within their unit test class. """ def __init__(self, placement_api_client): """Creates a new PlacementAPIClientFixture. :param placement_api_client: Placement API client object. """ super(PlacementAPIClientFixture, self).__init__() self.placement_api_client = placement_api_client def _setUp(self): self.addCleanup(self._restore) def mock_create_client(): self.placement_api_client.client = mock.Mock() self._mock_create_client = mock.patch.object( self.placement_api_client, '_create_client', side_effect=mock_create_client) self._mock_get = mock.patch.object(self.placement_api_client, '_get') self._mock_post = mock.patch.object(self.placement_api_client, '_post') self._mock_put = mock.patch.object(self.placement_api_client, '_put') self._mock_delete = mock.patch.object(self.placement_api_client, '_delete') self._mock_create_client.start() self.mock_get = self._mock_get.start() self.mock_post = self._mock_post.start() self.mock_put = self._mock_put.start() self.mock_delete = self._mock_delete.start() def _restore(self): self._mock_create_client.stop() self._mock_get.stop() self._mock_post.stop() self._mock_put.stop() self._mock_delete.stop() class DBRetryErrorsFixture(fixtures.Fixture): def __init__(self, **retry_kwargs): self._retry_kwargs = retry_kwargs self._patchers = [] def _setUp(self): for k, v in self._retry_kwargs.items(): patcher = mock.patch.object(db_api._retry_db_errors, k, new=v) patcher.start() self._patchers.append(patcher) self.addCleanup(self._restore) def _restore(self): for p in self._patchers: p.stop() class DBAPIContextManagerFixture(fixtures.Fixture): def __init__(self, mock_context_manager=mock.ANY): self.cxt_manager = (mock.Mock() if mock_context_manager == mock.ANY else mock_context_manager) self._backup_mgr = None def _setUp(self): self._backup_mgr = db_api._CTX_MANAGER db_api._CTX_MANAGER = self.cxt_manager self.addCleanup(self._restore) def _restore(self): db_api._CTX_MANAGER = self._backup_mgr class DBQueryHooksFixture(fixtures.Fixture): def _setUp(self, query_hooks=None): self._backup = model_query._model_query_hooks model_query._model_query_hooks = query_hooks or {} self.addCleanup(self._restore) def _restore(self): model_query._model_query_hooks = self._backup class RPCFixture(fixtures.Fixture): def _setUp(self): # don't actually start RPC listeners when testing mock.patch.object(rpc.Connection, 'consume_in_threads', return_value=[]).start() self.useFixture(fixtures.MonkeyPatch( 'oslo_messaging.Notifier', fake_notifier.FakeNotifier)) self.messaging_conf = conffixture.ConfFixture(CONF) self.messaging_conf.transport_url = 'fake:/' # NOTE(russellb) We want all calls to return immediately. self.messaging_conf.response_timeout = 0 self.useFixture(self.messaging_conf) self.addCleanup(rpc.cleanup) rpc.init(CONF) class DBResourceExtendFixture(fixtures.Fixture): def __init__(self, extended_functions=None): self.extended_functions = extended_functions or {} def _setUp(self): self._backup = copy.deepcopy( resource_extend._resource_extend_functions) resource_extend._resource_extend_functions = self.extended_functions self.addCleanup(self._restore) def _restore(self): resource_extend._resource_extend_functions = self._backup class OpenFixture(fixtures.Fixture): """Mock access to a specific file while preserving open for others.""" def __init__(self, filepath, contents=''): self.path = filepath self.contents = contents def _setUp(self): self.mock_open = mock.mock_open(read_data=self.contents) self._orig_open = open def replacement_open(name, *args, **kwargs): if name == self.path: return self.mock_open(name, *args, **kwargs) return self._orig_open(name, *args, **kwargs) self._patch = mock.patch('builtins.open', new=replacement_open) self._patch.start() self.addCleanup(self._patch.stop) class WarningsFixture(fixtures.Fixture): """Filters out warnings during test runs.""" warning_types = ( DeprecationWarning, PendingDeprecationWarning, ImportWarning ) def __init__(self, module_re=None): """Create a new WarningsFixture. :param module_re: A list of regular expression strings that will be used with filterwarnings. Multiple expressions are or'd together. """ self._modules = ['^neutron_lib\\.'] if module_re: self._modules.extend(module_re) def _setUp(self): self.addCleanup(warnings.resetwarnings) for wtype in self.warning_types: warnings.filterwarnings( "once", category=wtype, module='|'.join(self._modules)) neutron-lib-2.3.0/.stestr.conf0000664000175000017500000000011113641427107016243 0ustar zuulzuul00000000000000[DEFAULT] test_path=${OS_TEST_PATH:-./neutron_lib/tests/unit} top_dir=./ neutron-lib-2.3.0/.mailmap0000664000175000017500000000013113641427107015415 0ustar zuulzuul00000000000000# Format is: # # neutron-lib-2.3.0/PKG-INFO0000664000175000017500000000312713641427200015073 0ustar zuulzuul00000000000000Metadata-Version: 1.2 Name: neutron-lib Version: 2.3.0 Summary: Neutron shared routines and utilities Home-page: https://docs.openstack.org/neutron-lib/latest/ Author: OpenStack Author-email: openstack-discuss@lists.openstack.org License: UNKNOWN Description: ======================== Team and repository tags ======================== .. image:: https://governance.openstack.org/tc/badges/neutron-lib.svg :target: https://governance.openstack.org/tc/reference/tags/index.html .. Change things from this point on =============================== neutron-lib =============================== Neutron shared routines and utilities * Free software: Apache license * Documentation: https://docs.openstack.org/neutron-lib/latest/ * Source: https://opendev.org/openstack/neutron-lib * Bugs: https://bugs.launchpad.net/neutron * Release notes: https://docs.openstack.org/releasenotes/neutron-lib/ Features -------- * TODO Platform: UNKNOWN Classifier: Environment :: OpenStack Classifier: Intended Audience :: Information Technology Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Requires-Python: >=3.6 neutron-lib-2.3.0/requirements.txt0000664000175000017500000000171313641427107017267 0ustar zuulzuul00000000000000# The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. pbr!=2.1.0,>=2.0.0 # Apache-2.0 SQLAlchemy>=1.2.0 # MIT pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0 # BSD keystoneauth1>=3.4.0 # Apache-2.0 netaddr>=0.7.18 # BSD stevedore>=1.20.0 # Apache-2.0 os-ken >= 0.3.0 # Apache-2.0 oslo.concurrency>=3.26.0 # Apache-2.0 oslo.config>=5.2.0 # Apache-2.0 oslo.context>=2.19.2 # Apache-2.0 oslo.db>=4.37.0 # Apache-2.0 oslo.i18n>=3.15.3 # Apache-2.0 oslo.log>=3.36.0 # Apache-2.0 oslo.messaging>=5.29.0 # Apache-2.0 oslo.policy>=1.30.0 # Apache-2.0 oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0 oslo.service!=1.28.1,>=1.24.0 # Apache-2.0 oslo.utils>=3.33.0 # Apache-2.0 oslo.versionedobjects>=1.31.2 # Apache-2.0 osprofiler>=1.4.0 # Apache-2.0 setproctitle>=1.1.10 # BSD WebOb>=1.7.1 # MIT os-traits>=0.9.0 # Apache-2.0 neutron-lib-2.3.0/neutron_lib.egg-info/0000775000175000017500000000000013641427200020005 5ustar zuulzuul00000000000000neutron-lib-2.3.0/neutron_lib.egg-info/pbr.json0000664000175000017500000000005613641427177021501 0ustar zuulzuul00000000000000{"git_version": "4f787b8", "is_release": true}neutron-lib-2.3.0/neutron_lib.egg-info/dependency_links.txt0000664000175000017500000000000113641427177024070 0ustar zuulzuul00000000000000 neutron-lib-2.3.0/neutron_lib.egg-info/SOURCES.txt0000664000175000017500000017562213641427200021706 0ustar zuulzuul00000000000000.coveragerc .mailmap .stestr.conf .zuul.yaml AUTHORS CONTRIBUTING.rst ChangeLog HACKING.rst LICENSE README.rst babel.cfg lower-constraints.txt requirements.txt setup.cfg setup.py test-requirements.txt tox.ini api-ref/source/conf.py api-ref/source/index.rst api-ref/source/v2/address-scopes.inc api-ref/source/v2/agents.inc api-ref/source/v2/auto-topology.inc api-ref/source/v2/availability_zones.inc api-ref/source/v2/bgpvpn-bgpvpns.inc api-ref/source/v2/bgpvpn-network_associations.inc api-ref/source/v2/bgpvpn-overview.inc api-ref/source/v2/bgpvpn-port_associations.inc api-ref/source/v2/bgpvpn-router_associations.inc api-ref/source/v2/dhcp-agent-scheduler.inc api-ref/source/v2/extensions.inc api-ref/source/v2/fip-port-forwarding.inc api-ref/source/v2/fip64.inc api-ref/source/v2/firewall_log.inc api-ref/source/v2/flavors.inc api-ref/source/v2/floatingippools.inc api-ref/source/v2/floatingips.inc api-ref/source/v2/fwaas-v2.inc api-ref/source/v2/index.rst api-ref/source/v2/intro.inc api-ref/source/v2/l3-agent-scheduler.inc api-ref/source/v2/l3-conntrack-helper.inc api-ref/source/v2/logging.inc api-ref/source/v2/logging_resource.inc api-ref/source/v2/metering.inc api-ref/source/v2/network-ip-availability.inc api-ref/source/v2/network_segment_ranges.inc api-ref/source/v2/networks.inc api-ref/source/v2/parameters.yaml api-ref/source/v2/ports.inc api-ref/source/v2/qos.inc api-ref/source/v2/quota_details.inc api-ref/source/v2/quotas.inc api-ref/source/v2/rbac-policy.inc api-ref/source/v2/router-interface-fip.inc api-ref/source/v2/routers.inc api-ref/source/v2/security-group-rules.inc api-ref/source/v2/security-groups.inc api-ref/source/v2/segments.inc api-ref/source/v2/service-providers.inc api-ref/source/v2/subnetpool_prefix_ops.inc api-ref/source/v2/subnetpools.inc api-ref/source/v2/subnets.inc api-ref/source/v2/tags.inc api-ref/source/v2/trunk-details.inc api-ref/source/v2/trunk.inc api-ref/source/v2/versions.inc api-ref/source/v2/vpnaas.inc api-ref/source/v2/samples/service-type-response.json api-ref/source/v2/samples/address-scopes/address-scope-create-request.json api-ref/source/v2/samples/address-scopes/address-scope-create-response.json api-ref/source/v2/samples/address-scopes/address-scope-show-response.json api-ref/source/v2/samples/address-scopes/address-scope-update-request.json api-ref/source/v2/samples/address-scopes/address-scope-update-response.json api-ref/source/v2/samples/address-scopes/address-scopes-list-response.json api-ref/source/v2/samples/agents/agent-dhcp-network-add-request.json api-ref/source/v2/samples/agents/agent-dhcp-networks-list-response.json api-ref/source/v2/samples/agents/agent-l3-router-add-request.json api-ref/source/v2/samples/agents/agent-l3-router-remove-request.json api-ref/source/v2/samples/agents/agent-l3-routers-list-response.json api-ref/source/v2/samples/agents/agent-show-response.json api-ref/source/v2/samples/agents/agent-update-request.json api-ref/source/v2/samples/agents/agent-update-response.json api-ref/source/v2/samples/agents/agents-list-response.json api-ref/source/v2/samples/agents/network-dhcp-agent-list-response.json api-ref/source/v2/samples/agents/router-l3-agent-list-response.json api-ref/source/v2/samples/auto-topology/topo-show-response.json api-ref/source/v2/samples/availability-zones/azs-list-response.json api-ref/source/v2/samples/bgpvpn/bgpvpns/bgpvpn-create-request.json api-ref/source/v2/samples/bgpvpn/bgpvpns/bgpvpn-create-response.json api-ref/source/v2/samples/bgpvpn/bgpvpns/bgpvpn-show-response.json api-ref/source/v2/samples/bgpvpn/bgpvpns/bgpvpn-update-request.json api-ref/source/v2/samples/bgpvpn/bgpvpns/bgpvpn-update-response.json api-ref/source/v2/samples/bgpvpn/bgpvpns/bgpvpns-list-response.json api-ref/source/v2/samples/bgpvpn/network_associations/network_association-create-request.json api-ref/source/v2/samples/bgpvpn/network_associations/network_association-create-response.json api-ref/source/v2/samples/bgpvpn/network_associations/network_association-list-response.json api-ref/source/v2/samples/bgpvpn/network_associations/network_association-show-response.json api-ref/source/v2/samples/bgpvpn/port_associations/port_association-create-request.json api-ref/source/v2/samples/bgpvpn/port_associations/port_association-create-response.json api-ref/source/v2/samples/bgpvpn/port_associations/port_association-list-response.json api-ref/source/v2/samples/bgpvpn/port_associations/port_association-show-response.json api-ref/source/v2/samples/bgpvpn/port_associations/port_association-update-request.json api-ref/source/v2/samples/bgpvpn/port_associations/port_association-update-response.json api-ref/source/v2/samples/bgpvpn/router_associations/router_association-create-request.json api-ref/source/v2/samples/bgpvpn/router_associations/router_association-create-response.json api-ref/source/v2/samples/bgpvpn/router_associations/router_association-list-response.json api-ref/source/v2/samples/bgpvpn/router_associations/router_association-show-response.json api-ref/source/v2/samples/bgpvpn/router_associations/router_association-update-request.json api-ref/source/v2/samples/bgpvpn/router_associations/router_association-update-response.json api-ref/source/v2/samples/conntrack_helpers/conntrack-helper-create-request.json api-ref/source/v2/samples/conntrack_helpers/conntrack-helper-create-response.json api-ref/source/v2/samples/conntrack_helpers/conntrack-helper-list-response.json api-ref/source/v2/samples/conntrack_helpers/conntrack-helper-show-response.json api-ref/source/v2/samples/conntrack_helpers/conntrack-helper-update-request.json api-ref/source/v2/samples/conntrack_helpers/conntrack-helper-update-response.json api-ref/source/v2/samples/extensions/extension-show-response.json api-ref/source/v2/samples/extensions/extensions-list-response.json api-ref/source/v2/samples/firewall-v2/firewall-group-create-request.json api-ref/source/v2/samples/firewall-v2/firewall-group-create-response.json api-ref/source/v2/samples/firewall-v2/firewall-group-show-response.json api-ref/source/v2/samples/firewall-v2/firewall-group-update-request.json api-ref/source/v2/samples/firewall-v2/firewall-group-update-response.json api-ref/source/v2/samples/firewall-v2/firewall-groups-list-response.json api-ref/source/v2/samples/firewall-v2/firewall-policies-list-response.json api-ref/source/v2/samples/firewall-v2/firewall-policy-create-request.json api-ref/source/v2/samples/firewall-v2/firewall-policy-create-response.json api-ref/source/v2/samples/firewall-v2/firewall-policy-insert-rule-request.json api-ref/source/v2/samples/firewall-v2/firewall-policy-insert-rule-response.json api-ref/source/v2/samples/firewall-v2/firewall-policy-remove-rule-request.json api-ref/source/v2/samples/firewall-v2/firewall-policy-remove-rule-response.json api-ref/source/v2/samples/firewall-v2/firewall-policy-show-response.json api-ref/source/v2/samples/firewall-v2/firewall-policy-update-request.json api-ref/source/v2/samples/firewall-v2/firewall-policy-update-response.json api-ref/source/v2/samples/firewall-v2/firewall-rule-create-request.json api-ref/source/v2/samples/firewall-v2/firewall-rule-create-response.json api-ref/source/v2/samples/firewall-v2/firewall-rule-show-response.json api-ref/source/v2/samples/firewall-v2/firewall-rule-update-request.json api-ref/source/v2/samples/firewall-v2/firewall-rule-update-response.json api-ref/source/v2/samples/firewall-v2/firewall-rules-list-response.json api-ref/source/v2/samples/firewall_log/firewall_log-create-request.json api-ref/source/v2/samples/firewall_log/firewall_log-create-response.json api-ref/source/v2/samples/firewall_log/firewall_log-show-response.json api-ref/source/v2/samples/firewall_log/firewall_log-update-request.json api-ref/source/v2/samples/firewall_log/firewall_log-update-response.json api-ref/source/v2/samples/firewall_log/firewall_logs-list-response.json api-ref/source/v2/samples/firewalls/firewall-create-request.json api-ref/source/v2/samples/firewalls/firewall-create-response.json api-ref/source/v2/samples/firewalls/firewall-policies-list-response.json api-ref/source/v2/samples/firewalls/firewall-policy-create-request.json api-ref/source/v2/samples/firewalls/firewall-policy-create-response.json api-ref/source/v2/samples/firewalls/firewall-policy-insert-rule-request.json api-ref/source/v2/samples/firewalls/firewall-policy-insert-rule-response.json api-ref/source/v2/samples/firewalls/firewall-policy-remove-rule-request.json api-ref/source/v2/samples/firewalls/firewall-policy-remove-rule-response.json api-ref/source/v2/samples/firewalls/firewall-policy-show-response.json api-ref/source/v2/samples/firewalls/firewall-policy-update-request.json api-ref/source/v2/samples/firewalls/firewall-policy-update-response.json api-ref/source/v2/samples/firewalls/firewall-rule-create-request.json api-ref/source/v2/samples/firewalls/firewall-rule-create-response.json api-ref/source/v2/samples/firewalls/firewall-rule-show-response.json api-ref/source/v2/samples/firewalls/firewall-rule-update-request.json api-ref/source/v2/samples/firewalls/firewall-rule-update-response.json api-ref/source/v2/samples/firewalls/firewall-rules-list-response.json api-ref/source/v2/samples/firewalls/firewall-show-response.json api-ref/source/v2/samples/firewalls/firewall-update-request.json api-ref/source/v2/samples/firewalls/firewall-update-response.json api-ref/source/v2/samples/firewalls/firewalls-list-response.json api-ref/source/v2/samples/flavors/flavor-associate-request.json api-ref/source/v2/samples/flavors/flavor-associate-response.json api-ref/source/v2/samples/flavors/flavor-create-request.json api-ref/source/v2/samples/flavors/flavor-create-response.json api-ref/source/v2/samples/flavors/flavor-show-response.json api-ref/source/v2/samples/flavors/flavor-update-request.json api-ref/source/v2/samples/flavors/flavor-update-response.json api-ref/source/v2/samples/flavors/flavors-list-response.json api-ref/source/v2/samples/flavors/service-profile-create-request.json api-ref/source/v2/samples/flavors/service-profile-create-response.json api-ref/source/v2/samples/flavors/service-profile-show-response.json api-ref/source/v2/samples/flavors/service-profile-update-request.json api-ref/source/v2/samples/flavors/service-profile-update-response.json api-ref/source/v2/samples/flavors/service-profiles-list-response.json api-ref/source/v2/samples/floatingips/floating-ip-pools-list-response.json api-ref/source/v2/samples/floatingips/floating-ips-list-response.json api-ref/source/v2/samples/floatingips/floatingip-create-request.json api-ref/source/v2/samples/floatingips/floatingip-create-response.json api-ref/source/v2/samples/floatingips/floatingip-disassociate-request.json api-ref/source/v2/samples/floatingips/floatingip-disassociate-response.json api-ref/source/v2/samples/floatingips/floatingip-show-response.json api-ref/source/v2/samples/floatingips/floatingip-update-request.json api-ref/source/v2/samples/floatingips/floatingip-update-response.json api-ref/source/v2/samples/logging_resource/logging_resource-create-request.json api-ref/source/v2/samples/logging_resource/logging_resource-create-response.json api-ref/source/v2/samples/logging_resource/logging_resource-show-response.json api-ref/source/v2/samples/logging_resource/logging_resource-update-request.json api-ref/source/v2/samples/logging_resource/logging_resource-update-response.json api-ref/source/v2/samples/logging_resource/logging_resources-list-response.json api-ref/source/v2/samples/logs/log-create-request.json api-ref/source/v2/samples/logs/log-create-response.json api-ref/source/v2/samples/logs/log-list-response.json api-ref/source/v2/samples/logs/log-show-response.json api-ref/source/v2/samples/logs/log-update-request.json api-ref/source/v2/samples/logs/log-update-response.json api-ref/source/v2/samples/logs/loggable_resources-list-response.json api-ref/source/v2/samples/metering/metering-label-create-request.json api-ref/source/v2/samples/metering/metering-label-create-response.json api-ref/source/v2/samples/metering/metering-label-delete-request-json-http.txt api-ref/source/v2/samples/metering/metering-label-delete-response-json-http.txt api-ref/source/v2/samples/metering/metering-label-rule-create-request.json api-ref/source/v2/samples/metering/metering-label-rule-create-response.json api-ref/source/v2/samples/metering/metering-label-rule-delete-request-json-http.txt api-ref/source/v2/samples/metering/metering-label-rule-delete-response-json-http.txt api-ref/source/v2/samples/metering/metering-label-rule-show-request-json-http.txt api-ref/source/v2/samples/metering/metering-label-rule-show-response.json api-ref/source/v2/samples/metering/metering-label-rules-list-request-json-http.txt api-ref/source/v2/samples/metering/metering-label-rules-list-response.json api-ref/source/v2/samples/metering/metering-label-show-request-json-http.txt api-ref/source/v2/samples/metering/metering-label-show-response.json api-ref/source/v2/samples/metering/metering-labels-list-request-json-http.txt api-ref/source/v2/samples/metering/metering-labels-list-response.json api-ref/source/v2/samples/network-ip-availability/network-ip-availability-list.json api-ref/source/v2/samples/network-ip-availability/network-ip-availability-show.json api-ref/source/v2/samples/network_segment_ranges/network_segment_range-create-request.json api-ref/source/v2/samples/network_segment_ranges/network_segment_range-create-response.json api-ref/source/v2/samples/network_segment_ranges/network_segment_range-show-response.json api-ref/source/v2/samples/network_segment_ranges/network_segment_range-update-request.json api-ref/source/v2/samples/network_segment_ranges/network_segment_range-update-response.json api-ref/source/v2/samples/network_segment_ranges/network_segment_ranges-list-response.json api-ref/source/v2/samples/networks/network-create-request.json api-ref/source/v2/samples/networks/network-create-response.json api-ref/source/v2/samples/networks/network-multi-create-request.json api-ref/source/v2/samples/networks/network-multi-create-response.json api-ref/source/v2/samples/networks/network-multi-show-response.json api-ref/source/v2/samples/networks/network-multi-update-request.json api-ref/source/v2/samples/networks/network-provider-create-request.json api-ref/source/v2/samples/networks/network-provider-create-response.json api-ref/source/v2/samples/networks/network-provider-show-response.json api-ref/source/v2/samples/networks/network-provider-update-request.json api-ref/source/v2/samples/networks/network-show-response.json api-ref/source/v2/samples/networks/network-update-request.json api-ref/source/v2/samples/networks/network-update-response.json api-ref/source/v2/samples/networks/networks-bulk-create-request.json api-ref/source/v2/samples/networks/networks-bulk-create-response.json api-ref/source/v2/samples/networks/networks-list-response.json api-ref/source/v2/samples/networks/networks-provider-list-response.json api-ref/source/v2/samples/networks/version-show-response.json api-ref/source/v2/samples/networks/versions-list-response.json api-ref/source/v2/samples/port_forwardings/port-fowarding-create-request.json api-ref/source/v2/samples/port_forwardings/port-fowarding-create-response.json api-ref/source/v2/samples/port_forwardings/port-fowarding-list-response.json api-ref/source/v2/samples/port_forwardings/port-fowarding-show-response.json api-ref/source/v2/samples/port_forwardings/port-fowarding-update-request.json api-ref/source/v2/samples/port_forwardings/port-fowarding-update-response.json api-ref/source/v2/samples/ports/port-bind-create-request.json api-ref/source/v2/samples/ports/port-bind-create-response.json api-ref/source/v2/samples/ports/port-bind-show-response.json api-ref/source/v2/samples/ports/port-bind-update-request.json api-ref/source/v2/samples/ports/port-bind-update-response.json api-ref/source/v2/samples/ports/port-create-request.json api-ref/source/v2/samples/ports/port-create-response.json api-ref/source/v2/samples/ports/port-show-response.json api-ref/source/v2/samples/ports/port-update-request.json api-ref/source/v2/samples/ports/port-update-response.json api-ref/source/v2/samples/ports/ports-bind-list-response.json api-ref/source/v2/samples/ports/ports-bulk-create-request.json api-ref/source/v2/samples/ports/ports-bulk-create-response.json api-ref/source/v2/samples/ports/ports-list-response.json api-ref/source/v2/samples/qos/bandwidth_limit_rule-create-request.json api-ref/source/v2/samples/qos/bandwidth_limit_rule-create-response.json api-ref/source/v2/samples/qos/bandwidth_limit_rule-show-response.json api-ref/source/v2/samples/qos/bandwidth_limit_rule-update-request.json api-ref/source/v2/samples/qos/bandwidth_limit_rule-update-response.json api-ref/source/v2/samples/qos/bandwidth_limit_rules-list-response.json api-ref/source/v2/samples/qos/dscp_marking_rule-create-request.json api-ref/source/v2/samples/qos/dscp_marking_rule-create-response.json api-ref/source/v2/samples/qos/dscp_marking_rule-show-response.json api-ref/source/v2/samples/qos/dscp_marking_rule-update-request.json api-ref/source/v2/samples/qos/dscp_marking_rule-update-response.json api-ref/source/v2/samples/qos/dscp_marking_rules-list-response.json api-ref/source/v2/samples/qos/minimum_bandwidth_rule-create-request.json api-ref/source/v2/samples/qos/minimum_bandwidth_rule-create-response.json api-ref/source/v2/samples/qos/minimum_bandwidth_rule-show-response.json api-ref/source/v2/samples/qos/minimum_bandwidth_rule-update-request.json api-ref/source/v2/samples/qos/minimum_bandwidth_rule-update-response.json api-ref/source/v2/samples/qos/minimum_bandwidth_rules-list-response.json api-ref/source/v2/samples/qos/policies-list-response.json api-ref/source/v2/samples/qos/policy-create-request.json api-ref/source/v2/samples/qos/policy-create-response.json api-ref/source/v2/samples/qos/policy-show-response.json api-ref/source/v2/samples/qos/policy-update-request.json api-ref/source/v2/samples/qos/policy-update-response.json api-ref/source/v2/samples/qos/rule_type-details-response.json api-ref/source/v2/samples/qos/rule_types-list-response.json api-ref/source/v2/samples/quota_details/quota-details-show-for-project-response.json api-ref/source/v2/samples/quotas/quotas-list-for-project-response.json api-ref/source/v2/samples/quotas/quotas-list-response.json api-ref/source/v2/samples/quotas/quotas-update-request.json api-ref/source/v2/samples/quotas/quotas-update-response.json api-ref/source/v2/samples/rbac_policy/rbac-policies-list-response.json api-ref/source/v2/samples/rbac_policy/rbac-policy-create-request.json api-ref/source/v2/samples/rbac_policy/rbac-policy-create-response.json api-ref/source/v2/samples/rbac_policy/rbac-policy-show-response.json api-ref/source/v2/samples/rbac_policy/rbac-policy-update-request.json api-ref/source/v2/samples/rbac_policy/rbac-policy-update-response.json api-ref/source/v2/samples/routers/router-add-extraroutes-request.json api-ref/source/v2/samples/routers/router-add-extraroutes-response.json api-ref/source/v2/samples/routers/router-add-interface-request-with-port.json api-ref/source/v2/samples/routers/router-add-interface-request.json api-ref/source/v2/samples/routers/router-add-interface-response.json api-ref/source/v2/samples/routers/router-create-request.json api-ref/source/v2/samples/routers/router-create-response.json api-ref/source/v2/samples/routers/router-remove-extraroutes-request.json api-ref/source/v2/samples/routers/router-remove-extraroutes-response.json api-ref/source/v2/samples/routers/router-remove-interface-request-with-port.json api-ref/source/v2/samples/routers/router-remove-interface-request.json api-ref/source/v2/samples/routers/router-remove-interface-response.json api-ref/source/v2/samples/routers/router-show-response.json api-ref/source/v2/samples/routers/router-update-request.json api-ref/source/v2/samples/routers/router-update-response.json api-ref/source/v2/samples/routers/routers-list-response.json api-ref/source/v2/samples/security-groups/security-group-create-request.json api-ref/source/v2/samples/security-groups/security-group-create-response.json api-ref/source/v2/samples/security-groups/security-group-delete-request-json-http.txt api-ref/source/v2/samples/security-groups/security-group-delete-response-json-http.txt api-ref/source/v2/samples/security-groups/security-group-rule-create-request.json api-ref/source/v2/samples/security-groups/security-group-rule-create-response.json api-ref/source/v2/samples/security-groups/security-group-rule-delete-request-json-http.txt api-ref/source/v2/samples/security-groups/security-group-rule-delete-response-json-http.txt api-ref/source/v2/samples/security-groups/security-group-rule-show-request-json-http.txt api-ref/source/v2/samples/security-groups/security-group-rule-show-response.json api-ref/source/v2/samples/security-groups/security-group-rules-list-request-json-http.txt api-ref/source/v2/samples/security-groups/security-group-rules-list-response.json api-ref/source/v2/samples/security-groups/security-group-show-request-json-http.txt api-ref/source/v2/samples/security-groups/security-group-show-response.json api-ref/source/v2/samples/security-groups/security-group-update-request.json api-ref/source/v2/samples/security-groups/security-group-update-response.json api-ref/source/v2/samples/security-groups/security-groups-list-request-json-http.txt api-ref/source/v2/samples/security-groups/security-groups-list-response.json api-ref/source/v2/samples/segments/segment-create-request.json api-ref/source/v2/samples/segments/segment-create-response.json api-ref/source/v2/samples/segments/segment-show-response.json api-ref/source/v2/samples/segments/segment-update-request.json api-ref/source/v2/samples/segments/segment-update-response.json api-ref/source/v2/samples/segments/segments-list-response.json api-ref/source/v2/samples/subnets/subnet-create-request.json api-ref/source/v2/samples/subnets/subnet-create-response.json api-ref/source/v2/samples/subnets/subnet-show-response.json api-ref/source/v2/samples/subnets/subnet-update-request.json api-ref/source/v2/samples/subnets/subnet-update-response.json api-ref/source/v2/samples/subnets/subnetpool-add-prefixes-request.json api-ref/source/v2/samples/subnets/subnetpool-add-prefixes-response.json api-ref/source/v2/samples/subnets/subnetpool-create-request.json api-ref/source/v2/samples/subnets/subnetpool-create-response.json api-ref/source/v2/samples/subnets/subnetpool-remove-prefixes-request.json api-ref/source/v2/samples/subnets/subnetpool-remove-prefixes-response.json api-ref/source/v2/samples/subnets/subnetpool-show-response.json api-ref/source/v2/samples/subnets/subnetpool-update-request.json api-ref/source/v2/samples/subnets/subnetpool-update-response.json api-ref/source/v2/samples/subnets/subnetpools-list-response.json api-ref/source/v2/samples/subnets/subnets-create-bulk-request.json api-ref/source/v2/samples/subnets/subnets-create-bulk-response.json api-ref/source/v2/samples/subnets/subnets-list-response.json api-ref/source/v2/samples/tag/tag-obtain-response.json api-ref/source/v2/samples/tag/tag-update-request.json api-ref/source/v2/samples/tag/tag-update-response.json api-ref/source/v2/samples/trunks/trunk-add-subports-request.json api-ref/source/v2/samples/trunks/trunk-add-subports-response.json api-ref/source/v2/samples/trunks/trunk-create-request.json api-ref/source/v2/samples/trunks/trunk-details-show-response.json api-ref/source/v2/samples/trunks/trunk-list-subports-response.json api-ref/source/v2/samples/trunks/trunk-remove-subports-request.json api-ref/source/v2/samples/trunks/trunk-remove-subports-response.json api-ref/source/v2/samples/trunks/trunk-show-response.json api-ref/source/v2/samples/trunks/trunk-update-request.json api-ref/source/v2/samples/trunks/trunk-update-response.json api-ref/source/v2/samples/trunks/trunks-create-response.json api-ref/source/v2/samples/trunks/trunks-list-response.json api-ref/source/v2/samples/vpn/ikepolicies-list-response.json api-ref/source/v2/samples/vpn/ikepolicy-create-request.json api-ref/source/v2/samples/vpn/ikepolicy-create-response.json api-ref/source/v2/samples/vpn/ikepolicy-show-response.json api-ref/source/v2/samples/vpn/ikepolicy-update-request.json api-ref/source/v2/samples/vpn/ikepolicy-update-response.json api-ref/source/v2/samples/vpn/ipsec-site-connection-create-request.json api-ref/source/v2/samples/vpn/ipsec-site-connection-create-response.json api-ref/source/v2/samples/vpn/ipsec-site-connection-show-response.json api-ref/source/v2/samples/vpn/ipsec-site-connection-update-request.json api-ref/source/v2/samples/vpn/ipsec-site-connection-update-response.json api-ref/source/v2/samples/vpn/ipsec-site-connections-list-response.json api-ref/source/v2/samples/vpn/ipsecpolicies-list-response.json api-ref/source/v2/samples/vpn/ipsecpolicy-create-request.json api-ref/source/v2/samples/vpn/ipsecpolicy-create-response.json api-ref/source/v2/samples/vpn/ipsecpolicy-show-response.json api-ref/source/v2/samples/vpn/ipsecpolicy-update-request.json api-ref/source/v2/samples/vpn/ipsecpolicy-update-response.json api-ref/source/v2/samples/vpn/vpn-endpoint-group-create-request.json api-ref/source/v2/samples/vpn/vpn-endpoint-group-create-response.json api-ref/source/v2/samples/vpn/vpn-endpoint-group-show-response.json api-ref/source/v2/samples/vpn/vpn-endpoint-group-update-request.json api-ref/source/v2/samples/vpn/vpn-endpoint-group-update-response.json api-ref/source/v2/samples/vpn/vpn-endpoint-groups-list-response.json api-ref/source/v2/samples/vpn/vpnservice-create-request.json api-ref/source/v2/samples/vpn/vpnservice-create-response.json api-ref/source/v2/samples/vpn/vpnservice-show-response.json api-ref/source/v2/samples/vpn/vpnservice-update-request.json api-ref/source/v2/samples/vpn/vpnservice-update-response.json api-ref/source/v2/samples/vpn/vpnservices-list-response.json doc/requirements.txt doc/source/conf.py doc/source/index.rst doc/source/contributor/api_attributes.rst doc/source/contributor/api_converters.rst doc/source/contributor/api_extensions.rst doc/source/contributor/api_validators.rst doc/source/contributor/callbacks.rst doc/source/contributor/consuming.rst doc/source/contributor/contributing.rst doc/source/contributor/conventions.rst doc/source/contributor/db_model_query.rst doc/source/contributor/index.rst doc/source/contributor/internals.rst doc/source/contributor/releasing.rst doc/source/contributor/review-guidelines.rst doc/source/contributor/rpc_api.rst doc/source/install/index.rst doc/source/reference/index.rst doc/source/user/hacking.rst doc/source/user/index.rst neutron_lib/__init__.py neutron_lib/_i18n.py neutron_lib/constants.py neutron_lib/context.py neutron_lib/fixture.py neutron_lib/rpc.py neutron_lib/version.py neutron_lib/worker.py neutron_lib.egg-info/PKG-INFO neutron_lib.egg-info/SOURCES.txt neutron_lib.egg-info/dependency_links.txt neutron_lib.egg-info/entry_points.txt neutron_lib.egg-info/not-zip-safe neutron_lib.egg-info/pbr.json neutron_lib.egg-info/requires.txt neutron_lib.egg-info/top_level.txt neutron_lib/agent/__init__.py neutron_lib/agent/constants.py neutron_lib/agent/extension.py neutron_lib/agent/l2_extension.py neutron_lib/agent/l3_extension.py neutron_lib/agent/topics.py neutron_lib/api/__init__.py neutron_lib/api/attributes.py neutron_lib/api/converters.py neutron_lib/api/extensions.py neutron_lib/api/faults.py neutron_lib/api/definitions/__init__.py neutron_lib/api/definitions/_dummy.py neutron_lib/api/definitions/address_scope.py neutron_lib/api/definitions/agent.py neutron_lib/api/definitions/agent_resources_synced.py neutron_lib/api/definitions/allowedaddresspairs.py neutron_lib/api/definitions/auto_allocated_topology.py neutron_lib/api/definitions/availability_zone.py neutron_lib/api/definitions/availability_zone_filter.py neutron_lib/api/definitions/base.py neutron_lib/api/definitions/bgpvpn.py neutron_lib/api/definitions/bgpvpn_routes_control.py neutron_lib/api/definitions/bgpvpn_stdattrs.py neutron_lib/api/definitions/bgpvpn_stdattrs_net_assoc.py neutron_lib/api/definitions/bgpvpn_stdattrs_port_assoc.py neutron_lib/api/definitions/bgpvpn_stdattrs_router_assoc.py neutron_lib/api/definitions/bgpvpn_vni.py neutron_lib/api/definitions/constants.py neutron_lib/api/definitions/data_plane_status.py neutron_lib/api/definitions/default_subnetpools.py neutron_lib/api/definitions/dhcpagentscheduler.py neutron_lib/api/definitions/dns.py neutron_lib/api/definitions/dns_domain_ports.py neutron_lib/api/definitions/dvr.py neutron_lib/api/definitions/empty_string_filtering.py neutron_lib/api/definitions/expose_l3_conntrack_helper.py neutron_lib/api/definitions/expose_port_forwarding_in_fip.py neutron_lib/api/definitions/external_net.py neutron_lib/api/definitions/extra_dhcp_opt.py neutron_lib/api/definitions/extraroute.py neutron_lib/api/definitions/extraroute_atomic.py neutron_lib/api/definitions/filter_validation.py neutron_lib/api/definitions/fip64.py neutron_lib/api/definitions/fip_pf_description.py neutron_lib/api/definitions/fip_port_details.py neutron_lib/api/definitions/firewall_v2.py neutron_lib/api/definitions/flavors.py neutron_lib/api/definitions/floating_ip_port_forwarding.py neutron_lib/api/definitions/floatingip_autodelete_internal.py neutron_lib/api/definitions/floatingip_pools.py neutron_lib/api/definitions/flowclassifier.py neutron_lib/api/definitions/ip_allocation.py neutron_lib/api/definitions/ip_substring_port_filtering.py neutron_lib/api/definitions/l2_adjacency.py neutron_lib/api/definitions/l3.py neutron_lib/api/definitions/l3_conntrack_helper.py neutron_lib/api/definitions/l3_ext_gw_mode.py neutron_lib/api/definitions/l3_ext_ha_mode.py neutron_lib/api/definitions/l3_flavors.py neutron_lib/api/definitions/l3_port_ip_change_not_allowed.py neutron_lib/api/definitions/logging.py neutron_lib/api/definitions/logging_resource.py neutron_lib/api/definitions/metering.py neutron_lib/api/definitions/multiprovidernet.py neutron_lib/api/definitions/network.py neutron_lib/api/definitions/network_availability_zone.py neutron_lib/api/definitions/network_ip_availability.py neutron_lib/api/definitions/network_mtu.py neutron_lib/api/definitions/network_mtu_writable.py neutron_lib/api/definitions/network_segment_range.py neutron_lib/api/definitions/pagination.py neutron_lib/api/definitions/port.py neutron_lib/api/definitions/port_mac_address_regenerate.py neutron_lib/api/definitions/port_resource_request.py neutron_lib/api/definitions/port_security.py neutron_lib/api/definitions/portbindings.py neutron_lib/api/definitions/portbindings_extended.py neutron_lib/api/definitions/project_default_networks.py neutron_lib/api/definitions/project_id.py neutron_lib/api/definitions/provider_net.py neutron_lib/api/definitions/qos.py neutron_lib/api/definitions/qos_bw_limit_direction.py neutron_lib/api/definitions/qos_bw_minimum_ingress.py neutron_lib/api/definitions/qos_default.py neutron_lib/api/definitions/qos_gateway_ip.py neutron_lib/api/definitions/qos_port_network_policy.py neutron_lib/api/definitions/qos_rule_type_details.py neutron_lib/api/definitions/qos_rules_alias.py neutron_lib/api/definitions/rbac_address_scope.py neutron_lib/api/definitions/rbac_security_groups.py neutron_lib/api/definitions/rbac_subnetpool.py neutron_lib/api/definitions/revisionifmatch.py neutron_lib/api/definitions/router_admin_state_down_before_update.py neutron_lib/api/definitions/router_availability_zone.py neutron_lib/api/definitions/router_interface_fip.py neutron_lib/api/definitions/routerservicetype.py neutron_lib/api/definitions/security_groups_port_filtering.py neutron_lib/api/definitions/segment.py neutron_lib/api/definitions/segments_peer_subnet_host_routes.py neutron_lib/api/definitions/servicetype.py neutron_lib/api/definitions/sfc.py neutron_lib/api/definitions/sort_key_validation.py neutron_lib/api/definitions/sorting.py neutron_lib/api/definitions/standard_attr_segment.py neutron_lib/api/definitions/stateful_security_group.py neutron_lib/api/definitions/subnet.py neutron_lib/api/definitions/subnet_dns_publish_fixed_ip.py neutron_lib/api/definitions/subnet_onboard.py neutron_lib/api/definitions/subnet_segmentid_enforce.py neutron_lib/api/definitions/subnet_segmentid_writable.py neutron_lib/api/definitions/subnet_service_types.py neutron_lib/api/definitions/subnetpool.py neutron_lib/api/definitions/subnetpool_prefix_ops.py neutron_lib/api/definitions/tag_ports_during_bulk_creation.py neutron_lib/api/definitions/trunk.py neutron_lib/api/definitions/trunk_details.py neutron_lib/api/definitions/uplink_status_propagation.py neutron_lib/api/definitions/vlantransparent.py neutron_lib/api/definitions/vpn.py neutron_lib/api/definitions/vpn_endpoint_groups.py neutron_lib/api/definitions/vpn_flavors.py neutron_lib/api/validators/__init__.py neutron_lib/api/validators/allowedaddresspairs.py neutron_lib/api/validators/availability_zone.py neutron_lib/api/validators/dns.py neutron_lib/api/validators/multiprovidernet.py neutron_lib/callbacks/__init__.py neutron_lib/callbacks/events.py neutron_lib/callbacks/exceptions.py neutron_lib/callbacks/manager.py neutron_lib/callbacks/priority_group.py neutron_lib/callbacks/registry.py neutron_lib/callbacks/resources.py neutron_lib/db/__init__.py neutron_lib/db/api.py neutron_lib/db/constants.py neutron_lib/db/model_base.py neutron_lib/db/model_query.py neutron_lib/db/resource_extend.py neutron_lib/db/sqlalchemytypes.py neutron_lib/db/standard_attr.py neutron_lib/db/utils.py neutron_lib/exceptions/__init__.py neutron_lib/exceptions/address_scope.py neutron_lib/exceptions/agent.py neutron_lib/exceptions/allowedaddresspairs.py neutron_lib/exceptions/availability_zone.py neutron_lib/exceptions/dhcpagentscheduler.py neutron_lib/exceptions/dns.py neutron_lib/exceptions/dvr.py neutron_lib/exceptions/external_net.py neutron_lib/exceptions/extraroute.py neutron_lib/exceptions/firewall_v2.py neutron_lib/exceptions/flavors.py neutron_lib/exceptions/l3.py neutron_lib/exceptions/l3_ext_ha_mode.py neutron_lib/exceptions/metering.py neutron_lib/exceptions/multiprovidernet.py neutron_lib/exceptions/network_segment_range.py neutron_lib/exceptions/placement.py neutron_lib/exceptions/port_security.py neutron_lib/exceptions/qos.py neutron_lib/exceptions/vlantransparent.py neutron_lib/exceptions/vpn.py neutron_lib/hacking/__init__.py neutron_lib/hacking/checks.py neutron_lib/hacking/translation_checks.py neutron_lib/locale/zh_CN/LC_MESSAGES/neutron_lib.po neutron_lib/objects/__init__.py neutron_lib/objects/common_types.py neutron_lib/objects/exceptions.py neutron_lib/objects/registry.py neutron_lib/objects/utils.py neutron_lib/objects/extensions/__init__.py neutron_lib/objects/extensions/standardattributes.py neutron_lib/objects/logapi/__init__.py neutron_lib/objects/logapi/event_types.py neutron_lib/placement/__init__.py neutron_lib/placement/client.py neutron_lib/placement/constants.py neutron_lib/placement/utils.py neutron_lib/plugins/__init__.py neutron_lib/plugins/constants.py neutron_lib/plugins/directory.py neutron_lib/plugins/utils.py neutron_lib/plugins/ml2/__init__.py neutron_lib/plugins/ml2/api.py neutron_lib/policy/__init__.py neutron_lib/policy/_engine.py neutron_lib/services/__init__.py neutron_lib/services/base.py neutron_lib/services/constants.py neutron_lib/services/logapi/__init__.py neutron_lib/services/logapi/constants.py neutron_lib/services/qos/__init__.py neutron_lib/services/qos/base.py neutron_lib/services/qos/constants.py neutron_lib/services/trunk/__init__.py neutron_lib/services/trunk/constants.py neutron_lib/tests/__init__.py neutron_lib/tests/_base.py neutron_lib/tests/_post_mortem_debug.py neutron_lib/tests/tools.py neutron_lib/tests/etc/dummy_policy.json neutron_lib/tests/etc/neutron_lib.conf neutron_lib/tests/etc/no_policy.json neutron_lib/tests/etc/policy.json neutron_lib/tests/unit/__init__.py neutron_lib/tests/unit/fake_notifier.py neutron_lib/tests/unit/test_context.py neutron_lib/tests/unit/test_fixture.py neutron_lib/tests/unit/test_neutron_lib.py neutron_lib/tests/unit/test_rpc.py neutron_lib/tests/unit/test_worker.py neutron_lib/tests/unit/api/__init__.py neutron_lib/tests/unit/api/test_attributes.py neutron_lib/tests/unit/api/test_conversions.py neutron_lib/tests/unit/api/test_extensions.py neutron_lib/tests/unit/api/test_faults.py neutron_lib/tests/unit/api/definitions/__init__.py neutron_lib/tests/unit/api/definitions/base.py neutron_lib/tests/unit/api/definitions/ip_allocation.py neutron_lib/tests/unit/api/definitions/test__dummy.py neutron_lib/tests/unit/api/definitions/test_address_scope.py neutron_lib/tests/unit/api/definitions/test_admin_state_down_before_update.py neutron_lib/tests/unit/api/definitions/test_agent.py neutron_lib/tests/unit/api/definitions/test_agent_resources_synced.py neutron_lib/tests/unit/api/definitions/test_allowedaddresspairs.py neutron_lib/tests/unit/api/definitions/test_auto_allocated_topology.py neutron_lib/tests/unit/api/definitions/test_availability_zone.py neutron_lib/tests/unit/api/definitions/test_availability_zone_filter.py neutron_lib/tests/unit/api/definitions/test_bgpvpn.py neutron_lib/tests/unit/api/definitions/test_bgpvpn_net_assoc_stdattrs.py neutron_lib/tests/unit/api/definitions/test_bgpvpn_port_assoc_stdattrs.py neutron_lib/tests/unit/api/definitions/test_bgpvpn_router_assoc_stdattrs.py neutron_lib/tests/unit/api/definitions/test_bgpvpn_routes_control.py neutron_lib/tests/unit/api/definitions/test_bgpvpn_stdattrs.py neutron_lib/tests/unit/api/definitions/test_bgpvpn_vni.py neutron_lib/tests/unit/api/definitions/test_data_plane_status.py neutron_lib/tests/unit/api/definitions/test_default_subnetpools.py neutron_lib/tests/unit/api/definitions/test_dhcpagentscheduler.py neutron_lib/tests/unit/api/definitions/test_dns.py neutron_lib/tests/unit/api/definitions/test_dns_domain_ports.py neutron_lib/tests/unit/api/definitions/test_dvr.py neutron_lib/tests/unit/api/definitions/test_empty_string_filtering.py neutron_lib/tests/unit/api/definitions/test_expose_l3_conntrack_helper.py neutron_lib/tests/unit/api/definitions/test_expose_port_forwarding_in_fip.py neutron_lib/tests/unit/api/definitions/test_external_net.py neutron_lib/tests/unit/api/definitions/test_extra_dhcp_opt.py neutron_lib/tests/unit/api/definitions/test_extraroute.py neutron_lib/tests/unit/api/definitions/test_extraroute_atomic.py neutron_lib/tests/unit/api/definitions/test_filter_validation.py neutron_lib/tests/unit/api/definitions/test_fip64.py neutron_lib/tests/unit/api/definitions/test_fip_port_details.py neutron_lib/tests/unit/api/definitions/test_firewall_v2.py neutron_lib/tests/unit/api/definitions/test_flavors.py neutron_lib/tests/unit/api/definitions/test_floating_ip_port_forwarding.py neutron_lib/tests/unit/api/definitions/test_floating_ip_port_forwarding_extension.py neutron_lib/tests/unit/api/definitions/test_floatingip_autodelete_internal.py neutron_lib/tests/unit/api/definitions/test_floatingip_pools.py neutron_lib/tests/unit/api/definitions/test_flowclassifier.py neutron_lib/tests/unit/api/definitions/test_ip_substring_port_filtering.py neutron_lib/tests/unit/api/definitions/test_l2_adjancency.py neutron_lib/tests/unit/api/definitions/test_l3.py neutron_lib/tests/unit/api/definitions/test_l3_conntrack_helper.py neutron_lib/tests/unit/api/definitions/test_l3_ext_gw_mode.py neutron_lib/tests/unit/api/definitions/test_l3_ext_ha_mode.py neutron_lib/tests/unit/api/definitions/test_l3_flavors.py neutron_lib/tests/unit/api/definitions/test_l3_port_ip_change_not_allowed.py neutron_lib/tests/unit/api/definitions/test_logging.py neutron_lib/tests/unit/api/definitions/test_logging_resource.py neutron_lib/tests/unit/api/definitions/test_metering.py neutron_lib/tests/unit/api/definitions/test_multiprovidernet.py neutron_lib/tests/unit/api/definitions/test_network.py neutron_lib/tests/unit/api/definitions/test_network_availability_zone.py neutron_lib/tests/unit/api/definitions/test_network_ip_availability.py neutron_lib/tests/unit/api/definitions/test_network_mtu.py neutron_lib/tests/unit/api/definitions/test_network_mtu_writable.py neutron_lib/tests/unit/api/definitions/test_network_segment_range.py neutron_lib/tests/unit/api/definitions/test_pagination.py neutron_lib/tests/unit/api/definitions/test_port.py neutron_lib/tests/unit/api/definitions/test_port_mac_address_regenerate.py neutron_lib/tests/unit/api/definitions/test_port_resource_request.py neutron_lib/tests/unit/api/definitions/test_port_security.py neutron_lib/tests/unit/api/definitions/test_portbindings.py neutron_lib/tests/unit/api/definitions/test_portbindings_extended.py neutron_lib/tests/unit/api/definitions/test_project_default_networks.py neutron_lib/tests/unit/api/definitions/test_project_id.py neutron_lib/tests/unit/api/definitions/test_provider_net.py neutron_lib/tests/unit/api/definitions/test_qos.py neutron_lib/tests/unit/api/definitions/test_qos_bw_limit_direction.py neutron_lib/tests/unit/api/definitions/test_qos_bw_minimum_ingress.py neutron_lib/tests/unit/api/definitions/test_qos_default.py neutron_lib/tests/unit/api/definitions/test_qos_gateway_ip.py neutron_lib/tests/unit/api/definitions/test_qos_port_network_policy.py neutron_lib/tests/unit/api/definitions/test_qos_rule_type_details.py neutron_lib/tests/unit/api/definitions/test_qos_rules_alias.py neutron_lib/tests/unit/api/definitions/test_rbac_address_scope.py neutron_lib/tests/unit/api/definitions/test_rbac_security_groups.py neutron_lib/tests/unit/api/definitions/test_rbac_subnetpool.py neutron_lib/tests/unit/api/definitions/test_revisionifmatch.py neutron_lib/tests/unit/api/definitions/test_router_availability_zone.py neutron_lib/tests/unit/api/definitions/test_router_interface_fip.py neutron_lib/tests/unit/api/definitions/test_routerservicetype.py neutron_lib/tests/unit/api/definitions/test_security_groups_port_filtering.py neutron_lib/tests/unit/api/definitions/test_segment.py neutron_lib/tests/unit/api/definitions/test_segment_peer_subnet_host_routes.py neutron_lib/tests/unit/api/definitions/test_servicetype.py neutron_lib/tests/unit/api/definitions/test_sfc.py neutron_lib/tests/unit/api/definitions/test_sort_key_validation.py neutron_lib/tests/unit/api/definitions/test_sorting.py neutron_lib/tests/unit/api/definitions/test_standard_attr_segment.py neutron_lib/tests/unit/api/definitions/test_stateful_security_group.py neutron_lib/tests/unit/api/definitions/test_subnet.py neutron_lib/tests/unit/api/definitions/test_subnet_dns_publish_fixed_ip.py neutron_lib/tests/unit/api/definitions/test_subnet_onboard.py neutron_lib/tests/unit/api/definitions/test_subnet_segmentid_enforce.py neutron_lib/tests/unit/api/definitions/test_subnet_segmentid_writable.py neutron_lib/tests/unit/api/definitions/test_subnet_service_types.py neutron_lib/tests/unit/api/definitions/test_subnetpool.py neutron_lib/tests/unit/api/definitions/test_subnetpool_prefix_ops.py neutron_lib/tests/unit/api/definitions/test_tag_ports_during_bulk_creation.py neutron_lib/tests/unit/api/definitions/test_trunk.py neutron_lib/tests/unit/api/definitions/test_trunk_details.py neutron_lib/tests/unit/api/definitions/test_uplink_status_propagation.py neutron_lib/tests/unit/api/definitions/test_vlantransparent.py neutron_lib/tests/unit/api/definitions/test_vpn.py neutron_lib/tests/unit/api/definitions/test_vpn_endpoint_groups.py neutron_lib/tests/unit/api/definitions/test_vpn_flavors.py neutron_lib/tests/unit/api/validators/__init__.py neutron_lib/tests/unit/api/validators/test_allowedaddresspairs.py neutron_lib/tests/unit/api/validators/test_availability_zone.py neutron_lib/tests/unit/api/validators/test_dns.py neutron_lib/tests/unit/api/validators/test_multiprovidernet.py neutron_lib/tests/unit/api/validators/test_validators.py neutron_lib/tests/unit/callbacks/__init__.py neutron_lib/tests/unit/callbacks/test_callback_exceptions.py neutron_lib/tests/unit/callbacks/test_events.py neutron_lib/tests/unit/callbacks/test_manager.py neutron_lib/tests/unit/callbacks/test_registry.py neutron_lib/tests/unit/clients/__init__.py neutron_lib/tests/unit/db/__init__.py neutron_lib/tests/unit/db/_base.py neutron_lib/tests/unit/db/test_api.py neutron_lib/tests/unit/db/test_model_base.py neutron_lib/tests/unit/db/test_model_query.py neutron_lib/tests/unit/db/test_resource_extend.py neutron_lib/tests/unit/db/test_sqlalchemytypes.py neutron_lib/tests/unit/db/test_standard_attr.py neutron_lib/tests/unit/db/test_utils.py neutron_lib/tests/unit/exceptions/__init__.py neutron_lib/tests/unit/exceptions/test_exceptions.py neutron_lib/tests/unit/hacking/__init__.py neutron_lib/tests/unit/hacking/test_checks.py neutron_lib/tests/unit/legacy/__init__.py neutron_lib/tests/unit/objects/__init__.py neutron_lib/tests/unit/objects/test_common_types.py neutron_lib/tests/unit/objects/test_utils.py neutron_lib/tests/unit/placement/__init__.py neutron_lib/tests/unit/placement/test_client.py neutron_lib/tests/unit/placement/test_utils.py neutron_lib/tests/unit/plugins/__init__.py neutron_lib/tests/unit/plugins/test_directory.py neutron_lib/tests/unit/plugins/test_utils.py neutron_lib/tests/unit/plugins/ml2/__init__.py neutron_lib/tests/unit/plugins/ml2/test_api.py neutron_lib/tests/unit/policy/__init__.py neutron_lib/tests/unit/policy/test__engine.py neutron_lib/tests/unit/services/__init__.py neutron_lib/tests/unit/services/test_base.py neutron_lib/tests/unit/services/qos/__init__.py neutron_lib/tests/unit/services/qos/test_base.py neutron_lib/tests/unit/utils/__init__.py neutron_lib/tests/unit/utils/test_file.py neutron_lib/tests/unit/utils/test_helpers.py neutron_lib/tests/unit/utils/test_host.py neutron_lib/tests/unit/utils/test_net.py neutron_lib/tests/unit/utils/test_runtime.py neutron_lib/tests/unit/utils/test_test.py neutron_lib/utils/__init__.py neutron_lib/utils/file.py neutron_lib/utils/helpers.py neutron_lib/utils/host.py neutron_lib/utils/net.py neutron_lib/utils/runtime.py neutron_lib/utils/test.py neutron_lib/utils/upgrade_checks.py releasenotes/notes/.placeholder releasenotes/notes/Adds-PORT_FORWARDING_FLOATINGIP_KEY-ee2c7d164bea04b4.yaml releasenotes/notes/add-a-getter-for-a-newly-added-option-2082877bf7dd136b.yaml releasenotes/notes/add-action-status-3dbfe2490a0d231a.yaml releasenotes/notes/add-api-extension-sort-key-validation-b42f5839671fe5f5.yaml releasenotes/notes/add-availability_zone_filter-extension-e91e1e5e822e4133.yaml releasenotes/notes/add-base-upgrade-checks-class-f6da1d501663d8c5.yaml releasenotes/notes/add-can-port-be-bound-to-virtual-bridge-5d6db8785e58fcb9.yaml releasenotes/notes/add-convert-to-string-524541aa6224f66f.yaml releasenotes/notes/add-description-field-in-port-forwarding-9da781b1e38ca858.yaml releasenotes/notes/add-directory-is-loaded-e9da5b65824dddad.yaml releasenotes/notes/add-empty-string-filtering-api-extension-44cb392025dc359c.yaml releasenotes/notes/add-exception-pkg-5a14389891abf358.yaml releasenotes/notes/add-extension-standard-attr-segment-8c721741589bf10b.yaml releasenotes/notes/add-extension-supported-be6f7069856d2891.yaml releasenotes/notes/add-extension-uplink-status-propagation-6b6050d6609c19c8.yaml releasenotes/notes/add-filter-validation-api-extension-15cc667d5498f163.yaml releasenotes/notes/add-floatingip-pools-extension-17a1ee5c7eafc989.yaml releasenotes/notes/add-ip-hopopt-to-protocol-dictionary-3cbe54bb5056f790.yaml releasenotes/notes/add-ip-substring-filtering-extension-06bb0c1f738ee330.yaml releasenotes/notes/add-ipinip-protocol-ab9287f9b698f34c.yaml releasenotes/notes/add-is-default-to-network-d16a2e6bcfae943a.yaml releasenotes/notes/add-is_filter-keyword-to-attribute-maps-3fa31e91c353d033.yaml releasenotes/notes/add-is_sort_key-keyword-to-attribute-map-75342446d99f4490.yaml releasenotes/notes/add-network-address-scope-affinity-error-8f6b4493a92142d4.yaml releasenotes/notes/add-network-segment-range-overlap-exception-e8b4b2b425c51c80.yaml releasenotes/notes/add-network-segment-range-plugin-constant-9e80453919162c89.yaml releasenotes/notes/add-ovo-registry-27cb7d4ac76d4dc8.yaml releasenotes/notes/add-port-binding-resource-73f9800dbda121ca.yaml releasenotes/notes/add-port-bindings-resource-messages-rpc-1382ba9842561cdb.yaml releasenotes/notes/add-port_details-to-floatingip-a2a3c95cc54737ac.yaml releasenotes/notes/add-rbac-address-scope-dc4683772b205632.yaml releasenotes/notes/add-rbac-security-groups-2e47acd9eac3a320.yaml releasenotes/notes/add-rbac-subnetpool-bb63d4cef1d06e73.yaml releasenotes/notes/add-retrieve-sort-keys-from-attribute-map-ae53d67e0be2ace0.yaml releasenotes/notes/add-router-not-found-in-factory-exception-e2bf9431549ff9b9.yaml releasenotes/notes/add-support-for-fetching-specific-column-in-OVO-81b764b203849776.yaml releasenotes/notes/add-traffic-control-exceptions-0e137dae3a556d54.yaml releasenotes/notes/add-two-fields-to-duplicated-entry-exception-75b0e07c6e1cc6ae.yaml releasenotes/notes/add-type-driver-methods-for-network-segment-range-e6d300d430d97dd6.yaml releasenotes/notes/add-validate-cidr-848c9171dcbcf57c.yaml releasenotes/notes/add-validator-pkg-a6565a2d4fbfa1d8.yaml releasenotes/notes/add-vif-type-agilio-ovs-6bee5b2557aca10e.yaml releasenotes/notes/add-vni-to-bgpvpn-7531df9fa4f8955b.yaml releasenotes/notes/add-vnic-virtio-forwarder-portbinding-f7f87dfbef456ed1.yaml releasenotes/notes/add_fwg_group-9252d07f1011613d.yaml releasenotes/notes/admin-state-down-before-update-c06fb3a551fe499f.yaml releasenotes/notes/advsvc-role-support-d4f1c532264b729a.yaml releasenotes/notes/agent-resources-synced-e70828841faf7acd.yaml releasenotes/notes/agent_extensions-2b497ff33c6dc3e8.yaml releasenotes/notes/alembic-branches-6d5947d141efd26e.yaml releasenotes/notes/api-definition-base-d2e9514c5ee2ef5b.yaml releasenotes/notes/bgpvpn-api-def-22c7072575316ddd.yaml releasenotes/notes/bgpvpn-api-ref-f0294d9ddec726a0.yaml releasenotes/notes/bgpvpn-routes-control-51cd95d6ab265cb1.yaml releasenotes/notes/bgpvpn_rt_fix-6d02db6a1c22f002.yaml releasenotes/notes/boilerplate-ext-descriptor-a5cec8b9b900cbfd.yaml releasenotes/notes/callback_priority-2ded960e17bd5db9.yaml releasenotes/notes/change_placement_client_method_names_b26bb71425f42db3.yaml releasenotes/notes/cidr_for_canonical_format-4e7925d76a27a19d.yaml releasenotes/notes/cleanup-unused-l3-attr-def-f0eab40813d17a2d.yaml releasenotes/notes/client-id-number-dhcp-option-a099f927eb8f99af.yaml releasenotes/notes/conntrack-helper-parent-resource-mapping-95a4a2cb6f6536fe.yaml releasenotes/notes/context-manager-23538670cd9c701f.yaml releasenotes/notes/context-public-6df198b77027c224.yaml releasenotes/notes/core-attributes-43e6969f1b187e5c.yaml releasenotes/notes/create-netmtu-writable-extension-284892119ef6595c.yaml releasenotes/notes/data-plane-status-ext-c3452a01ef5007ce.yaml releasenotes/notes/default_overrides_none-ecc8dcf2c9c37e5d.yaml releasenotes/notes/deprecate-api-utils-4f86288591c95679.yaml releasenotes/notes/directory-fixture-083c5c5f365670d6.yaml releasenotes/notes/disable-port-number-zero-2fb484a802f099a7.yaml releasenotes/notes/dns-api-def-bc24a58f56c5fbfb.yaml releasenotes/notes/dns-domain-ports-ext-39a069119e79e59b.yaml releasenotes/notes/drop-python-2-7-f46dfa10169f70db.yaml releasenotes/notes/enable-hacking-check-H904-f512ecc98c0a4033.yaml releasenotes/notes/ethertype_validator-2d608a46c237e214.yaml releasenotes/notes/events_l3_flavors-053714858ced693d.yaml releasenotes/notes/expose-and-enhance-callback-api-714cce65a3c44fe7.yaml releasenotes/notes/expose-port-forwarding-in-fip-a7880506cea0ad1d.yaml releasenotes/notes/extend-segment-methods-with-filters-6e74953ae2d3b828.yaml releasenotes/notes/extension-fixture-b7fd61384f1a4d1d.yaml releasenotes/notes/extension_descriptor-04025e86249cc94c.yaml releasenotes/notes/extra-dhcp-opt-public-vars-ec4e1c2dcac43d69.yaml releasenotes/notes/extraroute-atomic-apidef-80a7c6d4a773c701.yaml releasenotes/notes/extraroute-atomic-apidef-additive-fb783d66c08618d4.yaml releasenotes/notes/fip64-0c6bb38417d602f1.yaml releasenotes/notes/fix-warnfixture-c9457c50d0d5c5a7.yaml releasenotes/notes/floatingip-autodelete-internal-dep-8e544fad694d1275.yaml releasenotes/notes/floatingip-autodelete-internal-f08675d8d64d34c6.yaml releasenotes/notes/floatingip-portforwarding-17c284080541bc78.yaml releasenotes/notes/flush_on_subtransaction-99ef11dfb56b706d.yaml releasenotes/notes/fwaas-api-def-a6f03db369177b4a.yaml releasenotes/notes/fwaas-exceptions-e580766205b466d4.yaml releasenotes/notes/fwaas_converters_validators-c310900b4386146e.yaml releasenotes/notes/gateway-ip-qos-ext-d3ffb5f517c9f713.yaml releasenotes/notes/hacking-check-n537-280ec39c061d9dd7.yaml releasenotes/notes/interconnection-api-def-cbec5e4f77852fe7.yaml releasenotes/notes/introduce-logging-api-031d00eb84d5d061.yaml releasenotes/notes/introduce_subnetpool_prefix_ops_extension-e37874c936d2554c.yaml releasenotes/notes/ipv6-canonical-address-13900a784f847ce3.yaml releasenotes/notes/ipv6_address_usage-ef3d65ad5aa5798b.yaml releasenotes/notes/l3-agent-extensions-ha-state-change-837140efe4187a99.yaml releasenotes/notes/l3-apidef-exceptions-ee57b9df1c7443d4.yaml releasenotes/notes/l3-apidefs-d028c708c22ef2a0.yaml releasenotes/notes/l3-conntrack-helper-validator-654ccafb296e5f21.yaml releasenotes/notes/l3-port-ip-change-not-allow-2c98e13c08b5ee85.yaml releasenotes/notes/l3_conntrack_helper-f186bcdcc31bcaf2.yaml releasenotes/notes/logging-api-ref-fafb884367ca60a2.yaml releasenotes/notes/logging-resource-api-cecf33e3be468eb2.yaml releasenotes/notes/mac-generator-f927df2fe57300c0.yaml releasenotes/notes/migrate-public-to-shared-0c67b32f9c37c751.yaml releasenotes/notes/move-get-random-mac-98f47d81cb34483d.yaml releasenotes/notes/move-segment-range-types-to-lib-constants-d45c6959607e9136.yaml releasenotes/notes/moved-netmtu-extension-5999348000adcfaf.yaml releasenotes/notes/network-segment-range-ext-2b93b7fa42310c25.yaml releasenotes/notes/new-hacking-check-no-log-translations-4a430a38aeb06452.yaml releasenotes/notes/new-policy-module-f5638e23fe91a287.yaml releasenotes/notes/new-validator-range-or-none-dc8d557ec1f2622a.yaml releasenotes/notes/new-vif-details-parameters-71e70ab5e7c26c45.yaml releasenotes/notes/one-hacking-factory-01053e8e3d88c3d5.yaml releasenotes/notes/oslo-db-jitter-c4d13cc81755203e.yaml releasenotes/notes/placement-NoAuthClient-for-fullstack-tests-17b4ab512417d638.yaml releasenotes/notes/placement-binding-exceptions-6362d52391b7023e.yaml releasenotes/notes/placement-client-bump-latest-supported-version-to-1-20-fe96751dab42399b.yaml releasenotes/notes/placement-client-bump-latest-supported-version-to-1-23-83589217b7b079fe.yaml releasenotes/notes/placement-client-do-not-swallow-exceptions-c33c9a9224a27551.yaml releasenotes/notes/placement-client-move-9f292ae2067c119c.yaml releasenotes/notes/placement-client-optional-rp-generations-44d1f1055d5496be.yaml releasenotes/notes/placement-client-return-f4f22d244e7b174a.yaml releasenotes/notes/placement-client-update-ensure-rp-9e5c3cf34d49b212.yaml releasenotes/notes/placement-constants-f2629b98f6fe148f.yaml releasenotes/notes/placement-resource-provider-functions-17ec45f714ea2b23.yaml releasenotes/notes/placement-utils-a66e6b302d2bc8f0.yaml releasenotes/notes/plugin-directory-55861f4098813ba6.yaml releasenotes/notes/policy-in-code-1e73cabebd41d66e.yaml releasenotes/notes/policy-redux-25c26836219fd02d.yaml releasenotes/notes/populate-dict-defaults-3f205c414f21bf54.yaml releasenotes/notes/port-mac-address-regenerate-cc33d03216b5bc3d.yaml releasenotes/notes/port-range-compared-as-int-4d07fe030206f818.yaml releasenotes/notes/port-resource-request-cb520720cd19523b.yaml releasenotes/notes/portbindings-apidef-3d7893bcb94d7f61.yaml releasenotes/notes/portbindings-extended-3a89560ee63824e1.yaml releasenotes/notes/provider-net-apidef-9ebe9f56840c79f7.yaml releasenotes/notes/public-service-classes-e52d7c79a075b799.yaml releasenotes/notes/public-sql-fixtures-35d0aa74a368e217.yaml releasenotes/notes/qos-bw-minimum-ingress-cff397e598b6fa3a.yaml releasenotes/notes/qos-port-network-policy-c64c57cf2ccec725.yaml releasenotes/notes/qos-rules-alias-ext-c13417dcb3d81130.yaml releasenotes/notes/qos-rules-alias-ext-fix-3f3f7dd21837cfec.yaml releasenotes/notes/rehome-address-scope-apidef-f4e8bb74be61729a.yaml releasenotes/notes/rehome-agent-apidef-7a2dde6a9810f55c.yaml releasenotes/notes/rehome-allowedaddrpairs-apidef-cd342b9a57a2dfdf.yaml releasenotes/notes/rehome-api-faults-cf30246e5e5bf8b8.yaml releasenotes/notes/rehome-autotopology-apidef-4a77e8ba0c783f7e.yaml releasenotes/notes/rehome-az-apidef-1e63cbd2359994fa.yaml releasenotes/notes/rehome-common-constants-52f39a79e8eabd7e.yaml releasenotes/notes/rehome-common-constants-8ac9580e52fd3618.yaml releasenotes/notes/rehome-common-exceptions-eda074ddb02349ab.yaml releasenotes/notes/rehome-common-rpc-5d84a9fe0faa71b7.yaml releasenotes/notes/rehome-core-api-defs-390735ff3bd5d2ab.yaml releasenotes/notes/rehome-db-api-63300ddab6a41e28.yaml releasenotes/notes/rehome-db-api-event-listeners-2fb5256166e2a4e8.yaml releasenotes/notes/rehome-db-model-query-234b1559f3728a5e.yaml releasenotes/notes/rehome-db-utils-3076bf724caa31ef.yaml releasenotes/notes/rehome-dftsnetpool-apidef-4de5d75d2a63dec9.yaml releasenotes/notes/rehome-dhcpagentscheduler-apidef-1f7729fb5834dcd2.yaml releasenotes/notes/rehome-dhcpopts-apidef-389ab9d8935e5e0d.yaml releasenotes/notes/rehome-dvr-apidef-a6aa415152457c9a.yaml releasenotes/notes/rehome-dvr-related-leftover-constants-2cf329794166b3f2.yaml releasenotes/notes/rehome-externalnet-apidef-d377f87da900eabe.yaml releasenotes/notes/rehome-extraroute-apidef-e14e72e03ce18ead.yaml releasenotes/notes/rehome-flavors-apidef-ef84b2c1c7eaeed7.yaml releasenotes/notes/rehome-get-port-binding-98765e77c627e57d.yaml releasenotes/notes/rehome-get-updatable-fields-82fd87d402d63ca2.yaml releasenotes/notes/rehome-getphysmtu-plugin-fn-5875e352e3a14af3.yaml releasenotes/notes/rehome-ipalloc-apidef-dee59cfffd903b7a.yaml releasenotes/notes/rehome-ipv6pdprefix-const-d3b39992df4adef8.yaml releasenotes/notes/rehome-l2adjacency-apidef-f91bf184d90122c8.yaml releasenotes/notes/rehome-l3extgwmode-apidef-8f83e0f6cf0515e7.yaml releasenotes/notes/rehome-l3exthamode-apidef-9b3ef0956edb3883.yaml releasenotes/notes/rehome-l3flavors-apidef-da5e9b5d46df5cc7.yaml releasenotes/notes/rehome-metering-apidef-d9a0e70cbecc2bcc.yaml releasenotes/notes/rehome-ml2-api-extaliases-4db48e113893c7a5.yaml releasenotes/notes/rehome-ml2-driverapi-363db4b8fa42f8f1.yaml releasenotes/notes/rehome-ml2-mechdriver-cc86d3a2fe4c2822.yaml releasenotes/notes/rehome-modelquery-2079a43163def870.yaml releasenotes/notes/rehome-multiprovidernet-apidef-367e57772e931758.yaml releasenotes/notes/rehome-netaz-apidef-74e962ef682380bc.yaml releasenotes/notes/rehome-netipavail-apidef-d03558ac48b71333.yaml releasenotes/notes/rehome-obj-commontypes-f8dfca432bf4583b.yaml releasenotes/notes/rehome-obj-logeventtypes-b31e7c6492ca6615.yaml releasenotes/notes/rehome-obj-stdattrs-06c4df5bb1fca3f1.yaml releasenotes/notes/rehome-ovo-exceptions-fbddfeea582ef3f1.yaml releasenotes/notes/rehome-pagination-apidef-9aebf1c7a6bcb58b.yaml releasenotes/notes/rehome-placement-api-client-a9ac5d96ca8570aa.yaml releasenotes/notes/rehome-plugin-constants-ebf350dfd989957a.yaml releasenotes/notes/rehome-plugin-utils-39e3f839c0538de9.yaml releasenotes/notes/rehome-plugin-utils-create-fns-9b8591f5222bff66.yaml releasenotes/notes/rehome-port-dev-util-ea6f4a5c4da42f6c.yaml releasenotes/notes/rehome-projid-apidef-a433b1b003f27a20.yaml releasenotes/notes/rehome-provider-network-attribute-updates-supported-ea02a526ef297053.yaml releasenotes/notes/rehome-psec-apidef-bd9344ec1e6066b4.yaml releasenotes/notes/rehome-qos-apidef-0dbe094b8b21a580.yaml releasenotes/notes/rehome-qos-driverbase-f729875b2ad74ce0.yaml releasenotes/notes/rehome-qosbwldir-apidef-f0e3f778f2f980c0.yaml releasenotes/notes/rehome-qosdft-apidef-b70596ca11c08803.yaml releasenotes/notes/rehome-qosrtdetails-apidef-2276ec66a0e545ca.yaml releasenotes/notes/rehome-rbac-policy-callbacks-24fa12ad1ab4c443.yaml releasenotes/notes/rehome-resource-extend-7eee483ec4146801.yaml releasenotes/notes/rehome-revisionifmatch-apidef-574ac0a930cdaf3f.yaml releasenotes/notes/rehome-routeraz-apidef-efc5f202e04b8272.yaml releasenotes/notes/rehome-routersvctype-apidef-1d9d712fd5383eb5.yaml releasenotes/notes/rehome-runtime-utils-acb4451326cbe4d9.yaml releasenotes/notes/rehome-secgrp-portfilter-apidef-6723062419531d70.yaml releasenotes/notes/rehome-segment-apidef-a5f81adb834328f8.yaml releasenotes/notes/rehome-shared-const-d847b2e190122425.yaml releasenotes/notes/rehome-sorting-apidef-1547f093da322c14.yaml releasenotes/notes/rehome-sqlalchemytypes-14817eb6694463db.yaml releasenotes/notes/rehome-stdattr-d834900d3fd3c2e6.yaml releasenotes/notes/rehome-subnetservicetypes-apidef-31e2e9564c746317.yaml releasenotes/notes/rehome-svctype-apidef-9002b2e2bcbeec8e.yaml releasenotes/notes/rehome-testools-6fba053249e14d42.yaml releasenotes/notes/rehome-topics-ca451e72c8c9603a.yaml releasenotes/notes/rehome-trunk-callback-resources-be40f8382490ef0d.yaml releasenotes/notes/rehome-trunk-consts-407e4590e9386d19.yaml releasenotes/notes/rehome-unstable-test-decorator-a062301ac7d7a082.yaml releasenotes/notes/rehome-vlantransp-apidef-1cd7d3ace9042686.yaml releasenotes/notes/rehome-worker-b7e9c7f477bdb926.yaml releasenotes/notes/remove-ensure_dir-aed59b616e02a2bb.yaml releasenotes/notes/remove-hacking-check-n523-014d163a5ae23adb.yaml releasenotes/notes/remove-neutron-interconnection-api-definition-4ff88c583f2fe47b.yaml releasenotes/notes/remove-neutron-lib-from-db-profiling-38436898d8e45b37.yaml releasenotes/notes/remove_label-801d7a1b13f179fa.yaml releasenotes/notes/reset-db-retry-settings-49e51cef4c842f69.yaml releasenotes/notes/resource-provider-uuid5-namespace-f7276ba1945ce82f.yaml releasenotes/notes/responsible_for_ports_allocation-5599dc59b3c98db2.yaml releasenotes/notes/revert-review-400408-4999a9159689c0c5.yaml releasenotes/notes/rm-apiutils-fa30241be7ca5162.yaml releasenotes/notes/rm-dup-pluginconst-085d0fcee4e931b8.yaml releasenotes/notes/routed-networks-hostroutes-fb43abf942b154ff.yaml releasenotes/notes/router-interface-fip-1e79b7909f8b264f.yaml releasenotes/notes/separate-hacking-factories-6fc36b38de95662a.yaml releasenotes/notes/service-plugin-base-a42c2241a2fe0d26.yaml releasenotes/notes/setproctitle_for_workers-e8805fcaf34026ab.yaml releasenotes/notes/sfc-api-def-4f46632eadfe895a.yaml releasenotes/notes/sqlalchemy-1-3-0-b0a2b15b10ae526f.yaml releasenotes/notes/stateful-security-group-a1ece5472f029dc1.yaml releasenotes/notes/std_attributes_bgpvpn-5a1c63f68d1ff6be.yaml releasenotes/notes/subnet-dns-publish-fixed-ip-031d78bbc85a419e.yaml releasenotes/notes/subnet-onboard-allow-create-update-subnets-74a4be6e9e97bbb6.yaml releasenotes/notes/subnet-onboard-api-definition-f4918ff1f1d12c97.yaml releasenotes/notes/subnet_segment_id_policy_enforce-cd8053c51417d373.yaml releasenotes/notes/subnet_segmentid_writable-e28a85033272f05d.yaml releasenotes/notes/subresource-update-attrmap-and-classmethods-76accdd5c56a3bd4.yaml releasenotes/notes/support-custom-filter-f4a15bb5b38b7d3e.yaml releasenotes/notes/support-rarp-protocol-44f5c67784e74db4.yaml releasenotes/notes/tag-ports-during-bulk-creation-ext-3dd2e68d99157a19.yaml releasenotes/notes/traffic-control-constants-b8120d1bea0681bf.yaml releasenotes/notes/transaction_constraint-d3f93c2ced4a74c6.yaml releasenotes/notes/trunk-api-08bfdcdd80f7e666.yaml releasenotes/notes/update-hacking-check-n536-2f63898bea693125.yaml releasenotes/notes/update-segment-api-definition-d7297e73e76a754c.yaml releasenotes/notes/update-subnet-onboard-api-267a9a37f6426d64.yaml releasenotes/notes/validator_check_route_loopback-bc2166b10a754c77.yaml releasenotes/notes/validator_ip_or_subnet_or_none-0175f906a9113954.yaml releasenotes/notes/vnic-type-smart-nic-45dd5a22a9d1aa63.yaml releasenotes/notes/vpn-api-def-52970461fac0f7d2.yaml releasenotes/source/README.rst releasenotes/source/conf.py releasenotes/source/index.rst releasenotes/source/ocata.rst releasenotes/source/pike.rst releasenotes/source/queens.rst releasenotes/source/rocky.rst releasenotes/source/stein.rst releasenotes/source/train.rst releasenotes/source/unreleased.rst releasenotes/source/_static/.placeholder releasenotes/source/_templates/.placeholder releasenotes/source/locale/fr/LC_MESSAGES/releasenotes.po tools/api_report.sh tools/check_samples.sh tools/migration_report.sh tools/pyir.pyneutron-lib-2.3.0/neutron_lib.egg-info/not-zip-safe0000664000175000017500000000000113641427177022250 0ustar zuulzuul00000000000000 neutron-lib-2.3.0/neutron_lib.egg-info/PKG-INFO0000664000175000017500000000312713641427177021122 0ustar zuulzuul00000000000000Metadata-Version: 1.2 Name: neutron-lib Version: 2.3.0 Summary: Neutron shared routines and utilities Home-page: https://docs.openstack.org/neutron-lib/latest/ Author: OpenStack Author-email: openstack-discuss@lists.openstack.org License: UNKNOWN Description: ======================== Team and repository tags ======================== .. image:: https://governance.openstack.org/tc/badges/neutron-lib.svg :target: https://governance.openstack.org/tc/reference/tags/index.html .. Change things from this point on =============================== neutron-lib =============================== Neutron shared routines and utilities * Free software: Apache license * Documentation: https://docs.openstack.org/neutron-lib/latest/ * Source: https://opendev.org/openstack/neutron-lib * Bugs: https://bugs.launchpad.net/neutron * Release notes: https://docs.openstack.org/releasenotes/neutron-lib/ Features -------- * TODO Platform: UNKNOWN Classifier: Environment :: OpenStack Classifier: Intended Audience :: Information Technology Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Requires-Python: >=3.6 neutron-lib-2.3.0/neutron_lib.egg-info/top_level.txt0000664000175000017500000000001413641427177022547 0ustar zuulzuul00000000000000neutron_lib neutron-lib-2.3.0/neutron_lib.egg-info/entry_points.txt0000664000175000017500000000021413641427177023315 0ustar zuulzuul00000000000000[oslo.policy.enforcer] neutron_lib = neutron_lib._policy:get_enforcer [oslo.policy.policies] neutron_lib = neutron_lib._policy:list_rules neutron-lib-2.3.0/neutron_lib.egg-info/requires.txt0000664000175000017500000000075413641427177022430 0ustar zuulzuul00000000000000pbr!=2.1.0,>=2.0.0 SQLAlchemy>=1.2.0 pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0 keystoneauth1>=3.4.0 netaddr>=0.7.18 stevedore>=1.20.0 os-ken>=0.3.0 oslo.concurrency>=3.26.0 oslo.config>=5.2.0 oslo.context>=2.19.2 oslo.db>=4.37.0 oslo.i18n>=3.15.3 oslo.log>=3.36.0 oslo.messaging>=5.29.0 oslo.policy>=1.30.0 oslo.serialization!=2.19.1,>=2.18.0 oslo.service!=1.28.1,>=1.24.0 oslo.utils>=3.33.0 oslo.versionedobjects>=1.31.2 osprofiler>=1.4.0 setproctitle>=1.1.10 WebOb>=1.7.1 os-traits>=0.9.0 neutron-lib-2.3.0/lower-constraints.txt0000664000175000017500000000341213641427107020237 0ustar zuulzuul00000000000000alabaster==0.7.10 alembic==0.8.10 amqp==2.1.1 appdirs==1.3.0 Babel==2.3.4 cachetools==2.0.0 contextlib2==0.4.0 coverage==4.0 decorator==3.4.0 docutils==0.11 dulwich==0.15.0 eventlet==0.18.2 extras==1.0.0 fasteners==0.7.0 fixtures==3.0.0 flake8==2.6.2 flake8-import-order==0.12 future==0.16.0 futurist==1.2.0 greenlet==0.4.10 hacking==1.1.0 imagesize==0.7.1 iso8601==0.1.11 Jinja2==2.10 keystoneauth1==3.4.0 kombu==4.0.0 linecache2==1.0.0 Mako==0.4.0 MarkupSafe==1.0 mccabe==0.2.1 monotonic==0.6 mox3==0.20.0 msgpack-python==0.4.0 netaddr==0.7.18 netifaces==0.10.4 openstackdocstheme==1.18.1 os-api-ref==1.4.0 os-client-config==1.28.0 os-ken==0.3.0 os-traits==0.9.0 oslo.concurrency==3.26.0 oslo.config==5.2.0 oslo.context==2.19.2 oslo.db==4.37.0 oslo.i18n==3.15.3 oslo.log==3.36.0 oslo.messaging==5.29.0 oslo.middleware==3.31.0 oslo.policy==1.30.0 oslo.serialization==2.18.0 oslo.service==1.24.0 oslo.utils==3.33.0 oslo.versionedobjects===1.31.2 oslotest==3.2.0 osprofiler===1.4.0 Paste==2.0.2 PasteDeploy==1.5.0 pbr==2.0.0 pecan===1.0.0 pep8==1.5.7 pika==0.10.0 pika-pool==0.1.3 prettytable==0.7.2 pycodestyle==2.4.0 pyflakes==0.8.1 Pygments==2.2.0 pyinotify==0.9.6 pyparsing==2.1.0 python-dateutil==2.5.3 python-editor==1.0.3 python-mimeparse==1.6.0 python-subunit==1.0.0 pytz==2013.6 PyYAML==3.12 reno==2.5.0 repoze.lru==0.7 requests==2.14.2 requestsexceptions==1.2.0 rfc3986==0.3.1 Routes==2.3.1 setproctitle==1.1.10 snowballstemmer==1.2.1 Sphinx==1.6.2 sphinxcontrib-websupport==1.0.1 SQLAlchemy==1.2.0 sqlalchemy-migrate==0.11.0 sqlparse==0.2.2 statsd==3.2.1 stestr==1.0.0 stevedore==1.20.0 Tempita==0.5.2 tenacity==3.2.1 testrepository==0.0.18 testresources==2.0.0 testscenarios==0.4 testtools==2.2.0 traceback2==1.4.0 unittest2==1.1.0 vine==1.1.4 weakrefmethod==1.0.2 WebOb==1.7.1 wrapt==1.7.0 neutron-lib-2.3.0/LICENSE0000664000175000017500000002363713641427107015021 0ustar zuulzuul00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. neutron-lib-2.3.0/HACKING.rst0000664000175000017500000000165613641427107015607 0ustar zuulzuul00000000000000neutron-lib Style Commandments ============================== - Step 1: Read the OpenStack Style Commandments https://docs.openstack.org/hacking/latest/ - Step 2: Read on Neutron Library Specific Commandments ------------------------------------- - [N521] Validate that jsonutils module is used instead of json - [N524] Prevent use of deprecated contextlib.nested. - [N525] Python 3: Do not use xrange. - [N526] Python 3: do not use basestring. - [N527] Python 3: do not use dict.iteritems. - [N529] Method's default argument shouldn't be mutable - [N530] No importing of neutron; should be ignored in neutron itself - [N532] Validate that LOG.warning is used instead of LOG.warn. The latter is deprecated. - [N534] Exception messages should be translated - [N535] Usage of Python eventlet module not allowed - [N536] Use assertIsNone/assertIsNotNone rather than assertEqual/assertIs to check None values. - [N537] Don't translate logs. neutron-lib-2.3.0/tox.ini0000664000175000017500000001034313641427107015315 0ustar zuulzuul00000000000000[tox] minversion = 3.2.0 envlist = py37,pep8 skipsdist = True ignore_basepython_conflict = True [testenv] usedevelop = True passenv = TRACE_FAILONLY setenv = PYTHONWARNINGS=default::DeprecationWarning OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true} OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true} OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true} deps = -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands = stestr run {posargs} [testenv:pep8] commands = flake8 {toxinidir}/tools/check_samples.sh {[testenv:bandit]commands} [testenv:releasenotes] deps = -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -r{toxinidir}/requirements.txt -r{toxinidir}/doc/requirements.txt commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [testenv:venv] commands = {posargs} [testenv:cover] setenv = {[testenv]setenv} PYTHON=coverage run --source neutron_lib --parallel-mode commands = stestr run --no-subunit-trace {posargs} coverage combine coverage html -d cover coverage xml -o cover/coverage.xml [testenv:docs] deps = -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -r{toxinidir}/requirements.txt -r{toxinidir}/doc/requirements.txt commands = sphinx-build -W -b html doc/source doc/build/html [testenv:pdf-docs] envdir = {toxworkdir}/docs deps = {[testenv:docs]deps} whitelist_externals = make commands = sphinx-build -W -b latex doc/source doc/build/pdf make -C doc/build/pdf [testenv:api-ref] whitelist_externals = rm deps = -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -r{toxinidir}/requirements.txt -r{toxinidir}/doc/requirements.txt commands = rm -rf api-ref/build sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html [testenv:linkcheck] deps = -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} -r{toxinidir}/requirements.txt -r{toxinidir}/doc/requirements.txt whitelist_externals = rm commands = rm -rf api-ref/build sphinx-build -W -b linkcheck api-ref/source api-ref/build/linkcheck rm -rf doc/build sphinx-build -W -b linkcheck doc/source doc/build/linkcheck [testenv:debug] commands = oslo_debug_helper -t neutron_lib/tests/unit {posargs} [testenv:api-report] commands = {toxinidir}/tools/api_report.sh [flake8] # H106: Don't put vim configuration in source files # H203: Use assertIs(Not)None to check for None # H204: Use assert(Not)Equal to check for equality # H205: Use assert(Greater|Less)(Equal) for comparison # H904: Delay string interpolations at logging calls enable-extensions=H106,H203,H204,H205,H904 show-source = True exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools import-order-style = pep8 [flake8:local-plugins] extension = # Checks for neutron and related projects N521 = neutron_lib.hacking.checks:use_jsonutils N524 = neutron_lib.hacking.checks:check_no_contextlib_nested N529 = neutron_lib.hacking.checks:no_mutable_default_args N530 = neutron_lib.hacking.checks:check_neutron_namespace_imports N532 = neutron_lib.hacking.translation_checks:check_log_warn_deprecated N534 = neutron_lib.hacking.translation_checks:check_raised_localized_exceptions N536 = neutron_lib.hacking.checks:assert_equal_none N537 = neutron_lib.hacking.translation_checks:no_translate_logs # Checks specific to neutron-lib only N535 = neutron_lib.hacking.checks:check_no_eventlet_imports [testenv:bandit] # B104: Possible binding to all interfaces # B303: Blacklist use of insecure MD2, MD4, MD5, or SHA1 hash functions # B311: Standard pseudo-random generators are not suitable for security/cryptographic purpose deps = -r{toxinidir}/test-requirements.txt commands = bandit -r neutron_lib -x tests -n5 -s B104,B303,B311 [hacking] import_exceptions = neutron_lib._i18n [testenv:lower-constraints] deps = -c{toxinidir}/lower-constraints.txt -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt neutron-lib-2.3.0/tools/0000775000175000017500000000000013641427200015133 5ustar zuulzuul00000000000000neutron-lib-2.3.0/tools/check_samples.sh0000775000175000017500000000150313641427107020300 0ustar zuulzuul00000000000000#! /bin/sh # Copyright (C) 2017 Midokura SARL. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. set -e DIR=api-ref/source/v2/samples find $DIR -name "*.json" | while read f; do if ! python -m json.tool $f > /dev/null; then echo "$f had errors." exit 1 fi done neutron-lib-2.3.0/tools/api_report.sh0000775000175000017500000000517313641427107017652 0ustar zuulzuul00000000000000#!/usr/bin/env bash # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. set -eu TMPDIR=`mktemp -d /tmp/${0##*/}.XXXXXX` || exit 1 trap "rm -rf $TMPDIR" EXIT PROJECT="neutron-lib" PACKAGE="neutron_lib" PYIR_PATH="tools/pyir.py" TAG_RELEASE='' usage() { echo "Usage: $0 [OPTION]..." echo "Generate a python API report between current and the said release tag." echo "" echo " -t, --tag=[] Release tag to generate API report difference with." echo " Defaults to the latest git tag." echo " -h, --help Print this usage message" echo exit 0 } install_project() { git clone -b ${TAG_RELEASE} https://github.com/openstack/${PROJECT}.git ${TMPDIR}/${PROJECT} || (echo "Failed to install ${TAG_RELEASE}" && exit 2) } parse_args() { while [ "$1" != "" ]; do PARAM=`echo $1 | awk -F= '{print $1}'` VALUE=`echo $1 | awk -F= '{print $2}'` case ${PARAM} in -h | --help) usage exit ;; -t | --tag) TAG_RELEASE=${VALUE} break ;; *) echo "ERROR: unknown parameter \"${PARAM}\"" usage exit 1 ;; esac shift done } if [ $# -ne 0 ]; then parse_args $@ fi if [[ ${TAG_RELEASE} == '' ]]; then echo "Finding latest git tag..." TAG_RELEASE=`git tag | tail -n1` if [[ $? -ne 0 ]]; then echo "Failed to find latest git tag! Exiting." exit 1 fi echo "Set tag to: ${TAG_RELEASE}" fi ${PYIR_PATH} generate --blacklist '.*\/tests\/.*','.*\._(\w*)' ${PACKAGE} > "${TMPDIR}/${PACKAGE}.master.json.txt" install_project ${PYIR_PATH} generate --blacklist '.*\/tests\/.*','.*\._(\w*)' ${TMPDIR}/${PROJECT}/${PACKAGE} > "${TMPDIR}/${PACKAGE}.${TAG_RELEASE}.json.txt" echo "===========================================================" echo "Changes between current commit and release tag ${TAG_RELEASE}" echo "===========================================================" ${PYIR_PATH} diff "${TMPDIR}/${PACKAGE}.master.json.txt" "${TMPDIR}/${PACKAGE}.${TAG_RELEASE}.json.txt" neutron-lib-2.3.0/tools/pyir.py0000775000175000017500000013224613641427107016511 0ustar zuulzuul00000000000000#!/usr/bin/env python # Copyright 2016 VMware, Inc. # All Rights Reserved # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # import abc import contextlib import imp import inspect import os from os import path import re import shutil import sys import tempfile import argparse import six from oslo_serialization import jsonutils __version__ = '0.0.2' # NOTE(boden): This is a prototype and needs additional love _MOCK_SRC = ''' class _PyIREmptyMock_(object): def __init__(self, *args, **kwargs): self._args_ = args self._kwargs_ = kwargs def __or__(self, o): return o def __ror__(self, o): return o def __xor__(self, o): return o def __rxor__(self, o): return o def __and__(self, o): return o def __rand__(self, o): return o def __rshift__(self, o): return o def __rrshift__(self, o): return o def __lshift__(self, o): return o def __rlshift__(self, o): return o def __pow__(self, o): return o def __rpow__(self, o): return o def __divmod__(self, o): return o def __rdivmod__(self, o): return o def __mod__(self, o): return o def __rmod__(self, o): return o def __floordiv__(self, o): return o def __rfloordiv__(self, o): return o def __truediv__(self, o): return o def __rtrudiv__(self, o): return o def __add__(self, o): return o def __radd__(self, o): return o def __sub__(self, o): return o def __rsub__(self, o): return o def __mul__(self, o): return o def __rmul__(self, o): return o def __matmul__(self, o): return o def __rmatmul__(self, o): return o def __getattribute__(self, name): return _PyIREmptyMock_() def __call__(self, *args, **kwargs): return _PyIREmptyMock_() def __iter__(self): return [].__iter__() def __getitem__(self, item): return _PyIREmptyMock_() def __setitem__(self, key, value): pass def __delitem__(self, key): pass def __enter__(self): return self def __exit__(self, type, value, traceback): pass class _PyIREmptyImport_(_PyIREmptyMock_): pass ''' _MOCK_CLASS_NAME = '_PyIREmptyMock_' _MOCK_IMPORT_CLASS_NAME = '_PyIREmptyImport_' UNKNOWN_VAL = 'PYIR UNKNOWN VALUE' _BLACKLIST = [re.compile(".*\.%s" % _MOCK_CLASS_NAME), re.compile(".*\.%s" % _MOCK_IMPORT_CLASS_NAME)] def blacklist_filter(value): for pattern in _BLACKLIST: if pattern.match(value): return False return True def add_blacklist_from_csv_str(csv_str): global _BLACKLIST _BLACKLIST.extend([re.compile(p) for p in split_on_token(csv_str, ',')]) def for_tokens(the_str, tokens, callback): in_str = [] tokens = list(tokens) index = 0 def _compare_tokens(idx): hits = [] for token in tokens: if the_str[idx:].startswith(token): hits.append(token) return hits for c in the_str: if c == '\'' or c == '\"': if in_str and in_str[len(in_str) - 1] == c: in_str.pop() else: in_str.append(c) elif not in_str: matching_tokens = _compare_tokens(index) if matching_tokens: callback(matching_tokens, index, the_str[index:]) index += 1 def token_indexes(the_str, tokens): indexes = [] def _count(toks, idx, substring): indexes.append(idx) for_tokens(the_str, tokens, _count) return indexes def split_on_token(the_str, token): indexes = token_indexes(the_str, [token]) if not indexes: return [the_str] strs = [] indexes.insert(0, None) for start, end in zip(indexes, indexes[1:] + [None]): start = 0 if start is None else start + 1 if end is None: end = len(the_str) strs.append(the_str[start:end]) return strs def count_tokens(the_str, tokens): return len(token_indexes(the_str, tokens)) def remove_tokens(the_str, tokens): in_str = [] tokens = list(tokens) index = 0 new_str = '' def _token(idx): for token in tokens: if the_str[idx:].startswith(token): return token return None while index < len(the_str): c = the_str[index] if c == '\'' or c == '\"': if in_str and in_str[len(in_str) - 1] == c: in_str.pop() else: in_str.append(c) elif not in_str: tok = _token(index) if tok: index += len(tok) continue new_str += c index += 1 return new_str def remove_brackets(the_str): return remove_tokens(the_str, ['(', ')']) def parent_path(file_path): if not file_path or file_path == '/': return None return path.abspath(path.join(file_path, '..')) def is_py_file(file_path): file_path = file_path if filter(blacklist_filter, [file_path]) else None return (file_path and path.isfile(file_path) and file_path.endswith('.py')) def is_py_dir(dir_path): if not filter(blacklist_filter, [dir_path]): return False if path.isdir(dir_path): for f in os.listdir(dir_path): f = path.join(dir_path, f) if is_py_file(f): return True return False def is_py_package_dir(dir_path): if not filter(blacklist_filter, [dir_path]): return False if path.isdir(dir_path): return '__init__.py' in os.listdir(dir_path) return False def parent_package_names(file_or_dir_path): pkg_names = [] file_or_dir_path = parent_path(file_or_dir_path) while file_or_dir_path: if is_py_package_dir(file_or_dir_path): pkg_names.append(os.path.basename(file_or_dir_path)) else: break file_or_dir_path = parent_path(file_or_dir_path) return None if not pkg_names else reversed(pkg_names) def whitespace(line): if line.isspace(): return line, '' char_index = 0 for char_index in range(len(line)): if not line[char_index].isspace(): break return line[:char_index], line[char_index:].strip() def ordered(obj): if isinstance(obj, dict): return sorted((k, ordered(v)) for k, v in obj.items()) if isinstance(obj, list): return sorted(ordered(x) for x in obj) else: return obj def json_primitive(val): if isinstance(val, (str, int, bool)): return str(val) elif str(val).startswith('<') or type(val) in [dict, list, set, tuple]: return str(type(val)) elif (str(val).count(_MOCK_CLASS_NAME) or str(val).count(_MOCK_IMPORT_CLASS_NAME)): return UNKNOWN_VAL return val def is_mock_import(obj): return _MOCK_IMPORT_CLASS_NAME in str(obj) def _member_filter(obj): return not inspect.isbuiltin(obj) and not inspect.ismodule(obj) class PyFiles(object): def __init__(self, files): self._files = set(PyFiles.check_py_paths(files)) @staticmethod def check_py_paths(py_paths): checked = [] for f in py_paths: f = path.abspath(f) assert path.exists(f) if path.isfile(f): if not is_py_file(f): raise IOError("'%s' is not a .py file." % f) else: if not is_py_package_dir(f): raise IOError("'%s' doesn't contain __init__.py." % f) checked.append(f) return checked @property def files(self): return set(self._files) @property def has_files(self): return len(self._files) > 0 def _path_to_tmp_tree(self, tree_dir, src_path): tree_dest = path.join(tree_dir, path.basename(src_path)) parent_dirs = list(parent_package_names(src_path) or []) if parent_dirs: tree_dest = path.join(tree_dir, *tuple(parent_dirs)) os.makedirs(tree_dest) subpath = tree_dir for subdir in parent_dirs: subpath = path.join(subpath, subdir) open(path.join(subpath, '__init__.py'), 'a').close() tree_dest = path.join(tree_dest, path.basename(src_path)) copy_fn = shutil.copytree if path.isdir(src_path) else shutil.copyfile copy_fn(src_path, tree_dest) return tree_dest def to_tmp_tree(self, tree_dir=None): tree_dir = tree_dir or tempfile.mkdtemp() assert path.isdir(tree_dir) subtrees = [] for f in self._files: subtrees.append(self._path_to_tmp_tree(tree_dir, f)) return tree_dir, subtrees @contextlib.contextmanager def tmp_tree(self, delete_on_exit=True): tree = None try: tree, subtress = self.to_tmp_tree() yield tree finally: if tree and delete_on_exit: shutil.rmtree(tree) @staticmethod def filter_all_py_files(root_dir, filters): for child in os.listdir(root_dir): child_path = path.join(root_dir, child) if is_py_file(child_path): PyFile.rewrite(child_path, filters) elif is_py_dir(child_path): PyFiles.filter_all_py_files(child_path, filters) class PyLine(object): def __init__(self, ws, logical_line, py_file): self.ws = '' if ws is None else ws if ws == "\n": self.ws = '' self.logical = '' if logical_line is None else logical_line self._py_file = py_file @property def is_str_line(self): return ((self.logical.startswith('\'') and self.logical.endswith('\'')) or (self.logical.startswith('\"') and self.logical.endswith('\"'))) @property def is_empty_line(self): return len(self.logical.strip()) == 0 @property def indent(self): return self.ws.count(' ') + (self.ws.count("\t") * 4) @property def bracket_tics(self): return (count_tokens(self.logical, PyLineTokens.OPEN_B) - count_tokens(self.logical, PyLineTokens.CLOSED_B)) @property def physical_line(self): return str(self) @property def is_comment(self): return self.logical.startswith(PyLineTokens.COMMENT) def comment_out(self): if not self.is_comment: self.logical = PyLineTokens.COMMENT + self.logical @property def has_unmatched_brackets(self): return self.bracket_tics != 0 @property def is_continuation(self): return (self.logical.endswith(PyLineTokens.BACKSLASH) or self.has_unmatched_brackets) @property def is_space(self): if self.logical == '': return self.ws.isspace() return self.logical.isspace() @property def file_path(self): return self._py_file.name @staticmethod def from_string_lines(lines, py_file=None): py_lines = [] for l in lines: ws, logical = whitespace(l) py_lines.append(PyLine(ws, logical, py_file)) return py_lines def __str__(self): return self.ws + self.logical class FilterMarker(object): def __init__(self, filt, markers=None): self._filter = filt self.markers = markers or [] def mark(self, line): if self._filter.mark(line): self.markers.append(line) def filter(self, py_file): for marker in self.markers: self._filter.filter(marker, py_file) def reset(self): self.markers = [] class PyFile(object): def __init__(self, py_filters): self._markers = [] self._add_filters(py_filters) self._lines = [] def prepend_lines(self, lines): lines = list(lines) lines.extend(self._lines) self._lines = lines def reset(self): self._lines = [] for m in self._markers: m.reset() def first_line(self): return self._lines[0] if self._lines else None def next_line(self, py_line): if py_line not in self._lines: return None index = self._lines.index(py_line) + 1 if index >= len(self._lines): return None return self._lines[index] def prev_line(self, py_line): if py_line not in self._lines: return None index = self._lines.index(py_line) - 1 if index <= 0: return None return self._lines[index] def del_line(self, py_line): self._lines.remove(py_line) def get_line(self, py_line): return (None if not self.contains_line(py_line) else self._lines[self._lines.index(py_line)]) def contains_line(self, py_line): return py_line in self._lines def _add_filters(self, filters): self._markers.extend([FilterMarker(f) for f in filters]) def _mark_line_filter(self, line): for marker in self._markers: marker.mark(line) def load_path(self, py_path): with open(py_path, 'r') as py_file: for line in py_file: ws, logical = whitespace(line) line = PyLine(ws, logical, py_file) self._lines.append(line) self._mark_line_filter(line) def filter(self): if not self._lines or not self._markers: return None for marker in self._markers: marker.filter(self) def insert_after(self, py_line, py_line_to_add): if py_line not in self._lines: return False self._lines.insert(self._lines.index(py_line) + 1, py_line_to_add) return True def to_file_str(self): buff = '' for line in self._lines: buff += str(line) + "\n" return buff def save(self, py_path): with open(py_path, 'w') as py_file: py_file.write(self.to_file_str()) @staticmethod def filter_to_file_str(py_path, filters): py_file = PyFile(filters) py_file.load_path(py_path) py_file.filter() return py_file.to_file_str() @staticmethod def rewrite(py_path, filters): py_file = PyFile(filters) py_file.load_path(py_path) py_file.filter() py_file.save(py_path) class ImportParser(object): def __init__(self): self.names = [] self.modules = [] def _segs(self, the_str, token=' '): return [s.strip() for s in the_str.split(token) if s and not s.isspace()] def _lstrip(self, the_str, to_strip): return the_str[len(to_strip):].strip() def _next_token(self, the_str, delim=' ', strip=True): try: idx = the_str.index(delim) content = the_str[:idx] remainder = the_str[idx:] if strip: content.strip() remainder.strip() return content, remainder except ValueError: return None, None def _parse_from(self, import_str): import_str = self._lstrip(import_str, 'from ') module_name, import_str = self._next_token(import_str) import_str = self._lstrip(import_str, 'import ') for name_def in self._segs(import_str, token=','): if name_def.count(' as '): segs = self._segs(name_def, token=' as ') self.names.append(segs[1]) self.modules.append(module_name + '.' + segs[0]) else: self.names.extend(self._segs(name_def, '.')) self.modules.append(module_name) def _parse_import(self, import_str): import_str = self._lstrip(import_str, 'import ') for name_def in self._segs(import_str, token=','): if name_def.count(' as '): segs = self._segs(name_def, token=' as ') self.names.append(segs[1]) self.modules.append(segs[0]) else: self.names.extend(self._segs(name_def, '.')) self.modules.append(name_def) def reset(self): self.names = [] self.modules = [] def is_statement(self, import_str): return import_str.startswith(('import ', 'from ', )) def parse(self, import_str): self.reset() import_str = import_str.replace('(', '').replace(')', '') if import_str.startswith('import '): self._parse_import(import_str) elif import_str.startswith('from '): self._parse_from(import_str) else: raise IOError("Invalid import string: %s" % import_str) return self class PyLineTokens(object): COMMENT = '#' BACKSLASH = '\\' DECORATOR = '@' OPEN_B = '(' CLOSED_B = ')' class AbstractFilter(object, metaclass=abc.ABCMeta): @abc.abstractmethod def mark(self, py_line): pass @abc.abstractmethod def filter(self, py_line, py_file): pass class AbstractPerFileFilter(AbstractFilter, metaclass=abc.ABCMeta): def __init__(self): self._marked = [] def mark(self, py_line): if py_line.file_path not in self._marked: self._marked.append(py_line.file_path) return True return False @abc.abstractmethod def _filter(self, py_line, py_file): pass def filter(self, py_line, py_file): if py_line.file_path not in self._marked: return self._marked.remove(py_line.file_path) return self._filter(py_line, py_file) class CommentOutDecorators(AbstractFilter): def mark(self, py_line): if py_line.is_str_line: return False if py_line.logical.startswith(PyLineTokens.DECORATOR): return True return False def filter(self, py_line, py_file): if not py_file.get_line(py_line): return py_line.comment_out() class StripTrailingComments(AbstractFilter): _RE = re.compile('^([^#]*)#(.*)$') def mark(self, py_line): if (py_line.is_str_line or not count_tokens(py_line.logical, PyLineTokens.COMMENT)): return False m = StripTrailingComments._RE.match(py_line.logical) return True if m else False def filter(self, py_line, py_file): if not py_file.get_line(py_line): return m = StripTrailingComments._RE.match(py_line.logical) py_line.logical = m.group(1).strip() class AddMockDefinitions(AbstractPerFileFilter): _LINES = PyLine.from_string_lines(_MOCK_SRC.split("\n")) def _filter(self, py_line, py_file): py_file.prepend_lines(AddMockDefinitions._LINES) class PassEmptyDef(AbstractPerFileFilter): def _has_body(self, def_py_line, py_file): indent = def_py_line.indent line = py_file.next_line(def_py_line) while line: if line.is_empty_line: line = py_file.next_line(line) continue elif line.indent > indent: return True elif line.indent <= indent: return False else: line = py_file.next_line(line) return False def _filter(self, py_line, py_file): line = py_file.first_line() while line: if (line.logical.startswith(('class ', 'def ',)) and not self._has_body(line, py_file)): pass_line = PyLine(line.ws + " ", 'pass', py_file) py_file.insert_after(line, pass_line) line = py_file.next_line(pass_line) else: line = py_file.next_line(line) class RemoveDocStrings(AbstractPerFileFilter): _COMMENT = '"""' def _comment_count(self, py_line): return count_tokens(py_line.logical, RemoveDocStrings._COMMENT) def _safe_delete_line(self, py_line, py_file): if py_line.logical.endswith((',', ')',)): return py_file.del_line(py_line) def _filter(self, py_line, py_file): in_comment = False last_line = line = py_file.first_line() while line: comment_count = self._comment_count(line) if comment_count: if in_comment: in_comment = False elif comment_count == 1: in_comment = True py_file.del_line(line) elif in_comment: py_file.del_line(line) if not py_file.contains_line(line): if not py_file.contains_line(last_line): last_line = line = py_file.first_line() else: line = py_file.next_line(last_line) else: next_line = py_file.next_line(line) last_line = line line = next_line class RemoveCommentLines(AbstractFilter): def mark(self, py_line): return py_line.logical.startswith(PyLineTokens.COMMENT) def filter(self, py_line, py_file): py_line = py_file.get_line(py_line) if py_line and self.mark(py_line): py_file.del_line(py_line) class AbstractMultiLineCollector(AbstractFilter, metaclass=abc.ABCMeta): def __init__(self): self._comment_stripper = StripTrailingComments() def _strip_backslash(self, py_line): if py_line.logical.endswith(PyLineTokens.BACKSLASH): py_line.logical = py_line.logical[:-1].strip() return True return False def _collect(self, py_line, py_file, continue_fn): self._strip_backslash(py_line) next_line = py_file.next_line(py_line) while next_line: if not next_line.is_comment: if self._comment_stripper.mark(next_line): self._comment_stripper.filter(next_line, py_file) if not next_line.is_space: py_line.logical += ' ' + next_line.logical py_file.del_line(next_line) if continue_fn(py_line): next_line = py_file.next_line(py_line) continue else: break def _collect_backslash(self, py_line, py_file): self._strip_backslash(py_line) self._collect(py_line, py_file, self._strip_backslash) def _collect_brackets(self, py_line, py_file): self._collect(py_line, py_file, lambda l: l.has_unmatched_brackets) def filter(self, py_line, py_file): if py_line.logical.endswith(PyLineTokens.BACKSLASH): self._collect_backslash(py_line, py_file) else: self._collect_brackets(py_line, py_file) class MergeMultiLineImports(AbstractMultiLineCollector): def mark(self, py_line): if py_line.is_str_line: return False logical = py_line.logical return (logical.startswith(('import ', 'from ',)) and py_line.is_continuation) def filter(self, py_line, py_file): super(MergeMultiLineImports, self).filter(py_line, py_file) py_line.logical = remove_brackets(py_line.logical) class MergeMultiLineClass(AbstractMultiLineCollector): def mark(self, py_line): if py_line.is_str_line: return False return py_line.logical.startswith('class ') and py_line.is_continuation class MergeMultiLineDef(AbstractMultiLineCollector): def mark(self, py_line): if py_line.is_str_line: return False return py_line.logical.startswith('def ') and py_line.is_continuation class MergeMultiLineDecorator(AbstractMultiLineCollector): def mark(self, py_line): if py_line.is_str_line: return False return (py_line.logical.startswith(PyLineTokens.DECORATOR) and py_line.is_continuation) class MockParentClass(AbstractFilter): _PARENT_RE = re.compile('class \w*\((.*)\)\:$') def mark(self, py_line): return (py_line.logical.startswith('class ') and not py_line.is_str_line) def filter(self, py_line, py_file): if not py_file.get_line(py_line): return m = MockParentClass._PARENT_RE.match(py_line.logical) if m: py_line.logical = py_line.logical.replace( "(%s):" % m.group(1), "(%s):" % _MOCK_CLASS_NAME) class MockImports(AbstractFilter): def __init__(self): self._parser = ImportParser() def mark(self, py_line): return self._parser.is_statement(remove_brackets(py_line.logical)) def filter(self, py_line, py_file): if not py_file.contains_line(py_line) or not self.mark(py_line): return py_line.logical = remove_brackets(py_line.logical) self._parser.parse(py_line.logical) if '*' in self._parser.names: inferred_names = [] for module in self._parser.modules: if not module.startswith('.'): inferred_names.extend(module.split('.')) self._parser.names = inferred_names if not self._parser.names: py_line.comment_out() return py_line.logical = ', '.join(self._parser.names) + ' = ' + ', '.join( [_MOCK_IMPORT_CLASS_NAME + '()' for n in self._parser.names]) if '_' in self._parser.names: # TODO(boden): one off mock_translate = PyLine(py_line.ws, '_ = lambda s: str(s)', py_file) py_file.insert_after(py_line, mock_translate) class APISignature(object): class SignatureType(object): CLASS = 'class' FUNCTION = 'function' METHOD = 'method' CLASS_ATTR = 'class_attribute' MODULE_ATTR = 'module_attribute' def __init__(self, signature_type, qualified_name, member, arg_spec): self.signature_type = signature_type self.qualified_name = qualified_name self.member = member self.arg_spec = arg_spec def to_dict(self): defaults = ([json_primitive(d) for d in self.arg_spec.defaults] if self.arg_spec.defaults else None) return { 'member_type': self.signature_type, 'qualified_name': self.qualified_name, 'member_value': json_primitive(self.member), 'arg_spec': { 'args': self.arg_spec.args, 'varargs': self.arg_spec.varargs, 'keywords': self.arg_spec.keywords, 'defaults': defaults } } @staticmethod def arg_spec_from_dict(arg_spec_dict): defaults = arg_spec_dict['defaults'] if defaults is not None: defaults = tuple(defaults) return inspect.ArgSpec(arg_spec_dict['args'], arg_spec_dict['varargs'], arg_spec_dict['keywords'], defaults) @staticmethod def from_dict(api_dict): return APISignature( api_dict['member_type'], api_dict['qualified_name'], api_dict['member_value'], APISignature.arg_spec_from_dict(api_dict['arg_spec'])) @property def signature(self): return self._build_signature(self.to_dict()) @staticmethod def get_signature(signature): if isinstance(signature, dict): signature = APISignature.from_dict(signature) return signature.signature def _build_callable_signature(self, signature_dict): arg_spec = signature_dict['arg_spec'] arg_str = '' defaults = arg_spec['defaults'] or [] named_args = arg_spec['args'] or [] named_kwargs = [] if defaults: named_args = arg_spec['args'][:-len(defaults)] named_kwargs = arg_spec['args'][-len(defaults):] if named_args: arg_str += ", ".join(named_args) if named_kwargs: kw_args = [] for kw_name, kw_default in zip(named_kwargs, defaults): kw_args.append("%s=%s" % (kw_name, kw_default)) arg_str += ", %s" % ", ".join(kw_args) if arg_spec['varargs'] is not None: arg_str = "*%s%s" % (arg_spec['varargs'], '' if not arg_str else ', ' + arg_str) if arg_spec['keywords'] is not None: arg_str += "%s**%s" % (', ' if arg_str else '', arg_spec['keywords']) if arg_str.startswith(','): arg_str = arg_str[1:] return "%s(%s)" % (signature_dict['qualified_name'], arg_str.strip()) def _build_variable_signature(self, signature_dict): return "%s = %s" % (signature_dict['qualified_name'], signature_dict['member_value']) def _build_class_signature(self, signature_dict): return signature_dict['qualified_name'] def _build_signature(self, signature_dict): if (signature_dict['member_type'] in [APISignature.SignatureType.FUNCTION, APISignature.SignatureType.METHOD]): return self._build_callable_signature(signature_dict) elif signature_dict['member_type'] == APISignature.SignatureType.CLASS: return self._build_class_signature(signature_dict) else: return self._build_variable_signature(signature_dict) class ModuleParser(object): def __init__(self, listeners, abort_on_load_failure=False): self.listeners = listeners self.abort_on_load_failure = abort_on_load_failure def _notify(self, signature_type, qualified_name, member, arg_spec=None): for listener in self.listeners: notify = getattr(listener, 'parse_' + signature_type) notify(APISignature(signature_type, qualified_name, member, arg_spec or inspect.ArgSpec(None, None, None, None))) def _collect_paths(self, paths, recurse=True): inits, mods = [], [] if not paths: return inits, mods for py_path in paths: if is_py_file(py_path): if path.basename(py_path) == '__init__.py': inits.append(py_path) else: mods.append(py_path) elif is_py_dir(py_path) and recurse: c_inits, c_mods = self._collect_paths( [path.join(py_path, c) for c in os.listdir(py_path)], recurse=recurse) inits.extend(c_inits) mods.extend(c_mods) return inits, mods def _load_path(self, module_path): module_name = path.basename(path.splitext(module_path)[0]) pkg_name = '.'.join(parent_package_names(module_path) or '') defined_name = ('%s.%s' % (pkg_name, module_name) if pkg_name else module_name) if module_name == '__init__': defined_name = pkg_name search_paths = [parent_path(module_path)] f = None try: if defined_name in sys.modules: del sys.modules[defined_name] f, p, d = imp.find_module(module_name, search_paths) module = imp.load_module(defined_name, f, p, d) if defined_name == '__init__': setattr(module, '__path__', search_paths) return module except Exception as e: sys.stderr.write("Failed to load module '%s' due to: %s" % (module_path, e)) if self.abort_on_load_failure: raise e finally: if f: f.close() def load_modules(self, init_paths, module_paths): init_mods, mods = [], [] failed_to_load = [] def _load(paths, store): for m_path in paths: module = self._load_path(m_path) if module: store.append(module) else: failed_to_load.append(m_path) _load(init_paths, init_mods) _load(module_paths, mods) return init_mods, mods, failed_to_load def _fully_qualified_name(self, parent, name): if inspect.isclass(parent): prefix = parent.__module__ + '.' + parent.__name__ else: prefix = parent.__name__ return prefix + '.' + name def parse_modules(self, modules): for module in modules: for member_name, member in inspect.getmembers( module, _member_filter): if member_name.startswith('__') and member_name.endswith('__'): continue fqn = self._fully_qualified_name(module, member_name) if inspect.isclass(member): self._notify(APISignature.SignatureType.CLASS, fqn, member) self.parse_modules([member]) elif inspect.isfunction(member): self._notify(APISignature.SignatureType.FUNCTION, fqn, member, arg_spec=inspect.getargspec(member)) elif inspect.ismethod(member): self._notify(APISignature.SignatureType.METHOD, fqn, member, arg_spec=inspect.getargspec(member)) else: event = (APISignature.SignatureType.MODULE_ATTR if inspect.ismodule(module) else APISignature.SignatureType.CLASS_ATTR) self._notify(event, fqn, member) def parse_paths(self, py_paths, recurse=True): init_paths, mod_paths = self._collect_paths( py_paths, recurse=recurse) init_mods, pkg_mods, failed_mods = self.load_modules( init_paths, mod_paths) self.parse_modules(init_mods) self.parse_modules(pkg_mods) class APIReport(object): def __init__(self, abort_on_load_failure=False): self._api = {} self._parser = ModuleParser( [self], abort_on_load_failure=abort_on_load_failure) def _add(self, event): if is_mock_import(event.member): return uuid = str(event.qualified_name) if uuid in self._api: # TODO(boden): configurable bail on duplicate flag sys.stderr.write("Duplicate API signature: %s" % uuid) return if not filter(blacklist_filter, [uuid]): return self._api[uuid] = event.to_dict() def parse_method(self, event): self._add(event) def parse_function(self, event): self._add(event) def parse_class(self, event): self._add(event) def parse_class_attribute(self, event): self._add(event) def parse_module_attribute(self, event): self._add(event) def parse_api_paths(self, api_paths, recurse=True): self._parser.parse_paths(api_paths, recurse=recurse) def parse_api_path(self, api_path, recurse=True): self.parse_api_paths([api_path], recurse=recurse) @property def api(self): return dict(self._api) def to_json(self): return jsonutils.dumps(self._api) @staticmethod def from_json(json_str): api = APIReport() api._api = jsonutils.loads(json_str) return api @staticmethod def from_json_file(file_path): with open(file_path, 'r') as json_file: data = json_file.read() return APIReport.from_json(data) @staticmethod def api_diff_files(new_api, old_api): new_api = APIReport.from_json_file(new_api) old_api = APIReport.from_json_file(old_api) return new_api.api_diff(old_api) def get_filtered_signatures(self): return filter(blacklist_filter, self.get_signatures()) def get_signatures(self): return sorted([APISignature.get_signature(s) for s in self._api.values()]) def api_diff(self, other_api): our_keys = sorted(self.api.keys()) other_keys = sorted(other_api.api.keys()) new_keys = set(our_keys) - set(other_keys) removed_keys = set(other_keys) - set(our_keys) common_keys = set(our_keys) & set(other_keys) common_key_changes = [k for k in common_keys if ordered(self.api[k]) != ordered(other_api.api[k])] for k in common_key_changes: if (not blacklist_filter(self.api[k]['member_value']) and not blacklist_filter(other_api.api[k]['member_value'])): common_key_changes.remove(k) def _build_report(new_api): apis = APIReport() apis._api = new_api return apis return { 'new': _build_report({k: self.api[k] for k in new_keys}), 'removed': _build_report({k: other_api.api[k] for k in removed_keys}), 'unchanged': _build_report({k: self.api[k] for k in set(common_keys) - set(common_key_changes)}), 'new_changed': _build_report({k: self.api[k] for k in common_key_changes}), 'old_changed': _build_report({k: other_api.api[k] for k in common_key_changes}) } class AbstractCommand(object, metaclass=abc.ABCMeta): @abc.abstractmethod def get_parser(self): pass @abc.abstractmethod def run(self, args): pass def _add_blacklist_opt(parser): parser.add_argument( '--blacklist', help='One or more regular expressions used to filter out ' 'API paths from the report. File path segments, module ' 'names, class names, etc. are all subject to filtering. ' 'Multiple regexes can be specified using a comma in the ' '--blacklist argument.') class GenerateReportCommand(AbstractCommand): PY_LINE_FILTERS = [RemoveDocStrings(), RemoveCommentLines(), StripTrailingComments(), MergeMultiLineImports(), MergeMultiLineClass(), MergeMultiLineDef(), MergeMultiLineDecorator(), CommentOutDecorators(), PassEmptyDef(), MockParentClass(), AddMockDefinitions(), MockImports()] def __init__(self): self._parser = argparse.ArgumentParser( prog='generate', description='Generate an interface report for python ' 'source. The paths given can be a python ' 'package or project directory, or a single ' 'python source file. The program replaces ' 'your imports with mocks, so no dependencies ' 'are needed in the python env.') _add_blacklist_opt(self._parser) self._parser.add_argument( '--debug', help='Exit parsing on failure to load a module and ' 'leave temp staging dir intact..', action='store_const', const=True) self._parser.add_argument('PATH', nargs='+', metavar='PATH') def get_parser(self): return self._parser def run(self, args): if args.blacklist: add_blacklist_from_csv_str(args.blacklist) files = PyFiles(args.PATH) with files.tmp_tree(delete_on_exit=( not args.debug)) as tmp_root: PyFiles.filter_all_py_files( tmp_root, GenerateReportCommand.PY_LINE_FILTERS) report = APIReport(abort_on_load_failure=args.debug) for child in os.listdir(tmp_root): child_path = path.join(tmp_root, child) report.parse_api_paths([child_path]) print("%s" % report.to_json()) class PrintReportCommand(AbstractCommand): def __init__(self): self._parser = argparse.ArgumentParser( prog='print', description='Given a JSON API file, print the API signatures ' 'to STDOUT.') _add_blacklist_opt(self._parser) self._parser.add_argument('REPORT_FILE', help='Path to JSON report file.') def get_parser(self): return self._parser def run(self, args): if args.blacklist: add_blacklist_from_csv_str(args.blacklist) report = APIReport.from_json_file(args.REPORT_FILE) for signature in report.get_filtered_signatures(): print(signature) class DiffReportCommand(AbstractCommand): def __init__(self): self._parser = argparse.ArgumentParser( prog='diff', description='Given a new and old JSON interface report ' 'files, calculate the changes between new ' 'and old and echo them to STDOUT.') _add_blacklist_opt(self._parser) self._parser.add_argument( '--unchanged', help='Used with --diff to specify that unchanged ' 'public APIs should be reported in addition to ' 'new and removed.', action='store_const', const=True) self._parser.add_argument('NEW_REPORT_FILE', help='Path to new report file.') self._parser.add_argument('OLD_REPORT_FILE', help='Path to old report file.') def get_parser(self): return self._parser def _print_row(self, heading, content_list): print(heading) print("-----------------------------------------------------") for content in content_list: print(str(content)) print("-----------------------------------------------------\n") def run(self, args): if args.blacklist: add_blacklist_from_csv_str(args.blacklist) api_diff = APIReport.api_diff_files( args.NEW_REPORT_FILE, args.OLD_REPORT_FILE) self._print_row("New API Signatures", api_diff['new'].get_filtered_signatures()) self._print_row("Removed API Signatures", api_diff['removed'].get_filtered_signatures()) new_sigs = api_diff['new_changed'].get_filtered_signatures() old_sigs = api_diff['old_changed'].get_filtered_signatures() if len(new_sigs) != len(old_sigs): new_sigs = [] old_sigs = [] new_changed = api_diff['new_changed'].api old_changed = api_diff['old_changed'].api for n, new_spec in new_changed.items(): display_old = blacklist_filter(old_changed[n]['member_value']) display_new = blacklist_filter(new_spec['member_value']) if display_old and display_new: new_sigs.append(APISignature.get_signature(new_spec)) old_sigs.append(APISignature.get_signature(old_changed[n])) elif not display_old: new_sigs.append(APISignature.get_signature(new_spec)) old_sigs.append(n) else: new_sigs.append('UNKNOWN') old_sigs.append(n) self._print_row("Changed API Signatures", ["%s [is now] %s" % (old_sigs[i], new_sigs[i]) for i in range(len(new_sigs))]) if args.unchanged: self._print_row("Unchanged API Signatures", api_diff['unchanged'].get_filtered_signatures()) class CLI(object): def __init__(self, commands): self._commands = {c.get_parser().prog: c for c in commands} self.parser = argparse.ArgumentParser( prog='pyir', description='Python API report tooling.', usage="pyir <%s> [args]" % "|".join(self._commands.keys()), add_help=True) self.parser.add_argument( 'command', help='The command to run. Known commands: ' '%s . Try \'pyir --help\' for more info ' 'on a specific command. ' % ", ".join(self._commands.keys())) args = self.parser.parse_args(sys.argv[1:2]) if args.command not in self._commands.keys(): print("Unknown command: %s" % args.command) self.parser.print_help() exit(1) cmd = self._commands[args.command] cmd.get_parser().prog = self.parser.prog + ' ' + cmd.get_parser().prog cmd.run(cmd.get_parser().parse_args(sys.argv[2:])) def main(): CLI([DiffReportCommand(), GenerateReportCommand(), PrintReportCommand()]) if __name__ == '__main__': main() exit(0) neutron-lib-2.3.0/tools/migration_report.sh0000775000175000017500000000226313641427107021067 0ustar zuulzuul00000000000000#!/bin/bash function count_imports() { local module="$1" local path="$2" egrep -R -w "^(import|from) $module" --exclude-dir=".*tox" $your_project | wc -l } if [ $# -eq 0 ]; then echo "Please specify path to your project." exit 1 else your_project="$1" fi command -v bc >/dev/null 2>&1 || { echo "I require bc but it's not installed. Aborting." >&2; exit 1; } total_imports=$(egrep -R -w "^(import|from)" --exclude-dir=".*tox" $your_project | wc -l) neutron_imports=$(count_imports neutron $your_project) lib_imports=$(count_imports neutron_lib $your_project) total_neutron_related_imports=$((neutron_imports + lib_imports)) echo "You have $total_imports total imports" echo "You imported Neutron $neutron_imports times" echo "You imported Neutron-Lib $lib_imports times" if [ "$lib_imports" -eq 0 ]; then echo "Your project does not import neutron-lib once, you suck!" fi goal=$(bc -l <<< "scale=4; ($lib_imports/$total_neutron_related_imports*100)") target=$(bc <<< "$goal>50") if [ "$target" -eq 0 ]; then echo "You need to get to 100%, you are this far: $goal%, get on with it!" else echo "You need to get to 100%, you are close: $goal%, good job!" fi neutron-lib-2.3.0/.zuul.yaml0000664000175000017500000000133413641427107015743 0ustar zuulzuul00000000000000- project: templates: - check-requirements - publish-openstack-docs-pti - openstack-cover-jobs - openstack-lower-constraints-jobs - openstack-python3-ussuri-jobs - lib-forward-testing-python3 - release-notes-jobs-python3 check: jobs: # This job comes from lib-forward-testing-python3 template, # but it is limited to 2h there and we want to set # for it 3h timeout - tempest-full-py3: timeout: 10800 gate: jobs: # This job comes from lib-forward-testing-python3 template, # but it is limited to 2h there and we want to set # for it 3h timeout - tempest-full-py3: timeout: 10800 neutron-lib-2.3.0/babel.cfg0000664000175000017500000000002113641427107015520 0ustar zuulzuul00000000000000[python: **.py] neutron-lib-2.3.0/README.rst0000664000175000017500000000122713641427107015472 0ustar zuulzuul00000000000000======================== Team and repository tags ======================== .. image:: https://governance.openstack.org/tc/badges/neutron-lib.svg :target: https://governance.openstack.org/tc/reference/tags/index.html .. Change things from this point on =============================== neutron-lib =============================== Neutron shared routines and utilities * Free software: Apache license * Documentation: https://docs.openstack.org/neutron-lib/latest/ * Source: https://opendev.org/openstack/neutron-lib * Bugs: https://bugs.launchpad.net/neutron * Release notes: https://docs.openstack.org/releasenotes/neutron-lib/ Features -------- * TODO neutron-lib-2.3.0/releasenotes/0000775000175000017500000000000013641427200016464 5ustar zuulzuul00000000000000neutron-lib-2.3.0/releasenotes/source/0000775000175000017500000000000013641427200017764 5ustar zuulzuul00000000000000neutron-lib-2.3.0/releasenotes/source/pike.rst0000664000175000017500000000021713641427107021454 0ustar zuulzuul00000000000000=================================== Pike Series Release Notes =================================== .. release-notes:: :branch: stable/pike neutron-lib-2.3.0/releasenotes/source/train.rst0000664000175000017500000000017613641427107021645 0ustar zuulzuul00000000000000========================== Train Series Release Notes ========================== .. release-notes:: :branch: stable/train neutron-lib-2.3.0/releasenotes/source/ocata.rst0000664000175000017500000000023013641427107021606 0ustar zuulzuul00000000000000=================================== Ocata Series Release Notes =================================== .. release-notes:: :branch: origin/stable/ocata neutron-lib-2.3.0/releasenotes/source/index.rst0000664000175000017500000000032013641427107021626 0ustar zuulzuul00000000000000=============================== Neutron Library Release Notes =============================== .. toctree:: :maxdepth: 1 README.rst unreleased train stein rocky queens pike ocata neutron-lib-2.3.0/releasenotes/source/_static/0000775000175000017500000000000013641427200021412 5ustar zuulzuul00000000000000neutron-lib-2.3.0/releasenotes/source/_static/.placeholder0000664000175000017500000000000013641427107023671 0ustar zuulzuul00000000000000neutron-lib-2.3.0/releasenotes/source/rocky.rst0000664000175000017500000000022113641427107021646 0ustar zuulzuul00000000000000=================================== Rocky Series Release Notes =================================== .. release-notes:: :branch: stable/rocky neutron-lib-2.3.0/releasenotes/source/_templates/0000775000175000017500000000000013641427200022121 5ustar zuulzuul00000000000000neutron-lib-2.3.0/releasenotes/source/_templates/.placeholder0000664000175000017500000000000013641427107024400 0ustar zuulzuul00000000000000neutron-lib-2.3.0/releasenotes/source/unreleased.rst0000664000175000017500000000015613641427107022655 0ustar zuulzuul00000000000000============================= Current Series Release Notes ============================= .. release-notes:: neutron-lib-2.3.0/releasenotes/source/queens.rst0000664000175000017500000000022313641427107022021 0ustar zuulzuul00000000000000=================================== Queens Series Release Notes =================================== .. release-notes:: :branch: stable/queens neutron-lib-2.3.0/releasenotes/source/locale/0000775000175000017500000000000013641427200021223 5ustar zuulzuul00000000000000neutron-lib-2.3.0/releasenotes/source/locale/fr/0000775000175000017500000000000013641427200021632 5ustar zuulzuul00000000000000neutron-lib-2.3.0/releasenotes/source/locale/fr/LC_MESSAGES/0000775000175000017500000000000013641427200023417 5ustar zuulzuul00000000000000neutron-lib-2.3.0/releasenotes/source/locale/fr/LC_MESSAGES/releasenotes.po0000664000175000017500000000142213641427107026455 0ustar zuulzuul00000000000000# Gérald LONLAS , 2016. #zanata msgid "" msgstr "" "Project-Id-Version: Neutron Library Release Notes\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-01-25 04:56+0000\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "PO-Revision-Date: 2016-10-22 05:51+0000\n" "Last-Translator: Gérald LONLAS \n" "Language-Team: French\n" "Language: fr\n" "X-Generator: Zanata 3.9.6\n" "Plural-Forms: nplurals=2; plural=(n > 1)\n" msgid "Current Series Release Notes" msgstr "Note de la release actuelle" msgid "Neutron Library Release Notes" msgstr "Note de release pour la librairie Neutron" msgid "Neutron Library Release Notes Howto" msgstr "Note de release Howto pour la librairie Neutron" neutron-lib-2.3.0/releasenotes/source/README.rst0000664000175000017500000000077213641427107021467 0ustar zuulzuul00000000000000=================================== Neutron Library Release Notes Howto =================================== Release notes for documenting new features in OpenStack projects. Background on the process, tooling, and methodology is documented in a `mailing list post by Doug Hellmann `_. For information on how to create release notes, please consult the `Release Notes documentation `_. neutron-lib-2.3.0/releasenotes/source/conf.py0000664000175000017500000002206113641427107021272 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. # Neutron Library Release Notes documentation build configuration file, # created by # sphinx-quickstart on Wed Oct 18 17:40:50 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'openstackdocstheme', 'reno.sphinxext', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. # source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'Neutron Library Release Notes' copyright = u'2016, Neutron Library Developers' # Release notes are version independent. # The full version, including alpha/beta/rc tags. release = '' # The short X.Y version. version = '' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all # documents. # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. # add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). # add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. # show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. # keep_warnings = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'openstackdocs' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". # html_title = None # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. # html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. # html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. # html_last_updated_fmt = '%b %d, %Y' html_last_updated_fmt = '%Y-%m-%d %H:%M' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. # html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. # html_additional_pages = {} # If false, no module index is generated. # html_domain_indices = True # If false, no index is generated. # html_use_index = True # If true, the index is split into individual pages for each letter. # html_split_index = False # If true, links to the reST sources are added to the pages. # html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. # html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. # html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'NeutronLibReleaseNotesdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # 'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ ('index', 'NeutronLibReleaseNotes.tex', u'Neutron Library Notes Documentation', u'Neutron Library Developers', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. # latex_use_parts = False # If true, show page references after internal links. # latex_show_pagerefs = False # If true, show URL addresses after external links. # latex_show_urls = False # Documents to append as an appendix to all manuals. # latex_appendices = [] # If false, no module index is generated. # latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'neutronlibreleasenotes', u'Neutron Library', 'Neutron Library Release Notes Documentation', [u'Neutron Library Developers'], 1) ] # If true, show URL addresses after external links. # man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'NeutronLibReleaseNotes', u'Neutron Library', 'Neutron Library Release Notes Documentation', u'Neutron Library Developers', 'NeutronLibReleaseNotes', 'For sharing/decoupling neutron functionality across the Stadium.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. # texinfo_appendices = [] # If false, no module index is generated. # texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. # texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. # texinfo_no_detailmenu = False # -- Options for Internationalization output ------------------------------ locale_dirs = ['locale/'] # -- Options for openstackdocstheme ------------------------------------------- repository_name = 'openstack/neutron-lib' bug_project = 'neutron' bug_tag = 'doc' neutron-lib-2.3.0/releasenotes/source/stein.rst0000664000175000017500000000022113641427107021641 0ustar zuulzuul00000000000000=================================== Stein Series Release Notes =================================== .. release-notes:: :branch: stable/stein neutron-lib-2.3.0/releasenotes/notes/0000775000175000017500000000000013641427200017614 5ustar zuulzuul00000000000000neutron-lib-2.3.0/releasenotes/notes/gateway-ip-qos-ext-d3ffb5f517c9f713.yaml0000664000175000017500000000020613641427107026460 0ustar zuulzuul00000000000000--- features: - | Add new extension `qos-gateway-ip` which extends the `router_gw_info` with new attribute `qos_policy_id`. neutron-lib-2.3.0/releasenotes/notes/rehome-externalnet-apidef-d377f87da900eabe.yaml0000664000175000017500000000036613641427107030131 0ustar zuulzuul00000000000000--- features: - The ``external-net`` API extension's API definition is now available in ``neutron_lib.api.definitions.external_net``. - External network related exceptions are now available in ``neutron_lib.exceptions.external_net``. neutron-lib-2.3.0/releasenotes/notes/add-network-segment-range-plugin-constant-9e80453919162c89.yaml0000664000175000017500000000027413641427107032544 0ustar zuulzuul00000000000000other: - | Add the ``neutron_lib.plugins.constants.NETWORK_SEGMENT_RANGE`` constant so that it can be used elsewhere related to the ``network_segment_range`` service plugin. neutron-lib-2.3.0/releasenotes/notes/rm-dup-pluginconst-085d0fcee4e931b8.yaml0000664000175000017500000000036013641427107026555 0ustar zuulzuul00000000000000--- upgrade: - The ``CORE`` and ``L3`` service type name constants have been removed from ``neutron_lib.constants``. These constants are duplicates of those in ``neutron_lib.plugin.constants`` and consumers should use the latter. neutron-lib-2.3.0/releasenotes/notes/add-router-not-found-in-factory-exception-e2bf9431549ff9b9.yaml0000664000175000017500000000016013641427107032764 0ustar zuulzuul00000000000000--- features: - Adds new L3 exception ``RouterNotFoundInRouterFactory`` in ``neutron_lib.exceptions.l3``. neutron-lib-2.3.0/releasenotes/notes/placement-client-optional-rp-generations-44d1f1055d5496be.yaml0000664000175000017500000000101113641427107032637 0ustar zuulzuul00000000000000--- other: - | The ``resource_provider_generation`` parameters of the following methods of ``PlacementAPIClient`` are now optional: ``update_resource_provider_inventories``, ``update_resource_provider_inventory`` and ``update_resource_provider_traits``. You may call the methods without this parameter or pass ``None`` with the meaning to ignore resource provider generations. That is the client will (in quick succession) get the object and update it supplying the same generation. neutron-lib-2.3.0/releasenotes/notes/boilerplate-ext-descriptor-a5cec8b9b900cbfd.yaml0000664000175000017500000000044013641427107030473 0ustar zuulzuul00000000000000--- features: - The ``APIExtensionDescriptor`` was added to ``neutron_lib.api.extensions`` and can be used with extensions that have an API definition in neutron-lib to minimize the boilplate code needed in the extension definition class. For more details, see the dev-ref. neutron-lib-2.3.0/releasenotes/notes/rehome-api-faults-cf30246e5e5bf8b8.yaml0000664000175000017500000000022313641427107026330 0ustar zuulzuul00000000000000--- features: - The ``FAULT_MAP`` dictionary from ``neutron.api.v2.base`` has been rehomed to ``neutron_lib.api.faults`` with the same name. neutron-lib-2.3.0/releasenotes/notes/rm-apiutils-fa30241be7ca5162.yaml0000664000175000017500000000041413641427107025151 0ustar zuulzuul00000000000000--- upgrade: - The ``neutron_lib.api.utils`` module has been removed. The single ``populate_project_info`` function therein is available in ``neutron_lib.api.attributes`` and has been marked as a moved function in the ``utils`` module for some time now. neutron-lib-2.3.0/releasenotes/notes/rehome-get-port-binding-98765e77c627e57d.yaml0000664000175000017500000000017613641427107027252 0ustar zuulzuul00000000000000--- features: - The ``get_port_binding_by_status_and_host`` function is now available in ``neutron_lib.plugins.utils``. neutron-lib-2.3.0/releasenotes/notes/dns-api-def-bc24a58f56c5fbfb.yaml0000664000175000017500000000040413641427107025232 0ustar zuulzuul00000000000000--- features: - The ``DNS Integration`` extension API definition has been added as ``neutron_lib.api.definitions.dns``. - The ``validate_dns_name``, ``validate_fip_dns_name``, and ``validate_dns_domain`` are now available as neutron-lib validators.neutron-lib-2.3.0/releasenotes/notes/rehome-netaz-apidef-74e962ef682380bc.yaml0000664000175000017500000000026213641427107026503 0ustar zuulzuul00000000000000--- features: - The API definition for neutron's ``network_availability_zone`` extension is now available in ``neutron_lib.api.definitions.network_availability_zone``. neutron-lib-2.3.0/releasenotes/notes/add-availability_zone_filter-extension-e91e1e5e822e4133.yaml0000664000175000017500000000022513641427107032454 0ustar zuulzuul00000000000000--- other: - | Add a shim extension ``availability_zone_filter`` to indicate if ``availability_zone`` resource supports filter parameters. neutron-lib-2.3.0/releasenotes/notes/placement-client-move-9f292ae2067c119c.yaml0000664000175000017500000000036613641427107027042 0ustar zuulzuul00000000000000--- other: - | The ``PlacementAPIClient`` class is moved from ``neutron_lib.clients.placement`` to ``neutron_lib.placement.client`` in order to consolidate all Placement related logic under sub-package ``neutron_lib.placement``.neutron-lib-2.3.0/releasenotes/notes/add-rbac-address-scope-dc4683772b205632.yaml0000664000175000017500000000024513641427107026673 0ustar zuulzuul00000000000000features: - | Added API definition for ``rbac-address-scope`` extension, which allows sharing address scope between tenants via the network RBAC mechanism.neutron-lib-2.3.0/releasenotes/notes/add-network-address-scope-affinity-error-8f6b4493a92142d4.yaml0000664000175000017500000000044713641427107032504 0ustar zuulzuul00000000000000--- features: - | A new exception named ``NetworkAddressScopeAffinityError`` has been added in neutron_lib/exceptions/address_scope.py. This is to be raised by consumers when network / address scope affinity constraints are violated on subnet creation and subnet pool updates. neutron-lib-2.3.0/releasenotes/notes/placement-resource-provider-functions-17ec45f714ea2b23.yaml0000664000175000017500000000137213641427107032353 0ustar zuulzuul00000000000000features: - Added ``list_resource_providers`` function to the Placement API client, which allows to retrieve a list of Resource Providers filtering by UUID or parent UUID. It requires at least version ``1.3`` of placement API for listing resource providers that are members of any of the list of aggregates provided. It requires at least version ``1.14`` of placement API for listing nested resource providers. - Added ``get_resource_provider`` function to the Placement API client, which allows to retrieve an specific Resource Provider by its UUID. - Added ``PlacementAPIVersionIncorrect`` exception class which can be raised when requested placement API version is incorect and doesn't support requested API feature. neutron-lib-2.3.0/releasenotes/notes/subnet_segmentid_writable-e28a85033272f05d.yaml0000664000175000017500000000023213641427107030005 0ustar zuulzuul00000000000000--- features: - | Make ``segment_id`` of subnet resource writable. Enables the possibility to migrate a non-routed network to a routed network. neutron-lib-2.3.0/releasenotes/notes/rehome-metering-apidef-d9a0e70cbecc2bcc.yaml0000664000175000017500000000033513641427107027605 0ustar zuulzuul00000000000000--- features: - The ``metering`` extension's API is now available in ``neutron_lib.api.definitions.metering``. - Exceptions for the ``metering`` extension are available in ``neutron_lib.exceptions.metering``. ././@LongLink0000000000000000000000000000016200000000000011214 Lustar 00000000000000neutron-lib-2.3.0/releasenotes/notes/placement-client-bump-latest-supported-version-to-1-23-83589217b7b079fe.yamlneutron-lib-2.3.0/releasenotes/notes/placement-client-bump-latest-supported-version-to-1-23-835892170000664000175000017500000000073313641427107032665 0ustar zuulzuul00000000000000--- other: - | Bump the microversion used by ``PlacementAPIClient`` from ``1.20`` to ``1.23`` in order to have access to the ``code`` attribute of JSON error responses (`Placement API changelog `_). Both ``1.20`` and ``1.23`` were released in the ``Rocky`` version of Placement therefore we expect no upgrade impact. neutron-lib-2.3.0/releasenotes/notes/rehome-qosbwldir-apidef-f0e3f778f2f980c0.yaml0000664000175000017500000000023413641427107027447 0ustar zuulzuul00000000000000--- features: - The ``qos-bw-limit-direction`` extension's API definition is now available in ``neutron_lib.api.definitions.qos_bw_limit_direction``. neutron-lib-2.3.0/releasenotes/notes/std_attributes_bgpvpn-5a1c63f68d1ff6be.yaml0000664000175000017500000000044513641427107027507 0ustar zuulzuul00000000000000--- features: - | Add API extensions to advertise the support of standard attributes with BGPVPN resources: ``standard-attr-bgpvpn``, ``standard-attr-bgpvpn-network-association``, ``standard-attr-bgpvpn-router-association`` and ``standard-attr-bgpvpn-port-association``. neutron-lib-2.3.0/releasenotes/notes/rehome-vlantransp-apidef-1cd7d3ace9042686.yaml0000664000175000017500000000044613641427107027624 0ustar zuulzuul00000000000000--- features: - The ``vlan-transparent`` extension's API definition is now available in ``neutron_lib.api.definitions.vlantransparent``. - The ``get_vlan_transparent`` function from the ``vlan-transparent`` extension is available in ``neutron_lib.api.definitions.vlantransparent``. neutron-lib-2.3.0/releasenotes/notes/rehome-agent-apidef-7a2dde6a9810f55c.yaml0000664000175000017500000000020213641427107026601 0ustar zuulzuul00000000000000--- features: - The neutron ``agent`` extension's API definition is now available as ``neutron_lib.api.definitions.agent``. neutron-lib-2.3.0/releasenotes/notes/public-sql-fixtures-35d0aa74a368e217.yaml0000664000175000017500000000016113641427107026555 0ustar zuulzuul00000000000000--- features: - The ``SqlFixture`` and ``StaticSqlFixture`` are now available in ``neutron_lib.fixtures``. neutron-lib-2.3.0/releasenotes/notes/setproctitle_for_workers-e8805fcaf34026ab.yaml0000664000175000017500000000311113641427107030136 0ustar zuulzuul00000000000000features: - | ``neutron_lib.worker.BaseWorker`` will now set the process title on process start, if it is a new process. By default, the name will be "neutron-server", and the description will be the name of the worker class, followed by the original process title. Both fields are customizable via the ``name`` and ``desc`` arguments to ``BaseWorker.start()``, and the change can be disabled via the ``set_proctitle`` argument to the ``__init__`` function. ``neutron.conf`` will have a setting for disabling this functionality for all in-tree workers, but by default, all out of tree plugin workers will set their name at fork time. Available settings are 'on' (described above, and the default), 'off' (same as today), or 'brief', which settings the process name to just name and description. 'brief' is probably most useful/simple for deployers, but 'on' is the default in order to prevent as many script related breakages as possible. upgrade: - Any plugin which forks worker processes from neutron-server will have its proctitle set to "neutron-server" plus a classname in ps output. Any tool used for monitoring/maintenance that watches the process table should be modified to only look for the string ``neutron-server``. On the plus side, it will now be possible to distinguish which process belongs to which plugin, based on the new naming. Note that the original process string is still in the proctitle, so as long as the scripting is not looking for a perfect string match, it should continue to work. ././@LongLink0000000000000000000000000000016200000000000011214 Lustar 00000000000000neutron-lib-2.3.0/releasenotes/notes/placement-client-bump-latest-supported-version-to-1-20-fe96751dab42399b.yamlneutron-lib-2.3.0/releasenotes/notes/placement-client-bump-latest-supported-version-to-1-20-fe96751d0000664000175000017500000000027313641427107033101 0ustar zuulzuul00000000000000--- other: - | Bump ``PlacementAPIClient's`` max supported microversion to ``1.20``, as from that microversion placement API returns json body for POST /resource_providers. neutron-lib-2.3.0/releasenotes/notes/expose-port-forwarding-in-fip-a7880506cea0ad1d.yaml0000664000175000017500000000036313641427107030600 0ustar zuulzuul00000000000000--- features: - | Introduced ``expose-port-forwarding-in-fip`` API extension for exposing ``port_forwardings`` field in ``FloatingIP`` API response. This extension requires the ``router`` and ``port_forwarding`` service plugins. neutron-lib-2.3.0/releasenotes/notes/add-floatingip-pools-extension-17a1ee5c7eafc989.yaml0000664000175000017500000000020713641427107031124 0ustar zuulzuul00000000000000--- features: - | Add ``floatingip-pools`` API extension. This extension provides API endpoint for listing floatingip pools. neutron-lib-2.3.0/releasenotes/notes/move-segment-range-types-to-lib-constants-d45c6959607e9136.yaml0000664000175000017500000000037013641427107032565 0ustar zuulzuul00000000000000--- other: - | The ``neutron_lib.api.definitions.network_segment_range.NETWORK_SEGMENT_RANGE_TYPE_LIST`` constant was moved to ``neutron_lib.constants`` and renamed to ``NETWORK_SEGMENT_RANGE_TYPES`` so that it can be used elsewhere. neutron-lib-2.3.0/releasenotes/notes/extend-segment-methods-with-filters-6e74953ae2d3b828.yaml0000664000175000017500000000042113641427107031661 0ustar zuulzuul00000000000000--- features: - | Extend the ML2 type driver abstract methods ``reserve_provider_segment`` and ``allocate_tenant_segment`` with ``filters`` that is used as search criteria for the segment allocation support when network-segment-range extension is loaded. neutron-lib-2.3.0/releasenotes/notes/rehome-extraroute-apidef-e14e72e03ce18ead.yaml0000664000175000017500000000040013641427107027755 0ustar zuulzuul00000000000000--- features: - The API definition for the ``extraroute`` extension is now available in ``neutron_lib.api.defintions.extraroute``. - Exceptions related to the ``extraroute`` extension are now available in ``neutron_lib.exceptions.extraroute``. neutron-lib-2.3.0/releasenotes/notes/extension-fixture-b7fd61384f1a4d1d.yaml0000664000175000017500000000117713641427107026507 0ustar zuulzuul00000000000000--- features: - A new fixture for testing with neutron-lib API definitions has been added as ``neutron_lib.fixtures.APIDefinitionFixture``. This fixture can be used anytime extension plugins are being tested that modify resource attribute maps and ensures the single global API definition attribute map is copied and restored. - The ``neutron_lib.api.extensions.APIExtensionDescriptor`` class now defines update_attributes_map that uses the API definitions attribute map if none is given. This is the default behavior in most all extensions today and thus is collapsed into the base class for convenience. neutron-lib-2.3.0/releasenotes/notes/rehome-ovo-exceptions-fbddfeea582ef3f1.yaml0000664000175000017500000000023313641427107027545 0ustar zuulzuul00000000000000--- features: - The neutron versioned object exceptions from ``neutron.objects.exceptions`` are now available in ``neutron_lib.objects.exceptions``. neutron-lib-2.3.0/releasenotes/notes/add-vni-to-bgpvpn-7531df9fa4f8955b.yaml0000664000175000017500000000026613641427107026204 0ustar zuulzuul00000000000000--- features: - | The ``bgpvpn-vni`` API extension adds the ``vni`` optional attribute to ``bgpvpn`` objects to control the VXLAN VNI when VXLAN encapsulation is used. neutron-lib-2.3.0/releasenotes/notes/portbindings-extended-3a89560ee63824e1.yaml0000664000175000017500000000015213641427107027070 0ustar zuulzuul00000000000000--- features: - | API reference for ``extended port bindings`` extension for ``port`` resource. neutron-lib-2.3.0/releasenotes/notes/rehome-l3exthamode-apidef-9b3ef0956edb3883.yaml0000664000175000017500000000037113641427107027662 0ustar zuulzuul00000000000000--- features: - The ``l3-ha`` extension's API definition is now available in ``neutron_lib.api.definitions.l3_ext_ha_mode``. - Exceptions related to the ``l3-ha`` extension are available in ``neutron_lib.api.exceptions.l3_ext_ha_mode``. neutron-lib-2.3.0/releasenotes/notes/traffic-control-constants-b8120d1bea0681bf.yaml0000664000175000017500000000045513641427107030076 0ustar zuulzuul00000000000000--- features: - | Adds traffic control related constants: * Qdisc types: ``htb``, ``tbf`` and ``ingress``, used in Neutron ``tc_lib`` * Qdisc ID: for ``ingress`` type, because this one is specific only for ingress traffic. * Qdisc parents: for ``root`` and ``ingress`` types. neutron-lib-2.3.0/releasenotes/notes/add-api-extension-sort-key-validation-b42f5839671fe5f5.yaml0000664000175000017500000000074613641427107032106 0ustar zuulzuul00000000000000--- features: - | Add API extension ``sort-key-validation``. This extension indicates if the server supports validation on sorting. other: - | API extension ``sort-key-validation`` relies on the ``is_sort_key`` keyword in the ``RESOURCE_ATTRIBUTE_MAP`` to judge if an attribute can be used as sort key. Neutron plugins which want to support sort key validation needs to set ``is_sort_key`` to ``True`` for each attribute in their resource attribute map. neutron-lib-2.3.0/releasenotes/notes/add_fwg_group-9252d07f1011613d.yaml0000664000175000017500000000056413641427107025303 0ustar zuulzuul00000000000000--- features: - | Updated fwaas API extension definition to include previously missing ability to specify remote firewall groups for ingress and egress traffic. When a firewall group rule specifies a remote group, for example an ingress rule in fwgA specifies a remote group of fwgB, that means only packets from fwgB could match this ingress rule. neutron-lib-2.3.0/releasenotes/notes/logging-api-ref-fafb884367ca60a2.yaml0000664000175000017500000000013313641427107025747 0ustar zuulzuul00000000000000--- features: - API reference for the logging extension for ``security_group`` resource. neutron-lib-2.3.0/releasenotes/notes/add-ipinip-protocol-ab9287f9b698f34c.yaml0000664000175000017500000000021313641427107026621 0ustar zuulzuul00000000000000--- features: - | Adds the IP-in-IP protocol under the name ``ipip`` to the list of protocols supported in security group rules. ././@LongLink0000000000000000000000000000015700000000000011220 Lustar 00000000000000neutron-lib-2.3.0/releasenotes/notes/rehome-provider-network-attribute-updates-supported-ea02a526ef297053.yamlneutron-lib-2.3.0/releasenotes/notes/rehome-provider-network-attribute-updates-supported-ea02a526ef20000664000175000017500000000023113641427107033546 0ustar zuulzuul00000000000000--- features: - The function ``provider_network_attribute_updates_supported`` is now available in ``neutron_lib.plugins.ml2.api.MechanismDriver``. neutron-lib-2.3.0/releasenotes/notes/add-port-bindings-resource-messages-rpc-1382ba9842561cdb.yaml0000664000175000017500000000035113641427107032360 0ustar zuulzuul00000000000000--- features: - New ``PORT_BINDING``, ``ACTIVATE`` and ``DEACTIVATE`` definitions have been added to ``neutron_lib.agent.topics``, to enable plug-ins to notify agents when a port binding has been activated or de-activated. neutron-lib-2.3.0/releasenotes/notes/cidr_for_canonical_format-4e7925d76a27a19d.yaml0000664000175000017500000000032713641427107030025 0ustar zuulzuul00000000000000--- features: - | A new converter is added to facilitate converting IPv6 CIDRs to canonical format. This way IPv6 CIDRs can be specified in multiple formats but would be handled in their canonical format. neutron-lib-2.3.0/releasenotes/notes/portbindings-apidef-3d7893bcb94d7f61.yaml0000664000175000017500000000026213641427107026671 0ustar zuulzuul00000000000000--- features: - The API definition and associated constants have been rehomed from ``neutron.extensions.portbindings`` to ``neutron_lib.api.definitions.portbindings``. neutron-lib-2.3.0/releasenotes/notes/rehome-stdattr-d834900d3fd3c2e6.yaml0000664000175000017500000000013013641427107025657 0ustar zuulzuul00000000000000--- features: - The ``neutron_lib.db.standard_attr`` module is now available for use. neutron-lib-2.3.0/releasenotes/notes/add-retrieve-sort-keys-from-attribute-map-ae53d67e0be2ace0.yaml0000664000175000017500000000030613641427107033156 0ustar zuulzuul00000000000000--- features: - | A new method ``retrieve_valid_sort_keys`` was added to ``neutron_lib.api.attributes``. This method can help retrieve valid sort keys from a given resource attribute map. neutron-lib-2.3.0/releasenotes/notes/fwaas-api-def-a6f03db369177b4a.yaml0000664000175000017500000000010713641427107025323 0ustar zuulzuul00000000000000--- features: - Adds neutron-fwaas API definitions to neutron-lib. neutron-lib-2.3.0/releasenotes/notes/add-is_sort_key-keyword-to-attribute-map-75342446d99f4490.yaml0000664000175000017500000000025613641427107032404 0ustar zuulzuul00000000000000--- features: - | Add a new keyword ``is_sort_key`` to attribute maps. This keyword indicates that the attribute can be used as a sort key for sorting list result. neutron-lib-2.3.0/releasenotes/notes/client-id-number-dhcp-option-a099f927eb8f99af.yaml0000664000175000017500000000054613641427107030421 0ustar zuulzuul00000000000000--- fixes: - | For Infiniband support, Ironic needs to send the ``client-id`` DHCP option as a number in order for IP address assignment to work. This is now supported in Neutron, and can be specified as option number 61 as defined in RFC 4776. For more information see bug `1770932 `_ neutron-lib-2.3.0/releasenotes/notes/add-empty-string-filtering-api-extension-44cb392025dc359c.yaml0000664000175000017500000000024113641427107032567 0ustar zuulzuul00000000000000--- features: - | Add ``empty-string-filtering`` API extension. This extension indicates if the server supports filtering attributes with empty value. neutron-lib-2.3.0/releasenotes/notes/expose-and-enhance-callback-api-714cce65a3c44fe7.yaml0000664000175000017500000000133313641427107030751 0ustar zuulzuul00000000000000--- features: - Neutron's callback API found in ``neutron.callbacks.*`` is now exposed in ``neutron_lib.callbacks.*``. In addition, a set of event payload objects are now available for use in transporting event payload data in a standardized way. - A test fixture is provided for isolating the global callback manager in ``neutron_lib.callbacks.registry``. For more details see the comments in ``neutron_lib.fixture.CallbackRegistryFixture``. deprecations: - The use of ``neutron_lib.callbacks.registry.notify()`` and ``neutron_lib.callbacks.manager.CallbacksManager.notify()`` is deprecated in favor of their ``publish()`` counterparts and will be removed in the "Queens" release time-frame. neutron-lib-2.3.0/releasenotes/notes/alembic-branches-6d5947d141efd26e.yaml0000664000175000017500000000031613641427107026113 0ustar zuulzuul00000000000000--- features: - The constants ``EXPAND_BRANCH`` and ``CONTRACT_BRANCH`` are now available in ``neutron_lib.db.constants``. They should be used instead of the ones in ``neutron.db.migration.cli``. neutron-lib-2.3.0/releasenotes/notes/bgpvpn-api-def-22c7072575316ddd.yaml0000664000175000017500000000020513641427107025355 0ustar zuulzuul00000000000000--- features: - API definition for the ``networking-bgpvpn`` extension. - Adds new validator ``validate_list_of_regex_or_none``. neutron-lib-2.3.0/releasenotes/notes/fwaas-exceptions-e580766205b466d4.yaml0000664000175000017500000000061313641427107025771 0ustar zuulzuul00000000000000--- features: - | The exception classes have migrated from neutron_fwaas to neutron_lib as mentioned below: * ``neutron_fwaas.extensions.firewall`` -> ``neutron_lib.exceptions.firewall_v1`` * ``neutron_fwaas.extensions.firewallrouterinsertion`` -> ``neutron_lib.exceptions.firewall_v1`` * ``neutron_fwaas.extensions.firewall_v2`` -> ``neutron_lib.exceptions.firewall_v2`` neutron-lib-2.3.0/releasenotes/notes/policy-redux-25c26836219fd02d.yaml0000664000175000017500000000051513641427107025207 0ustar zuulzuul00000000000000--- deprecations: - | ``policy.refresh()`` and ``policy.reset()`` have been removed. The library policy module is not meant for public consumption, and it should be considered in practice a private component of the library. If you use it, you will do so at your own risk, as it has been marked as a private module. neutron-lib-2.3.0/releasenotes/notes/subnet-dns-publish-fixed-ip-031d78bbc85a419e.yaml0000664000175000017500000000051313641427107030152 0ustar zuulzuul00000000000000--- features: - | The ``subnet-dns-publish-fixed-ip`` API extension is added. It adds the ``dns_publish_fixed_ip`` attribute to subnets, indicating whether to publish DNS records for fixed IPs from this subnet in an external DNS service. For details see [`bug 1784879 `_]. neutron-lib-2.3.0/releasenotes/notes/add-traffic-control-exceptions-0e137dae3a556d54.yaml0000664000175000017500000000023513641427107030717 0ustar zuulzuul00000000000000--- features: - | Adds new traffic control exceptions ``TcLibQdiscNeededArguments`` and ``TcLibQdiscTypeError`` in ``neutron-lib.exceptions.qos``. neutron-lib-2.3.0/releasenotes/notes/support-rarp-protocol-44f5c67784e74db4.yaml0000664000175000017500000000016213641427107027177 0ustar zuulzuul00000000000000--- features: - | Add ``ETHERTYPE_RARP`` constant which represents RARP protocol to support live-migration. neutron-lib-2.3.0/releasenotes/notes/transaction_constraint-d3f93c2ced4a74c6.yaml0000664000175000017500000000066713641427107027670 0ustar zuulzuul00000000000000--- features: - | Contexts may now have transaction constraints set on them to be enforced by the revision plugin in Neutron for generalized compare-and-swap updates. Calling ``set_transaction_constraint`` on the context before performing a resource mutation will setup the constraint. This is also exposed to users via the HTTP API with ``if-match`` headers and the API layer sets the constraint on the context. neutron-lib-2.3.0/releasenotes/notes/extraroute-atomic-apidef-additive-fb783d66c08618d4.yaml0000664000175000017500000000045113641427107031350 0ustar zuulzuul00000000000000--- features: - | The ``extraroute-atomic`` api-def's ACTION_MAP is changed so we add the new member actions (``add_extraroutes`` and ``remove_extraroutes``) while we also keep the ``router`` extension's member actions (``add_router_interface`` and ``remove_router_interface``). neutron-lib-2.3.0/releasenotes/notes/l3-apidefs-d028c708c22ef2a0.yaml0000664000175000017500000000026713641427107024644 0ustar zuulzuul00000000000000--- features: - The ``floating_ip`` and ``router`` API definitions from ``neutron.extensions.l3`` have been rehomed to ``neutron_lib.api.definitions`` as the module ``l3``. neutron-lib-2.3.0/releasenotes/notes/rehome-rbac-policy-callbacks-24fa12ad1ab4c443.yaml0000664000175000017500000000017613641427107030360 0ustar zuulzuul00000000000000--- features: - The ``rbac-policy`` callback resource now available as ``neutron_lib.callbacks.resources.RBAC_POLICY``. neutron-lib-2.3.0/releasenotes/notes/subnet-onboard-api-definition-f4918ff1f1d12c97.yaml0000664000175000017500000000011313641427107030547 0ustar zuulzuul00000000000000--- features: - Adds ``subnet_onboard`` API definition to neutron-lib. neutron-lib-2.3.0/releasenotes/notes/add-is_filter-keyword-to-attribute-maps-3fa31e91c353d033.yaml0000664000175000017500000000025413641427107032400 0ustar zuulzuul00000000000000--- features: - | Add a new keyword ``is_filter`` to attribute maps. This keyword indicates that the attribute can be used for filtering result on list requests. neutron-lib-2.3.0/releasenotes/notes/rehome-projid-apidef-a433b1b003f27a20.yaml0000664000175000017500000000021013641427107026573 0ustar zuulzuul00000000000000--- features: - The ``project-id`` API extension's API definition is now available in ``neutron_lib.api.definitions.project_id``. neutron-lib-2.3.0/releasenotes/notes/port-resource-request-cb520720cd19523b.yaml0000664000175000017500000000067113641427107027130 0ustar zuulzuul00000000000000--- features: - The new extension ``port-resource-request`` adds the ``resource_request`` attribute to port responses. This attribute enables Neutron to communicate to Nova resources needed by the port, such as physnet, VNIC type and bandwidth. If the port requested by Nova boot has the ``resource_request`` attribute, then the Nova Scheduler will try to allocate the VM in a host that can satisfy those requirements. neutron-lib-2.3.0/releasenotes/notes/rehome-plugin-utils-create-fns-9b8591f5222bff66.yaml0000664000175000017500000000027413641427107030621 0ustar zuulzuul00000000000000--- features: - The ``create_network``, ``create_subnet`` and ``create_port`` functions from ``neutron.plugins.common.utils`` are now available in ``neutron_lib.plugins.utils``. neutron-lib-2.3.0/releasenotes/notes/l3-port-ip-change-not-allow-2c98e13c08b5ee85.yaml0000664000175000017500000000066613641427107030006 0ustar zuulzuul00000000000000--- fixes: - | Directly updating some L3-related port IP addresses does not have any effect on the L3 agent side. As a consequence, these L3-related ports should not allow changing of their IP address. A new shim extension has been added called ``l3-port-ip-change-not-allowed`` to prevent such IP address change. For more information please see bug `1796824 `_. neutron-lib-2.3.0/releasenotes/notes/rehome-routersvctype-apidef-1d9d712fd5383eb5.yaml0000664000175000017500000000022413641427107030367 0ustar zuulzuul00000000000000--- features: - The ``router-service-type`` extension's API definition is now available in ``neutron_lib.api.definitions.routerservicetype``. neutron-lib-2.3.0/releasenotes/notes/sqlalchemy-1-3-0-b0a2b15b10ae526f.yaml0000664000175000017500000000047113641427107025553 0ustar zuulzuul00000000000000--- other: - | Since `commit `_, an AssociationProxy proxy instance is an AssociationProxyInstance derivative object. In order to import versions SQLAlchemy>=1.3.x, we need to handle both implementations. neutron-lib-2.3.0/releasenotes/notes/rehome-ml2-driverapi-363db4b8fa42f8f1.yaml0000664000175000017500000000017213641427107026737 0ustar zuulzuul00000000000000--- features: - The public APIs from ``neutron.plugins.ml2.driver_api`` are now in ``neutron_lib.plugins.ml2.api``. neutron-lib-2.3.0/releasenotes/notes/responsible_for_ports_allocation-5599dc59b3c98db2.yaml0000664000175000017500000000075413641427107031602 0ustar zuulzuul00000000000000--- features: - | New MechanismDriver API method: ``responsible_for_ports_allocation``. Mechanism drivers wanting to support resource allocations for ports in Placement (eg. wanting to guarantee some minimum bandwidth allocated on the resource provider in the port's ``binding:profile.allocation``) must implement this method. The default implementation reports not being responsible for any resource providers, therefore unaffected drivers need not be changed. neutron-lib-2.3.0/releasenotes/notes/rehome-ipv6pdprefix-const-d3b39992df4adef8.yaml0000664000175000017500000000016113641427107030127 0ustar zuulzuul00000000000000--- features: - The ``PROVISIONAL_IPV6_PD_PREFIX`` constant is now available in ``neutron_lib.constants``. neutron-lib-2.3.0/releasenotes/notes/add-rbac-subnetpool-bb63d4cef1d06e73.yaml0000664000175000017500000000024013641427107026701 0ustar zuulzuul00000000000000features: - | Added API definition for ``rbac-subnetpool`` extension, which allows sharing subnetpool between tenants via the network RBAC mechanism. neutron-lib-2.3.0/releasenotes/notes/policy-in-code-1e73cabebd41d66e.yaml0000664000175000017500000000044313641427107025752 0ustar zuulzuul00000000000000--- features: - | policy-in-code support in neutron-lib is added. The default policies for 'context_is_admin' and 'context_is_advsvc' are now implemented as embeded policies. (Note that the main policy-in-code support will be implemented in the main neutron codebase.) neutron-lib-2.3.0/releasenotes/notes/rehome-secgrp-portfilter-apidef-6723062419531d70.yaml0000664000175000017500000000026513641427107030520 0ustar zuulzuul00000000000000--- features: - The API defintion for the ``port-security-groups-filtering`` extension is now available in ``neutron_lib.api.definitions.security_groups_port_filtering``. neutron-lib-2.3.0/releasenotes/notes/context-manager-23538670cd9c701f.yaml0000664000175000017500000000033613641427107025664 0ustar zuulzuul00000000000000--- features: - | ``neutron_lib.db`` has a public module ``api`` that provides accessor functions for transactional context manager services. - | ``neutron_lib.fixture`` has a new ``SqlFixture`` available. neutron-lib-2.3.0/releasenotes/notes/port-range-compared-as-int-4d07fe030206f818.yaml0000664000175000017500000000033613641427107027620 0ustar zuulzuul00000000000000--- fixes: - Bug `1738371 `_ is fixed by comparing min port and max port in port range specification as integers instead of strings, during port range validation. neutron-lib-2.3.0/releasenotes/notes/rehome-ml2-mechdriver-cc86d3a2fe4c2822.yaml0000664000175000017500000000022513641427107027075 0ustar zuulzuul00000000000000--- features: - The ML2 ``MechanismDriver`` class from ``neutron.plugins.ml2.driver_api`` is now available in ``neutron_lib.plugins.ml2.api``. neutron-lib-2.3.0/releasenotes/notes/validator_ip_or_subnet_or_none-0175f906a9113954.yaml0000664000175000017500000000010013641427107030671 0ustar zuulzuul00000000000000--- features: - Added validator validate_ip_or_subnet_or_none neutron-lib-2.3.0/releasenotes/notes/add-port_details-to-floatingip-a2a3c95cc54737ac.yaml0000664000175000017500000000021713641427107030770 0ustar zuulzuul00000000000000--- features: - | Add ``fip-port-details`` API extension. This extension add ``port_details`` attribute to the Floating IP resource. neutron-lib-2.3.0/releasenotes/notes/rehome-db-api-63300ddab6a41e28.yaml0000664000175000017500000000135413641427107025321 0ustar zuulzuul00000000000000--- features: - The public APIs from ``neutron.db.api`` are now available in the ``neutron_lib.db.api`` module. - The ``CONTEXT_READER`` and ``CONTEXT_WRITER`` global database contexts are available in ``neutron_lib.db.api`` for convenient access as decorators. - The ``DBRetryErrorsFixture`` and ``DBAPIContextManagerFixture`` test fixtures are now available in ``neutron_lib.fixture`` allowing consumers to patch out retry error values and the gobal context manager. upgrade: - Consumers using the global ``context_manager`` from ``neutron.db.api`` should now use the ``get_context_manager()`` function in the ``neutron_lib.db.api`` module or the global ``CONTEXT_READER`` and ``CONTEXT_WRITER`` if needed.neutron-lib-2.3.0/releasenotes/notes/l3-agent-extensions-ha-state-change-837140efe4187a99.yaml0000664000175000017500000000015213641427107031335 0ustar zuulzuul00000000000000--- features: - | A new abstract method ``ha_state_change`` has been added to ``L3AgentExtension``. neutron-lib-2.3.0/releasenotes/notes/extension_descriptor-04025e86249cc94c.yaml0000664000175000017500000000016513641427107027042 0ustar zuulzuul00000000000000--- features: - The ExtensionDescriptor class moved from neutron.api.extensions to neutron_lib.api.extensions. ././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000neutron-lib-2.3.0/releasenotes/notes/placement-client-do-not-swallow-exceptions-c33c9a9224a27551.yamlneutron-lib-2.3.0/releasenotes/notes/placement-client-do-not-swallow-exceptions-c33c9a9224a27551.yam0000664000175000017500000000054513641427107032676 0ustar zuulzuul00000000000000--- other: - | The Placement client previously swallowed a few exceptions (but logged a warning when doing this). In order to let the user of the client choose to handle or ignore the error condition the client no longer does this. Also to avoid losing error information we catch and re-throw HTTP 4xx exceptions with better messages. ././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000neutron-lib-2.3.0/releasenotes/notes/add-type-driver-methods-for-network-segment-range-e6d300d430d97dd6.yamlneutron-lib-2.3.0/releasenotes/notes/add-type-driver-methods-for-network-segment-range-e6d300d430d970000664000175000017500000000036513641427107033035 0ustar zuulzuul00000000000000--- features: - | Introduce the ML2 type driver abstract methods ``initialize_network_segment_range_support`` and ``update_network_segment_range_allocations`` for the network segment range support when the extension is loaded. neutron-lib-2.3.0/releasenotes/notes/rehome-plugin-utils-39e3f839c0538de9.yaml0000664000175000017500000000043013641427107026574 0ustar zuulzuul00000000000000--- features: - The publically consumed API's from ``neutron.plugins.common.utils`` are now available in ``neutron_lib.plugins.utils``. - The ``NetworkVlanRangeError`` and ``PhysicalNetworkNameError`` exception classes are now available in ``neutron_lib.exceptions``. neutron-lib-2.3.0/releasenotes/notes/rehome-placement-api-client-a9ac5d96ca8570aa.yaml0000664000175000017500000000035213641427107030333 0ustar zuulzuul00000000000000--- features: - The neutron placement API client is now available as ``neutron_lib.clients.placement``. - A new fixture for testing placement API calls has been added as ``neutron_lib.fixtures.PlacementAPIClientFixture``. neutron-lib-2.3.0/releasenotes/notes/rehome-resource-extend-7eee483ec4146801.yaml0000664000175000017500000000035413641427107027243 0ustar zuulzuul00000000000000--- features: - The ``neutron.db._resource_extend`` is now available as ``neutron_lib.db.resource_extend`` along with a new ``DBResourceExtendFixture`` that allows tests to modify the map of registered resource functions. neutron-lib-2.3.0/releasenotes/notes/add-a-getter-for-a-newly-added-option-2082877bf7dd136b.yaml0000664000175000017500000000027213641427107031612 0ustar zuulzuul00000000000000--- features: - Maximum rpc timeout is now configurable by ``rpc_response_max_timeout`` from Neutron config instead of being calculated as ``10 * rpc_response_timeout`` value. neutron-lib-2.3.0/releasenotes/notes/add-ovo-registry-27cb7d4ac76d4dc8.yaml0000664000175000017500000000100613641427107026264 0ustar zuulzuul00000000000000--- features: - The ``neutron_lib.utils.runtime.NamespacedPlugins`` class is now available and wraps a stevedore namespace of plugins. - The ``neutron_lib.objects.registry`` module is now available for loading neutron versioned object classes registered as entry points with the ``NEUTRON_OBJECT_NAMESPACE`` namespace therein. This global registry can be used by consumers to access references to neutron versioned object classes and instances so there's no need to import ``neutron.objects``. neutron-lib-2.3.0/releasenotes/notes/vpn-api-def-52970461fac0f7d2.yaml0000664000175000017500000000056013641427107024751 0ustar zuulzuul00000000000000--- features: - Adds ``neutron-vpnaas`` API definitions to neutron-lib, including ``vpnaas``, ``vpn-endpoint-groups`` and ``vpn-flavors``. - Migrate user facing exceptions into neutron-lib along with the API definitions. - A new validator for type ``type:list_of_subnets_or_none`` to validate data is a list of subnet dicts or ``None`` is added too. neutron-lib-2.3.0/releasenotes/notes/data-plane-status-ext-c3452a01ef5007ce.yaml0000664000175000017500000000015313641427107027031 0ustar zuulzuul00000000000000--- features: - API definition and reference documentation for the port data plane status extension. neutron-lib-2.3.0/releasenotes/notes/update-segment-api-definition-d7297e73e76a754c.yaml0000664000175000017500000000036713641427107030512 0ustar zuulzuul00000000000000--- other: - | This release removes the ``description`` from the segment extension's attribute map as well as adds the ``standard-attr-description`` as required dependency and ``standard-attr-segment`` as an optional dependency. neutron-lib-2.3.0/releasenotes/notes/populate-dict-defaults-3f205c414f21bf54.yaml0000664000175000017500000000044313641427107027211 0ustar zuulzuul00000000000000--- features: - | A new ``dict_populate_defaults`` flag can be used in API definition for a dictionary attribute, which will results in default values for the keys to be filled in. This can also be used on values of a dictionary attribute if they are dictionaries as well. neutron-lib-2.3.0/releasenotes/notes/rehome-dhcpopts-apidef-389ab9d8935e5e0d.yaml0000664000175000017500000000076513641427107027302 0ustar zuulzuul00000000000000--- features: - The ``extra_dhcp_opt`` API extension definition from ``neutron.extensions`` has been rehomed to ``neutron_lib.api.definitions`` with the same name. - A new validator ``validate_any_key_specs_or_none`` has been added for the corresponding validation type ``type:list_of_any_key_specs_or_none``. This validator can be used to check that a list of dicts match at least 1 key spec allowing consumers the ability to define multiple formats for their validated data. neutron-lib-2.3.0/releasenotes/notes/l3_conntrack_helper-f186bcdcc31bcaf2.yaml0000664000175000017500000000061413641427107027131 0ustar zuulzuul00000000000000--- features: - | The ``l3-conntrack-helper`` API definition for ``Router`` is introduced, which allows conntrack helper target rules to be set for a ``Router``. - | Introduced ``expose-l3-conntrack-helper`` API extension for exposing ``conntrack_helpers`` field in ``Router`` API response. This extension requires the ``router`` and ``conntrack_helper`` service plugins. neutron-lib-2.3.0/releasenotes/notes/rehome-segment-apidef-a5f81adb834328f8.yaml0000664000175000017500000000017613641427107027102 0ustar zuulzuul00000000000000--- features: - The ``segment`` extension's API definition is now available in ``neutron_lib.api.definitions.segment``. neutron-lib-2.3.0/releasenotes/notes/api-definition-base-d2e9514c5ee2ef5b.yaml0000664000175000017500000000027213641427107026677 0ustar zuulzuul00000000000000--- other: - Provide API definition framework for Neutron Stadium APIs to be consolidated into neutron-lib. For more details see review https://review.opendev.org/#/c/353131/. neutron-lib-2.3.0/releasenotes/notes/remove_label-801d7a1b13f179fa.yaml0000664000175000017500000000021213641427107025344 0ustar zuulzuul00000000000000--- other: - | The ``LABEL`` variable, which was uselessly duplicating ``ALIAS``, has been removed from API definition modules. neutron-lib-2.3.0/releasenotes/notes/directory-fixture-083c5c5f365670d6.yaml0000664000175000017500000000107013641427107026257 0ustar zuulzuul00000000000000--- features: - | Introduced neutron_lib.fixture, and added fixture for plugin directory ``PluginDirectoryFixture``. An example below: .. code-block:: python from neutron_lib.plugins import directory from neutron_lib import fixture def setup_test_directory_instance(self): """Give a private copy of the directory to each test.""" self._plugin_directory = directory._PluginDirectory() self.useFixture(fixture.PluginDirectoryFixture( plugin_directory=self._plugin_directory)) neutron-lib-2.3.0/releasenotes/notes/rehome-routeraz-apidef-efc5f202e04b8272.yaml0000664000175000017500000000024413641427107027274 0ustar zuulzuul00000000000000--- features: - Neutron's ``router_availability_zone`` extension API definition is now available in ``neutron_lib.api.definitions.router_availability_zone``. neutron-lib-2.3.0/releasenotes/notes/revert-review-400408-4999a9159689c0c5.yaml0000664000175000017500000000044413641427107026102 0ustar zuulzuul00000000000000--- fixes: - Bug `1720046 `_ is fixed by reverting the logic of ``neutron_lib.utils.net.get_random_mac`` to its original behavior from commit `If2539f94b5479f0d6afa64c973082cbe8c5309ac `_. neutron-lib-2.3.0/releasenotes/notes/validator_check_route_loopback-bc2166b10a754c77.yaml0000664000175000017500000000032313641427107031044 0ustar zuulzuul00000000000000--- fixes: - | Static route validator should verify that routed CIDR isn't a loopback. Loopback addresses should not be routable. Bug: `1834012 `_ neutron-lib-2.3.0/releasenotes/notes/rehome-plugin-constants-ebf350dfd989957a.yaml0000664000175000017500000000026013641427107027611 0ustar zuulzuul00000000000000--- features: - Many of the constants from ``neutron.plugins.common.constants`` are now available in ``neutron_lib.plugins.constants`` and ``neutron_lib.constants``. neutron-lib-2.3.0/releasenotes/notes/hacking-check-n537-280ec39c061d9dd7.yaml0000664000175000017500000000015213641427107026076 0ustar zuulzuul00000000000000--- features: - Added hacking check ``N536``. This hacking check is added to the incubating checks. neutron-lib-2.3.0/releasenotes/notes/rehome-flavors-apidef-ef84b2c1c7eaeed7.yaml0000664000175000017500000000101113641427107027377 0ustar zuulzuul00000000000000--- features: - The ``flavors`` API definition is now available in ``neutron_lib.api.definitions.flavors``. - A new ``type:service_plugin_type`` validator has been added that allows a service plugin to be validated at runtime by checking the ``neutron_lib.plugins.directory``. - Exceptions related to the ``flavor`` API have been added to ``neutron_lib.exceptions.flavors`` except for ``InvalidFlavorServiceType`` which is now a generic ``InvalidServiceType`` in ``neutron_lib.exceptions``. neutron-lib-2.3.0/releasenotes/notes/rehome-qos-apidef-0dbe094b8b21a580.yaml0000664000175000017500000000020213641427107026207 0ustar zuulzuul00000000000000--- features: - The API definition for neutron's ``qos`` extension is now available in ``neutron_lib.api.definitions.qos``. neutron-lib-2.3.0/releasenotes/notes/rehome-l3flavors-apidef-da5e9b5d46df5cc7.yaml0000664000175000017500000000020413641427107027566 0ustar zuulzuul00000000000000--- features: - The ``l3-flavors`` extension's API definition is now available in ``neutron_lib.api.definitions.l3_flavors``. neutron-lib-2.3.0/releasenotes/notes/cleanup-unused-l3-attr-def-f0eab40813d17a2d.yaml0000664000175000017500000000024013641427107027730 0ustar zuulzuul00000000000000--- other: - | The ``convert_list_to`` and ``default`` parameters of external_fixed_ips have been removed from l3 and l3_ext_gw_mode API definitions. neutron-lib-2.3.0/releasenotes/notes/rehome-sorting-apidef-1547f093da322c14.yaml0000664000175000017500000000017613641427107026746 0ustar zuulzuul00000000000000--- features: - The ``sorting`` extension's API definition is now available in ``neutron_lib.api.definitions.sorting``. neutron-lib-2.3.0/releasenotes/notes/qos-port-network-policy-c64c57cf2ccec725.yaml0000664000175000017500000000030013641427107027627 0ustar zuulzuul00000000000000--- features: - | Add field ``qos_port_network_policy_id`` to the ``port`` definition. This read only parameter contains the QoS policy of the network where the port is plugged. neutron-lib-2.3.0/releasenotes/notes/fwaas_converters_validators-c310900b4386146e.yaml0000664000175000017500000000027013641427107030274 0ustar zuulzuul00000000000000--- features: - Added the converter ``convert_string_to_case_insensitive``. - Added the converter ``convert_to_protocol``. - Added the validator ``validate_port_range_or_none``. neutron-lib-2.3.0/releasenotes/notes/add-vnic-virtio-forwarder-portbinding-f7f87dfbef456ed1.yaml0000664000175000017500000000053313641427107032473 0ustar zuulzuul00000000000000--- features: - The ``VNIC_VIRTIO_FORWARDER`` VNIC type has been added to portbindings. This VNIC type is intended to request a low-latency virtio port inside the instance, likely backed by hardware acceleration. Currently the Agilio OVS external plugin provides support for this, with support from other vendors following soon. neutron-lib-2.3.0/releasenotes/notes/rehome-testools-6fba053249e14d42.yaml0000664000175000017500000000026613641427107025772 0ustar zuulzuul00000000000000--- features: - The ``OpenFixture`` class is now available in ``neutron_lib.fixtures``. - The ``reset_random_seed`` function is now available in ``neutron_lib.tests.tools``. neutron-lib-2.3.0/releasenotes/notes/default_overrides_none-ecc8dcf2c9c37e5d.yaml0000664000175000017500000000035113641427107027760 0ustar zuulzuul00000000000000--- features: - | A new flag can be used in API definition: ``default_overrides_none``. When enabled, the default value for the attribute will be used, including if the attribute was explicitly defined as ``null``. neutron-lib-2.3.0/releasenotes/notes/rehome-worker-b7e9c7f477bdb926.yaml0000664000175000017500000000022313641427107025610 0ustar zuulzuul00000000000000--- features: - The ``NeutronWorker`` class from the ``neutron.worker`` module is now available as ``BaseWorker`` in ``neutron_lib.worker``. neutron-lib-2.3.0/releasenotes/notes/flush_on_subtransaction-99ef11dfb56b706d.yaml0000664000175000017500000000046513641427107027755 0ustar zuulzuul00000000000000--- fixes: - The oslo.db context manager returned by ``db.api.get_context_manager()`` will be configured with flush_on_subtransaction=True to more closely match the behavior of the previous session.begin(subtransactions=True) pattern we used everywhere before. See bug 1664643 for more details. neutron-lib-2.3.0/releasenotes/notes/add-base-upgrade-checks-class-f6da1d501663d8c5.yaml0000664000175000017500000000032113641427107030344 0ustar zuulzuul00000000000000--- other: - | Base class for upgrade checks used in checks in ``neutron-status upgrade check`` tool is now available in ``neutron_lib.utils.upgrade_checks`` and can be reused by other projects. neutron-lib-2.3.0/releasenotes/notes/placement-client-return-f4f22d244e7b174a.yaml0000664000175000017500000000054713641427107027467 0ustar zuulzuul00000000000000--- other: - | The ``create_resource_provider`` and ``associate_aggregates`` methods of ``PlacementAPIClient`` now return the parsed body of the respective responses. Since these methods returned ``None`` previously this is unlikely to break anything. On the other hand callers of these methods now have a chance to simplify their code. neutron-lib-2.3.0/releasenotes/notes/rehome-l3extgwmode-apidef-8f83e0f6cf0515e7.yaml0000664000175000017500000000021713641427107027702 0ustar zuulzuul00000000000000--- features: - The API definition for the ``ext-gw-mode`` extension is now available in ``neutron_lib.api.definitions.l3_ext_gw_mode``. neutron-lib-2.3.0/releasenotes/notes/rehome-ipalloc-apidef-dee59cfffd903b7a.yaml0000664000175000017500000000021213641427107027357 0ustar zuulzuul00000000000000--- features: - The ``ip_allocation`` extension's API definition is now available in ``neutron_lib.api.definitions.ip_allocation``. neutron-lib-2.3.0/releasenotes/notes/qos-rules-alias-ext-c13417dcb3d81130.yaml0000664000175000017500000000054613641427107026447 0ustar zuulzuul00000000000000--- features: - | The ``qos-rules-alias`` API extension is introduced to enable users to perform ``GET``, ``PUT`` and ``DELETE`` operations on ``bandwidth_limit_rules``, ``dscp_marking_rules`` and ``minimum_bandwidth_rules`` as though they are first level resources. In other words, the user will not have to specify the QoS policy ID. neutron-lib-2.3.0/releasenotes/notes/move-get-random-mac-98f47d81cb34483d.yaml0000664000175000017500000000025013641427107026415 0ustar zuulzuul00000000000000--- features: - The ``get_random_mac`` utility function from ``neutron.common.utils`` is now in ``neutron_lib.utils.net`` with the same name, ``get_random_mac``. neutron-lib-2.3.0/releasenotes/notes/rehome-pagination-apidef-9aebf1c7a6bcb58b.yaml0000664000175000017500000000021013641427107030047 0ustar zuulzuul00000000000000--- features: - The ``pagination`` API extension's API definition is now available in ``neutron_lib.api.definitions.pagination``. neutron-lib-2.3.0/releasenotes/notes/one-hacking-factory-01053e8e3d88c3d5.yaml0000664000175000017500000000034013641427107026471 0ustar zuulzuul00000000000000--- other: - The hacking check factory function ``neutron_lib.hacking.checks.incubating_factory`` has been removed. All consumers should use ``neutron_lib.hacking.checks.factory`` as per the ``usage`` dev-ref. neutron-lib-2.3.0/releasenotes/notes/add-is-default-to-network-d16a2e6bcfae943a.yaml0000664000175000017500000000037713641427107030037 0ustar zuulzuul00000000000000--- features: - | The ``project-default-networks`` extension is now available and adds a new attribute ``project_default`` into the ``network`` resource. This attribute will be used to indicate if a network is a project default network. neutron-lib-2.3.0/releasenotes/notes/rehome-runtime-utils-acb4451326cbe4d9.yaml0000664000175000017500000000042113641427107027070 0ustar zuulzuul00000000000000--- features: - The ``load_class_by_alias_or_classname`` function from ``neutron.common.utils`` is now available in ``neutron_lib.utils.runtime``. - The ``synchronized`` decorator from ``neutron.common.utils`` is now available in ``neutron_lib.utils.runtime``. neutron-lib-2.3.0/releasenotes/notes/placement-utils-a66e6b302d2bc8f0.yaml0000664000175000017500000000052013641427107026076 0ustar zuulzuul00000000000000--- features: - | neutron-lib now has a new module: ``neutron_lib.placement.utils``. This module contains logic that is to be shared between in-tree Neutron components and possibly out-of-tree Neutron agents that want to support features involving the Placement service (for example guaranteed minimum bandwidth). ././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000neutron-lib-2.3.0/releasenotes/notes/add-network-segment-range-overlap-exception-e8b4b2b425c51c80.yamlneutron-lib-2.3.0/releasenotes/notes/add-network-segment-range-overlap-exception-e8b4b2b425c51c80.ya0000664000175000017500000000020513641427107032772 0ustar zuulzuul00000000000000--- features: - | Add ``NetworkSegmentRangeOverlaps`` exception to prevent overlapping network segment ranges on creation. neutron-lib-2.3.0/releasenotes/notes/add-ip-hopopt-to-protocol-dictionary-3cbe54bb5056f790.yaml0000664000175000017500000000054613641427107032017 0ustar zuulzuul00000000000000--- other: - | ``IP`` and ``HOPOPT`` keywords were added to ``neutron_lib.constants.IP_PROTOCOL_MAP``. This allows the use of these keywords to be used when creating security group rules to describe either all IP protocols (for IPv4), or Hop-by-Hop Options (for IPv6), instead of having to use the number zero (0) for this purpose. neutron-lib-2.3.0/releasenotes/notes/agent-resources-synced-e70828841faf7acd.yaml0000664000175000017500000000032013641427107027376 0ustar zuulzuul00000000000000--- features: - | The ``agent-resources-synced`` extension introduces a new agent attribute named ``resources_synced`` that tracks the success of the resource view synchronization to Placement. neutron-lib-2.3.0/releasenotes/notes/stateful-security-group-a1ece5472f029dc1.yaml0000664000175000017500000000025013641427107027620 0ustar zuulzuul00000000000000--- features: - | The API defintion for the ``stateful-security-group`` extension is now available in ``neutron_lib.api.definitions.stateful_security_group``.neutron-lib-2.3.0/releasenotes/notes/introduce-logging-api-031d00eb84d5d061.yaml0000664000175000017500000000013413641427107027007 0ustar zuulzuul00000000000000--- features: - API definition for the logging extension for ``security_group`` resource. neutron-lib-2.3.0/releasenotes/notes/admin-state-down-before-update-c06fb3a551fe499f.yaml0000664000175000017500000000034413641427107030706 0ustar zuulzuul00000000000000--- features: - Router API is modified through a regime API extension to neutron-lib that enforces the admin state of a router be DOWN (admin_state_up=False) prior to modifying the distributed attribute of the router. neutron-lib-2.3.0/releasenotes/notes/add-description-field-in-port-forwarding-9da781b1e38ca858.yaml0000664000175000017500000000023513641427107032615 0ustar zuulzuul00000000000000--- features: - | Add a new field ``description`` in floating ip portforwardings that can be used to help users to manage/find easily theirs rules.neutron-lib-2.3.0/releasenotes/notes/Adds-PORT_FORWARDING_FLOATINGIP_KEY-ee2c7d164bea04b4.yaml0000664000175000017500000000011213641427107030447 0ustar zuulzuul00000000000000--- other: - | Add new ``PORT_FORWARDING_FLOATINGIP_KEY`` constant. neutron-lib-2.3.0/releasenotes/notes/rehome-autotopology-apidef-4a77e8ba0c783f7e.yaml0000664000175000017500000000024613641427107030267 0ustar zuulzuul00000000000000--- features: - The neutron ``auto-allocated-topology`` extension's API definition is now available as ``neutron_lib.api.definitions.auto_allocated_topology``. neutron-lib-2.3.0/releasenotes/notes/moved-netmtu-extension-5999348000adcfaf.yaml0000664000175000017500000000017613641427107027371 0ustar zuulzuul00000000000000--- features: - The ``net-mtu`` extension API definition has been added as ``neutron_lib.api.definitions.network_mtu``. neutron-lib-2.3.0/releasenotes/notes/l3-apidef-exceptions-ee57b9df1c7443d4.yaml0000664000175000017500000000020113641427107026730 0ustar zuulzuul00000000000000--- features: - The exception classes from ``neutron.extensions.l3`` have been rehomed into ``neutron_lib.exceptions.l3``. neutron-lib-2.3.0/releasenotes/notes/rehome-revisionifmatch-apidef-574ac0a930cdaf3f.yaml0000664000175000017500000000022013641427107030742 0ustar zuulzuul00000000000000--- features: - The ``revision-if-match`` extension's API definition is now available in ``neutron_lib.api.definitions.revisionifmatch``. neutron-lib-2.3.0/releasenotes/notes/remove-neutron-lib-from-db-profiling-38436898d8e45b37.yaml0000664000175000017500000000051213641427107031574 0ustar zuulzuul00000000000000--- other: - | Module ``neutron_lib.db`` is now removed from db profiling projects so database calls done from this module will not be tracked in osprofiler results. All db calls which are tracked by osprofiler are comming from Neutron and this avoids having each call logged twice in osprofiler report. neutron-lib-2.3.0/releasenotes/notes/ipv6_address_usage-ef3d65ad5aa5798b.yaml0000664000175000017500000000030413641427107026645 0ustar zuulzuul00000000000000--- features: - | A converter ``convert_ip_to_canonical_format`` has been added to neutron-lib which allows IPv6 addresses to be stored and displayed in canonical format.neutron-lib-2.3.0/releasenotes/notes/change_placement_client_method_names_b26bb71425f42db3.yaml0000664000175000017500000000154313641427107032334 0ustar zuulzuul00000000000000--- prelude: > Change create_inventory in placement client to update_resource_provider_inventories and update_inventory to update_resource_provider_inventory issues: - Placement API has no POST method for creating resource provider inventories but instead has PUT to update the inventories of a resource provider. - Placement API has method to update the inventory for a given resource_provider. fixes: - Change the method name create_inventory in clients/placement.py to update_resource_provider_inventories as that represents what is on the placement side. - Change the POST call to /resource_providers/{uuid}/inventories to PUT. - Change the method name update_inventory in clients/placement.py to update_resource_provider_inventory as that represents that the method updates the inventory of a resource_provider. neutron-lib-2.3.0/releasenotes/notes/remove-ensure_dir-aed59b616e02a2bb.yaml0000664000175000017500000000027013641427107026501 0ustar zuulzuul00000000000000--- upgrade: - The deprecated ``neutron_libutils.file.ensure_dir`` function is removed. Consumers can use ``ensure_tree(path, 0o755)`` from ``oslo_utils.fileutils`` instead. neutron-lib-2.3.0/releasenotes/notes/disable-port-number-zero-2fb484a802f099a7.yaml0000664000175000017500000000053413641427107027502 0ustar zuulzuul00000000000000--- fixes: - | Neutron API should not allow user to set zero for floating IP port forwarding internal or external port number. Directly modify the floating-ip-port-forwarding extension to change external_port and internal_port minimum value to 1. Then API and port forwarding object will make consistent for these attributes. neutron-lib-2.3.0/releasenotes/notes/ethertype_validator-2d608a46c237e214.yaml0000664000175000017500000000034113641427107026631 0ustar zuulzuul00000000000000--- features: - A new API validation type ``type:ethertype`` has been added and validates ethertypes either as a valid two byte octet or as 'IPv4' and 'IPv6' based on the sg_filter_ethertypes configuration setting. neutron-lib-2.3.0/releasenotes/notes/service-plugin-base-a42c2241a2fe0d26.yaml0000664000175000017500000000023113641427107026540 0ustar zuulzuul00000000000000--- features: - The class ``neutron.services.service_base.ServicePluginBase`` is now available as ``neutron_lib.services.base.ServicePluginBase``. neutron-lib-2.3.0/releasenotes/notes/mac-generator-f927df2fe57300c0.yaml0000664000175000017500000000061513641427107025452 0ustar zuulzuul00000000000000--- features: - | Introduced ``neutron_lib.utils.net.random_mac_generator(basemac)``. It allows you to get a mac address string Python generator from the same kind of basemac that ``neutron_lib.utils.net.get_random_mac(basemac)`` expects. If there are a lot of macs to get, this will speed the process up significantly over generating single macs and testing for collisions. neutron-lib-2.3.0/releasenotes/notes/subnet_segment_id_policy_enforce-cd8053c51417d373.yaml0000664000175000017500000000035613641427107031342 0ustar zuulzuul00000000000000--- fixes: - | Change API to enforce policy rules for subnet entities with specified segment_ids, to fix a broken implementation of that policy enforcement. Bug: `1784259 `_ ././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000neutron-lib-2.3.0/releasenotes/notes/subnet-onboard-allow-create-update-subnets-74a4be6e9e97bbb6.yamlneutron-lib-2.3.0/releasenotes/notes/subnet-onboard-allow-create-update-subnets-74a4be6e9e97bbb6.yam0000664000175000017500000000014713641427107033165 0ustar zuulzuul00000000000000--- features: - The ``subnet_onboard`` API definition now supports creating and updating subnets neutron-lib-2.3.0/releasenotes/notes/bgpvpn_rt_fix-6d02db6a1c22f002.yaml0000664000175000017500000000025013641427107025540 0ustar zuulzuul00000000000000--- fixes: - | Fixes BGPVPN Interconnection API to not allow the definition of an empty string Route Target (allowing it was simply wrong and unintentional). neutron-lib-2.3.0/releasenotes/notes/rehome-common-exceptions-eda074ddb02349ab.yaml0000664000175000017500000000045013641427107027772 0ustar zuulzuul00000000000000--- features: - The following exceptions from ``neutron.common.exceptions`` have been rehomed into neutron-lib; ``PortBindingAlreadyActive``, ``PortBindingAlreadyExists``, ``PortBindingError``, ``ProcessExecutionError``, ``RouterQosBindingNotFound``, ``RouterQosBindingError``. neutron-lib-2.3.0/releasenotes/notes/add-validator-pkg-a6565a2d4fbfa1d8.yaml0000664000175000017500000000043713641427107026357 0ustar zuulzuul00000000000000--- features: - A new ``neutron_lib.validators`` package is now available where the existing definitions from the ``validators`` module are now in ``neutron_lib.validators.__init__`` and subsequent per-component validators can be created in their own validators sub-module.neutron-lib-2.3.0/releasenotes/notes/drop-python-2-7-f46dfa10169f70db.yaml0000664000175000017500000000021213641427107025563 0ustar zuulzuul00000000000000--- upgrade: - | Python 2.7 support has been dropped. The minimum version of Python now supported by neutron-lib is Python 3.6. neutron-lib-2.3.0/releasenotes/notes/add-ip-substring-filtering-extension-06bb0c1f738ee330.yaml0000664000175000017500000000023413641427107032057 0ustar zuulzuul00000000000000--- features: - | Add ``ip-substring-filtering`` API extension. This extension provides the ability to filter ports with an IP address substring. neutron-lib-2.3.0/releasenotes/notes/rehome-modelquery-2079a43163def870.yaml0000664000175000017500000000013513641427107026227 0ustar zuulzuul00000000000000--- features: - The ``model_query`` function is now available in ``neutron_lib.db.utils``. neutron-lib-2.3.0/releasenotes/notes/rehome-psec-apidef-bd9344ec1e6066b4.yaml0000664000175000017500000000037513641427107026365 0ustar zuulzuul00000000000000--- features: - The ``port security`` extension API definition has been rehomed from ``neutron`` to ``neutron_lib.api.definitions.port_security``. The related exceptions can be found in the ``neutron_lib.exceptions.port_security`` module. neutron-lib-2.3.0/releasenotes/notes/core-attributes-43e6969f1b187e5c.yaml0000664000175000017500000000154013641427107025777 0ustar zuulzuul00000000000000--- features: - A bulk of the ``neutron.api.v2.attributes`` functionality is now available in ``neutron_lib.api.attributes``. A new ``AttributeInfo`` class is available in that acts as a wrapper for an API resource's attribute dict and allows consumers to perform operations with the underlying attribute dict. The ``populate_project_info`` function is now available. The global attribute map ``RESOURCES`` is now available and will take the place of neutron's global ``RESOURCE_ATTRIBUTE_MAP``. - The ``neutron_lib.fixture.APIDefinitionFixture`` has been updated to handle backing-up and restoring the global ``RESOURCES`` dict. By default the constructor now also uses all API definitions if none are passed to it's constructor. This is the default behavior almost all consumers need and is thus a convenience change. neutron-lib-2.3.0/releasenotes/notes/rehome-qos-driverbase-f729875b2ad74ce0.yaml0000664000175000017500000000043613641427107027141 0ustar zuulzuul00000000000000--- features: - The ``DriverBase`` class from ``neutron.services.qos.drivers.base`` is now available in the ``neutron_lib.services.qos.base`` module. - The constants defined in ``neutron.services.qos.qos_consts`` are now available in ``neutron_lib.services.qos.constants``. neutron-lib-2.3.0/releasenotes/notes/rehome-netipavail-apidef-d03558ac48b71333.yaml0000664000175000017500000000023613641427107027417 0ustar zuulzuul00000000000000--- features: - The ``network-ip-availability`` extension's API definition is now available in ``neutron_lib.api.definitions.network_ip_availability``. ././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000neutron-lib-2.3.0/releasenotes/notes/add-two-fields-to-duplicated-entry-exception-75b0e07c6e1cc6ae.yamlneutron-lib-2.3.0/releasenotes/notes/add-two-fields-to-duplicated-entry-exception-75b0e07c6e1cc6ae.y0000664000175000017500000000027213641427107033057 0ustar zuulzuul00000000000000--- other: - | Add two fields ``columns`` and ``value`` to exception ``NeutronDbObjectDuplicateEntry``. These two fields are populated from the corresponding db exception. neutron-lib-2.3.0/releasenotes/notes/trunk-api-08bfdcdd80f7e666.yaml0000664000175000017500000000007113641427107025006 0ustar zuulzuul00000000000000--- features: - API reference for the trunk extension. neutron-lib-2.3.0/releasenotes/notes/qos-bw-minimum-ingress-cff397e598b6fa3a.yaml0000664000175000017500000000025013641427107027431 0ustar zuulzuul00000000000000--- features: - New extension ``qos-bw-minimum-ingress`` for extending ``qos_minimum_bandwidth_rule`` with ingress direction for placement based enforcement. neutron-lib-2.3.0/releasenotes/notes/add-port-binding-resource-73f9800dbda121ca.yaml0000664000175000017500000000046213641427107027740 0ustar zuulzuul00000000000000--- features: - A new ``PORT_BINDING`` resource definition has been added to ``neutron_lib.callbacks.resources``, to enable the multiple port binding service plugin to notify the core plugin and other subscribers when create, update and delete operations are performed on a port binding. neutron-lib-2.3.0/releasenotes/notes/rehome-l2adjacency-apidef-f91bf184d90122c8.yaml0000664000175000017500000000021013641427107027520 0ustar zuulzuul00000000000000--- features: - The ``l2_adjacency`` extension's API definition is now available in ``neutron_lib.api.definitions.l2_adjacency``. neutron-lib-2.3.0/releasenotes/notes/placement-client-update-ensure-rp-9e5c3cf34d49b212.yaml0000664000175000017500000000020613641427107031344 0ustar zuulzuul00000000000000--- features: - | New methods available in Placement client: ``update_resource_provider`` and ``ensure_resource_provider``. neutron-lib-2.3.0/releasenotes/notes/network-segment-range-ext-2b93b7fa42310c25.yaml0000664000175000017500000000013413641427107027646 0ustar zuulzuul00000000000000--- features: - | Add API definition for the new ``network-segment-range`` extension. neutron-lib-2.3.0/releasenotes/notes/logging-resource-api-cecf33e3be468eb2.yaml0000664000175000017500000000015013641427107027162 0ustar zuulzuul00000000000000--- features: - API reference and definition for networking-midonet's ``logging-resource`` extension. neutron-lib-2.3.0/releasenotes/notes/rehome-subnetservicetypes-apidef-31e2e9564c746317.yaml0000664000175000017500000000053513641427107031166 0ustar zuulzuul00000000000000--- features: - The ``subnet-service-types`` extension is now available in ``neutron_lib.api.definitions.subnet_service_types``. - The ``InvalidSubnetServiceType`` and ``InvalidInputSubnetServiceType`` exceptions are now available in ``neutron_lib.exceptions``. - The validation type ``list_of_subnet_service_types`` is now available. neutron-lib-2.3.0/releasenotes/notes/rehome-obj-commontypes-f8dfca432bf4583b.yaml0000664000175000017500000000054513641427107027474 0ustar zuulzuul00000000000000--- features: - The ``neutron.objects.common_types`` module is now available in ``neutron_lib.objects.common_types``. - The ``get_random_EUI`` and ``get_random_ip_network`` functions are now available in ``neutron_lib.tests.tools``. - The ``AuthenticIPNetwork`` and ``AuthenticEUI`` classes are now available in ``neutron_lib.utils.net``. neutron-lib-2.3.0/releasenotes/notes/new-vif-details-parameters-71e70ab5e7c26c45.yaml0000664000175000017500000000044413641427107030063 0ustar zuulzuul00000000000000--- features: - | Added two new parameters in ``portbindings.port.vif_details``: * ``connectivity``: a string informing about the back-end connectivity level (l2, l3 or not specified). * ``bound_drivers``: a dictionary mapping the binding level to the driver name. neutron-lib-2.3.0/releasenotes/notes/rehome-common-constants-52f39a79e8eabd7e.yaml0000664000175000017500000000035313641427107027662 0ustar zuulzuul00000000000000--- features: - The remaining ``neutron.common.constants`` are now available in ``neutron_lib.constants`` with the exception of ``EXT_PARENT_RESOURCE_MAPPING`` that is now available in ``neutron_lib.services.constants``. neutron-lib-2.3.0/releasenotes/notes/rehome-port-dev-util-ea6f4a5c4da42f6c.yaml0000664000175000017500000000017713641427107027135 0ustar zuulzuul00000000000000--- features: - The ``neutron.common.utils`` function ``is_port_trusted`` is now available in ``neutron_lib.utils.net``. neutron-lib-2.3.0/releasenotes/notes/add-vif-type-agilio-ovs-6bee5b2557aca10e.yaml0000664000175000017500000000027413641427107027415 0ustar zuulzuul00000000000000--- features: - A VIF type for Agilio OVS (``VIF_TYPE_AGILIO_OVS``) has been added to portbindings. This links the external Neutron plugin to the external OS-VIF plugin in Nova. neutron-lib-2.3.0/releasenotes/notes/rehome-getphysmtu-plugin-fn-5875e352e3a14af3.yaml0000664000175000017500000000024513641427107030227 0ustar zuulzuul00000000000000--- features: - The ``neutron.plugins.common.utils.get_deployment_physnet_mtu`` function is now available in ``neutron_lib.plugins.utils`` with the same name. neutron-lib-2.3.0/releasenotes/notes/fix-warnfixture-c9457c50d0d5c5a7.yaml0000664000175000017500000000025013641427107026063 0ustar zuulzuul00000000000000--- features: - The ``WarningsFixture`` is now available in ``neutron_lib.fixture`` and its constructor accepts additional module's to use with filterwarnings. neutron-lib-2.3.0/releasenotes/notes/rehome-obj-stdattrs-06c4df5bb1fca3f1.yaml0000664000175000017500000000023613641427107027026 0ustar zuulzuul00000000000000--- features: - The ``neutron.objects.extensions.standardattributes`` module is now available as ``neutron_lib.objects.extensions.standardattributes``. ././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000neutron-lib-2.3.0/releasenotes/notes/subresource-update-attrmap-and-classmethods-76accdd5c56a3bd4.yamlneutron-lib-2.3.0/releasenotes/notes/subresource-update-attrmap-and-classmethods-76accdd5c56a3bd4.ya0000664000175000017500000000103313641427107033322 0ustar zuulzuul00000000000000--- features: - All methods defined in ``APIExtensionDescriptor`` are now class methods. This allows consumers to call them without a reference to an actual extension object instance. fixes: - The ``get_extended_resources`` method of the ``APIExtensionDescriptor`` was updated to also include the underlying API definition's ``SUB_RESOURCE_ATTRIBUTE_MAP`` in the returned dict. As a result, the ``update_attributes_map`` method now also includes the sub-resources if no ``extension_attrs_map`` is passed to it. neutron-lib-2.3.0/releasenotes/notes/rehome-address-scope-apidef-f4e8bb74be61729a.yaml0000664000175000017500000000022213641427107030245 0ustar zuulzuul00000000000000--- features: - The neutron ``address-scope`` extension's API definition is now available as ``neutron_lib.api.definitions.address_scope``. neutron-lib-2.3.0/releasenotes/notes/rehome-db-api-event-listeners-2fb5256166e2a4e8.yaml0000664000175000017500000000030113641427107030375 0ustar zuulzuul00000000000000--- features: - The private ORM event listener functions from ``neutron.db.api`` are now in ``neutron_lib.db.api`` and are automatically loaded when importing any neutron-lib module. neutron-lib-2.3.0/releasenotes/notes/floatingip-portforwarding-17c284080541bc78.yaml0000664000175000017500000000030313641427107027677 0ustar zuulzuul00000000000000--- features: - | The ``portforwarding`` API definition for ``FloatingIP``is introduced, which allows a ``FloatingIP:Port`` to forward packets back to a VM's ``Internal IP:Port`` . ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000neutron-lib-2.3.0/releasenotes/notes/remove-neutron-interconnection-api-definition-4ff88c583f2fe47b.yamlneutron-lib-2.3.0/releasenotes/notes/remove-neutron-interconnection-api-definition-4ff88c583f2fe47b.0000664000175000017500000000050713641427107033226 0ustar zuulzuul00000000000000--- other: - | Removes the definition of ``interconnection`` API extension for neutron-interconnection project. Neutron-interconnection project was removed from Neutron stadium due to lack of activity for long time so there is no need to keep the API definition in the official Neutron's API definitions. neutron-lib-2.3.0/releasenotes/notes/placement-binding-exceptions-6362d52391b7023e.yaml0000664000175000017500000000020313641427107030231 0ustar zuulzuul00000000000000--- features: - | New exception classes: ``UnknownResourceProvider`` and ``AmbiguousResponsibilityForResourceProvider``. neutron-lib-2.3.0/releasenotes/notes/add-extension-supported-be6f7069856d2891.yaml0000664000175000017500000000031113641427107027367 0ustar zuulzuul00000000000000--- features: - | Rehome the validation for checking if an extension is supported by the plugin. The method ``is_extension_supported`` will now be part of ``neutron_lib.api.extensions``. neutron-lib-2.3.0/releasenotes/notes/rehome-dftsnetpool-apidef-4de5d75d2a63dec9.yaml0000664000175000017500000000024013641427107030132 0ustar zuulzuul00000000000000--- features: - The API definition for neutron extension ``default-subnetpools`` is now available in ``neutron_lib.api.definitions.default_subnetpools``. neutron-lib-2.3.0/releasenotes/notes/bgpvpn-routes-control-51cd95d6ab265cb1.yaml0000664000175000017500000000053713641427107027274 0ustar zuulzuul00000000000000--- features: - | The ``bgpvpn-routes-control`` API extension is introduced to enrich the base ``bgpvpn`` extension. It allows to control BGPVPN connectivity at the granularity of a port and the advertisement into a BGPVPN of routes corresponding to destination reachable via a given port (static routes, BGPVPN route leaking). neutron-lib-2.3.0/releasenotes/notes/rehome-sqlalchemytypes-14817eb6694463db.yaml0000664000175000017500000000025413641427107027300 0ustar zuulzuul00000000000000--- features: - The ``neutron_lib.tests._tools`` module is now public and named ``tools``. - The ``sqlalchemytypes`` module is now available in ``neutron_lib.db``. neutron-lib-2.3.0/releasenotes/notes/add-rbac-security-groups-2e47acd9eac3a320.yaml0000664000175000017500000000025113641427107027665 0ustar zuulzuul00000000000000features: - | Adds API definition for ``rbac-security-groups`` extension, which allows sharing security groups between tenants via the network RBAC mechanism. neutron-lib-2.3.0/releasenotes/notes/new-policy-module-f5638e23fe91a287.yaml0000664000175000017500000000070213641427107026230 0ustar zuulzuul00000000000000--- other: - | New module ``neutron_lib.policy`` was added. It contains constants: ``RULE_ADMIN_OR_OWNER``, ``RULE_ADMIN_ONLY``, ``RULE_ANY``, ``RULE_ADVSVC``, ``RULE_ADMIN_OR_NET_OWNER``, ``RULE_ADMIN_OR_NET_OWNER_OR_ADVSVC`` and ``RULE_ADMIN_OR_PARENT_OWNER``. It contains also helper functions ``policy_and`` and ``policy_or``. Those constants and functions can be used in policy modules in Neutron related projects. neutron-lib-2.3.0/releasenotes/notes/extraroute-atomic-apidef-80a7c6d4a773c701.yaml0000664000175000017500000000010313641427107027535 0ustar zuulzuul00000000000000--- features: - | New API definition: ``extraroute-atomic``. neutron-lib-2.3.0/releasenotes/notes/support-custom-filter-f4a15bb5b38b7d3e.yaml0000664000175000017500000000060213641427107027364 0ustar zuulzuul00000000000000--- prelude: > This release adds support for custom filtering in versioned object. features: - | A class called ``FilterObj`` is introduced. This is the base class from which the custom filter class should inherit. This release also implements two filter class: ``NotIn`` and ``NotEqual``. The class ``StringMatchingFilterObj`` is now a subclass of ``FilterObj``. neutron-lib-2.3.0/releasenotes/notes/rehome-qosrtdetails-apidef-2276ec66a0e545ca.yaml0000664000175000017500000000023213641427107030136 0ustar zuulzuul00000000000000--- features: - The ``qos-rule-type-details`` extension's API definition is now available in ``neutron_lib.api.definitions.qos_rule_type_details``. neutron-lib-2.3.0/releasenotes/notes/separate-hacking-factories-6fc36b38de95662a.yaml0000664000175000017500000000037013641427107030121 0ustar zuulzuul00000000000000--- features: - The hacking check factory ``incubating_factory`` has been added to ``neutron_lib.hacking.checks`` allowing adopters to test compliance on incubating hacking checks. See the usage documentation for additional details. neutron-lib-2.3.0/releasenotes/notes/rehome-dvr-apidef-a6aa415152457c9a.yaml0000664000175000017500000000054313641427107026133 0ustar zuulzuul00000000000000--- features: - The API definition for the ``dvr`` extension is now available in ``neutron_lib.api.defintions.dvr``. - The two ``MacAddressGenerationFailure`` exceptions are now available as ``HostMacAddressGenerationFailure`` and ``NetworkMacAddressGenerationFailure`` for host and network MAC address generation errors respectively. neutron-lib-2.3.0/releasenotes/notes/oslo-db-jitter-c4d13cc81755203e.yaml0000664000175000017500000000030513641427107025470 0ustar zuulzuul00000000000000--- fixes: - The oslo.db wrap_db_retry function now supports randomized time jitter in its retry algorithm. Add support for that feature, if the installed version of oslo.db supports it. neutron-lib-2.3.0/releasenotes/notes/add-validate-cidr-848c9171dcbcf57c.yaml0000664000175000017500000000042213641427107026251 0ustar zuulzuul00000000000000--- features: - | A new function named ``validate_route_cidr`` was introduced which is used to validate if ``destination`` of ``routes`` and ``destination`` of ``host_routes`` is a network address of a destination subnet or an IP address of a destination. neutron-lib-2.3.0/releasenotes/notes/rehome-get-updatable-fields-82fd87d402d63ca2.yaml0000664000175000017500000000021413641427107030157 0ustar zuulzuul00000000000000--- features: - The ``get_updatable_fields`` function from ``neutron.objects.base`` is now available in ``neutron_lib.object.utils``. neutron-lib-2.3.0/releasenotes/notes/rehome-core-api-defs-390735ff3bd5d2ab.yaml0000664000175000017500000000022513641427107026673 0ustar zuulzuul00000000000000--- features: - The ``network``, ``port``, ``subnet`` and ``subnetpool`` API definitions are now available in ``neutron_lib.api.definitions``. neutron-lib-2.3.0/releasenotes/notes/deprecate-api-utils-4f86288591c95679.yaml0000664000175000017500000000032713641427107026326 0ustar zuulzuul00000000000000--- deprecations: - The function ``neutron_lib.api.utils.populate_project_info`` has moved to ``neutron_lib.api.attributes.populate_project_info``. It will be removed from the old location in the future. neutron-lib-2.3.0/releasenotes/notes/port-mac-address-regenerate-cc33d03216b5bc3d.yaml0000664000175000017500000000064613641427107030254 0ustar zuulzuul00000000000000--- features: - | Adds api extension ``port-mac-address-regenerate``. Also adds converter ``convert_to_mac_if_none`` used by api extenstion ``port-mac-address-regenerate``. When passing ``'null'`` (``None``) as the ``mac_address`` on port update the converter will generate a new mac address that will be assigned to the port. `RFE: #1768690 `_. neutron-lib-2.3.0/releasenotes/notes/provider-net-apidef-9ebe9f56840c79f7.yaml0000664000175000017500000000022013641427107026614 0ustar zuulzuul00000000000000--- features: - The Neutron ``Provider network`` extension API definition has been added as ``neutron_lib.api.definitions.provider_net``. neutron-lib-2.3.0/releasenotes/notes/add-directory-is-loaded-e9da5b65824dddad.yaml0000664000175000017500000000024413641427107027540 0ustar zuulzuul00000000000000--- features: - | Introduced neutron_lib.plugins.directory.is_loaded(). This can be used in lieu of len(plugins()) or bool(plugins()) or plugins() alone. neutron-lib-2.3.0/releasenotes/notes/rehome-db-utils-3076bf724caa31ef.yaml0000664000175000017500000000032313641427107025772 0ustar zuulzuul00000000000000--- features: - The database utility functions ``get_marker_obj``, ``filter_non_model_columns``, ``model_query_scope_is_project`` and ``resource_fields`` are now available in ``neutron_lib.db.utils``. neutron-lib-2.3.0/releasenotes/notes/rehome-topics-ca451e72c8c9603a.yaml0000664000175000017500000000024113641427107025473 0ustar zuulzuul00000000000000--- features: - The public constants and ``get_topic_name`` function from ``neutron.common.topics`` are now available in ``neutron_lib.agent.topics``. neutron-lib-2.3.0/releasenotes/notes/update-hacking-check-n536-2f63898bea693125.yaml0000664000175000017500000000027513641427107027233 0ustar zuulzuul00000000000000--- fixes: - Update hacking check ``N536``. Current implementation recognizes ``self.assertEqual((None, None), A)`` as invalid incorrectly while ``(None, None)`` is not ``None``. neutron-lib-2.3.0/releasenotes/notes/add-can-port-be-bound-to-virtual-bridge-5d6db8785e58fcb9.yaml0000664000175000017500000000032513641427107032332 0ustar zuulzuul00000000000000--- features: - | Add ``can_port_be_bound_to_virtual_bridge`` function in ``neutron_lib.plugins.utils``. This function checks if a port, depending on the VNIC type, can be bound to a virtual bridge. neutron-lib-2.3.0/releasenotes/notes/rehome-ml2-api-extaliases-4db48e113893c7a5.yaml0000664000175000017500000000025613641427107027530 0ustar zuulzuul00000000000000--- features: - The ``ExtensionDriver`` class in ``neutron_lib.plugins.ml2.api`` now contains the ``extension_aliases`` property to match neutron's implementation. neutron-lib-2.3.0/releasenotes/notes/rehome-allowedaddrpairs-apidef-cd342b9a57a2dfdf.yaml0000664000175000017500000000055113641427107031167 0ustar zuulzuul00000000000000--- features: - The ``allowed-address-pairs`` API definition is now available in ``neutron_lib.api.definitions.allowedaddresspairs``. - The address pair validation is now available via the ``type:allowed_address_pairs`` validation type. - Address pair API definition exceptions are available in ``neutron_lib.exceptions.allowedaddresspairs``. neutron-lib-2.3.0/releasenotes/notes/add-exception-pkg-5a14389891abf358.yaml0000664000175000017500000000044013641427107026076 0ustar zuulzuul00000000000000--- features: - A new ``neutron_lib.exceptions`` package is now available where the existing definitions from the ``exceptions`` module are now in ``neutron_lib.exceptions.__init__`` and subsequent per-component exceptions can be created in their own exceptions sub-module. neutron-lib-2.3.0/releasenotes/notes/extra-dhcp-opt-public-vars-ec4e1c2dcac43d69.yaml0000664000175000017500000000030313641427107030217 0ustar zuulzuul00000000000000--- features: - The constants ``VALID_BLANK_EXTRA_DHCP_OPTS`` and ``DHCP_OPT_VALUE_MAX_LEN`` are now public in the ``neutron_lib.api.definitions.extra_dhcp_opt`` API definition module. neutron-lib-2.3.0/releasenotes/notes/rehome-az-apidef-1e63cbd2359994fa.yaml0000664000175000017500000000074613641427107026057 0ustar zuulzuul00000000000000--- features: - The ``availability_zone`` extension's API definition is now available in ``neutron_lib.api.definitions.availability_zone``. - A new API validation type ``type:availability_zone_hint_list`` has been added and validates a list of availability zone hints. - Exceptions for the ``availability_zone`` are now available in ``neutron_lib.exceptions.availability_zone``. - The constant ``AZ_HINTS_DB_LEN`` has been added to ``neutron_lib.db.constants``. neutron-lib-2.3.0/releasenotes/notes/conntrack-helper-parent-resource-mapping-95a4a2cb6f6536fe.yaml0000664000175000017500000000026313641427107033016 0ustar zuulzuul00000000000000--- other: - | Parent resource mapping was added to ``EXT_PARENT_RESOURCE_MAPPING`` in ``neutron_lib.services.constants`` for the ``l3-conntrack-helper`` extension. neutron-lib-2.3.0/releasenotes/notes/vnic-type-smart-nic-45dd5a22a9d1aa63.yaml0000664000175000017500000000011113641427107026572 0ustar zuulzuul00000000000000--- features: - | Add ``smart-nic`` VNIC type for Smart NIC ports. neutron-lib-2.3.0/releasenotes/notes/introduce_subnetpool_prefix_ops_extension-e37874c936d2554c.yaml0000664000175000017500000000035213641427107033401 0ustar zuulzuul00000000000000--- features: - Adds ``subnetpool-prefix-ops`` API definition to neutron-lib. This extension introduces API's that provide explicit support for removing prefixes from a subnet pool and adding subnets to a subnet pool. neutron-lib-2.3.0/releasenotes/notes/plugin-directory-55861f4098813ba6.yaml0000664000175000017500000000066213641427107026020 0ustar zuulzuul00000000000000--- features: - | Introduced neutron_lib.plugins.directory to get references for loaded plugins in a neutron server process. For example: .. code-block:: python from neutron_lib import constants from neutron_lib.plugins import directory core_plugin = directory.get_plugin() l3_plugin = directory.get_plugin(constants.L3) For more examples, see: https://review.opendev.org/#/c/386845/ ././@LongLink0000000000000000000000000000015300000000000011214 Lustar 00000000000000neutron-lib-2.3.0/releasenotes/notes/add-support-for-fetching-specific-column-in-OVO-81b764b203849776.yamlneutron-lib-2.3.0/releasenotes/notes/add-support-for-fetching-specific-column-in-OVO-81b764b203849770000664000175000017500000000053113641427107032345 0ustar zuulzuul00000000000000--- features: - | Add method ``get_values`` in ``neutron_lib.db.model_query``. This method allow callers to fetch specific column from a database model. Add keyword parameter ``field`` to method ``query_with_hooks``. The default value of this parameter is None. Callers can set this parameter to query specific column. neutron-lib-2.3.0/releasenotes/notes/l3-conntrack-helper-validator-654ccafb296e5f21.yaml0000664000175000017500000000041313641427107030541 0ustar zuulzuul00000000000000--- fixes: - | Fixes an issue in the ``l3-conntrack-helper`` API definition. The validation for the ``helper`` field passed a string validation method instead of the maximum length of the string. This caused a TypeError when running under python3. neutron-lib-2.3.0/releasenotes/notes/context-public-6df198b77027c224.yaml0000664000175000017500000000040413641427107025527 0ustar zuulzuul00000000000000--- features: - | The ``context`` module has been made public. For example: .. code-block:: python from neutron_lib import context ctx = context.get_admin_context() For more examples, see: https://review.opendev.org/#/c/388157/ neutron-lib-2.3.0/releasenotes/notes/enable-hacking-check-H904-f512ecc98c0a4033.yaml0000664000175000017500000000034113641427107027236 0ustar zuulzuul00000000000000--- other: - OpenStack dev hacking check ``H904`` is now enabled in ``tox.ini`` via the ``enable-extensions`` configuration property. Neutron-lib adopters should also enable this hacking check in their ``tox.ini``. neutron-lib-2.3.0/releasenotes/notes/resource-provider-uuid5-namespace-f7276ba1945ce82f.yaml0000664000175000017500000000125013641427107031375 0ustar zuulzuul00000000000000--- features: - | New MechanismDriver API class property: ``resource_provider_uuid5_namespace``. Mechanism drivers wanting to support resource provider information reporting to Placement (eg. reporting resource providers to guarantee some minimum bandwidth allocated on them later) must set this class property to a UUID object unique to that mechanism driver. It will be used as a UUID v5 namespace in generating UUIDs for resource providers. The default implementation sets it to ``None``, meaning that the mechanism driver does not support resource provider information reporting to Placement. Unaffected drivers need not be changed. neutron-lib-2.3.0/releasenotes/notes/update-subnet-onboard-api-267a9a37f6426d64.yaml0000664000175000017500000000056713641427107027556 0ustar zuulzuul00000000000000--- other: - | This change removes the ``ONBOARD_SUBNETS_SPECS`` attribute extension from the subnet onboard extension descriptor. This has been deemed to be an unnecessary attribute extension during implementation and has been removed. Because subnet onboard is not yet a completed Neutron feature, the API definition is being updated to reflect this. ././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000neutron-lib-2.3.0/releasenotes/notes/placement-NoAuthClient-for-fullstack-tests-17b4ab512417d638.yamlneutron-lib-2.3.0/releasenotes/notes/placement-NoAuthClient-for-fullstack-tests-17b4ab512417d638.yam0000664000175000017500000000020613641427107032614 0ustar zuulzuul00000000000000--- other: - | Add ``NoAuthClient`` for placement.client to enable fullstack testing of placement reporting service plugin. neutron-lib-2.3.0/releasenotes/notes/agent_extensions-2b497ff33c6dc3e8.yaml0000664000175000017500000000016513641427107026374 0ustar zuulzuul00000000000000--- features: - Neutron agent extension abstract classes are moved from ``neutron.agent`` to ``neutron_lib.agent`` neutron-lib-2.3.0/releasenotes/notes/router-interface-fip-1e79b7909f8b264f.yaml0000664000175000017500000000015413641427107026720 0ustar zuulzuul00000000000000--- features: - API reference and definition for networking-midonet's ``router-interface-fip`` extension. neutron-lib-2.3.0/releasenotes/notes/floatingip-autodelete-internal-dep-8e544fad694d1275.yaml0000664000175000017500000000021513641427107031521 0ustar zuulzuul00000000000000--- other: - | For technical reasons the ``floatingip-autodelete-internal`` extension no longer requires the ``router`` extension. neutron-lib-2.3.0/releasenotes/notes/rehome-common-rpc-5d84a9fe0faa71b7.yaml0000664000175000017500000000142113641427107026413 0ustar zuulzuul00000000000000--- features: - The ``neutron.common.rpc`` module is now available as ``neutron_lib.rpc`` and automatically exposes all exception modules from ``neutron_lib.exceptions`` for RPC usage. - Exceptions from ``neutron.common.exceptions`` are now available in the ``neutron_lib.exceptions`` package whereupon exceptions are now in their respective module (e.g. L3 exceptions are in ``neutron_lib.exceptions.l3``, etc.). - The ``neutron.tests.fake_notifier`` is now available as ``neutron_lib.tests.unit.fake_notifier``. - The ``neutron_lib.utils.runtime.list_package_modules`` function is now available for listing all modules in a said package. - The ``RPCFixture`` is now available in ``neutron_lib.fixtures`` for setting up RPC based unit tests. neutron-lib-2.3.0/releasenotes/notes/rehome-trunk-callback-resources-be40f8382490ef0d.yaml0000664000175000017500000000027513641427107031113 0ustar zuulzuul00000000000000--- features: - The ``SUBPORTS``, ``TRUNK`` and ``TRUNK_PLUGIN`` constants are now available in ``neutron_lib.callbacks.resources`` for defining Trunk related callback resources. neutron-lib-2.3.0/releasenotes/notes/.placeholder0000664000175000017500000000000013641427107022073 0ustar zuulzuul00000000000000neutron-lib-2.3.0/releasenotes/notes/fip64-0c6bb38417d602f1.yaml0000664000175000017500000000013513641427107023561 0ustar zuulzuul00000000000000--- features: - API reference and definition for networking-midonet's ``fip64`` extension. neutron-lib-2.3.0/releasenotes/notes/migrate-public-to-shared-0c67b32f9c37c751.yaml0000664000175000017500000000030013641427107027427 0ustar zuulzuul00000000000000--- upgrade: - | FWaaS has renamed the ``public`` attribute to ``shared`` to be in-sync with Openstack nomenclature based on the functionality the ``shared`` attribute provides. neutron-lib-2.3.0/releasenotes/notes/qos-rules-alias-ext-fix-3f3f7dd21837cfec.yaml0000664000175000017500000000103513641427107027474 0ustar zuulzuul00000000000000--- fixes: - | The ``qos-rules-alias`` API extension wrongly attempted to re-define ``bandwidth_limit_rules``, ``dscp_marking_rules`` and ``minimum_bandwidth_rules`` as first level API resources, leading to conflicts in the QoS API. We now define ``alias_bandwidth_limit_rules``, ``alias_dscp_marking_rules`` and ``alias_minimum_bandwidth_rules`` that will enable users to perform ``GET``, ``PUT`` and ``DELETE`` operations on the corresponding QoS rules without having to specify the associated policy ID. neutron-lib-2.3.0/releasenotes/notes/rehome-trunk-consts-407e4590e9386d19.yaml0000664000175000017500000000025613641427107026454 0ustar zuulzuul00000000000000--- features: - The trunk service constants are now available in ``neutron_lib.services.trunk.constants``, but now have the constant name prefixed with ``TRUNK_``. neutron-lib-2.3.0/releasenotes/notes/rehome-multiprovidernet-apidef-367e57772e931758.yaml0000664000175000017500000000054313641427107030573 0ustar zuulzuul00000000000000--- features: - The ``multi-provider`` extension's API definition is available in ``neutron_lib.api.defintions.multiprovidernet``. - Exceptions for the ``multi-provider`` extension can be found in ``neutron_lib.exceptions.multiprovidernet``. - The validation type ``type:network_segments`` is now available for API attribute validation. neutron-lib-2.3.0/releasenotes/notes/rehome-unstable-test-decorator-a062301ac7d7a082.yaml0000664000175000017500000000022113641427107030643 0ustar zuulzuul00000000000000--- features: - The ``unstable_test`` decorator from ``neutron.tests.base`` is now available in neutron-lib in ``neutron_lib.utils.test``. neutron-lib-2.3.0/releasenotes/notes/rehome-dvr-related-leftover-constants-2cf329794166b3f2.yaml0000664000175000017500000000033613641427107032120 0ustar zuulzuul00000000000000--- features: - Moving the leftover DVR related constants from ``neutron.common.constants``. The constants ``L3_AGENT_MODE_DVR_NO_EXTERNAL`` and ``DVR_SNAT_BOUND`` are now available in ``neutron_lib.constants``. neutron-lib-2.3.0/releasenotes/notes/placement-constants-f2629b98f6fe148f.yaml0000664000175000017500000000014113641427107026727 0ustar zuulzuul00000000000000--- features: - | New constants module for Placement: ``neutron_lib.placement.constants``. neutron-lib-2.3.0/releasenotes/notes/add-action-status-3dbfe2490a0d231a.yaml0000664000175000017500000000017513641427107026311 0ustar zuulzuul00000000000000--- features: - The ``ACTION_STATUS`` is added to API definitions for neutron extension has specific ``action_status``.neutron-lib-2.3.0/releasenotes/notes/remove-hacking-check-n523-014d163a5ae23adb.yaml0000664000175000017500000000016613641427107027420 0ustar zuulzuul00000000000000--- other: - The deprecated ``N523`` hacking check that ensures proper oslo namespace imports has been removed. neutron-lib-2.3.0/releasenotes/notes/advsvc-role-support-d4f1c532264b729a.yaml0000664000175000017500000000020613641427107026575 0ustar zuulzuul00000000000000--- fixes: - Bug `1796854 `_ is fixed by validating if advsvc context is used. neutron-lib-2.3.0/releasenotes/notes/rehome-qosdft-apidef-b70596ca11c08803.yaml0000664000175000017500000000020613641427107026555 0ustar zuulzuul00000000000000--- features: - The ``qos-default`` extension's API definition is now available in ``neutron_lib.api.definitions.qos_default``. neutron-lib-2.3.0/releasenotes/notes/dns-domain-ports-ext-39a069119e79e59b.yaml0000664000175000017500000000021413641427107026575 0ustar zuulzuul00000000000000--- features: - The ``dns-domain-ports`` extension API definition has been added as ``neutron_lib.api.definitions.dns_domain_ports``. neutron-lib-2.3.0/releasenotes/notes/public-service-classes-e52d7c79a075b799.yaml0000664000175000017500000000074513641427107027242 0ustar zuulzuul00000000000000--- features: - The ``neutron_lib.api.extensions.ExtensionDescriptor`` class's ``get_plugin_interface`` method now formally only supports ``neutron_lib.services.base.ServicePluginBase``. This change reflects the existing usage by consumers as almost all are returning instances of ``ServicePluginBase`` already. - The class ``WorkerBase`` is now available and provides the same functionality that's provided by ``neutron.worker.WorkerSupportServiceMixin``. neutron-lib-2.3.0/releasenotes/notes/rehome-svctype-apidef-9002b2e2bcbeec8e.yaml0000664000175000017500000000020713641427107027331 0ustar zuulzuul00000000000000--- features: - The ``service-type`` extension's API definition is now available in ``neutron_lib.api.definitions.servicetype``. neutron-lib-2.3.0/releasenotes/notes/rehome-shared-const-d847b2e190122425.yaml0000664000175000017500000000013513641427107026343 0ustar zuulzuul00000000000000--- features: - The ``SHARED`` constant is now available in ``neutron_lib.constants``. neutron-lib-2.3.0/releasenotes/notes/reset-db-retry-settings-49e51cef4c842f69.yaml0000664000175000017500000000067213641427107027456 0ustar zuulzuul00000000000000--- fixes: - | Increase the DB retry interval and max retry times for the ``retry_db_errors`` decorator in ``neutron_lib.db.api`` to 0.5 seconds and 20 times, respectively. For those actions which have a higher chance for DBDeadlock, users should have a higher success rate due to the larger random range and retry times. For more information see bug `1777968 `_ neutron-lib-2.3.0/releasenotes/notes/rehome-dhcpagentscheduler-apidef-1f7729fb5834dcd2.yaml0000664000175000017500000000035313641427107031274 0ustar zuulzuul00000000000000--- features: - The ``dhcp_agent_scheduler`` extension's API defintion is now available in ``neutron_lib.api.definitions.dhcpagentscheduler`` and the corresponding exceptions in ``neutron_lib.exceptions.dhcpagentscheduler``. neutron-lib-2.3.0/releasenotes/notes/add-extension-uplink-status-propagation-6b6050d6609c19c8.yaml0000664000175000017500000000061013641427107032470 0ustar zuulzuul00000000000000--- features: - | Add an API extension ``uplink-status-propagation`` to indicate if the server support propagating uplink status. This extension adds an attribute ``propagate_uplink_status`` to port. This attribute can be implemented for VF port. If it is set to ``True``, the VF link state can follow that of PF. The default is ``False`` which is the current behavior. neutron-lib-2.3.0/releasenotes/notes/add-convert-to-string-524541aa6224f66f.yaml0000664000175000017500000000026013641427107026710 0ustar zuulzuul00000000000000--- features: - | A new converter ``convert_to_string`` into ``neutron_lib.api.converters``. This method can convert an argument which is not None into string value. neutron-lib-2.3.0/releasenotes/notes/rehome-db-model-query-234b1559f3728a5e.yaml0000664000175000017500000000141013641427107026666 0ustar zuulzuul00000000000000--- features: - The public functions of ``neutron.db._model_query`` are now available in ``neutron_lib.db.model_query`` with the same name. While these modules can be used, forward looking projects should start moving to versioned objects and after which point we can remove this module. - A new fixture named ``DBQueryHooksFixture`` is provided for testing purposes allowing consumers to patch-out the model_query filter hooks. - The ``make_weak_ref`` and ``resolve_ref`` functions from neutron are now available in ``neutron_lib.utils.helpers``. - The ``TenantIdProjectIdFilterConflict`` exception is now available in ``neutron_lib.exceptions``. - The ``neutron.objects.utils`` module is now available in ``neutron_lib.objects.utils``. neutron-lib-2.3.0/releasenotes/notes/interconnection-api-def-cbec5e4f77852fe7.yaml0000664000175000017500000000015713641427107027612 0ustar zuulzuul00000000000000--- features: - Adds definition of ``interconnection`` API extension for neutron-interconnection project.neutron-lib-2.3.0/releasenotes/notes/rehome-obj-logeventtypes-b31e7c6492ca6615.yaml0000664000175000017500000000041113641427107027574 0ustar zuulzuul00000000000000--- features: - The ``neutron.objects.logapi.events_types`` module is now available as ``neutron_lib.objects.logapi.events_types``. - The ``neutron.services.logapi.common.constants`` module is now available as ``neutron_lib.services.logapi.constants``. neutron-lib-2.3.0/releasenotes/notes/callback_priority-2ded960e17bd5db9.yaml0000664000175000017500000000062413641427107026567 0ustar zuulzuul00000000000000--- features: - | Introduced priority to callback subscription. An integer value can be associated with each callback so that callbacks can be executed in specified order for same resources and events. Every callback will have priority value by default. To execute callbacks in specified order, priorities should be defined explicitly, lower priority value would be executed first. neutron-lib-2.3.0/releasenotes/notes/ipv6-canonical-address-13900a784f847ce3.yaml0000664000175000017500000000036413641427107027027 0ustar zuulzuul00000000000000--- fixes: - | The ``gateway`` , ``allocation_pools`` and ``cidr`` attributes of a Subnet with IPv6 addresses are now converted to IPv6 canonical format to address. `bug 1531103 `_ neutron-lib-2.3.0/releasenotes/notes/floatingip-autodelete-internal-f08675d8d64d34c6.yaml0000664000175000017500000000012413641427107030755 0ustar zuulzuul00000000000000--- features: - | New shim API extension: ``floatingip-autodelete-internal``. neutron-lib-2.3.0/releasenotes/notes/routed-networks-hostroutes-fb43abf942b154ff.yaml0000664000175000017500000000033013641427107030447 0ustar zuulzuul00000000000000--- features: - | Adds api-extension ``segments-peer-subnet-host-routes``. Adds host routes to subnets on a routed network (segments). `RFE: 1766380 `_. neutron-lib-2.3.0/releasenotes/notes/sfc-api-def-4f46632eadfe895a.yaml0000664000175000017500000000101313641427107025067 0ustar zuulzuul00000000000000--- features: - Add the definitions for the ``sfc`` and ``flowclassifier`` API extensions of the networking-sfc project. - Add a ``convert_uppercase_ip`` converter, convenient to easily accept for instance ``Ipv4``, ``IPv4`` and ``ipv4`` independently of the case of the first two letters. - And add a ``convert_prefix_forced_case`` converter, to allow forcing the case of a string prefix - Add a ``uuid_list_non_empty`` validator, that will validate that the value is a non-empty list of UUIDs neutron-lib-2.3.0/releasenotes/notes/events_l3_flavors-053714858ced693d.yaml0000664000175000017500000000022613641427107026234 0ustar zuulzuul00000000000000--- features: - This adds two new events ``PRECOMMIT_ADD_ASSOCIATION``, ``PRECOMMIT_DELETE_ASSOCIATIONS`` and a resource ``ROUTER_CONTROLLER``. neutron-lib-2.3.0/releasenotes/notes/rehome-common-constants-8ac9580e52fd3618.yaml0000664000175000017500000000040713641427107027435 0ustar zuulzuul00000000000000--- features: - Constants from ``neutron.common.constants`` are now available in neutron-lib. Note that consumers using ``ROUTER_STATUS_ACTIVE`` or ``ROUTER_STATUS_ERROR`` should now just use ``ACTIVE`` and ``ERROR`` from ``neutron_lib.constants``. neutron-lib-2.3.0/releasenotes/notes/create-netmtu-writable-extension-284892119ef6595c.yaml0000664000175000017500000000047113641427107031126 0ustar zuulzuul00000000000000--- features: - The new ``net-mtu-writable`` extension API definition has been added as ``neutron_lib.api.definitions.network_mtu_writable``. The new extension indicates that the network ``mtu`` attribute is writeable. Plugins supporting the new extension are expected to also support ``net-mtu``. neutron-lib-2.3.0/releasenotes/notes/bgpvpn-api-ref-f0294d9ddec726a0.yaml0000664000175000017500000000011113641427107025613 0ustar zuulzuul00000000000000--- features: - API reference for the ``networking-bgpvpn`` extension. neutron-lib-2.3.0/releasenotes/notes/new-hacking-check-no-log-translations-4a430a38aeb06452.yaml0000664000175000017500000000117113641427107032002 0ustar zuulzuul00000000000000--- features: - | New ``N537`` hacking check is introduced that enforces no logging message translations, in any logging level. The check is enabled by default. Also, the ``N533`` hacking check is now removed because it is covered by ``N537``. upgrade: - | Library consumers may need to adopt their code to new requirements of ``N537`` hacking check, removing translation markers from all logging messages. If for some reason it doesn't fit the project, consumers can disable the new hacking check using ``ignore`` statement in ``flake8`` section of their ``tox.ini`` file, or by other means. neutron-lib-2.3.0/releasenotes/notes/tag-ports-during-bulk-creation-ext-3dd2e68d99157a19.yaml0000664000175000017500000000023713641427107031424 0ustar zuulzuul00000000000000--- features: - The ``tag-ports-during-bulk-creation`` shim extension API definition has been added to enable the tagging of ports during bulk creation. neutron-lib-2.3.0/releasenotes/notes/add-extension-standard-attr-segment-8c721741589bf10b.yaml0000664000175000017500000000020613641427107031533 0ustar zuulzuul00000000000000--- other: - | Add a shim extension ``standard-attr-segment`` to indicate if segment resource contains standard attributes. neutron-lib-2.3.0/releasenotes/notes/add-filter-validation-api-extension-15cc667d5498f163.yaml0000664000175000017500000000077113641427107031531 0ustar zuulzuul00000000000000--- features: - | Add API extension ``filter-validation``. This extension indicates if the server supports validation on filter parameters of the list requests. other: - | API extension ``filter-validation`` relies on the ``is_filter`` keyword in the ``RESOURCE_ATTRIBUTE_MAP`` to judge if an attribute can be used as filter. Neutron plugins which want to support filter validation needs to set ``is_filter`` to ``True`` for each attribute in their resource attribute map. neutron-lib-2.3.0/releasenotes/notes/new-validator-range-or-none-dc8d557ec1f2622a.yaml0000664000175000017500000000006513641427107030225 0ustar zuulzuul00000000000000--- features: - Added validator ``range_or_none``. neutron-lib-2.3.0/setup.py0000664000175000017500000000200613641427107015511 0ustar zuulzuul00000000000000# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. # THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT import setuptools # In python < 2.7.4, a lazy loading of package `pbr` will break # setuptools if some other modules registered functions in `atexit`. # solution from: http://bugs.python.org/issue15881#msg170215 try: import multiprocessing # noqa except ImportError: pass setuptools.setup( setup_requires=['pbr>=2.0.0'], pbr=True) neutron-lib-2.3.0/doc/0000775000175000017500000000000013641427200014540 5ustar zuulzuul00000000000000neutron-lib-2.3.0/doc/requirements.txt0000664000175000017500000000033513641427107020033 0ustar zuulzuul00000000000000sphinx!=1.6.6,!=1.6.7,>=1.6.2,<2.0.0;python_version=='2.7' # BSD sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD openstackdocstheme>=1.18.1 # Apache-2.0 os-api-ref>=1.4.0 # Apache-2.0 reno>=2.5.0 # Apache-2.0 neutron-lib-2.3.0/doc/source/0000775000175000017500000000000013641427200016040 5ustar zuulzuul00000000000000neutron-lib-2.3.0/doc/source/index.rst0000664000175000017500000000375213641427107017716 0ustar zuulzuul00000000000000.. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Welcome to Neutron Lib documentation! ===================================== Neutron-lib is an OpenStack library project used by Neutron, Advanced Services, and third-party projects that aims to provide common functionality across all such consumers. The library is developed with the following goals in mind: - Decouple sub-projects from Neutron (i.e. no direct neutron imports in sub-projects). - Pay down Neutron technical debt via refactoring/re-architecting of sub-optimal patterns in their respective neutron-lib implementation. This document describes the library for contributors of the project, and assumes that you are already familiar with Neutron from an end-user perspective. If not, hop over to the `OpenStack doc site `__ This documentation is generated by the Sphinx toolkit and lives in the source tree. Additional documentation on Neutron and other components of OpenStack can be found on the `OpenStack wiki`_ and the `Neutron section of the wiki`. The `Neutron Development wiki`_ is also a good resource for new contributors. .. _`OpenStack wiki`: http://wiki.openstack.org .. _`Neutron section of the wiki`: http://wiki.openstack.org/Neutron .. _`Neutron Development wiki`: http://wiki.openstack.org/NeutronDevelopment Enjoy! .. toctree:: :maxdepth: 2 install/index user/index contributor/index .. only:: html .. toctree:: :maxdepth: 1 reference/index neutron-lib-2.3.0/doc/source/install/0000775000175000017500000000000013641427200017506 5ustar zuulzuul00000000000000neutron-lib-2.3.0/doc/source/install/index.rst0000664000175000017500000000031213641427107021351 0ustar zuulzuul00000000000000============ Installation ============ At the command line:: $ pip install neutron-lib Or, if you have virtualenvwrapper installed:: $ mkvirtualenv neutron-lib $ pip install neutron-lib neutron-lib-2.3.0/doc/source/reference/0000775000175000017500000000000013641427200017776 5ustar zuulzuul00000000000000neutron-lib-2.3.0/doc/source/reference/index.rst0000664000175000017500000000172713641427107021654 0ustar zuulzuul00000000000000.. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Convention for heading levels in Neutron lib devref: ======= Heading 0 (reserved for the title in a document) ------- Heading 1 ~~~~~~~ Heading 2 +++++++ Heading 3 ''''''' Heading 4 (Avoid deeper levels because they do not render well.) ================ Module Reference ================ .. toctree:: :maxdepth: 1 * :ref:`genindex` * :ref:`search` neutron-lib-2.3.0/doc/source/user/0000775000175000017500000000000013641427200017016 5ustar zuulzuul00000000000000neutron-lib-2.3.0/doc/source/user/index.rst0000664000175000017500000000007413641427107020666 0ustar zuulzuul00000000000000===== Usage ===== .. toctree:: :maxdepth: 2 hacking neutron-lib-2.3.0/doc/source/user/hacking.rst0000664000175000017500000000732213641427107021166 0ustar zuulzuul00000000000000============== Hacking Checks ============== The ``neutron_lib.hacking`` package implements a number of public `flake8 checks `__ intended to help adopters validate their compliance with the latest hacking standards. To adopt neutron-lib's hacking checks: #. Update your project's ``tox.ini`` to include hacking checks from neutron-lib. More specifically, copy hacking checks under "Checks for neutron and related projects" in ``[flake8.local-plugin] extension`` in neutron-lib ``tox.ini`` to ``[flake8.local-plugin] extension`` in your project's ``tox.ini``. For example in your ``tox.ini``:: [flake8:local-plugins] extension = # Checks from neutron-lib N521 = neutron_lib.hacking.checks:use_jsonutils N524 = neutron_lib.hacking.checks:check_no_contextlib_nested N529 = neutron_lib.hacking.checks:no_mutable_default_args N530 = neutron_lib.hacking.checks:check_neutron_namespace_imports N532 = neutron_lib.hacking.translation_checks:check_log_warn_deprecated N534 = neutron_lib.hacking.translation_checks:check_raised_localized_exceptions N536 = neutron_lib.hacking.checks:assert_equal_none N537 = neutron_lib.hacking.translation_checks:no_translate_logs Under certain circumstances, adopters may need to ignore specific neutron-lib hacking checks temporarily. You can ignore such checks just by commenting out them (hopefully with a proper reason). If your project has its own hacking checks, you can add more rules to ``[flake8.local-plugin] extension`` along with hacking checks from neutron-lib. .. note:: The above configuration assumes hacking 2.x. If your project uses hacking 1.x, see :ref:`hacking1_support` below. #. Update your project's ``tox.ini`` enable any flake8 extensions neutron-lib's ``tox.ini`` does. These are hacking checks otherwise disabled by default that neutron-lib expects to run. For example in neutron-lib's ``tox.ini``:: [flake8] # H904: Delay string interpolations at logging calls enable-extensions=H904 In the example above, adopters should also add ``H904`` to the ``enable-extensions`` in their ``tox.ini``. #. Actively adopt neutron-lib hacking checks by running and monitoring the neutron-lib `periodic job `_ (as per `stadium guidelines `_ and watching for announcements. Announcements regarding neutron-lib adopter hacking checks will be communicated via openstack-discuss email list and `neutron meetings `_. .. _hacking1_support: Hacking 1.x support ------------------- If your project uses hacking 1.x, you need a different way to consume hacking checks from neutron-lib. .. warning:: hacking 1.x support is deprecated and will be dropped once all neutron related projects migrate to hacking 2.x. Update your project's ``tox.ini`` to use ``neutron_lib.hacking.checks.factory`` for its ``local-check-factory``. For example in your ``tox.ini``:: [hacking] local-check-factory = neutron_lib.hacking.checks.factory If your project needs to register additional project specific hacking checks, you can define your own factory function that calls neutron-lib's ``factory`` function. For example in your project's python source:: def my_factory(register): # register neutron-lib checks neutron_lib_checks.factory(register) # register project specific checks register(my_project_check) And use your project's own factory in ``tox.ini``:: [hacking] local-check-factory = myproject.mypkg.my_factory neutron-lib-2.3.0/doc/source/conf.py0000775000175000017500000001753613641427107017364 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. # Build configuration file that is execfile()'d with the current directory # set to it's containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os import subprocess import sys import warnings # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ROOT_DIR = os.path.abspath(os.path.join(BASE_DIR, "..", "..")) sys.path.insert(0, ROOT_DIR) # -- General configuration --------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.coverage', 'sphinx.ext.ifconfig', 'sphinx.ext.graphviz', 'sphinx.ext.todo', 'openstackdocstheme',] todo_include_todos = True # Add any paths that contain templates here, relative to this directory. templates_path = [] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8' # The master doctree document. master_doc = 'index' # General information about the project. project = u'Neutron Library' copyright = u'2015-present, OpenStack Foundation.' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # Version info from neutron_lib.version import version_info as neutron_lib_version release = neutron_lib_version.release_string() # The short X.Y version. version = neutron_lib_version.version_string() # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of documents that shouldn't be included in the build. # unused_docs = [] # List of directories, relative to source directory, that shouldn't be searched # for source files. exclude_trees = [] # The reST default role (for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. show_authors = True # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. modindex_common_prefix = ['neutron_lib.'] # -- Options for man page output -------------------------------------------- # Grouping the document tree for man pages. # List of tuples 'sourcefile', 'target', u'title', u'Authors name', 'manual' # man_pages = [ # ('man/neutron-lib', 'neutron-lib', u'Neutron Library', # [u'OpenStack'], 1) # ] # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. # html_theme_path = ["."] # html_theme = '_theme' html_theme = 'openstackdocs' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = ['_theme'] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". # html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' html_last_updated_fmt = '%Y-%m-%d %H:%M' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_use_modindex = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = '' # Output file base name for HTML help builder. #htmlhelp_basename = 'neutronlibdoc' # -- Options for LaTeX output ------------------------------------------------ # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, # documentclass [howto/manual]). latex_documents = [ ('index', 'doc-neutron-lib.tex', u'Neutron Library Documentation', u'Neutron development team', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # Additional stuff for the LaTeX preamble. #latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_use_modindex = True latex_elements = { 'makeindex': '', 'printindex': '', 'preamble': r'\setcounter{tocdepth}{3}', } # -- Options for openstackdocstheme ------------------------------------------- repository_name = 'openstack/neutron-lib' bug_project = 'neutron' bug_tag = 'doc' linkcheck_anchors_ignore = [ # skip gerrit anchors r'\/q\/.*', r'q\,.*', r'\/c\/.*' ] neutron-lib-2.3.0/doc/source/contributor/0000775000175000017500000000000013641427200020412 5ustar zuulzuul00000000000000neutron-lib-2.3.0/doc/source/contributor/index.rst0000664000175000017500000000222013641427107022255 0ustar zuulzuul00000000000000.. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Convention for heading levels in Neutron lib devref: ======= Heading 0 (reserved for the title in a document) ------- Heading 1 ~~~~~~~ Heading 2 +++++++ Heading 3 ''''''' Heading 4 (Avoid deeper levels because they do not render well.) Contributor Guide ================= In the Contributor Guide, you will find information on the Neutron Library components and in how to use them, from a development standpoint. .. toctree:: :maxdepth: 2 consuming conventions review-guidelines contributing releasing internals neutron-lib-2.3.0/doc/source/contributor/review-guidelines.rst0000664000175000017500000000743713641427107024614 0ustar zuulzuul00000000000000================= Review Guidelines ================= When reviewing neutron-lib changes, please be aware: * When code is moved from neutron, please evaluate with the following criteria: - Is all of the code shared? Don't move neutron-only code. - Is the interface good, or does it need to be refactored? If refactoring is required it must be done before the public interface is released to PyPI as once released it must follow our `conventions <./conventions.html>`_. - Does it need new tests, specifically around the interface? We want a global unit coverage greater than 90%, and a per-module coverage greater than 80%. If neutron does not yet have a test, it needs to be added. Note that tests on things like constants are uninteresting, but any code or interface should have a unit test, if you cannot tell for sure that it is not going to be traversed in some alternative way (e.g. tempest/functional coverage). - Do the public APIs have their parameters and return values documented using reStructuredText docstring format (see below)? - In certain cases, it may be beneficial to determine how the neutron-lib code changes impact neutron `master`. This can be done as follows: - Publish a 'Do Not Merge' dummy patch to neutron that uses the code changes proposed (or already in) neutron-lib. Make sure to mark this neutron change as a 'DNM' (or 'WIP') and use -1 for workflow to indicate. - Publish a change to neutron-lib that uses `Depends-On:` for the dummy change in neutron; this pulls the neutron dummy change into the neutron-lib gate job. For example `386846 `_ uses a dummy neutron-lib patch to test code that already exists in neutron-lib `master` whereas `346554 `_ tests the neutron-lib patch's code itself. - View neutron-lib gate job results and repeat as necessary. * Public APIs should be documented using `reST style docstrings `_ that include an overview as well as parameter and return documentation. The format of docstrings can be found in the `OpenStack developer hacking docs `_. Note that public API documentation is a bonus, not a requirement. * Once public classes and methods are pushed to PyPI as part of a neutron-lib release, they must not be destructively changed without following the full OpenStack deprecation path. For example, do not: - Change names of classes or methods - Reorder method arguments - Change side effects Alternatives: - Add a second method with the new signature - Add keyword arguments The above implies that if you add something, we are stuck with that interface for a long time, so be careful. * Removing the code from neutron can be done without a temporary `debtcollector `_ notice by following the steps described in the 'Consume' phase of the `contributing doc <./contributing.html>`_. * Any code that imports/uses the following python modules should not be moved into neutron-lib: - eventlet * With respect to `Oslo config options `_: - Config options should only be included in neutron-lib when the respective functionality that uses the options lives in neutron-lib. In this case the options will need to be exposed as entry points for `config generation `_. - Common functionality in neutron-lib that accesses config values should assume the caller has registered them and document such in the docstring for the respective functionality in neutron-lib. neutron-lib-2.3.0/doc/source/contributor/api_converters.rst0000664000175000017500000000645013641427107024202 0ustar zuulzuul00000000000000.. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Convention for heading levels in Neutron devref: ======= Heading 0 (reserved for the title in a document) ------- Heading 1 ~~~~~~~ Heading 2 +++++++ Heading 3 ''''''' Heading 4 (Avoid deeper levels because they do not render well.) API Converters ============== Definitions for REST API attributes, can include conversion methods to help normalize user input or transform the input into a form that can be used. Defining A Converter Method --------------------------- By convention, the name should start with ``convert_to_``, and will take a single argument for the data to be converted. The method should return the converted data (which, if the input is None, and no conversion is performed, the implicit None returned by the method may be used). If the conversion is impossible, an InvalidInput exception should be raised, indicating what is wrong. For example, here is one that converts a variety of user inputs to a boolean value. :: def convert_to_boolean(data): if isinstance(data, str): val = data.lower() if val == "true" or val == "1": return True if val == "false" or val == "0": return False elif isinstance(data, bool): return data elif isinstance(data, int): if data == 0: return False elif data == 1: return True msg = _("'%s' cannot be converted to boolean") % data raise n_exc.InvalidInput(error_message=msg) Using Validators ---------------- In client code, the conversion can be used in a REST API definition, by specifying the name of the method as a value for the 'convert_to' key on an attribute. For example: :: 'admin_state_up': {'allow_post': True, 'allow_put': True, 'default': True, 'convert_to': conversions.convert_to_boolean, 'is_visible': True}, Here, the admin_state_up is a boolean, so the converter is used to take user's (string) input and transform it to a boolean. Test The Validator ------------------ Do the right thing, and make sure you've created a unit test for any converter that you add to verify that it works as expected. IPv6 canonical address formatter -------------------------------- There are several ways to display an IPv6 address, which can lead to a lot of confusion for users, engineers and operators alike. To reduce the impact of the multifaceted style of writing an IPv6 address, it is proposed that the IPv6 address in Neutron should be saved in the canonical format. If a user passes an IPv6 address, it will be saved in the canonical format. The full document is found at : http://tools.ietf.org/html/rfc5952 neutron-lib-2.3.0/doc/source/contributor/consuming.rst0000664000175000017500000000332313641427107023155 0ustar zuulzuul00000000000000===================== Consuming neutron-lib ===================== Many OpenStack projects consume neutron-lib by importing and using its code. As a result, these consumers must define ``neutron-lib`` as a dependency in their respective ``requirements.txt`` file. While this is likely nothing new to most OpenStack developers, it may not be obvious to consumers if they need to always use the latest release of neutron-lib, or if they can lag behind using an old(er) release of it. The answer is that it's up to the consuming project if they want to stay "current" or not in terms of the neutron-lib version they use. While we might like all consumers to stay current and there are benefits to it, this isn't always realistic for projects that have less developers/velocity. Therefore, each project has two options for consuming neutron-lib. * Opt-in to stay current by adding a comment with ``neutron-lib-current`` in their ``requirements.txt``. This string declares the project's intent to use the latest version of neutron-lib as well as their agreement to stay current with overall OpenStack initiatives. These projects receive updates "for free" as part of the ongoing neutron-lib work. For more details see the `ML archive `_ * Do not opt-in and rather manage your own consumption of neutron-lib. In this case your project developers must define the version of neutron-lib to use and update the project's code to consume it as they bump up the version. In this scenario most projects will also be managing a back-leveled version of ``neutron`` since neutron is always current with neutron-lib and might otherwise break the consuming code. neutron-lib-2.3.0/doc/source/contributor/internals.rst0000664000175000017500000000206613641427107023155 0ustar zuulzuul00000000000000.. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Convention for heading levels in Neutron lib devref: ======= Heading 0 (reserved for the title in a document) ------- Heading 1 ~~~~~~~ Heading 2 +++++++ Heading 3 ''''''' Heading 4 (Avoid deeper levels because they do not render well.) ===================== Neutron Lib Internals ===================== .. toctree:: :maxdepth: 3 api_attributes api_extensions api_converters api_validators callbacks db_model_query rpc_api neutron-lib-2.3.0/doc/source/contributor/releasing.rst0000664000175000017500000000360313641427107023125 0ustar zuulzuul00000000000000========= Releasing ========= Before you intend to release a new version of neutron-lib consider posting a `sentinel patch `_ that will allow to validate that the neutron-lib hash chosen for tagging is not breaking gate or check jobs affecting a project you care about, first and foremost Neutron. As the patch shows, upper-constraints must be bypassed and that may itself lead to failures due to upstream package changes. The patch also shows (expected) Grenade failures in that Grenade pulls its own upper-constraints file during the upgrade phase. In general a newer version of neutron-lib is validated through the Tempest -full job (and Grenade runs a subset of it), so Grenade failures can be safely ignored. In any other case consider (for failures caused by unpinned global requirements) hard-coding a dummy upper-constraints file that itself uses the specific neutron-lib hash you want to test. Furthermore, consider using a commit header that starts with DNM (Do Not Merge) to indicate that the change is just a test, or -2, if you have the right access permissions. It is also worth noting that every Stadium project will have a periodic job running unit tests and pep8 against the master version of neutron-lib Checking Grafana's `periodic `_ dashboard can give you a glimpse into the sanity of the integration between neutron-lib and the Stadium projects, and can be considered the quick check before going ahead with a full blown sentinel patch. Periodic failures can be debugged by viewing the `periodic logs `_ In addition, both the API reference as well as the project docs should be validated to ensure there are no dead links. To do so run ``tox -e linkcheck`` and address the errors. neutron-lib-2.3.0/doc/source/contributor/conventions.rst0000664000175000017500000000415313641427107023522 0ustar zuulzuul00000000000000======================= Neutron-Lib Conventions ======================= Summary ------- * Standard modules - current cycle + 2 deprecation policy * Legacy modules - current cycle + 1 deprecation policy * Private modules - no deprecation warnings of any kind Interface Contract ------------------ The neutron-lib repo exists to provide code with a long-term stable interface for subprojects. If we do need to deprecate something, a debtcollector warning will be added, the neutron-lib core team will make every effort to update any neutron stadium project for you, and you will get at least the current release plus two cycles before it disappears. In keeping with how hard it is to remove things, the change velocity of this library will be slower than neutron. There are two notable cases where code should go into standard neutron instead of this lib (or your repo): * It is something common, but changes a lot. An example is something like the neutron Port object. Everyone uses it, but it changes frequently. You don't want to wait for a library release to tweak some neutron feature, and we are not going to force releases quickly because you tried to put it here. Those items will need to be addressed in some other manner (in the case of the Port object, it'll be via an auto-magic container object that mimics it.) * It is something common, but you need it now. Put it in the repo that needs it, get your stuff working. Then consider making it available in the lib, and eventually remove it from your repo when the lib is publishing it. An example would be a new neutron constant. The process would be, put it in neutron along with your change, submit it to the lib, when that constant is eventually available, remove it from neutron and use the lib version. Private Interfaces ------------------ Private interfaces are *PRIVATE*. They will disappear, be renamed, and absolutely no regard will be given to anyone that is using them. They are for internal library use only. DO NOT USE THEM. THEY WILL CHANGE. Private interfaces in this library will always have a leading underscore, on the module or function name. neutron-lib-2.3.0/doc/source/contributor/rpc_api.rst0000664000175000017500000001243713641427107022576 0ustar zuulzuul00000000000000.. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Convention for heading levels in Neutron devref: ======= Heading 0 (reserved for the title in a document) ------- Heading 1 ~~~~~~~ Heading 2 +++++++ Heading 3 ''''''' Heading 4 (Avoid deeper levels because they do not render well.) Neutron RPC API Layer ===================== Neutron uses the oslo.messaging library to provide an internal communication channel between Neutron services. This communication is typically done via AMQP, but those details are mostly hidden by the use of oslo.messaging and it could be some other protocol in the future. RPC APIs are defined in Neutron in two parts: client side and server side. Client Side ----------- Here is an example of an rpc client definition: :: import oslo_messaging from neutron_lib import rpc as n_rpc class ClientAPI(object): """Client side RPC interface definition. API version history: 1.0 - Initial version 1.1 - Added my_remote_method_2 """ def __init__(self, topic): target = oslo_messaging.Target(topic=topic, version='1.0') self.client = n_rpc.get_client(target) def my_remote_method(self, context, arg1, arg2): cctxt = self.client.prepare() return cctxt.call(context, 'my_remote_method', arg1=arg1, arg2=arg2) def my_remote_method_2(self, context, arg1): cctxt = self.client.prepare(version='1.1') return cctxt.call(context, 'my_remote_method_2', arg1=arg1) This class defines the client side interface for an rpc API. The interface has 2 methods. The first method existed in version 1.0 of the interface. The second method was added in version 1.1. When the newer method is called, it specifies that the remote side must implement at least version 1.1 to handle this request. Server Side ----------- The server side of an rpc interface looks like this: :: import oslo_messaging class ServerAPI(object): target = oslo_messaging.Target(version='1.1') def my_remote_method(self, context, arg1, arg2): return 'foo' def my_remote_method_2(self, context, arg1): return 'bar' This class implements the server side of the interface. The oslo_messaging.Target() defined says that this class currently implements version 1.1 of the interface. .. _rpc_versioning: Versioning ---------- Note that changes to rpc interfaces must always be done in a backwards compatible way. The server side should always be able to handle older clients (within the same major version series, such as 1.X). It is possible to bump the major version number and drop some code only needed for backwards compatibility. For more information about how to do that, see https://wiki.openstack.org/wiki/RpcMajorVersionUpdates. Example Change ~~~~~~~~~~~~~~ As an example minor API change, let's assume we want to add a new parameter to my_remote_method_2. First, we add the argument on the server side. To be backwards compatible, the new argument must have a default value set so that the interface will still work even if the argument is not supplied. Also, the interface's minor version number must be incremented. So, the new server side code would look like this: :: import oslo_messaging class ServerAPI(object): target = oslo_messaging.Target(version='1.2') def my_remote_method(self, context, arg1, arg2): return 'foo' def my_remote_method_2(self, context, arg1, arg2=None): if not arg2: # Deal with the fact that arg2 was not specified if needed. return 'bar' We can now update the client side to pass the new argument. The client must also specify that version '1.2' is required for this method call to be successful. The updated client side would look like this: :: import oslo_messaging from neutron.common import rpc as n_rpc class ClientAPI(object): """Client side RPC interface definition. API version history: 1.0 - Initial version 1.1 - Added my_remote_method_2 1.2 - Added arg2 to my_remote_method_2 """ def __init__(self, topic): target = oslo_messaging.Target(topic=topic, version='1.0') self.client = n_rpc.get_client(target) def my_remote_method(self, context, arg1, arg2): cctxt = self.client.prepare() return cctxt.call(context, 'my_remote_method', arg1=arg1, arg2=arg2) def my_remote_method_2(self, context, arg1, arg2): cctxt = self.client.prepare(version='1.2') return cctxt.call(context, 'my_remote_method_2', arg1=arg1, arg2=arg2) More Info --------- For more information, see the oslo.messaging documentation: https://docs.openstack.org/oslo.messaging/latest/. neutron-lib-2.3.0/doc/source/contributor/callbacks.rst0000664000175000017500000006357313641427107023107 0ustar zuulzuul00000000000000.. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Convention for heading levels in Neutron devref: ======= Heading 0 (reserved for the title in a document) ------- Heading 1 ~~~~~~~ Heading 2 +++++++ Heading 3 ''''''' Heading 4 (Avoid deeper levels because they do not render well.) Neutron Callback System ======================= In Neutron, core and service components may need to cooperate during the execution of certain operations, or they may need to react upon the occurrence of certain events. For instance, when a Neutron resource is associated to multiple services, the components in charge of these services may need to play an active role in determining what the right state of the resource needs to be. The cooperation may be achieved by making each object aware of each other, but this leads to tight coupling, or alternatively it can be achieved by using a callback-based system, where the same objects are allowed to cooperate in a loose manner. This is particularly important since the spin off of the advanced services like VPN and Firewall, where each service's codebase lives independently from the core and from one another. This means that the tight coupling is no longer a practical solution for object cooperation. In addition to this, if more services are developed independently, there is no viable integration between them and the Neutron core. A callback system, and its registry, tries to address these issues. In object-oriented software systems, method invocation is also known as message passing: an object passes a message to another object, and it may or may not expect a message back. This point-to-point interaction can take place between the parties directly involved in the communication, or it can happen via an intermediary. The intermediary is then in charge of keeping track of who is interested in the messages and in delivering the messages forth and back, when required. As mentioned earlier, the use of an intermediary has the benefit of decoupling the parties involved in the communications, as now they only need to know about the intermediary; the other benefit is that the use of an intermediary opens up the possibility of multiple party communication: more than one object can express interest in receiving the same message, and the same message can be delivered to more than one object. To this aim, the intermediary is the entity that exists throughout the system lifecycle, as it needs to be able to track whose interest is associated to what message. In a design for a system that enables callback-based communication, the following aspects need to be taken into account: * how to become consumer of messages (i.e. how to be on the receiving end of the message); * how to become producer of messages (i.e. how to be on the sending end of the message); * how to consume/produce messages selectively; Translate and narrow this down to Neutron needs, and this means the design of a callback system where messages are about lifecycle events (e.g. before creation, before deletion, etc.) of Neutron resources (e.g. networks, routers, ports, etc.), where the various parties can express interest in knowing when these events for a specific resources take place. Rather than keeping the conversation abstract, let us delve into some examples, that would help understand better some of the principles behind the provided mechanism. Event payloads -------------- The use of ``**kwargs`` for callback event payloads is deprecated (slated to be removed in 'Queens') in favor of standardized event payload objects as described herein. The event payloads are defined in ``neutron_lib.callbacks.events`` and define a set of payload objects based on consumption pattern. The following event objects are defined today: - ``EventPayload``: Base object for all other payloads and define the common set of attributes used by events. The ``EventPayload`` can also be used directly for basic payloads that don't need to transport additional values. - ``DBEventPayload``: Payloads pertaining to database callbacks. These objects capture both the pre and post state (among other things) for database changes. - ``APIEventPayload``: Payloads pertaining to API callbacks. These objects capture details relating to an API event; such as the method name and API action. Each event object is described in greater detail in its own subsection below. For backwards compatibility the callback registry and manager still provide the ``notify`` method for passing ``**kwargs``, but also provide the ``publish`` method for passing an event object. Event objects: EventPayload ~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ``EventPayload`` object is the parent class of all other payload objects and defines the common set of attributes applicable to most events. For example, the ``EventPayload`` contains the ``context``, ``request_body``, etc. In addition, a ``metadata`` attribute is available to transport event data that's not yet standardized. While the ``metadata`` attribute is there for use, it should only be used in special cases like phasing in new payload attributes. Payload objects also transport resource state via the ``states`` attribute. This collection of resource objects tracks the state changes for the respective resource related to the event. For example database changes might have a pre and post updated resource that's used as ``states``. Tracking states allows consumers to inspect the various changes in the resource and take action as needed; for example checking the pre and post object to determine the delta. State object types are event specific; API events may use python ``dicts`` as state objects whereas database events use resource/OVO model objects. Note that states as well as any other event payload attributes are not copied; subscribers obtain a direct reference to event payload objects (states, metadata, etc.) and should not be modified by subscribers. Event objects: DBEventPayload ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For datastore/database events, ``DBEventPayload`` can be used as the payload event object. In addition to the attributes inherited from ``EventPayload``, database payloads also contain an additional ``desired_state``. The desired state is intended for use with pre create/commit scenarios where the publisher has a resource object (yet to be persisted) that's used in the event payload. These event objects are suitable for the standard before/after database events we have today as well as any that might arise in the future. Example usage:: # BEFORE_CREATE: DBEventPayload(context, request_body=params_of_create_request, resource_id=id_of_resource_if_avail, desired_state=db_resource_to_commit) # AFTER_CREATE: DBEventPayload(context, request_body=params_of_create_request, states=[my_new_copy_after_create], resource_id=id_of_resource) # PRECOMMIT_CREATE: DBEventPayload(context, request_body=params_of_create_request, resource_id=id_of_resource_if_avail, desired_state=db_resource_to_commit) # BEFORE_DELETE: DBEventPayload(context, states=[resource_to_delete], resource_id=id_of_resource) # AFTER_DELETE: DBEventPayload(context, states=[copy_of_deleted_resource], resource_id=id_of_resource) # BEFORE_UPDATE: DBEventPayload(context, request_body=body_of_update_request, states=[original_db_resource], resource_id=id_of_resource desired_state=updated_db_resource_to_commit) # AFTER_UPDATE: DBEventPayload(context, request_body=body_of_update_request, states=[original_db_resource, updated_db_resource], resource_id=id_of_resource) Event objects: APIEventPayload ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For API related callbacks, the ``APIEventPayload`` object can be used to transport callback payloads. For example, the REST API resource controller can use API events for pre/post operation callbacks. In addition to transporting all the attributes of ``EventPayload``, the ``APIEventPayload`` object also includes the ``action``, ``method_name`` and ``collection_name`` payload attributes permitting API components to pass along API controller specifics. Sample usage:: # BEFORE_RESPONSE for create: APIEventPayload(context, notifier_method, action, request_body=req_body, states=[create_result], collection_name=self._collection_name) # BEFORE_RESPONSE for delete: APIEventPayload(context, notifier_method, action, states=[copy_of_deleted_resource], collection_name=self._collection_name) # BEFORE_RESPONSE for update: APIEventPayload(context, notifier_method, action, states=[original, updated], collection_name=self._collection_name) Subscribing to events --------------------- Imagine that you have entity A, B, and C that have some common business over router creation. A wants to tell B and C that the router has been created and that they need to get on and do whatever they are supposed to do. In a callback-less world this would work like so: :: # A is done creating the resource # A gets hold of the references of B and C # A calls B # A calls C B->my_random_method_for_knowing_about_router_created() C->my_random_very_difficult_to_remember_method_about_router_created() If B and/or C change, things become sour. In a callback-based world, things become a lot more uniform and straightforward: :: # B and C ask I to be notified when A is done creating the resource # Suppose D another entity want subscription with higher priority # notification # ... # A is done creating the resource # A gets hold of the reference to the intermediary I # A calls I I->notify() Since B and C will have expressed interest in knowing about A's business, and D also subscribed for router creation with higher priority, 'I' will deliver the messages to D first and then to B and C in any order. If B, C and D change, A and 'I' do not need to change. In practical terms this scenario would be translated in the code below: :: from neutron_lib.callbacks import events from neutron_lib.callbacks import resources from neutron_lib.callbacks import registry def callback1(resource, event, trigger, payload): print('Callback1 called by trigger: ', trigger) print('payload: ', payload) def callback2(resource, event, trigger, payload): print('Callback2 called by trigger: ', trigger) print('payload: ', payload) def callbackhighproirity(resource, event, trigger, payload): print("Prepared data for entities") # A is using event in case for some callback or internal operations registry.subscribe(callbackhighpriority, resources.ROUTER, events.BEFORE_CREATE, priority=0) # B and C express interest with I registry.subscribe(callback1, resources.ROUTER, events.BEFORE_CREATE) registry.subscribe(callback2, resources.ROUTER, events.BEFORE_CREATE) print('Subscribed') # A notifies def do_notify(): registry.publish(resources.ROUTER, events.BEFORE_CREATE, do_notify, events.EventPayload(None)) print('Notifying...') do_notify() The output is: :: > Subscribed > Notifying... > callbackhighpriority called by trigger: > payload: > Callback2 called by trigger: > payload: > Callback1 called by trigger: > payload: Thanks to the intermediary existence throughout the life of the system, A, B, C and D are flexible to evolve their internals, dynamics, and lifecycles. Since different entities can subscribe to same events of a resource, the callback priority mechanism is in place to guarantee the order of execution for callbacks, entities have to subscribe events with a priority number of Integer type, lower the priority number is higher would be priority of callback. The following adds more details: * Priorities for callbacks should be coded in `neutron_lib/callbacks/priority_group.py` * If no priority is assigned during subscription then a default value will be used. * For callbacks having same priority, the execution order will be arbitary. Subscribing and aborting events ------------------------------- Interestingly in Neutron, certain events may need to be forbidden from happening due to the nature of the resources involved. To this aim, the callback-based mechanism has been designed to support a use case where, when callbacks subscribe to specific events, the action that results from it, may lead to the propagation of a message back to the sender, so that it itself can be alerted and stop the execution of the activity that led to the message dispatch in the first place. The typical example is where a resource, like a router, is used by one or more high-level service(s), like a VPN or a Firewall, and actions like interface removal or router destruction cannot not take place, because the resource is shared. To address this scenario, special events are introduced, 'BEFORE_*' events, to which callbacks can subscribe and have the opportunity to 'abort', by raising an exception when notified. Since multiple callbacks may express an interest in the same event for a particular resource, and since callbacks are executed independently from one another, this may lead to situations where notifications that occurred before the exception must be aborted. To this aim, when an exception occurs during the notification process, an abort_* event is propagated immediately after. It is up to the callback developer to determine whether subscribing to an abort notification is required in order to revert the actions performed during the initial execution of the callback (when the BEFORE_* event was fired). Exceptions caused by callbacks registered to abort events are ignored. The snippet below shows this in action: :: from neutron_lib.callbacks import events from neutron_lib.callbacks import exceptions from neutron_lib.callbacks import resources from neutron_lib.callbacks import registry def callback1(resource, event, trigger, payload=None): raise Exception('I am failing!') def callback2(resource, event, trigger, payload=None): print('Callback2 called by %s on event %s' % (trigger, event)) registry.subscribe(callback1, resources.ROUTER, events.BEFORE_CREATE) registry.subscribe(callback2, resources.ROUTER, events.BEFORE_CREATE) registry.subscribe(callback2, resources.ROUTER, events.ABORT_CREATE) print('Subscribed') def do_notify(): registry.publish(resources.ROUTER, events.BEFORE_CREATE, do_notify) print('Notifying...') try: do_notify() except exceptions.CallbackFailure as e: print("Error: %s" % e) The output is: :: > Subscribed > Notifying... > Callback2 called by on event before_create > Callback2 called by on event abort_create > Error: Callback __main__.callback1 failed with "I am failing!" In this case, upon the notification of the BEFORE_CREATE event, Callback1 triggers an exception that can be used to stop the action from taking place in do_notify(). On the other end, Callback2 will be executing twice, once for dealing with the BEFORE_CREATE event, and once to undo the actions during the ABORT_CREATE event. It is worth noting that it is not mandatory to have the same callback register to both BEFORE_* and the respective ABORT_* event; as a matter of fact, it is best to make use of different callbacks to keep the two logic separate. Unsubscribing to events ----------------------- There are a few options to unsubscribe registered callbacks: * clear(): it unsubscribes all subscribed callbacks: this can be useful especially when winding down the system, and notifications shall no longer be triggered. * unsubscribe(): it selectively unsubscribes a callback for a specific resource's event. Say callback C has subscribed to event A for resource R, any notification of event A for resource R will no longer be handed over to C, after the unsubscribe() invocation. * unsubscribe_by_resource(): say that callback C has subscribed to event A, B, and C for resource R, any notification of events related to resource R will no longer be handed over to C, after the unsubscribe_by_resource() invocation. * unsubscribe_all(): say that callback C has subscribed to events A, B for resource R1, and events C, D for resource R2, any notification of events pertaining resources R1 and R2 will no longer be handed over to C, after the unsubscribe_all() invocation. The snippet below shows these concepts in action: :: from neutron_lib.callbacks import events from neutron_lib.callbacks import exceptions from neutron_lib.callbacks import resources from neutron_lib.callbacks import registry def callback1(resource, event, trigger, payload=None): print('Callback1 called by %s on event %s for resource %s' % (trigger, event, resource)) def callback2(resource, event, trigger, payload=None): print('Callback2 called by %s on event %s for resource %s' % (trigger, event, resource)) registry.subscribe(callback1, resources.ROUTER, events.BEFORE_READ) registry.subscribe(callback1, resources.ROUTER, events.BEFORE_CREATE) registry.subscribe(callback1, resources.ROUTER, events.AFTER_DELETE) registry.subscribe(callback1, resources.PORT, events.BEFORE_UPDATE) registry.subscribe(callback2, resources.ROUTER_GATEWAY, events.BEFORE_UPDATE) print('Subscribed') def do_notify(): print('Notifying...') registry.publish(resources.ROUTER, events.BEFORE_READ, do_notify) registry.publish(resources.ROUTER, events.BEFORE_CREATE, do_notify) registry.publish(resources.ROUTER, events.AFTER_DELETE, do_notify) registry.publish(resources.PORT, events.BEFORE_UPDATE, do_notify) registry.publish(resources.ROUTER_GATEWAY, events.BEFORE_UPDATE, do_notify) do_notify() registry.unsubscribe(callback1, resources.ROUTER, events.BEFORE_READ) do_notify() registry.unsubscribe_by_resource(callback1, resources.PORT) do_notify() registry.unsubscribe_all(callback1) do_notify() registry.clear() do_notify() The output is: :: Subscribed Notifying... Callback1 called by on event before_read for resource router Callback1 called by on event before_create for resource router Callback1 called by on event after_delete for resource router Callback1 called by on event before_update for resource port Callback2 called by on event before_update for resource router_gateway Notifying... Callback1 called by on event before_create for resource router Callback1 called by on event after_delete for resource router Callback1 called by on event before_update for resource port Callback2 called by on event before_update for resource router_gateway Notifying... Callback1 called by on event before_create for resource router Callback1 called by on event after_delete for resource router Callback2 called by on event before_update for resource router_gateway Notifying... Callback2 called by on event before_update for resource router_gateway Notifying... Subscribing events using registry decorator ------------------------------------------- Now neutron-lib supports using registry decorators to subscribe events. There are two decorators ``has_registry_receivers``, which sets up the class ``__new__`` method to subscribe the bound method in the callback registry after object instantiation. ``receives`` use to decorate callback method which must defines the resource and events. Any class use ``receives`` must be decorated with ``has_registry_receivers``. Testing with callbacks ---------------------- A python `fixture `_ is provided for implementations that need to unit test and mock the callback registry. This can be used for example, when your code publishes callback events that you need to verify. Consumers can use ``neutron_lib.tests.unit.callbacks.base.CallbackRegistryFixture`` in their unit test classes with the ``useFixture()`` method passing along a ``CallbackRegistryFixture`` instance. If mocking of the actual singleton callback manager is necessary, consumers can pass a value to with the ``callback_manager`` kwarg. For example:: def setUp(self): super(MyTestClass, self).setUp() self.registry_fixture = callback_base.CallbackRegistryFixture() self.useFixture(self.registry_fixture) # each test now uses an isolated callback manager FAQ --- Can I use the callbacks registry to subscribe and notify non-core resources and events? Short answer is yes. The callbacks module defines literals for what are considered core Neutron resources and events. However, the ability to subscribe/notify is not limited to these as you can use your own defined resources and/or events. Just make sure you use string literals, as typos are common, and the registry does not provide any runtime validation. Therefore, make sure you test your code! What is the relationship between Callbacks and Taskflow? There is no overlap between Callbacks and Taskflow or mutual exclusion; as matter of fact they can be combined; You could have a callback that goes on and trigger a taskflow. It is a nice way of separating implementation from abstraction, because you can keep the callback in place and change Taskflow with something else. Is there any ordering guarantee during notifications? Depends, if the prorities are defined or passed during subscription, then yes callbacks will be executed in order, meaning the callback having the lowest integer value for priority will be executed first and so on. When priorities are not explicitly defined during subscription, all the callbacks will have default priority and will be executed in an arbitary order. How is the notifying object expected to interact with the subscribing objects? The ``notify`` method implements a one-way communication paradigm: the notifier sends a message without expecting a response back (in other words it fires and forget). However, due to the nature of Python, the payload can be mutated by the subscribing objects, and this can lead to unexpected behavior of your code, if you assume that this is the intentional design. Bear in mind, that passing-by-value using deepcopy was not chosen for efficiency reasons. Having said that, if you intend for the notifier object to expect a response, then the notifier itself would need to act as a subscriber. Is the registry thread-safe? Short answer is no: it is not safe to make mutations while callbacks are being called (more details as to why can be found line 937 of `dictobject `_). A mutation could happen if a 'subscribe'/'unsubscribe' operation interleaves with the execution of the notify loop. Albeit there is a possibility that things may end up in a bad state, the registry works correctly under the assumption that subscriptions happen at the very beginning of the life of the process and that the unsubscriptions (if any) take place at the very end. In this case, chances that things do go badly may be pretty slim. Making the registry thread-safe will be considered as a future improvement. What kind of function can be a callback? Anything you fancy: lambdas, 'closures', class, object or module methods. For instance: :: from neutron_lib.callbacks import events from neutron_lib.callbacks import resources from neutron_lib.callbacks import registry def callback1(resource, event, trigger, payload): print('module callback') class MyCallback(object): def callback2(self, resource, event, trigger, payload): print('object callback') @classmethod def callback3(cls, resource, event, trigger, payload): print('class callback') c = MyCallback() registry.subscribe(callback1, resources.ROUTER, events.BEFORE_CREATE) registry.subscribe(c.callback2, resources.ROUTER, events.BEFORE_CREATE) registry.subscribe(MyCallback.callback3, resources.ROUTER, events.BEFORE_CREATE) def do_notify(): def nested_subscribe(resource, event, trigger, payload): print('nested callback') registry.subscribe(nested_subscribe, resources.ROUTER, events.BEFORE_CREATE) registry.publish(resources.ROUTER, events.BEFORE_CREATE, do_notify, events.EventPayload(None)) print('Notifying...') do_notify() And the output is going to be: :: Notifying... module callback object callback class callback nested callback neutron-lib-2.3.0/doc/source/contributor/api_attributes.rst0000664000175000017500000001103513641427107024171 0ustar zuulzuul00000000000000.. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Convention for heading levels in Neutron devref: ======= Heading 0 (reserved for the title in a document) ------- Heading 1 ~~~~~~~ Heading 2 +++++++ Heading 3 ''''''' Heading 4 (Avoid deeper levels because they do not render well.) API Attributes ============== Neutron's resource attributes are defined in dictionaries in ``api/definitions``. The map containing all installed resources (for core and active extensions) is in ``api/attributes.py``. Attribute map structure ----------------------- Example attribute definitions for ``dns_name``: .. code-block:: python 'dns_name': { 'allow_post': True, 'allow_put': True, 'default': '', 'convert_to': convert_to_lowercase, 'validate': {'type:dns_name': FQDN_MAX_LEN}, 'is_visible': True }, The ``validate`` item specifies rules for `validating `_ the attribute. The ``convert_to`` item specifies rules for `converting `_ the attribute. Example attribute definitions for ``gateway_ip``: .. code-block:: python 'gateway_ip': { 'allow_post': True, 'allow_put': True, 'default': constants.ATTR_NOT_SPECIFIED, 'validate': {'type:ip_address_or_none': None}, 'is_visible': True } Note: a default of ``ATTR_NOT_SPECIFIED`` indicates that an attribute is not required, but will be generated by the plugin if it is not specified. Particularly, a value of ``ATTR_NOT_SPECIFIED`` is different from an attribute that has been specified with a value of ``None``. For example, if ``gateway_ip`` is omitted in a request to create a subnet, the plugin will receive ``ATTR_NOT_SPECIFIED`` and the default gateway IP will be generated. However, if ``gateway_ip`` is specified as ``None``, this means that the subnet does not have a gateway IP. The following are the defined keys for attribute maps: ========================== ====== ``default`` default value of the attribute (if missing, the attribute becomes mandatory) ``allow_post`` the attribute can be used on ``POST`` requests ``allow_put`` the attribute can be used on ``PUT`` requests ``validate`` specifies rules for validating data in the attribute ``convert_to`` transformation to apply to the value before it is returned ``convert_list_to`` if the value is a list, apply this transformation to the value before it is returned ``is_filter`` the attribute can be used in ``GET`` requests as filter ``is_sort_key`` the attribute can be used in ``GET`` requests as sort_key ``is_visible`` the attribute is returned in ``GET`` responses ``required_by_policy`` the attribute is required by the policy engine and should therefore be filled by the API layer even if not present in request body ``enforce_policy`` the attribute is actively part of the policy enforcing mechanism, ie: there might be rules which refer to this attribute ``primary_key`` Mark the attribute as a unique key. ``default_overrides_none`` if set, if the value passed is None, it will be replaced by the ``default`` value ``dict_populate_defaults`` if set, the ``default`` values of keys inside dict attributes, will be filled if not specified ========================== ====== When extending existing sub-resources, the sub-attribute map must define all extension attributes under the ``parameters`` object. This instructs the API internals to add the attributes to the existing sub-resource rather than overwrite its existing definition. For example: .. code-block:: python SUB_RESOURCE_ATTRIBUTE_MAP = { 'existing_subresource_to_extend': { 'parameters': { 'new_attr1': { 'allow_post': False, # etc.. } } } } neutron-lib-2.3.0/doc/source/contributor/db_model_query.rst0000664000175000017500000000446113641427107024151 0ustar zuulzuul00000000000000.. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Convention for heading levels in Neutron devref: ======= Heading 0 (reserved for the title in a document) ------- Heading 1 ~~~~~~~ Heading 2 +++++++ Heading 3 ''''''' Heading 4 (Avoid deeper levels because they do not render well.) DB Model Query ============== The implementation in ``neutron_lib.db.model_query`` is intended to be used as a stepping stone for existing consumers using standard database models/tables. Moving forward new database implementations should all use neutron's Versioned Object approach, while existing model based implementations should begin migrating to Versioned Objects. Registering Hooks ----------------- The ``neutron_lib.db.model_query.register_hook`` function allows hooks to be registered for invocation during a respective database query. Each hook has three components: - "query": used to build the query expression - "filter": used to build the filter expression - "result_filters": used for final filtering on the query result Query hooks take as input the query being built and return a transformed query expression. For example:: def mymodel_query_hook(context, original_model, query): augmented_query = ... return augmented_query Filter hooks take as input the filter expression being built and return a transformed filter expression. For example:: def mymodel_filter_hook(context, original_model, filters): refined_filters = ... return refined_filters Result filter hooks take as input the query expression and the filter expression, and return a final transformed query expression. For example:: def mymodel_result_filter_hook(query, filters): final_filters = ... return query.filter(final_filters) neutron-lib-2.3.0/doc/source/contributor/contributing.rst0000664000175000017500000002046513641427107023670 0ustar zuulzuul00000000000000============ Contributing ============ .. include:: ../../../CONTRIBUTING.rst As your code is subject to the `review guidelines <./review-guidelines.html>`_, please take the time to familiarize yourself with those guidelines. Rehoming Existing Code ---------------------- The checklist below aims to provide guidance for developers rehoming (moving) code into neutron-lib. Rehoming approaches that fall outside the scope herein will need to be considered on a case by case basis. The rehoming workflow procedure has four main phases: #. `Phase 1: Rehome`_ the code from neutron into neutron-lib. #. `Phase 2: Enhance`_ the code in neutron-lib if necessary. #. `Phase 3: Release`_ neutron-lib with the code so consumers can use it. #. `Phase 4: Consume`_ by removing the rehomed code from its source and changing references to use neutron-lib. Phase 1: Rehome ~~~~~~~~~~~~~~~ #. Identify the chunk of code for rehoming. Applicable code includes common classes/functions/modules/etc. that are consumed by networking project(s) outside of neutron. Optimal consumption patterns of the code at hand must also be considered to ensure the rehomed code addresses any technical debt. Finally, leave low-hanging fruit for last and tackle the most commonly used code first. If you have any doubt about the applicability of code for rehoming, reach out to one of the neutron core developers before digging in. #. Find and identify any unit tests for the code being rehomed. These unit tests can often be moved into neutron-lib with minimal effort. After inspecting the applicable unit tests, rewrite any that are non-optimal. #. Search and understand the consumers of the code being rehomed. This must include other networking projects in addition to neutron itself. At this point it may be determined that the code should be refactored before it is consumed. There are a few common strategies for refactoring, and the one chosen will depend on the nature of the code at hand: - Refactor/enhance the code as part of the initial neutron-lib patch. If this change will be disruptive to consumers, clearly communicate the change via email list or `meeting topic `_. - Leave the refactoring to the next (Enhance) phase. In this rehome phase, copy the code as-is into a private module according to our `conventions <./conventions.html>`_. This approach is slower, but may be necessary in some cases. #. Understand existing work underway which may impact the rehomed code, for example, in-flight patch sets that update the code being rehomed. In some cases it may make sense to let the in-flight patch merge and solidify a bit before rehoming. #. Prepare the code for neutron-lib. This may require replacing existing imports with those provided by neutron-lib and/or rewriting/rearchitecting non-optimal code (see above). The interfaces in the rehomed code are subject to our `conventions <./conventions.html>`_. #. Prepare the unit test code for neutron-lib. As indicated in the `review guidelines <./review-guidelines.html>`_ we are looking for a high code coverage by tests. This may require adding additional tests if neutron was lacking in coverage. #. Submit and shepherd your patch through its neutron-lib review. Include a `release note `_ that describes the code's old neutron location and new neutron-lib location. Also note that in some cases it makes sense to prototype a change in a consumer project to better understand the impacts of the change, which can be done using the ``Depends-On:`` approach described in the `review guidelines <./review-guidelines.html>`_ Examples: - `319769 `_ brought over a number of common utility functions as-is from neutron into a new package structure within neutron-lib. - `253661 `_ rehomed neutron callbacks into a private package that's enhanced via `346554 `_. - `319386 `_ rehomes a validator from neutron into neutron-lib. Phase 2: Enhance ~~~~~~~~~~~~~~~~ If the rehomed code is not applicable for enhancements and wasn't made private in Phase 1, you can skip this step. Develop and shepherd the enhancements to the private rehomed code applicable at this time. Private APIs made public as part of this phase will also need `release notes `_ indicating the new public functionality. Examples: - `346554 `_ enhances the rehomed private callback API in neutron-lib. Phase 3: Release ~~~~~~~~~~~~~~~~ A new neutron-lib release can be cut at any time. You can also request a release by following the README instructions in the `openstack/releases `_ project. Once a release is cut, an openstack infra proposal bot will submit patches to the master branch of all projects that consume neutron-lib to set the new release as the minimum requirement. Someone from the neutron release team can bump `global requirements` (g-r); for example `review 393600 `_. When the bot-proposed requirement patches have merged, your rehomed code can be consumed. Phase 4: Consume ~~~~~~~~~~~~~~~~ It's critical that before you submit your patch to remove the rehomed code from its source that you perform a diff between it and the rehomed version in neutron-lib to ensure nothing has changed in the source. If something has changed in the source, you need to push and shepherd a patch to neutron-lib with the difference(s) before proceeding with this consumption phase. The following guidelines are intended to provide a smooth transition to the rehomed code in neutron-lib and minimize impacts to subprojects consuming the rehomed code from its source. - If the change to consume the code from neutron-lib is widespread and/or "important", introduce your intentions for the change via the Neutron team `meeting slot `_ for neutron-lib. Subsequently follow-up with an email to openstack-discuss list using a subject with ``[neutron] neutron-lib impact`` providing additional details as necessary. Ideally we can identify the main impacted subprojects by `grepping the OpenStack code `_. - Prepare a neutron core patch to remove and update the rehomed code from its source. This can be done without a `debtcollector `_ notice by following the steps here. In the patch's commit message include the ``NeutronLibImpact`` so that we can easily `query `_ for such changes. Mark the patch as a work in progress with a -1 workflow vote. - If the change is significant enough, it may warrant a "reference implementation" in an impacted subproject to ensure the impacts are fully understood. Testing this change can be done using the ``Depends-On:`` approach described in the `review guidelines <./review-guidelines.html>`_. - If you are a core reviewer and about to approve a NeutronLibImpact change, please consider checking the state of all Stadium subprojects by looking at the `grafana periodic dashboard `_. This dashboard shows the status of subprojects' unit tests against neutron and neutron-lib master branches, and even though it is not exactly validating unit tests against a released version of neutron-lib it may be enough of an alarm bell to indicate that something might be wrong because of a patch that recently landed in neutron (assuming that the subprojects still has direct neutron imports). The check happens daily therefore consider waiting to approve if you are either aware of another impactful change recently merged that has not been yet processed or you see failure rates spiking. - All projects that have `neutron-lib-current `_ should also be updated as part of consumption. Examples: - `348472 `_ removes a validator in neutron that was rehomed to neutron-lib. neutron-lib-2.3.0/doc/source/contributor/api_extensions.rst0000664000175000017500000000672513641427107024214 0ustar zuulzuul00000000000000.. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Convention for heading levels in Neutron devref: ======= Heading 0 (reserved for the title in a document) ------- Heading 1 ~~~~~~~ Heading 2 +++++++ Heading 3 ''''''' Heading 4 (Avoid deeper levels because they do not render well.) API Extensions ============== API extensions provide a standardized way of introducing new API functionality. While the ``neutron-lib`` project itself does not serve an API, the ``neutron`` project does and leverages the API extension framework from ``neutron-lib``. API extensions consist of the following high-level constructs: - API definitions that specify the extension's static metadata. This metadata includes basic details about the extension such as its name, description, alias, etc. as well as its extended resources/sub-resources and required/optional extensions. These definitions live in the ``neutron_lib.api.definitions`` package. - API reference documenting the APIs/resources added/modified by the extension. This documentation is in ``rst`` format and is used to generate the `OpenStack Networking API reference `_. The API reference lives under the ``api-ref/source/v2`` directory of the ``neutron-lib`` project repository. - An extension descriptor class that must be defined in an extension directory for ``neutron`` or other sub-project that supports extensions. This concrete class provides the extension's metadata to the API server. These extension classes reside outside of ``neutron-lib``, but leverage the base classes from ``neutron_lib.api.extensions``. For more details see the section below on using neutron-lib's extension classes. - The API extension plugin implementation itself. This is the code that implements the extension's behavior and should carry out the operations defined by the extension. This code resides under its respective project repository, not in ``neutron-lib``. For more details see the `neutron api extension dev-ref `_. Using neutron-lib's base extension classes ------------------------------------------ The ``neutron_lib.api.extensions`` module provides a set of base extension descriptor classes consumers can use to define their extension descriptor(s). For those extensions that have an API definition in ``neutron_lib.api.definitions``, the ``APIExtensionDescriptor`` class can be used. For example:: from neutron_lib.api.definitions import provider_net from neutron_lib.api import extensions class Providernet(extensions.APIExtensionDescriptor): api_definition = provider_net # nothing else needed if default behavior is acceptable For extensions that do not yet have a definition in ``neutron_lib.api.definitions``, they can continue to use the ``ExtensionDescriptor`` as has been done historically. neutron-lib-2.3.0/doc/source/contributor/api_validators.rst0000664000175000017500000000661413641427107024162 0ustar zuulzuul00000000000000.. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Convention for heading levels in Neutron devref: ======= Heading 0 (reserved for the title in a document) ------- Heading 1 ~~~~~~~ Heading 2 +++++++ Heading 3 ''''''' Heading 4 (Avoid deeper levels because they do not render well.) API Validators ============== For the REST API, attributes may have custom validators defined. Each validator will have a method to perform the validation, and a type definition string, so that the validator can be referenced. Defining A Validator Method --------------------------- The validation method will have a positional argument for the data to be validated, and may have additional (optional) keyword arguments that can be used during validation. The method must handle any exceptions and either return None (success) or a i18n string indicating the validation failure message. By convention, the method name is prefixed with ``validate_`` and then includes the data type. For example: :: def validate_uuid(data, valid_values=None): if not uuidutils.is_uuid_like(data): msg = _("'%s' is not a valid UUID") % data LOG.debug(msg) return msg There is a validation dictionary that maps the method to a validation type that can be referred to in REST API definitions. An entry in the dictionary would look like the following: :: 'type:uuid': validate_uuid, Using Validators ---------------- In client code, the validator can be used in a REST API by using the dictionary key for the validator. For example: :: NETWORKS: { 'id': {'allow_post': False, 'allow_put': False, 'validate': {'type:uuid': None}, 'is_visible': True, 'primary_key': True}, 'name': {'allow_post': True, 'allow_put': True, 'validate': {'type:string': NAME_MAX_LEN}, 'default': '', 'is_visible': True}} Here, the networks resource has an 'id' attribute with a UUID validator, as seen by the 'validate' key containing a dictionary with a key of 'type:uuid'. Any addition arguments for the validator can be specified as values for the dictionary entry (None in this case, NAME_MAX_LEN in the 'name' attribute that uses a string validator). In a IP version attribute, one could have a validator defined as follows: :: 'ip_version': {'allow_post': True, 'allow_put': False, 'convert_to': conversions.convert_to_int, 'validate': {'type:values': [4, 6]}, 'is_visible': True}} Here, the validate_values() method will take the list of values as the allowable values that can be specified for this attribute. Test The Validator ------------------ Do the right thing, and make sure you've created a unit test for any validator that you add to verify that it works as expected, even for simple validators. neutron-lib-2.3.0/CONTRIBUTING.rst0000664000175000017500000000130213641427107016436 0ustar zuulzuul00000000000000If you would like to contribute to the development of OpenStack, you must follow the steps in this page: https://docs.openstack.org/infra/manual/developers.html If you already have a good understanding of how the system works and your OpenStack accounts are set up, you can skip to the development workflow section of this documentation to learn how changes to OpenStack should be submitted for review via the Gerrit tool: https://docs.openstack.org/infra/manual/developers.html#development-workflow Pull requests submitted through GitHub will be ignored. Bugs should be filed on Launchpad in the neutron project using the ``lib`` tag, not GitHub: https://bugs.launchpad.net/neutron/+bugs?field.tag=lib neutron-lib-2.3.0/api-ref/0000775000175000017500000000000013641427200015316 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/0000775000175000017500000000000013641427200016616 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/index.rst0000664000175000017500000000016313641427107020465 0ustar zuulzuul00000000000000======================= Networking Service APIs ======================= .. toctree:: :maxdepth: 2 v2/index neutron-lib-2.3.0/api-ref/source/v2/0000775000175000017500000000000013641427200017145 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/segments.inc0000664000175000017500000001221313641427107021472 0ustar zuulzuul00000000000000.. -*- rst -*- ======== Segments ======== Lists, shows details for, creates, updates, and deletes segments. The segments API is admin-only. Resource timestamps =================== The ``standard-attr-timestamp`` extension adds the ``created_at`` and ``updated_at`` attributes to all resources that have standard attributes. Show segment details ==================== .. rest_method:: GET /v2.0/segments/{segment_id} Shows details for a segment. You can control which response parameters are returned by using the fields query parameter. For information, see `Filtering and column selection `__. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - segment_id: segment_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - id: segment_id - network_id: network_id - physical_network: provider:physical_network - network_type: network_type - revision_number: revision_number - segmentation_id: provider:segmentation_id - name: name - description: description - created_at: created_at_resource - updated_at: updated_at_resource Response Example ---------------- .. literalinclude:: samples/segments/segment-show-response.json :language: javascript Update segment ============== .. rest_method:: PUT /v2.0/segments/{segment_id} Updates a segment. Normal response codes: 200 Error response codes: 400, 401, 403, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - segment_id: segment_id-path - name: name-segment - description: description-request Request Example --------------- .. literalinclude:: samples/segments/segment-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - id: segment_id - network_id: network_id - physical_network: provider:physical_network - network_type: network_type - revision_number: revision_number - segmentation_id: provider:segmentation_id - name: name - description: description - created_at: created_at_resource - updated_at: updated_at_resource Response Example ---------------- .. literalinclude:: samples/segments/segment-update-response.json :language: javascript Delete segment ============== .. rest_method:: DELETE /v2.0/segments/{segment_id} Deletes a segment and its associated resources. Normal response codes: 204 Error response codes: 401, 404, 409, 412 Request ------- .. rest_parameters:: parameters.yaml - segment_id: segment_id-path Response -------- There is no body content for the response of a successful DELETE request. List segments ============= .. rest_method:: GET /v2.0/segments Lists segments to which the project has access. Use the ``fields`` query parameter to filter the response. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - id: id-query - network_id: network_id-query - physical_network: provider:physical_network-query - network_type: provider:network_type-query - revision_number: revision_number-query - segmentation_id: provider:segmentation_id-query - name: name-query - description: description-query - sort_dir: sort_dir - sort_key: segment-sort_key - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - id: segment_id - network_id: network_id - physical_network: provider:physical_network - network_type: network_type - revision_number: revision_number - segmentation_id: provider:segmentation_id - name: name - description: description - created_at: created_at_resource - updated_at: updated_at_resource Response Example ---------------- .. literalinclude:: samples/segments/segments-list-response.json :language: javascript Create segment ============== .. rest_method:: POST /v2.0/segments Creates a segment. Normal response codes: 201 Error response codes: 400, 401 Request ------- .. rest_parameters:: parameters.yaml - network_id: network_id - physical_network: provider:physical_network - network_type: network_type - segmentation_id: provider:segmentation_id - name: name-segment - description: description-request Request Example --------------- .. literalinclude:: samples/segments/segment-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - id: segment_id - network_id: network_id - physical_network: provider:physical_network - network_type: network_type - revision_number: revision_number - segmentation_id: provider:segmentation_id - name: name - description: description - created_at: created_at_resource - updated_at: updated_at_resource Response Example ---------------- .. literalinclude:: samples/segments/segment-create-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/subnetpools.inc0000664000175000017500000001752013641427107022230 0ustar zuulzuul00000000000000.. -*- rst -*- ==================================== Subnet pools extension (subnetpools) ==================================== Lists, creates, shows details for, updates, and deletes subnet pools. Address Scopes Extension ======================== The ``address-scope`` extension adds the ``address_scope_id`` attribute to subnet pools. ``address_scope_id`` is the ID of the address scope that the subnet pool belongs to. Resource timestamps =================== The ``standard-attr-timestamp`` extension adds the ``created_at`` and ``updated_at`` attributes to all resources that have standard attributes. Tag extension ============= The ``standard-attr-tag`` adds Tag support for resources with standard attributes by adding the ``tags`` attribute allowing consumers to associate tags with resources. Show subnet pool ================ .. rest_method:: GET /v2.0/subnetpools/{subnetpool_id} Shows information for a subnet pool. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - subnetpool_id: subnetpool_id - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - subnetpool: subnetpool - id: subnetpool_id_body - name: name - default_quota: default_quota - tenant_id: project_id - project_id: project_id - created_at: created_at_resource - updated_at: updated_at_resource - prefixes: prefixes - min_prefixlen: min_prefixlen - address_scope_id: address_scope_id - ip_version: ip_version - shared: shared - default_prefixlen: default_prefixlen - max_prefixlen: max_prefixlen - description: description - is_default: subnetpool_is_default - revision_number: revision_number - tags: tags Response Example ---------------- .. literalinclude:: samples/subnets/subnetpool-show-response.json :language: javascript Update subnet pool ================== .. rest_method:: PUT /v2.0/subnetpools/{subnetpool_id} Updates a subnet pool. Normal response codes: 200 Error response codes: 400, 401, 403, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - subnetpool_id: subnetpool_id - subnetpool: subnetpool - name: name - default_quota: default_quota - tenant_id: project_id - project_id: project_id - prefixes: prefixes - min_prefixlen: min_prefixlen - address_scope_id: address_scope_id - default_prefixlen: default_prefixlen - max_prefixlen: max_prefixlen - description: description-request - is_default: subnetpool_is_default-request Request Example --------------- .. literalinclude:: samples/subnets/subnetpool-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - subnetpool: subnetpool - id: subnetpool_id_body - name: name - default_quota: default_quota - tenant_id: project_id - project_id: project_id - created_at: created_at_resource - updated_at: updated_at_resource - prefixes: prefixes - min_prefixlen: min_prefixlen - address_scope_id: address_scope_id - ip_version: ip_version - shared: shared - default_prefixlen: default_prefixlen - max_prefixlen: max_prefixlen - description: description - is_default: subnetpool_is_default - revision_number: revision_number - tags: tags Response Example ---------------- .. literalinclude:: samples/subnets/subnetpool-update-response.json :language: javascript Delete subnet pool ================== .. rest_method:: DELETE /v2.0/subnetpools/{subnetpool_id} Deletes a subnet pool. The operation fails if any subnets allocated from the subnet pool are still in use. Normal response codes: 204 Error response codes: 401, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - subnetpool_id: subnetpool_id Response -------- There is no body content for the response of a successful DELETE request. List subnet pools ================= .. rest_method:: GET /v2.0/subnetpools Lists subnet pools that the project has access to. Default policy settings return only the subnet pools owned by the project of the user submitting the request, unless the user has administrative role. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - id: id-query - name: name-query - default_quota: default_quota-query - tenant_id: project_id-query - project_id: project_id-query - min_prefixlen: min_prefixlen-query - address_scope_id: address_scope_id-query - ip_version: ip_version-query - shared: shared-query - default_prefixlen: default_prefixlen-query - max_prefixlen: max_prefixlen-query - description: description-query - is_default: subnetpool_is_default-query - revision_number: revision_number-query - sort_dir: sort_dir - sort_key: subnetpool-sort_key - tags: tags-query - tags-any: tags-any-query - not-tags: not-tags-query - not-tags-any: not-tags-any-query - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - subnetpools: subnetpools - id: subnetpool_id_body - name: name - default_quota: default_quota - tenant_id: project_id - project_id: project_id - created_at: created_at_resource - updated_at: updated_at_resource - prefixes: prefixes - min_prefixlen: min_prefixlen - address_scope_id: address_scope_id - ip_version: ip_version - shared: shared - default_prefixlen: default_prefixlen - max_prefixlen: max_prefixlen - description: description - is_default: subnetpool_is_default - revision_number: revision_number - tags: tags Response Example ---------------- .. literalinclude:: samples/subnets/subnetpools-list-response.json :language: javascript Create subnet pool ================== .. rest_method:: POST /v2.0/subnetpools Creates a subnet pool. Normal response codes: 201 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - subnetpool: subnetpool - name: name - default_quota: default_quota - tenant_id: project_id - project_id: project_id - prefixes: prefixes - min_prefixlen: min_prefixlen - address_scope_id: address_scope_id - shared: shared - default_prefixlen: default_prefixlen - max_prefixlen: max_prefixlen - description: description-request - is_default: subnetpool_is_default Request Example --------------- .. literalinclude:: samples/subnets/subnetpool-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - subnetpool: subnetpool - id: subnetpool_id_body - name: name - default_quota: default_quota - tenant_id: project_id - project_id: project_id - created_at: created_at_resource - updated_at: updated_at_resource - prefixes: prefixes - min_prefixlen: min_prefixlen - address_scope_id: address_scope_id - ip_version: ip_version - shared: shared - default_prefixlen: default_prefixlen - max_prefixlen: max_prefixlen - description: description - is_default: subnetpool_is_default - revision_number: revision_number - tags: tags Response Example ---------------- .. literalinclude:: samples/subnets/subnetpool-create-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/bgpvpn-bgpvpns.inc0000664000175000017500000001376113641427107022627 0ustar zuulzuul00000000000000.. -*- rst -*- ======== BGP VPNs ======== A new BGPVPN resource is introduced. It contains a set of parameters for a BGP-based VPN. A BGPVPN is created by the admin and given to a tenant who can then associate it to Networks, Routers or Ports (the latter when the ``bgpvpn-routes-control`` extension is available). The BGP VPNs API lists, shows details for, creates, updates, and deletes BGP VPNs. List BGP VPNs ============= .. rest_method:: GET /v2.0/bgpvpn/bgpvpns Lists BGP VPNs to which the project has access. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 400, 401, 403 Request ------- .. rest_parameters:: parameters.yaml - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - bgpvpns: bgpvpns - id: bgpvpn-id-body - name: bgpvpn-name-required - type: bgpvpn-type-required - route_distinguishers: bgpvpn-route_distinguishers-required - route_targets: bgpvpn-route_targets-required - import_targets: bgpvpn-import_targets-required - export_targets: bgpvpn-export_targets-required - networks: bgpvpn-networks-required - routers: bgpvpn-routers-required - ports: bgpvpn-ports - local_pref: bgpvpn-local_pref - vni: bgpvpn-vni-required - tenant_id: project_id - project_id: project_id Response Example ---------------- .. literalinclude:: samples/bgpvpn/bgpvpns/bgpvpns-list-response.json :language: javascript Create BGP VPNS =============== .. rest_method:: POST /v2.0/bgpvpn/bgpvpns Creates a BGP VPN. Normal response codes: 201 Error response codes: 400, 401 Request ------- .. rest_parameters:: parameters.yaml - bgpvpn: bgpvpn - name: bgpvpn-name - route_distinguishers: bgpvpn-route_distinguishers - route_targets: bgpvpn-route_targets - import_targets: bgpvpn-import_targets - export_targets: bgpvpn-export_targets - local_pref: bgpvpn-local_pref-request - vni: bgpvpn-vni - tenant_id: project_id-request - project_id: project_id-request - type: bgpvpn-type Request Example --------------- .. literalinclude:: samples/bgpvpn/bgpvpns/bgpvpn-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - bgpvpn: bgpvpn - id: bgpvpn-id-body - name: bgpvpn-name-required - type: bgpvpn-type-required - route_targets: bgpvpn-route_targets-required - import_targets: bgpvpn-import_targets-required - export_targets: bgpvpn-export_targets-required - networks: bgpvpn-networks-required - routers: bgpvpn-routers-required - ports: bgpvpn-ports - local_pref: bgpvpn-local_pref - vni: bgpvpn-vni-required - tenant_id: project_id - project_id: project_id Response Example ---------------- .. literalinclude:: samples/bgpvpn/bgpvpns/bgpvpn-create-response.json :language: javascript Show BGP VPN details ==================== .. rest_method:: GET /v2.0/bgpvpn/bgpvpns/{bgpvpn_id} Shows details for a BGP VPN. Normal response codes: 200 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - bgpvpn_id: bgpvpn-id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - bgpvpn: bgpvpn - id: bgpvpn-id-body - name: bgpvpn-name-required - type: bgpvpn-type-required - route_distinguishers: bgpvpn-route_distinguishers-required - route_targets: bgpvpn-route_targets-required - import_targets: bgpvpn-import_targets-required - export_targets: bgpvpn-export_targets-required - networks: bgpvpn-networks-required - routers: bgpvpn-routers-required - ports: bgpvpn-ports - local_pref: bgpvpn-local_pref - vni: bgpvpn-vni-required - tenant_id: project_id - project_id: project_id Response Example ---------------- .. literalinclude:: samples/bgpvpn/bgpvpns/bgpvpn-show-response.json :language: javascript Update a BGP VPN ================ .. rest_method:: PUT /v2.0/bgpvpn/bgpvpns/{bgpvpn_id} Updates a BGP VPN. Normal response codes: 201 Error response codes: 400, 401, 403, 404 Request ------- A non-admin user can only update the name parameter. All other updates require admin privileges. .. rest_parameters:: parameters.yaml - bgpvpn_id: bgpvpn-id-path - bgpvpn: bgpvpn - name: bgpvpn-name - route_distinguishers: bgpvpn-route_distinguishers - route_targets: bgpvpn-route_targets - import_targets: bgpvpn-import_targets - export_targets: bgpvpn-export_targets - local_pref: bgpvpn-local_pref-request Request Example --------------- .. literalinclude:: samples/bgpvpn/bgpvpns/bgpvpn-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - bgpvpn: bgpvpn - id: bgpvpn-id-body - name: bgpvpn-name-required - type: bgpvpn-type-required - route_distinguishers: bgpvpn-route_distinguishers-required - route_targets: bgpvpn-route_targets-required - import_targets: bgpvpn-import_targets-required - export_targets: bgpvpn-export_targets-required - networks: bgpvpn-networks-required - routers: bgpvpn-routers-required - ports: bgpvpn-ports - local_pref: bgpvpn-local_pref - vni: bgpvpn-vni-required - tenant_id: project_id - project_id: project_id Response Example ---------------- .. literalinclude:: samples/bgpvpn/bgpvpns/bgpvpn-update-response.json :language: javascript Delete BGP VPN ============== .. rest_method:: DELETE /v2.0/bgpvpn/bgpvpns/{bgpvpn_id} Deletes a BGP VPN and its network and/or router associations. Normal response codes: 204 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - bgpvpn_id: bgpvpn-id-path Response -------- There is no body content for the response of a successful DELETE request. neutron-lib-2.3.0/api-ref/source/v2/index.rst0000664000175000017500000000564213641427107021023 0ustar zuulzuul00000000000000:tocdepth: 2 ################### Networking API v2.0 ################### .. rest_expand_all:: #################### General API Overview #################### .. include:: intro.inc .. include:: versions.inc .. include:: extensions.inc ################## Layer 2 Networking ################## .. include:: networks.inc .. include:: network_segment_ranges.inc .. include:: ports.inc .. include:: segments.inc .. include:: trunk.inc .. include:: trunk-details.inc ################## Layer 3 Networking ################## .. include:: address-scopes.inc .. include:: l3-conntrack-helper.inc .. include:: floatingips.inc .. include:: floatingippools.inc .. include:: fip-port-forwarding.inc .. include:: routers.inc .. include:: subnetpools.inc .. include:: subnetpool_prefix_ops.inc .. include:: subnets.inc ######## Security ######## .. include:: fwaas-v2.inc .. include:: rbac-policy.inc .. include:: security-group-rules.inc .. include:: security-groups.inc .. include:: vpnaas.inc ################### Resource Management ################### .. include:: flavors.inc .. include:: metering.inc .. include:: network-ip-availability.inc .. include:: quotas.inc .. include:: quota_details.inc .. include:: service-providers.inc .. include:: tags.inc ################## Quality of Service ################## .. include:: qos.inc ########################################### Load Balancer as a Service 2.0 (DEPRECATED) ########################################### Neutron-lbaas is deprecated as of Queens. Load-Balancer-as-a-Service (LBaaS v2) is now provided by the `Octavia project `_. The `Octavia API v2 `_ is backwards compatible with the neutron-lbaas implementation of the LBaaS 2.0 API. Please see the FAQ at https://wiki.openstack.org/wiki/Neutron/LBaaS/Deprecation ##################################### Logging Resource (networking-midonet) ##################################### .. include:: logging_resource.inc .. include:: firewall_log.inc ################################################# Router interface floating IP (networking-midonet) ################################################# .. include:: router-interface-fip.inc ########################## FIP64 (networking-midonet) ########################## .. include:: fip64.inc ############################ BGP/MPLS VPN Interconnection ############################ .. include:: bgpvpn-overview.inc .. include:: bgpvpn-bgpvpns.inc .. include:: bgpvpn-network_associations.inc .. include:: bgpvpn-router_associations.inc .. include:: bgpvpn-port_associations.inc ####### Logging ####### .. include:: logging.inc ################# Networking Agents ################# .. include:: agents.inc .. include:: availability_zones.inc .. include:: l3-agent-scheduler.inc .. include:: dhcp-agent-scheduler.inc ####################### Auto Allocated Topology ####################### .. include:: auto-topology.inc neutron-lib-2.3.0/api-ref/source/v2/fip64.inc0000664000175000017500000000062513641427107020601 0ustar zuulzuul00000000000000.. -*- rst -*- ===== FIP64 ===== .. note:: Currently this extension ``fip64`` is only available for networking-midonet. This extension ``fip64`` provides `NAT64 `__ functionality by allowing to associate IPv6 floating IPs to IPv4 fixed IPs. (Without this extension, floating IPs are limited to IPv4.) This extension does not introduce any resources or attributes. neutron-lib-2.3.0/api-ref/source/v2/bgpvpn-router_associations.inc0000664000175000017500000001331413641427107025241 0ustar zuulzuul00000000000000.. -*- rst -*- =================== Router Associations =================== Associating a BGPVPN to a Router can be done only for BGPVPN of type L3. The semantic is that all Subnets bound to the Router will be interconnected with the BGPVPN. A said Router can be associated with multiple BGPVPNs. Associating or disassociating a BGPVPN to a Router is done by manipulating a Router association API resource as a sub-resource of the BGPVPN resource: Advertising router extra routes to a BGPVPN =========================================== The ``bgpvpn-routes-control`` API extension allows to control the re-advertisement of a router extra routes in a BGPVPN ("extra routes" are routes defined in the ``routes`` attribute of a router when the ``extraroute`` extension is available). The ``advertise_extra_routes`` attribute can in this case be set on a router_association: - ``true``: the extra routes defined in the ``routes`` attribute of the router will be advertised to the BGPVPN (default value) - ``false``: the extra routes defined in the ``routes`` attribute of the router will **not** be advertised to the BGPVPN List Router Associations ========================= .. rest_method:: GET /v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/router_associations Lists router associations for a given BGP VPN. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - bgpvpn_id: bgpvpn-id-path - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - router_associations: bgpvpn-router_associations - id: bgpvpn-router_association_id - router_id: bgpvpn-router_id - tenant_id: project_id - project_id: project_id Response Example ---------------- .. literalinclude:: samples/bgpvpn/router_associations/router_association-list-response.json :language: javascript Create Router Association ========================== .. rest_method:: POST /v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/router_associations Creates a router association for a given BGP VPN Normal response codes: 201 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - bgpvpn_id: bgpvpn-id-path - router_association: bgpvpn-router_association - router_id: bgpvpn-router_id Request Example --------------- .. literalinclude:: samples/bgpvpn/router_associations/router_association-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - router_association: bgpvpn-router_association - id: bgpvpn-router_association_id - router_id: bgpvpn-router_id - tenant_id: project_id - project_id: project_id Response Example ---------------- .. literalinclude:: samples/bgpvpn/router_associations/router_association-create-response.json :language: javascript Show Router Association details ================================ .. rest_method:: GET /v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/router_associations/{router_association_id} Shows details for a router association. Normal response codes: 200 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - bgpvpn_id: bgpvpn-id-path - router_association_id: bgpvpn-router_association_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - router_association: bgpvpn-router_association - id: bgpvpn-router_association_id - router_id: bgpvpn-router_id - tenant_id: project_id - project_id: project_id Response Example ---------------- .. literalinclude:: samples/bgpvpn/router_associations/router_association-show-response.json :language: javascript Update a Router Association ('bgpvpn-routes-control' extension) =============================================================== .. note:: This operation is only available when the ``bgpvpn-routes-control`` API extension is enabled. .. rest_method:: PUT /v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/router_associations/{router_association_id} Updates a router association. Normal response codes: 201 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - bgpvpn_id: bgpvpn-id-path - router_association_id: bgpvpn-router_association_id-path - router_association: bgpvpn-router_association - advertise_extra_routes: bgpvpn-advertise_extra_routes-request Request Example --------------- .. literalinclude:: samples/bgpvpn/router_associations/router_association-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - router_association: bgpvpn-router_association - id: bgpvpn-router_association_id - router_id: bgpvpn-router_id - project_id: project_id - advertise_extra_routes: bgpvpn-advertise_extra_routes Response Example ---------------- .. literalinclude:: samples/bgpvpn/router_associations/router_association-update-response.json :language: javascript Delete Router Association ========================== .. rest_method:: DELETE /v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/router_associations/{router_association_id} Deletes a router association. Normal response codes: 204 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - bgpvpn_id: bgpvpn-id-path - router_association_id: bgpvpn-router_association_id-path Response -------- There is no body content for the response of a successful DELETE request. neutron-lib-2.3.0/api-ref/source/v2/quota_details.inc0000664000175000017500000000160113641427107022502 0ustar zuulzuul00000000000000.. -*- rst -*- ======================================== Quotas details extension (quota_details) ======================================== Extends the ``quotas`` API to show a quota set for each project that includes the quota's used, limit and reserved counts per resource. A quota value of ``-1`` means that quota has no limit. Show quota details for a tenant =============================== .. rest_method:: GET /v2.0/quotas/{project_id}/details.json Shows quota details for a project. Normal response codes: 200 Error response codes: 401, 403 Request ------- .. rest_parameters:: parameters.yaml - project_id: project_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - quota: quota-detail Response Example ---------------- .. literalinclude:: samples/quota_details/quota-details-show-for-project-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/extensions.inc0000664000175000017500000000304713641427107022051 0ustar zuulzuul00000000000000.. -*- rst -*- ========== Extensions ========== Extensions introduce features and vendor-specific functionality to the API. List extensions =============== .. rest_method:: GET /v2.0/extensions Lists available extensions. Lists available Networking API v2.0 extensions and shows details for an extension. Normal response codes: 200 Error response codes: 401 Request ------- Response Parameters ------------------- .. rest_parameters:: parameters.yaml - extensions: extensions - name: extension-name - links: extension-links - alias: extension-alias-body - updated: extension-updated - description: extension-description Response Example ---------------- .. literalinclude:: samples/extensions/extensions-list-response.json :language: javascript Show extension details ====================== .. rest_method:: GET /v2.0/extensions/{alias} Shows details for an extension, by alias. The response shows the extension name and its alias. To show details for an extension, you specify the alias. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - alias: extensions-alias-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - extension: extension - name: extension-name - links: extension-links - alias: extension-alias-body - updated: extension-updated - description: extension-description Response Example ---------------- .. literalinclude:: samples/extensions/extension-show-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/samples/0000775000175000017500000000000013641427200020611 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/ports/0000775000175000017500000000000013641427200021760 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/ports/ports-list-response.json0000664000175000017500000000672713641427107026651 0ustar zuulzuul00000000000000{ "ports": [ { "admin_state_up": true, "allowed_address_pairs": [], "created_at": "2016-03-08T20:19:41", "data_plane_status": null, "description": "", "device_id": "9ae135f4-b6e0-4dad-9e91-3c223e385824", "device_owner": "network:router_gateway", "dns_assignment": [ { "hostname": "myport", "ip_address": "172.24.4.2", "fqdn": "myport.my-domain.org" } ], "dns_domain": "my-domain.org.", "dns_name": "myport", "extra_dhcp_opts": [ { "opt_value": "pxelinux.0", "ip_version": 4, "opt_name": "bootfile-name" } ], "fixed_ips": [ { "ip_address": "172.24.4.2", "subnet_id": "008ba151-0b8c-4a67-98b5-0d2b87666062" } ], "id": "d80b1a3b-4fc1-49f3-952e-1e2ab7081d8b", "ip_allocation": "immediate", "mac_address": "fa:16:3e:58:42:ed", "name": "", "network_id": "70c1db1f-b701-45bd-96e0-a313ee3430b3", "project_id": "", "revision_number": 1, "security_groups": [], "status": "ACTIVE", "tags": ["tag1,tag2"], "tenant_id": "", "updated_at": "2016-03-08T20:19:41", "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4", "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae", "port_security_enabled": false, "uplink_status_propagation": false }, { "admin_state_up": true, "allowed_address_pairs": [], "created_at": "2016-03-08T20:19:41", "data_plane_status": null, "description": "", "device_id": "9ae135f4-b6e0-4dad-9e91-3c223e385824", "device_owner": "network:router_interface", "dns_assignment": [ { "hostname": "myport2", "ip_address": "10.0.0.1", "fqdn": "myport2.my-domain.org" } ], "dns_domain": "my-domain.org.", "dns_name": "myport2", "extra_dhcp_opts": [ { "opt_value": "pxelinux.0", "ip_version": 4, "opt_name": "bootfile-name" } ], "fixed_ips": [ { "ip_address": "10.0.0.1", "subnet_id": "288bf4a1-51ba-43b6-9d0a-520e9005db17" } ], "id": "f71a6703-d6de-4be1-a91a-a570ede1d159", "ip_allocation": "immediate", "mac_address": "fa:16:3e:bb:3c:e4", "name": "", "network_id": "f27aa545-cbdd-4907-b0c6-c9e8b039dcc2", "project_id": "d397de8a63f341818f198abb0966f6f3", "revision_number": 1, "security_groups": [], "status": "ACTIVE", "tags": ["tag1,tag2"], "tenant_id": "d397de8a63f341818f198abb0966f6f3", "updated_at": "2016-03-08T20:19:41", "qos_network_policy_id": null, "qos_policy_id": null, "port_security_enabled": false, "uplink_status_propagation": false } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/ports/port-create-response.json0000664000175000017500000000340613641427107026745 0ustar zuulzuul00000000000000{ "port": { "admin_state_up": true, "allowed_address_pairs": [ { "ip_address": "12.12.11.12", "mac_address": "fa:14:2a:b3:cb:f0" } ], "created_at": "2016-03-08T20:19:41", "data_plane_status": null, "description": "", "device_id": "", "device_owner": "", "dns_assignment": [ { "hostname": "myport", "ip_address": "10.0.0.2", "fqdn": "myport.my-domain.org" } ], "dns_domain": "my-domain.org.", "dns_name": "myport", "extra_dhcp_opts": [ { "opt_value": "pxelinux.0", "ip_version": 4, "opt_name": "bootfile-name" } ], "fixed_ips": [ { "ip_address": "10.0.0.2", "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2" } ], "id": "65c0ee9f-d634-4522-8954-51021b570b0d", "ip_allocation": "immediate", "mac_address": "fa:16:3e:c9:cb:f0", "name": "private-port", "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", "port_security_enabled": true, "project_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa", "revision_number": 1, "security_groups": [ "f0ac4394-7e4a-4409-9701-ba8be283dbc3" ], "status": "DOWN", "tags": ["tag1,tag2"], "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa", "updated_at": "2016-03-08T20:19:41", "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4", "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae", "uplink_status_propagation": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/ports/ports-bulk-create-request.json0000664000175000017500000000063513641427107027716 0ustar zuulzuul00000000000000{ "ports": [ { "admin_state_up": false, "name": "sample_port_1", "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae" }, { "admin_state_up": false, "name": "sample_port_2", "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/ports/ports-bind-list-response.json0000664000175000017500000000774013641427107027557 0ustar zuulzuul00000000000000{ "ports": [ { "admin_state_up": true, "allowed_address_pairs": [], "binding:host_id": "devstack", "binding:profile": {}, "binding:vif_details": { "ovs_hybrid_plug": true, "port_filter": true }, "binding:vif_type": "ovs", "binding:vnic_type": "normal", "created_at": "2016-03-08T20:19:41", "data_plane_status": null, "description": "", "device_id": "9ae135f4-b6e0-4dad-9e91-3c223e385824", "device_owner": "network:router_gateway", "dns_assignment": [ { "hostname": "myport", "ip_address": "172.24.4.2", "fqdn": "myport.my-domain.org" } ], "dns_domain": "my-domain.org.", "dns_name": "myport", "extra_dhcp_opts": [], "fixed_ips": [ { "ip_address": "172.24.4.2", "subnet_id": "008ba151-0b8c-4a67-98b5-0d2b87666062" } ], "id": "d80b1a3b-4fc1-49f3-952e-1e2ab7081d8b", "ip_allocation": "immediate", "mac_address": "fa:16:3e:58:42:ed", "name": "", "network_id": "70c1db1f-b701-45bd-96e0-a313ee3430b3", "port_security_enabled": true, "project_id": "", "revision_number": 1, "security_groups": [], "status": "ACTIVE", "tenant_id": "", "updated_at": "2016-03-08T20:19:41", "qos_network_policy_id": null, "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae", "resource_request": { "required": ["CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"], "resources": {"NET_BW_EGR_KILOBIT_PER_SEC": 1000} }, "tags": ["tag1,tag2"], "tenant_id": "", "uplink_status_propagation": false }, { "admin_state_up": true, "allowed_address_pairs": [], "binding:host_id": "devstack", "binding:profile": {}, "binding:vif_details": { "ovs_hybrid_plug": true, "port_filter": true }, "binding:vif_type": "ovs", "binding:vnic_type": "normal", "created_at": "2016-03-08T20:19:41", "data_plane_status": null, "description": "", "device_id": "9ae135f4-b6e0-4dad-9e91-3c223e385824", "device_owner": "network:router_interface", "dns_assignment": [ { "hostname": "myport2", "ip_address": "10.0.0.1", "fqdn": "myport2.my-domain.org" } ], "dns_domain": "my-domain.org.", "dns_name": "myport2", "extra_dhcp_opts": [], "fixed_ips": [ { "ip_address": "10.0.0.1", "subnet_id": "288bf4a1-51ba-43b6-9d0a-520e9005db17" } ], "id": "f71a6703-d6de-4be1-a91a-a570ede1d159", "ip_allocation": "immediate", "mac_address": "fa:16:3e:bb:3c:e4", "name": "", "network_id": "f27aa545-cbdd-4907-b0c6-c9e8b039dcc2", "port_security_enabled": true, "project_id": "d397de8a63f341818f198abb0966f6f3", "revision_number": 2, "security_groups": [], "status": "ACTIVE", "tenant_id": "d397de8a63f341818f198abb0966f6f3", "updated_at": "2016-03-08T20:19:41", "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4", "qos_policy_id": null, "tags": ["tag1,tag2"], "tenant_id": "d397de8a63f341818f198abb0966f6f3", "uplink_status_propagation": false } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/ports/port-update-request.json0000664000175000017500000000040513641427107026612 0ustar zuulzuul00000000000000{ "port": { "admin_state_up": true, "device_id": "d90a13da-be41-461f-9f99-1dbcf438fdf2", "device_owner": "compute:nova", "name": "test-for-port-update", "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae" } } neutron-lib-2.3.0/api-ref/source/v2/samples/ports/port-update-response.json0000664000175000017500000000361713641427107026770 0ustar zuulzuul00000000000000{ "port": { "admin_state_up": true, "allowed_address_pairs": [], "binding:host_id": "test_for_port_update_host", "binding:profile": {}, "binding:vif_details": {}, "binding:vif_type": "binding_failed", "binding:vnic_type": "normal", "created_at": "2016-03-08T20:19:41", "data_plane_status": "ACTIVE", "description": "", "device_id": "d90a13da-be41-461f-9f99-1dbcf438fdf2", "device_owner": "compute:nova", "dns_assignment": [ { "hostname": "myport", "ip_address": "20.20.0.4", "fqdn": "myport.my-domain.org" } ], "dns_domain": "my-domain.org.", "dns_name": "myport", "extra_dhcp_opts": [ { "opt_value": "pxelinux.0", "ip_version": 4, "opt_name": "bootfile-name" } ], "fixed_ips": [ { "ip_address": "20.20.0.4", "subnet_id": "898dec4a-74df-4193-985f-c76721bcc746" } ], "id": "43c831e0-19ce-4a76-9a49-57b57e69428b", "ip_allocation": "immediate", "mac_address": "fa:16:3e:11:11:5e", "name": "test-for-port-update", "network_id": "883fc383-5ea1-4c8b-8916-e1ddb0a9f365", "project_id": "522eda8d23124b25bf03fe44f1986b74", "revision_number": 1, "security_groups": [ "ce0179d6-8a94-4f7c-91c2-f3038e2acbd0" ], "status": "DOWN", "tags": ["tag1,tag2"], "tenant_id": "522eda8d23124b25bf03fe44f1986b74", "updated_at": "2016-03-08T20:19:41", "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4", "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae", "port_security_enabled": false, "uplink_status_propagation": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/ports/port-show-response.json0000664000175000017500000000317413641427107026464 0ustar zuulzuul00000000000000{ "port": { "admin_state_up": true, "allowed_address_pairs": [], "created_at": "2016-03-08T20:19:41", "data_plane_status": "ACTIVE", "description": "", "device_id": "5e3898d7-11be-483e-9732-b2f5eccd2b2e", "device_owner": "network:router_interface", "dns_assignment": [ { "hostname": "myport", "ip_address": "10.0.0.1", "fqdn": "myport.my-domain.org" } ], "dns_domain": "my-domain.org.", "dns_name": "myport", "extra_dhcp_opts": [ { "opt_value": "pxelinux.0", "ip_version": 4, "opt_name": "bootfile-name" } ], "fixed_ips": [ { "ip_address": "10.0.0.1", "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2" } ], "id": "46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2", "ip_allocation": "immediate", "mac_address": "fa:16:3e:23:fd:d7", "name": "", "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", "port_security_enabled": false, "project_id": "7e02058126cc4950b75f9970368ba177", "revision_number": 1, "security_groups": [], "status": "ACTIVE", "tags": ["tag1,tag2"], "tenant_id": "7e02058126cc4950b75f9970368ba177", "updated_at": "2016-03-08T20:19:41", "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4", "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae", "uplink_status_propagation": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/ports/ports-bulk-create-response.json0000664000175000017500000000621413641427107030063 0ustar zuulzuul00000000000000{ "ports": [ { "admin_state_up": false, "allowed_address_pairs": [], "created_at": "2016-03-08T20:19:41", "data_plane_status": null, "description": "", "device_id": "", "device_owner": "", "dns_domain": "", "dns_name": "", "extra_dhcp_opts": [ { "opt_value": "pxelinux.0", "ip_version": 4, "opt_name": "bootfile-name" } ], "fixed_ips": [ { "ip_address": "10.0.0.5", "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2" } ], "id": "94225baa-9d3f-4b93-bf12-b41e7ce49cdb", "ip_allocation": "immediate", "mac_address": "fa:16:3e:48:b8:9f", "name": "sample_port_1", "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", "project_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa", "revision_number": 1, "security_groups": [ "f0ac4394-7e4a-4409-9701-ba8be283dbc3" ], "status": "DOWN", "tags": ["tag1,tag2"], "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa", "updated_at": "2016-03-08T20:19:41", "qos_network_policy_id": null, "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae", "port_security_enabled": false, "uplink_status_propagation": false }, { "admin_state_up": false, "allowed_address_pairs": [], "created_at": "2016-03-08T20:19:41", "data_plane_status": null, "description": "", "device_id": "", "device_owner": "", "dns_assignment": [], "dns_domain": "", "dns_name": "", "extra_dhcp_opts": [ { "opt_value": "pxelinux.0", "ip_version": 4, "opt_name": "bootfile-name" } ], "fixed_ips": [ { "ip_address": "10.0.0.6", "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2" } ], "id": "235b09e0-63c4-47f1-b221-66ba54c21760", "ip_allocation": "immediate", "mac_address": "fa:16:3e:f4:73:df", "name": "sample_port_2", "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", "project_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa", "revision_number": 1, "security_groups": [ "f0ac4394-7e4a-4409-9701-ba8be283dbc3" ], "status": "DOWN", "tags": ["tag1,tag2"], "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa", "updated_at": "2016-03-08T20:19:41", "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4", "qos_policy_id": null, "port_security_enabled": false, "uplink_status_propagation": false } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/ports/port-bind-update-response.json0000664000175000017500000000410213641427107027670 0ustar zuulzuul00000000000000{ "port": { "admin_state_up": true, "allowed_address_pairs": [], "binding:host_id": "test_for_port_update_host", "binding:profile": {}, "binding:vif_details": {}, "binding:vif_type": "binding_failed", "binding:vnic_type": "normal", "created_at": "2016-03-08T20:19:41", "data_plane_status": "DOWN", "description": "", "device_id": "d90a13da-be41-461f-9f99-1dbcf438fdf2", "device_owner": "compute:nova", "dns_assignment": [ { "hostname": "myport", "ip_address": "20.20.0.4", "fqdn": "myport.my-domain.org" } ], "dns_domain": "my-domain.org.", "dns_name": "myport", "extra_dhcp_opts": [ { "opt_value": "pxelinux.0", "ip_version": 4, "opt_name": "bootfile-name" } ], "fixed_ips": [ { "ip_address": "20.20.0.4", "subnet_id": "898dec4a-74df-4193-985f-c76721bcc746" } ], "id": "43c831e0-19ce-4a76-9a49-57b57e69428b", "ip_allocation": "immediate", "mac_address": "fa:16:3e:11:11:5e", "name": "test-for-port-update", "network_id": "883fc383-5ea1-4c8b-8916-e1ddb0a9f365", "project_id": "522eda8d23124b25bf03fe44f1986b74", "revision_number": 2, "security_groups": [ "ce0179d6-8a94-4f7c-91c2-f3038e2acbd0" ], "status": "DOWN", "tags": ["tag1,tag2"], "tenant_id": "522eda8d23124b25bf03fe44f1986b74", "updated_at": "2016-03-08T20:19:41", "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4", "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae", "port_security_enabled": false, "resource_request": { "required": ["CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"], "resources": {"NET_BW_EGR_KILOBIT_PER_SEC": 1000} }, "uplink_status_propagation": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/ports/port-bind-create-response.json0000664000175000017500000000466313641427107027665 0ustar zuulzuul00000000000000{ "port": { "admin_state_up": true, "allowed_address_pairs": [ { "ip_address": "12.12.11.12", "mac_address": "fa:14:2a:b3:cb:f0" } ], "binding:host_id": "4df8d9ff-6f6f-438f-90a1-ef660d4586ad", "binding:profile": { "local_link_information": [ { "port_id": "Ethernet3/1", "switch_id": "0a:1b:2c:3d:4e:5f", "switch_info": "switch1" } ] }, "binding:vif_details": {}, "binding:vif_type": "unbound", "binding:vnic_type": "other", "created_at": "2016-03-08T20:19:41", "data_plane_status": null, "description": "", "device_id": "d90a13da-be41-461f-9f99-1dbcf438fdf2", "device_owner": "baremetal:none", "dns_assignment": [ { "hostname": "myport", "ip_address": "10.0.0.2", "fqdn": "myport.my-domain.org" } ], "dns_domain": "my-domain.org.", "dns_name": "myport", "extra_dhcp_opts": [ { "opt_value": "pxelinux.0", "ip_version": 4, "opt_name": "bootfile-name" } ], "fixed_ips": [ { "ip_address": "10.0.0.2", "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2" } ], "id": "65c0ee9f-d634-4522-8954-51021b570b0d", "ip_allocation": "immediate", "mac_address": "fa:16:3e:c9:cb:f0", "name": "private-port", "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", "project_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa", "revision_number": 1, "security_groups": [ "f0ac4394-7e4a-4409-9701-ba8be283dbc3" ], "status": "DOWN", "tags": ["tag1,tag2"], "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa", "updated_at": "2016-03-08T20:19:41", "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4", "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae", "port_security_enabled": true, "resource_request": { "required": ["CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"], "resources": {"NET_BW_EGR_KILOBIT_PER_SEC": 1000} }, "uplink_status_propagation": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/ports/port-bind-create-request.json0000664000175000017500000000126113641427107027506 0ustar zuulzuul00000000000000{ "port": { "binding:host_id": "4df8d9ff-6f6f-438f-90a1-ef660d4586ad", "binding:profile": { "local_link_information": [ { "port_id": "Ethernet3/1", "switch_id": "0a:1b:2c:3d:4e:5f", "switch_info": "switch1" } ] }, "binding:vnic_type": "baremetal", "device_id": "d90a13da-be41-461f-9f99-1dbcf438fdf2", "device_owner": "baremetal:none", "dns_domain": "my-domain.org.", "dns_name": "myport", "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae", "uplink_status_propagation": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/ports/port-bind-show-response.json0000664000175000017500000000413113641427107027370 0ustar zuulzuul00000000000000{ "port": { "admin_state_up": true, "allowed_address_pairs": [], "binding:host_id": "devstack", "binding:profile": {}, "binding:vif_details": { "ovs_hybrid_plug": true, "port_filter": true }, "binding:vif_type": "ovs", "binding:vnic_type": "normal", "created_at": "2016-03-08T20:19:41", "data_plane_status": "ACTIVE", "description": "", "device_id": "5e3898d7-11be-483e-9732-b2f5eccd2b2e", "device_owner": "network:router_interface", "dns_assignment": [ { "hostname": "myport", "ip_address": "10.0.0.1", "fqdn": "myport.my-domain.org" } ], "dns_domain": "my-domain.org.", "dns_name": "myport", "extra_dhcp_opts": [ { "opt_value": "pxelinux.0", "ip_version": 4, "opt_name": "bootfile-name" } ], "fixed_ips": [ { "ip_address": "10.0.0.1", "subnet_id": "a0304c3a-4f08-4c43-88af-d796509c97d2" } ], "id": "46d4bfb9-b26e-41f3-bd2e-e6dcc1ccedb2", "ip_allocation": "immediate", "mac_address": "fa:16:3e:23:fd:d7", "mac_learning_enabled": false, "name": "", "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", "port_security_enabled": false, "project_id": "7e02058126cc4950b75f9970368ba177", "revision_number": 1, "security_groups": [], "status": "ACTIVE", "tags": ["tag1,tag2"], "tenant_id": "7e02058126cc4950b75f9970368ba177", "updated_at": "2016-03-08T20:19:41", "qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4", "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae", "resource_request": { "required": ["CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"], "resources": {"NET_BW_EGR_KILOBIT_PER_SEC": 1000} }, "uplink_status_propagation": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/ports/port-create-request.json0000664000175000017500000000103113641427107026567 0ustar zuulzuul00000000000000{ "port": { "admin_state_up": true, "dns_domain": "my-domain.org.", "dns_name": "myport", "name": "private-port", "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae", "port_security_enabled": true, "allowed_address_pairs": [ { "ip_address": "12.12.11.12", "mac_address": "fa:14:2a:b3:cb:f0" } ], "uplink_status_propagation": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/ports/port-bind-update-request.json0000664000175000017500000000043213641427107027524 0ustar zuulzuul00000000000000{ "port": { "binding:host_id": "test_for_port_update_host", "device_id": "d90a13da-be41-461f-9f99-1dbcf438fdf2", "data_plane_status": "DOWN", "device_owner": "compute:nova", "qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae" } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/0000775000175000017500000000000013641427200021413 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/qos/rule_types-list-response.json0000664000175000017500000000031513641427107027313 0ustar zuulzuul00000000000000{ "rule_types": [ { "type": "bandwidth_limit" }, { "type": "dscp_marking" }, { "type": "minimum_bandwidth" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/policies-list-response.json0000664000175000017500000000221613641427107026731 0ustar zuulzuul00000000000000{ "policies": [ { "project_id": "8d4c70a21fed4aeba121a1a429ba0d04", "tenant_id": "8d4c70a21fed4aeba121a1a429ba0d04", "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4", "is_default": false, "name": "10Mbit", "description": "This policy limits the ports to 10Mbit max.", "revision_number": 3, "created_at": "2018-04-03T21:26:39Z", "updated_at": "2018-04-03T21:26:39Z", "shared": false, "rules": [ { "max_kbps": 10000, "type": "bandwidth_limit", "id": "b1866696-032a-4228-857f-846075f63487", "max_burst_kbps": 0, "qos_policy_id": "46ebaec0-0570-43ac-82f6-60d2b03168c4" }, { "dscp_mark": 20, "type": "dscp_marking", "id": "d9c021d5-5433-4d7c-8bfa-69cca486aac8", "qos_policy_id": "46ebaec0-0570-43ac-82f6-60d2b03168c4" } ], "tags": ["tag1,tag2"] } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/minimum_bandwidth_rules-list-response.json0000664000175000017500000000027213641427107032033 0ustar zuulzuul00000000000000{ "minimum_bandwidth_rules": [ { "id": "1eddf7af-0b4c-42c5-8ae1-390b32f1de08", "min_kbps": 10000, "direction": "egress" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/bandwidth_limit_rule-show-response.json0000664000175000017500000000026413641427107031321 0ustar zuulzuul00000000000000{ "bandwidth_limit_rule": { "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c793", "max_kbps": 10000, "max_burst_kbps": 0, "direction": "egress" } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/dscp_marking_rule-update-response.json0000664000175000017500000000016313641427107031120 0ustar zuulzuul00000000000000{ "dscp_marking_rule": { "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c794", "dscp_mark": 16 } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/minimum_bandwidth_rule-show-response.json0000664000175000017500000000023113641427107031650 0ustar zuulzuul00000000000000{ "minimum_bandwidth_rule": { "id": "1eddf7af-0b4c-42c5-8ae1-390b32f1de08", "min_kbps": 10000, "direction": "egress" } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/minimum_bandwidth_rule-update-request.json0000664000175000017500000000010613641427107032005 0ustar zuulzuul00000000000000{ "minimum_bandwidth_rule": { "min_kbps": "20000" } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/bandwidth_limit_rules-list-response.json0000664000175000017500000000033113641427107031472 0ustar zuulzuul00000000000000{ "bandwidth_limit_rules": [ { "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c793", "max_kbps": 10000, "max_burst_kbps": 0, "direction": "egress" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/minimum_bandwidth_rule-create-response.json0000664000175000017500000000023113641427107032133 0ustar zuulzuul00000000000000{ "minimum_bandwidth_rule": { "id": "1eddf7af-0b4c-42c5-8ae1-390b32f1de08", "min_kbps": 10000, "direction": "egress" } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/policy-create-response.json0000664000175000017500000000100613641427107026705 0ustar zuulzuul00000000000000{ "policy": { "name": "10Mbit", "description": "This policy limits the ports to 10Mbit max.", "rules": [], "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4", "is_default": false, "project_id": "8d4c70a21fed4aeba121a1a429ba0d04", "revision_number": 1, "tenant_id": "8d4c70a21fed4aeba121a1a429ba0d04", "created_at": "2018-04-03T21:26:39Z", "updated_at": "2018-04-03T21:26:39Z", "shared": false, "tags": ["tag1,tag2"] } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/dscp_marking_rule-create-response.json0000664000175000017500000000016313641427107031101 0ustar zuulzuul00000000000000{ "dscp_marking_rule": { "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c794", "dscp_mark": 26 } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/dscp_marking_rule-update-request.json0000664000175000017500000000007713641427107030756 0ustar zuulzuul00000000000000{ "dscp_marking_rule": { "dscp_mark": "16" } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/bandwidth_limit_rule-update-response.json0000664000175000017500000000026413641427107031623 0ustar zuulzuul00000000000000{ "bandwidth_limit_rule": { "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c793", "max_kbps": 10000, "max_burst_kbps": 0, "direction": "egress" } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/minimum_bandwidth_rule-create-request.json0000664000175000017500000000010613641427107031766 0ustar zuulzuul00000000000000{ "minimum_bandwidth_rule": { "min_kbps": "10000" } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/policy-show-response.json0000664000175000017500000000202113641427107026420 0ustar zuulzuul00000000000000{ "policy": { "project_id": "8d4c70a21fed4aeba121a1a429ba0d04", "tenant_id": "8d4c70a21fed4aeba121a1a429ba0d04", "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4", "is_default": false, "name": "10Mbit", "description": "This policy limits the ports to 10Mbit max.", "revision_number": 3, "created_at": "2018-04-03T21:26:39Z", "updated_at": "2018-04-03T21:26:39Z", "shared": false, "rules": [ { "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c793", "qos_policy_id": "46ebaec0-0570-43ac-82f6-60d2b03168c4", "max_kbps": 10000, "max_burst_kbps": 0, "type": "bandwidth_limit" }, { "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c794", "qos_policy_id": "46ebaec0-0570-43ac-82f6-60d2b03168c4", "dscp_mark": 26, "type": "dscp_marking" } ], "tags": ["tag1,tag2"] } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/dscp_marking_rule-create-request.json0000664000175000017500000000007713641427107030737 0ustar zuulzuul00000000000000{ "dscp_marking_rule": { "dscp_mark": "26" } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/policy-create-request.json0000664000175000017500000000022213641427107026536 0ustar zuulzuul00000000000000{ "policy": { "name": "10Mbit", "description": "This policy limits the ports to 10Mbit max.", "shared": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/rule_type-details-response.json0000664000175000017500000000360513641427107027607 0ustar zuulzuul00000000000000{ "drivers": [ { "name": "openvswitch", "supported_parameters": [ { "parameter_name": "max_kbps", "parameter_type": "range", "parameter_values": { "end": 2147483647, "start": 0 } }, { "parameter_name": "direction", "parameter_type": "choices", "parameter_values": [ "ingress", "egress" ] }, { "parameter_name": "max_burst_kbps", "parameter_type": "range", "parameter_values": { "end": 2147483647, "start": 0 } } ] }, { "name": "linuxbridge", "supported_parameters": [ { "parameter_name": "max_kbps", "parameter_type": "range", "parameter_values": { "end": 2147483647, "start": 0 } }, { "parameter_name": "direction", "parameter_type": "choices", "parameter_values": [ "ingress", "egress" ] }, { "parameter_name": "max_burst_kbps", "parameter_type": "range", "parameter_values": { "end": 2147483647, "start": 0 } } ] } ], "type": "bandwidth_limit" } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/dscp_marking_rules-list-response.json0000664000175000017500000000022013641427107030766 0ustar zuulzuul00000000000000{ "dscp_marking_rules": [ { "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c794", "dscp_mark": 26 } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/dscp_marking_rule-show-response.json0000664000175000017500000000016313641427107030616 0ustar zuulzuul00000000000000{ "dscp_marking_rule": { "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c794", "dscp_mark": 26 } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/minimum_bandwidth_rule-update-response.json0000664000175000017500000000023113641427107032152 0ustar zuulzuul00000000000000{ "minimum_bandwidth_rule": { "id": "1eddf7af-0b4c-42c5-8ae1-390b32f1de08", "min_kbps": 20000, "direction": "egress" } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/bandwidth_limit_rule-create-response.json0000664000175000017500000000026413641427107031604 0ustar zuulzuul00000000000000{ "bandwidth_limit_rule": { "id": "5f126d84-551a-4dcf-bb01-0e9c0df0c793", "max_kbps": 10000, "max_burst_kbps": 0, "direction": "egress" } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/bandwidth_limit_rule-update-request.json0000664000175000017500000000010413641427107031446 0ustar zuulzuul00000000000000{ "bandwidth_limit_rule": { "max_kbps": "10000" } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/bandwidth_limit_rule-create-request.json0000664000175000017500000000010413641427107031427 0ustar zuulzuul00000000000000{ "bandwidth_limit_rule": { "max_kbps": "10000" } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/policy-update-response.json0000664000175000017500000000076113641427107026733 0ustar zuulzuul00000000000000{ "policy": { "name": "10Mbit", "description": "This policy limits the ports to 10Mbit max.", "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4", "is_default": false, "project_id": "8d4c70a21fed4aeba121a1a429ba0d04", "revision_number": 3, "created_at": "2018-04-03T21:26:39Z", "updated_at": "2018-04-03T21:26:39Z", "tenant_id": "8d4c70a21fed4aeba121a1a429ba0d04", "shared": false, "tags": ["tag1,tag2"] } } neutron-lib-2.3.0/api-ref/source/v2/samples/qos/policy-update-request.json0000664000175000017500000000022213641427107026555 0ustar zuulzuul00000000000000{ "policy": { "name": "10Mbit", "description": "This policy limits the ports to 10Mbit max.", "shared": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/quotas/0000775000175000017500000000000013641427200022125 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/quotas/quotas-update-response.json0000664000175000017500000000040013641427107027450 0ustar zuulzuul00000000000000{ "quota": { "subnet": 10, "network": 15, "floatingip": 50, "subnetpool": -1, "security_group_rule": 100, "security_group": 10, "router": 10, "rbac_policy": -1, "port": 50 } } neutron-lib-2.3.0/api-ref/source/v2/samples/quotas/quotas-update-request.json0000664000175000017500000000040013641427107027302 0ustar zuulzuul00000000000000{ "quota": { "floatingip": 50, "network": 10, "port": 50, "rbac_policy": -1, "router": 10, "security_group": 10, "security_group_rule": 100, "subnet": 10, "subnetpool": -1 } } neutron-lib-2.3.0/api-ref/source/v2/samples/quotas/quotas-list-for-project-response.json0000664000175000017500000000040013641427107031371 0ustar zuulzuul00000000000000{ "quota": { "floatingip": 50, "network": 10, "port": 50, "rbac_policy": -1, "router": 10, "security_group": 10, "security_group_rule": 100, "subnet": 10, "subnetpool": -1 } } neutron-lib-2.3.0/api-ref/source/v2/samples/quotas/quotas-list-response.json0000664000175000017500000000066413641427107027155 0ustar zuulzuul00000000000000{ "quotas": [ { "floatingip": 50, "network": 15, "port": 50, "project_id": "bab7d5c60cd041a0a36f7c4b6e1dd978", "rbac_policy": -1, "router": 10, "security_group": 10, "security_group_rule": 100, "subnet": 10, "subnetpool": -1, "tenant_id": "bab7d5c60cd041a0a36f7c4b6e1dd978" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/quota_details/0000775000175000017500000000000013641427200023447 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/quota_details/quota-details-show-for-project-response.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/quota_details/quota-details-show-for-project-response.js0000664000175000017500000000143213641427107033631 0ustar zuulzuul00000000000000{ "quota": { "rbac_policy": { "used": 4, "limit": 10, "reserved": 0 }, "subnetpool": { "used": 2, "limit": -1, "reserved": 0 }, "security_group_rule": { "used": 10, "limit": 100, "reserved": 1 }, "security_group": { "used": 3, "limit": 10, "reserved": 0 }, "subnet": { "used": 3, "limit": 100, "reserved": 0 }, "port": { "used": 21, "limit": 500, "reserved": 3 }, "network" :{ "used": 9, "limit": 100, "reserved": 2 } } } neutron-lib-2.3.0/api-ref/source/v2/samples/logs/0000775000175000017500000000000013641427200021555 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/logs/log-create-request.json0000664000175000017500000000022713641427107026167 0ustar zuulzuul00000000000000{ "log": { "name": "security group log", "description": "Log for project demo.", "resource_type": "security_group" } } neutron-lib-2.3.0/api-ref/source/v2/samples/logs/log-create-response.json0000664000175000017500000000104313641427107026332 0ustar zuulzuul00000000000000{ "log": { "name": "security group log", "description": "Log for project demo.", "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4", "project_id": "92a5a4f4245a4abbafacb7ca73b027b0", "tenant_id": "92a5a4f4245a4abbafacb7ca73b027b0", "created_at": "2018-04-03T21:03:04Z", "updated_at": "2018-04-03T21:03:04Z", "enabled": true, "resource_type": "security_group", "resource_id": null, "revision_number": 1, "target_id": null, "event": "ALL" } } neutron-lib-2.3.0/api-ref/source/v2/samples/logs/loggable_resources-list-response.json0000664000175000017500000000013713641427107031132 0ustar zuulzuul00000000000000{ "loggable_resources": [ { "type": "security_group" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/logs/log-list-response.json0000664000175000017500000000115413641427107026045 0ustar zuulzuul00000000000000{ "logs": [ { "name": "security group log", "description": "Log for project demo.", "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4", "project_id": "92a5a4f4245a4abbafacb7ca73b027b0", "tenant_id": "92a5a4f4245a4abbafacb7ca73b027b0", "created_at": "2018-04-03T21:03:04Z", "updated_at": "2018-04-03T21:03:04Z", "enabled": true, "revision_number": 1, "resource_type": "security_group", "resource_id": null, "target_id": null, "event": "ALL" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/logs/log-update-request.json0000664000175000017500000000006013641427107026201 0ustar zuulzuul00000000000000{ "log": { "enabled": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/logs/log-show-response.json0000664000175000017500000000104613641427107026052 0ustar zuulzuul00000000000000{ "log": { "name": "security group log", "description": "Log for project demo.", "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4", "project_id": "8d4c70a21fed4aeba121a1a429ba0d04", "tenant_id": "8d4c70a21fed4aeba121a1a429ba0d04", "created_at": "2018-04-03T21:03:04Z", "updated_at": "2018-04-03T21:03:04Z", "enabled": true, "revision_number": 1, "resource_type": "security_group", "resource_id": null, "target_id": null, "event": "ACCEPT" } } neutron-lib-2.3.0/api-ref/source/v2/samples/logs/log-update-response.json0000664000175000017500000000104513641427107026353 0ustar zuulzuul00000000000000{ "log": { "name": "security group log", "description": "Log for project demo.", "id": "46ebaec0-0570-43ac-82f6-60d2b03168c4", "project_id": "8d4c70a21fed4aeba121a1a429ba0d04", "tenant_id": "8d4c70a21fed4aeba121a1a429ba0d04", "created_at": "2018-04-03T21:03:04Z", "updated_at": "2018-04-03T21:03:04Z", "enabled": false, "revision_number": 3, "resource_type": "security_group", "resource_id": null, "target_id": null, "event": "DROP" } } neutron-lib-2.3.0/api-ref/source/v2/samples/tag/0000775000175000017500000000000013641427200021364 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/tag/tag-obtain-response.json0000664000175000017500000000006613641427107026150 0ustar zuulzuul00000000000000{ "tags": [ "red", "blue" ] } neutron-lib-2.3.0/api-ref/source/v2/samples/tag/tag-update-request.json0000664000175000017500000000006613641427107026010 0ustar zuulzuul00000000000000{ "tags": [ "red", "blue" ] } neutron-lib-2.3.0/api-ref/source/v2/samples/tag/tag-update-response.json0000664000175000017500000000006613641427107026156 0ustar zuulzuul00000000000000{ "tags": [ "red", "blue" ] } neutron-lib-2.3.0/api-ref/source/v2/samples/flavors/0000775000175000017500000000000013641427200022265 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/flavors/flavor-show-response.json0000664000175000017500000000034013641427107027266 0ustar zuulzuul00000000000000{ "flavor": { "description": "", "enabled": true, "service_profiles": [], "service_type": "FIREWALL", "id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0", "name": "dummy" } } neutron-lib-2.3.0/api-ref/source/v2/samples/flavors/flavor-associate-request.json0000664000175000017500000000013013641427107030110 0ustar zuulzuul00000000000000{ "service_profile": { "id": "4e5b9191-ffbe-4f7a-b112-2db98232fd32" } } neutron-lib-2.3.0/api-ref/source/v2/samples/flavors/service-profile-create-request.json0000664000175000017500000000033113641427107031210 0ustar zuulzuul00000000000000{ "service_profile": { "enabled": "true", "driver": "neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver", "description": "Dummy profile", "metainfo": "{'foo': 'bar'}" } } neutron-lib-2.3.0/api-ref/source/v2/samples/flavors/service-profiles-list-response.json0000664000175000017500000000102713641427107031254 0ustar zuulzuul00000000000000{ "service_profiles": [ { "id": "4e5b9191-ffbe-4f7a-b112-2db98232fd32", "enabled": true, "driver": "neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver", "description": "", "metainfo": "{}" }, { "id": "684322c5-703a-48a2-8138-34b99942a7ef", "enabled": true, "driver": "neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver", "description": "", "metainfo": "{}" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/flavors/flavors-list-response.json0000664000175000017500000000041513641427107027447 0ustar zuulzuul00000000000000{ "flavors": [ { "description": "", "enabled": true, "service_profiles": [], "service_type": "FIREWALL", "id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0", "name": "dummy" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/flavors/flavor-create-response.json0000664000175000017500000000035413641427107027556 0ustar zuulzuul00000000000000{ "flavor": { "id": "7fc0581b-4509-49e1-90eb-c953c877fa4c", "name": "dummy", "service_type": "FIREWALL", "description": "Dummy flavor", "enabled": true, "service_profiles": [] } } neutron-lib-2.3.0/api-ref/source/v2/samples/flavors/service-profile-create-response.json0000664000175000017500000000041513641427107031361 0ustar zuulzuul00000000000000{ "service_profile": { "enabled": true, "metainfo": "{'foo': 'bar'}", "driver": "neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver", "id": "7c793e5f-9b64-44e0-8b1f-902e59c85a01", "description": "Dummy profile" } } neutron-lib-2.3.0/api-ref/source/v2/samples/flavors/flavor-update-response.json0000664000175000017500000000036213641427107027574 0ustar zuulzuul00000000000000{ "flavor": { "description": "New description", "enabled": false, "service_profiles": [], "service_type": "FIREWALL", "id": "7fc0581b-4509-49e1-90eb-c953c877fa4c", "name": "newname" } } neutron-lib-2.3.0/api-ref/source/v2/samples/flavors/flavor-associate-response.json0000664000175000017500000000013013641427107030256 0ustar zuulzuul00000000000000{ "service_profile": { "id": "4e5b9191-ffbe-4f7a-b112-2db98232fd32" } } neutron-lib-2.3.0/api-ref/source/v2/samples/flavors/flavor-create-request.json0000664000175000017500000000022613641427107027406 0ustar zuulzuul00000000000000{ "flavor": { "service_type": "FIREWALL", "enabled": true, "name": "dummy", "description": "Dummy flavor" } } neutron-lib-2.3.0/api-ref/source/v2/samples/flavors/service-profile-update-request.json0000664000175000017500000000033313641427107031231 0ustar zuulzuul00000000000000{ "service_profile": { "enabled": false, "driver": "neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver", "description": "New description", "metainfo": "{'new': 'info'}" } } neutron-lib-2.3.0/api-ref/source/v2/samples/flavors/service-profile-show-response.json0000664000175000017500000000041513641427107031076 0ustar zuulzuul00000000000000{ "service_profile": { "enabled": true, "metainfo": "{'foo': 'bar'}", "driver": "neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver", "id": "7c793e5f-9b64-44e0-8b1f-902e59c85a01", "description": "Dummy profile" } } neutron-lib-2.3.0/api-ref/source/v2/samples/flavors/flavor-update-request.json0000664000175000017500000000017013641427107027423 0ustar zuulzuul00000000000000{ "flavor": { "enabled": false, "name": "newname", "description": "New description" } } neutron-lib-2.3.0/api-ref/source/v2/samples/flavors/service-profile-update-response.json0000664000175000017500000000042113641427107031375 0ustar zuulzuul00000000000000{ "service_profile": { "enabled": false, "metainfo": "{'new': 'info'}", "driver": "neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver", "id": "7c793e5f-9b64-44e0-8b1f-902e59c85a01", "description": "New description" } } neutron-lib-2.3.0/api-ref/source/v2/samples/auto-topology/0000775000175000017500000000000013641427200023433 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/auto-topology/topo-show-response.json0000664000175000017500000000015613641427107030131 0ustar zuulzuul00000000000000{ "id": "31483d41-5c2b-481c-beef-ab501bd2e0da", "tenant_id": "7623217f-dd15-44ec-994a-581a6e41c113" } neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/0000775000175000017500000000000013641427200022105 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/network_associations/0000775000175000017500000000000013641427200026355 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000016100000000000011213 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/network_associations/network_association-create-response.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/network_associations/network_association-create-r0000664000175000017500000000037113641427107034074 0ustar zuulzuul00000000000000{ "network_association": { "network_id": "8c5d88dc-60ac-4b02-a65a-36b65888ddcd", "tenant_id": "b7549121395844bea941bb92feb3fad9", "project_id": "b7549121395844bea941bb92feb3fad9", "id": "73238ca1-e05d-4c7a-b4d4-70407b4b8730" } } ././@LongLink0000000000000000000000000000015700000000000011220 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/network_associations/network_association-show-response.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/network_associations/network_association-show-res0000664000175000017500000000043713641427107034144 0ustar zuulzuul00000000000000{ "network_association": { "id": "1b09fd12-c769-4be7-9c26-dececa474acf", "network_id": "a4f2b8df-cb42-4893-a333-d0b5c36ade17", "tenant_id": "b7549121395844bea941bb92feb3fad9", "project_id": "b7549121395844bea941bb92feb3fad9" } } ././@LongLink0000000000000000000000000000015700000000000011220 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/network_associations/network_association-list-response.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/network_associations/network_association-list-res0000664000175000017500000000077113641427107034140 0ustar zuulzuul00000000000000{ "network_associations": [ { "network_id": "8c5d88dc-60ac-4b02-a65a-36b65888ddcd", "tenant_id": "b7549121395844bea941bb92feb3fad9", "project_id": "b7549121395844bea941bb92feb3fad9", "id": "96227c78-6a0c-4d9d-b441-c4b8f6fb6c4a" }, { "network_id": "a4f2b8df-cb42-4893-a333-d0b5c36ade17", "tenant_id": "b7549121395844bea941bb92feb3fad9", "project_id": "b7549121395844bea941bb92feb3fad9", "id": "1b09fd12-c769-4be7-9c26-dececa474acf" } ] } ././@LongLink0000000000000000000000000000016000000000000011212 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/network_associations/network_association-create-request.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/network_associations/network_association-create-r0000664000175000017500000000013413641427107034071 0ustar zuulzuul00000000000000{ "network_association": { "network_id": "8c5d88dc-60ac-4b02-a65a-36b65888ddcd" } } neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/router_associations/0000775000175000017500000000000013641427200026204 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015700000000000011220 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/router_associations/router_association-create-response.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/router_associations/router_association-create-res0000664000175000017500000000043313641427107034101 0ustar zuulzuul00000000000000{ "router_association": { "router_id": "46a1a80b-7c42-4c45-88fd-b531e636969f", "tenant_id": "b7549121395844bea941bb92feb3fad9", "project_id": "b7549121395844bea941bb92feb3fad9", "id": "c63149a0-a0b3-4ca7-aba4-9aaa1b39d7f3", "advertise_extra_routes": true } } ././@LongLink0000000000000000000000000000015600000000000011217 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/router_associations/router_association-update-request.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/router_associations/router_association-update-req0000664000175000017500000000021313641427107034112 0ustar zuulzuul00000000000000{ "router_association": { "router_id": "46a1a80b-7c42-4c45-88fd-b531e636969f", "advertise_extra_routes": false } } ././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/router_associations/router_association-list-response.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/router_associations/router_association-list-respo0000664000175000017500000000046213641427107034152 0ustar zuulzuul00000000000000{ "router_associations": [ { "router_id": "61222227-49eb-4dcc-b2d6-66bbfb2fdd7a", "tenant_id": "b7549121395844bea941bb92feb3fad9", "project_id": "b7549121395844bea941bb92feb3fad9", "id": "95277be7-a231-4e96-9625-8f9fe41de9d6", "advertise_extra_routes": true } ] } ././@LongLink0000000000000000000000000000015600000000000011217 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/router_associations/router_association-create-request.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/router_associations/router_association-create-req0000664000175000017500000000013213641427107034073 0ustar zuulzuul00000000000000{ "router_association": { "router_id": "b58a6241-6e49-4b11-87c6-8e0606dde796" } } ././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/router_associations/router_association-show-response.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/router_associations/router_association-show-respo0000664000175000017500000000046313641427107034160 0ustar zuulzuul00000000000000{ "router_association": { "id": "c63149a0-a0b3-4ca7-aba4-9aaa1b39d7f3", "router_id": "46a1a80b-7c42-4c45-88fd-b531e636969f", "tenant_id": "b7549121395844bea941bb92feb3fad9", "project_id": "b7549121395844bea941bb92feb3fad9", "advertise_extra_routes": true } } ././@LongLink0000000000000000000000000000015700000000000011220 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/router_associations/router_association-update-response.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/router_associations/router_association-update-res0000664000175000017500000000037213641427107034122 0ustar zuulzuul00000000000000{ "router_association": { "id": "c63149a0-a0b3-4ca7-aba4-9aaa1b39d7f3", "project_id": "b7549121395844bea941bb92feb3fad9", "router_id": "46a1a80b-7c42-4c45-88fd-b531e636969f", "advertise_extra_routes": false } }neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/bgpvpns/0000775000175000017500000000000013641427200023564 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/bgpvpns/bgpvpn-create-request.json0000664000175000017500000000044013641427107030706 0ustar zuulzuul00000000000000{ "bgpvpn": { "tenant_id": "b7549121395844bea941bb92feb3fad9", "route_targets": "64512:1444", "import_targets": "64512:1555", "export_targets": "64512:1666", "route_distinguishers": ["64512:1777", "64512:1888", "64512:1999"], "type": "l3", "vni": 1000 } } neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/bgpvpns/bgpvpn-update-response.json0000664000175000017500000000057713641427107031106 0ustar zuulzuul00000000000000{ "bgpvpn": { "export_targets": [], "name": "", "routers": [], "route_distinguishers": [ "12345:1234" ], "tenant_id": "b7549121395844bea941bb92feb3fad9", "import_targets": [], "route_targets": ["64512:1444"], "type": "l3", "id": "4d627abf-06dd-45ab-920b-8e61422bb984", "networks": [], "local_pref": null, "vni": 1000 } } neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/bgpvpns/bgpvpn-create-response.json0000664000175000017500000000103113641427107031051 0ustar zuulzuul00000000000000{ "bgpvpn": { "export_targets": [ "64512:1666" ], "name": "", "routers": [], "route_distinguishers": [ "64512:1777", "64512:1888", "64512:1999" ], "tenant_id": "b7549121395844bea941bb92feb3fad9", "project_id": "b7549121395844bea941bb92feb3fad9", "import_targets": [ "64512:1555" ], "route_targets": [ "64512:1444" ], "type": "l3", "id": "0f9d472a-908f-40f5-8574-b4e8a63ccbf0", "networks": [], "local_pref": null, "vni": 1000 } } neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/bgpvpns/bgpvpn-show-response.json0000664000175000017500000000100313641427107030565 0ustar zuulzuul00000000000000{ "bgpvpn": { "id": "460ac411-3dfb-45bb-8116-ed1a7233d143", "name": "foo", "route_targets": ["64512:1444"], "export_targets": [], "import_targets": [], "type": "l3", "tenant_id": "f94ea398564d49dfb0d542f086c68ce7", "project_id": "f94ea398564d49dfb0d542f086c68ce7", "routers": [], "route_distinguishers": [], "networks": [ "a4f2b8df-cb42-4893-a333-d0b5c36ade17" ], "local_pref": null, "vni": 1000 } } neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/bgpvpns/bgpvpns-list-response.json0000664000175000017500000000112413641427107030747 0ustar zuulzuul00000000000000{ "bgpvpns": [ { "export_targets": [ "64512:1666" ], "name": "", "routers": [], "route_distinguishers": [ "64512:1777", "64512:1888", "64512:1999" ], "tenant_id": "b7549121395844bea941bb92feb3fad9", "project_id": "b7549121395844bea941bb92feb3fad9", "import_targets": [ "64512:1555" ], "route_targets": [ "64512:1444" ], "type": "l3", "id": "0f9d472a-908f-40f5-8574-b4e8a63ccbf0", "networks": [], "local_pref": null, "vni": 1000 } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/bgpvpns/bgpvpn-update-request.json0000664000175000017500000000022113641427107030722 0ustar zuulzuul00000000000000{ "bgpvpn": { "name": "foo", "route_targets": ["64512:1444"], "export_targets": [], "import_targets": [] } } neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/port_associations/0000775000175000017500000000000013641427200025650 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015300000000000011214 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/port_associations/port_association-update-response.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/port_associations/port_association-update-respons0000664000175000017500000000067013641427107034133 0ustar zuulzuul00000000000000{ "port_association": { "id": "c63149a0-a0b3-4ca7-aba4-9aaa1b39d7f3", "port_id": "46a1a80b-7c42-4c45-88fd-b531e636969f", "project_id": "b7549121395844bea941bb92feb3fad9", "routes": [ { "type": "bgpvpn", "bgpvpn_id": "180630e3-9eae-4ba7-9939-d5f47966e1f0", "local_pref": 111 } ], "advertise_fixed_ips": false } } ././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/port_associations/port_association-create-request.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/port_associations/port_association-create-request0000664000175000017500000000034313641427107034110 0ustar zuulzuul00000000000000{ "port_association": { "port_id": "b58a6241-6e49-4b11-87c6-8e0606dde796", "routes": [ { "type": "prefix", "prefix": "20.1.0.0/16" } ] } } ././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/port_associations/port_association-update-request.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/port_associations/port_association-update-request0000664000175000017500000000051013641427107034123 0ustar zuulzuul00000000000000{ "port_association": { "port_id": "46a1a80b-7c42-4c45-88fd-b531e636969f", "routes": [ { "type": "bgpvpn", "bgpvpn_id": "180630e3-9eae-4ba7-9939-d5f47966e1f0", "local_pref": 111 } ], "advertise_fixed_ips": false } } ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/port_associations/port_association-list-response.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/port_associations/port_association-list-response.0000664000175000017500000000066513641427107034053 0ustar zuulzuul00000000000000{ "port_associations": [ { "id": "95277be7-a231-4e96-9625-8f9fe41de9d6", "port_id": "61222227-49eb-4dcc-b2d6-66bbfb2fdd7a", "project_id": "b7549121395844bea941bb92feb3fad9", "routes": [ { "type": "prefix", "prefix": "20.1.0.0/16" } ], "advertise_fixed_ips": true } ] } ././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/port_associations/port_association-show-response.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/port_associations/port_association-show-response.0000664000175000017500000000057013641427107034053 0ustar zuulzuul00000000000000{ "port_association": { "id": "c63149a0-a0b3-4ca7-aba4-9aaa1b39d7f3", "port_id": "46a1a80b-7c42-4c45-88fd-b531e636969f", "project_id": "b7549121395844bea941bb92feb3fad9", "routes": [ { "type": "prefix", "prefix": "20.1.0.0/16" } ], "advertise_fixed_ips": true } } ././@LongLink0000000000000000000000000000015300000000000011214 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/port_associations/port_association-create-response.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/bgpvpn/port_associations/port_association-create-respons0000664000175000017500000000057013641427107034113 0ustar zuulzuul00000000000000{ "port_association": { "id": "c63149a0-a0b3-4ca7-aba4-9aaa1b39d7f3", "port_id": "46a1a80b-7c42-4c45-88fd-b531e636969f", "project_id": "b7549121395844bea941bb92feb3fad9", "routes": [ { "type": "prefix", "prefix": "20.1.0.0/16" } ], "advertise_fixed_ips": true } } neutron-lib-2.3.0/api-ref/source/v2/samples/address-scopes/0000775000175000017500000000000013641427200023530 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/address-scopes/address-scope-show-response.json0000664000175000017500000000043713641427107032003 0ustar zuulzuul00000000000000{ "address_scope": { "name": "address-scope-ip4", "tenant_id": "a7a7fa10fd7a4c80acb7e4b224480495", "ip_version": 4, "shared": true, "project_id": "a7a7fa10fd7a4c80acb7e4b224480495", "id": "4143da3e-d2a7-4077-ba80-215ecfd016d7" } } neutron-lib-2.3.0/api-ref/source/v2/samples/address-scopes/address-scope-update-response.json0000664000175000017500000000043513641427107032303 0ustar zuulzuul00000000000000{ "address_scope": { "name": "address-scope-2", "tenant_id": "a7a7fa10fd7a4c80acb7e4b224480495", "ip_version": 4, "shared": true, "project_id": "a7a7fa10fd7a4c80acb7e4b224480495", "id": "4143da3e-d2a7-4077-ba80-215ecfd016d7" } } neutron-lib-2.3.0/api-ref/source/v2/samples/address-scopes/address-scope-create-request.json0000664000175000017500000000034713641427107032120 0ustar zuulzuul00000000000000{ "address_scope": { "name": "address-scope-2", "tenant_id": "a7a7fa10fd7a4c80acb7e4b224480495", "ip_version": 4, "shared": true, "project_id": "a7a7fa10fd7a4c80acb7e4b224480495" } } neutron-lib-2.3.0/api-ref/source/v2/samples/address-scopes/address-scope-create-response.json0000664000175000017500000000043513641427107032264 0ustar zuulzuul00000000000000{ "address_scope": { "name": "address-scope-2", "tenant_id": "a7a7fa10fd7a4c80acb7e4b224480495", "ip_version": 4, "shared": true, "project_id": "a7a7fa10fd7a4c80acb7e4b224480495", "id": "4143da3e-d2a7-4077-ba80-215ecfd016d7" } } neutron-lib-2.3.0/api-ref/source/v2/samples/address-scopes/address-scope-update-request.json0000664000175000017500000000013513641427107032132 0ustar zuulzuul00000000000000{ "address_scope": { "name": "address-scope-ip4", "shared": true } } neutron-lib-2.3.0/api-ref/source/v2/samples/address-scopes/address-scopes-list-response.json0000664000175000017500000000116513641427107032160 0ustar zuulzuul00000000000000{ "address_scopes": [ { "name": "address-scope-ip6", "tenant_id": "a7a7fa10fd7a4c80acb7e4b224480495", "ip_version": 6, "shared": true, "project_id": "a7a7fa10fd7a4c80acb7e4b224480495", "id": "3b189848-58bb-4499-abc2-8df170a6a8ae" }, { "name": "address-scope-2", "tenant_id": "a7a7fa10fd7a4c80acb7e4b224480495", "ip_version": 4, "shared": true, "project_id": "a7a7fa10fd7a4c80acb7e4b224480495", "id": "4143da3e-d2a7-4077-ba80-215ecfd016d7" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/service-type-response.json0000664000175000017500000000023413641427107025764 0ustar zuulzuul00000000000000{ "service_providers": [ { "service_type": "FIREWALL", "default": true, "name": "haproxy" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall_log/0000775000175000017500000000000013641427200023257 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/firewall_log/firewall_logs-list-response.json0000664000175000017500000000155613641427107031625 0ustar zuulzuul00000000000000{ "firewall_logs": [ { "description": "my firewall log 2", "firewall_id": "a6564146-f8b3-49c3-add1-fb213455d5a8", "fw_event": "ACCEPT", "id": "3969b708-d600-4343-93b9-01645f8e9a8a", "logging_resource_id": "13b64f3c-20af-4741-b230-658ab7d5b257", "project_id": "8d018258316e4f22890561e8780c85bb", "tenant_id": "8d018258316e4f22890561e8780c85bb" }, { "description": "my firewall log", "firewall_id": "a6564146-f8b3-49c3-add1-fb213455d5a8", "fw_event": "DROP", "id": "deb19331-e5d5-4a80-a37f-5e5ad407b353", "logging_resource_id": "13b64f3c-20af-4741-b230-658ab7d5b257", "project_id": "8d018258316e4f22890561e8780c85bb", "tenant_id": "8d018258316e4f22890561e8780c85bb" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall_log/firewall_log-update-response.json0000664000175000017500000000062513641427107031745 0ustar zuulzuul00000000000000{ "firewall_log": { "description": "my firewall log 3", "firewall_id": "a6564146-f8b3-49c3-add1-fb213455d5a8", "fw_event": "ALL", "id": "3969b708-d600-4343-93b9-01645f8e9a8a", "logging_resource_id": "13b64f3c-20af-4741-b230-658ab7d5b257", "project_id": "8d018258316e4f22890561e8780c85bb", "tenant_id": "8d018258316e4f22890561e8780c85bb" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall_log/firewall_log-update-request.json0000664000175000017500000000014613641427107031575 0ustar zuulzuul00000000000000{ "firewall_log": { "description": "my firewall log 3", "fw_event": "ALL" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall_log/firewall_log-create-response.json0000664000175000017500000000062413641427107031725 0ustar zuulzuul00000000000000{ "firewall_log": { "description": "my firewall log", "firewall_id": "a6564146-f8b3-49c3-add1-fb213455d5a8", "fw_event": "DROP", "id": "deb19331-e5d5-4a80-a37f-5e5ad407b353", "logging_resource_id": "13b64f3c-20af-4741-b230-658ab7d5b257", "project_id": "8d018258316e4f22890561e8780c85bb", "tenant_id": "8d018258316e4f22890561e8780c85bb" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall_log/firewall_log-show-response.json0000664000175000017500000000062513641427107031443 0ustar zuulzuul00000000000000{ "firewall_log": { "description": "my firewall log 3", "firewall_id": "a6564146-f8b3-49c3-add1-fb213455d5a8", "fw_event": "ALL", "id": "3969b708-d600-4343-93b9-01645f8e9a8a", "logging_resource_id": "13b64f3c-20af-4741-b230-658ab7d5b257", "project_id": "8d018258316e4f22890561e8780c85bb", "tenant_id": "8d018258316e4f22890561e8780c85bb" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall_log/firewall_log-create-request.json0000664000175000017500000000024413641427107031555 0ustar zuulzuul00000000000000{ "firewall_log": { "description": "my firewall log", "firewall_id": "a6564146-f8b3-49c3-add1-fb213455d5a8", "fw_event": "DROP" } } neutron-lib-2.3.0/api-ref/source/v2/samples/logging_resource/0000775000175000017500000000000013641427200024146 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/logging_resource/logging_resources-list-response.json0000664000175000017500000000126413641427107033377 0ustar zuulzuul00000000000000{ "logging_resources": [ { "description": "my log", "enabled": true, "firewall_logs": [], "id": "13b64f3c-20af-4741-b230-658ab7d5b257", "name": "log", "project_id": "8d018258316e4f22890561e8780c85bb", "tenant_id": "8d018258316e4f22890561e8780c85bb" }, { "description": "my log2", "enabled": true, "firewall_logs": [], "id": "335c7b7d-c4a9-423a-9c24-9f4982f31e24", "name": "log2", "project_id": "8d018258316e4f22890561e8780c85bb", "tenant_id": "8d018258316e4f22890561e8780c85bb" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/logging_resource/logging_resource-create-request.json0000664000175000017500000000016413641427107033334 0ustar zuulzuul00000000000000{ "logging_resource": { "description": "my log", "enabled": true, "name": "log" } } neutron-lib-2.3.0/api-ref/source/v2/samples/logging_resource/logging_resource-update-response.json0000664000175000017500000000137613641427107033527 0ustar zuulzuul00000000000000{ "logging_resource": { "description": "my log2", "enabled": false, "firewall_logs": [ { "description": "", "firewall_id": "682cfe44-5fcf-4c16-982e-1176493f6825", "fw_event": "ALL", "id": "1ee6fea7-c294-418e-9b97-06db48e3f3d5", "logging_resource_id": "335c7b7d-c4a9-423a-9c24-9f4982f31e24", "project_id": "8d018258316e4f22890561e8780c85bb", "tenant_id": "8d018258316e4f22890561e8780c85bb" } ], "id": "335c7b7d-c4a9-423a-9c24-9f4982f31e24", "name": "log2", "project_id": "8d018258316e4f22890561e8780c85bb", "tenant_id": "8d018258316e4f22890561e8780c85bb" } } neutron-lib-2.3.0/api-ref/source/v2/samples/logging_resource/logging_resource-show-response.json0000664000175000017500000000137313641427107033222 0ustar zuulzuul00000000000000{ "logging_resource": { "description": "my log", "enabled": true, "firewall_logs": [ { "description": "", "firewall_id": "682cfe44-5fcf-4c16-982e-1176493f6825", "fw_event": "ALL", "id": "1ee6fea7-c294-418e-9b97-06db48e3f3d5", "logging_resource_id": "13b64f3c-20af-4741-b230-658ab7d5b257", "project_id": "8d018258316e4f22890561e8780c85bb", "tenant_id": "8d018258316e4f22890561e8780c85bb" } ], "id": "13b64f3c-20af-4741-b230-658ab7d5b257", "name": "log", "project_id": "8d018258316e4f22890561e8780c85bb", "tenant_id": "8d018258316e4f22890561e8780c85bb" } } neutron-lib-2.3.0/api-ref/source/v2/samples/logging_resource/logging_resource-update-request.json0000664000175000017500000000013713641427107033353 0ustar zuulzuul00000000000000{ "logging_resource": { "description": "my log2", "enabled": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/logging_resource/logging_resource-create-response.json0000664000175000017500000000047213641427107033504 0ustar zuulzuul00000000000000{ "logging_resource": { "description": "my log", "enabled": true, "firewall_logs": [], "id": "13b64f3c-20af-4741-b230-658ab7d5b257", "name": "log", "project_id": "8d018258316e4f22890561e8780c85bb", "tenant_id": "8d018258316e4f22890561e8780c85bb" } } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/0000775000175000017500000000000013641427200022465 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/networks/networks-provider-list-response.json0000664000175000017500000000576213641427107031711 0ustar zuulzuul00000000000000{ "networks": [ { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2016-03-08T20:19:41", "dns_domain": "my-domain.org.", "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", "ipv4_address_scope": null, "ipv6_address_scope": null, "l2_adjacency": false, "mtu": 1500, "name": "net1", "port_security_enabled": true, "project_id": "4fd44f30292945e481c7b8a0c8908869", "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e", "provider:network_type": "vlan", "provider:physical_network": "public", "provider:segmentation_id": 3, "revision_number": 1, "router:external": false, "shared": false, "status": "ACTIVE", "subnets": [ "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" ], "tags": ["tag1,tag2"], "tenant_id": "4fd44f30292945e481c7b8a0c8908869", "updated_at": "2016-03-08T20:19:41", "vlan_transparent": true, "description": "", "is_default": false }, { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2016-03-08T20:19:41", "dns_domain": "my-domain.org.", "id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324", "ipv4_address_scope": null, "ipv6_address_scope": null, "l2_adjacency": false, "mtu": 1450, "name": "net2", "port_security_enabled": true, "project_id": "26a7980765d0414dbc1fc1f88cdb7e6e", "qos_policy_id": null, "provider:network_type": "local", "provider:physical_network": null, "provider:segmentation_id": null, "qos_policy_id": "bfdb6c39f71e4d44b1dfbda245c50819", "revision_number": 2, "router:external": false, "segments": [ { "provider:network_type": "vlan", "provider:physical_network": "public", "provider:segmentation_id": 2 }, { "provider:network_type": "vxlan", "provider:physical_network": "default", "provider:segmentation_id": 1000 } ], "shared": false, "status": "ACTIVE", "subnets": [ "08eae331-0402-425a-923c-34f7cfe39c1b" ], "tags": ["tag1,tag2"], "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e", "updated_at": "2016-03-08T20:19:41", "vlan_transparent": false, "description": "", "is_default": false } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/network-create-response.json0000664000175000017500000000170713641427107030161 0ustar zuulzuul00000000000000{ "network": { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2016-03-08T20:19:41", "dns_domain": "my-domain.org.", "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c", "ipv4_address_scope": null, "ipv6_address_scope": null, "l2_adjacency": true, "mtu": 1400, "name": "net1", "port_security_enabled": true, "project_id": "9bacb3c5d39d41a79512987f338cf177", "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e", "revision_number": 1, "router:external": false, "shared": false, "status": "ACTIVE", "subnets": [], "tags": ["tag1,tag2"], "tenant_id": "9bacb3c5d39d41a79512987f338cf177", "updated_at": "2016-03-08T20:19:41", "vlan_transparent": false, "description": "", "is_default": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/network-multi-create-response.json0000664000175000017500000000237613641427107031314 0ustar zuulzuul00000000000000{ "network": { "status": "ACTIVE", "subnets": [], "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2016-03-08T20:19:41", "name": "net1", "admin_state_up": true, "dns_domain": "", "ipv4_address_scope": null, "ipv6_address_scope": null, "l2_adjacency": true, "mtu": 1500, "port_security_enabled": true, "project_id": "9bacb3c5d39d41a79512987f338cf177", "tags": ["tag1,tag2"], "tenant_id": "9bacb3c5d39d41a79512987f338cf177", "updated_at": "2016-03-08T20:19:41", "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e", "revision_number": 1, "segments": [ { "provider:segmentation_id": 2, "provider:physical_network": "public", "provider:network_type": "vlan" }, { "provider:segmentation_id": null, "provider:physical_network": "default", "provider:network_type": "flat" } ], "shared": false, "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c", "description": "", "is_default": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/networks-bulk-create-request.json0000664000175000017500000000053313641427107031125 0ustar zuulzuul00000000000000{ "networks": [ { "admin_state_up": true, "name": "sample_network3", "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e" }, { "admin_state_up": true, "name": "sample_network4", "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/network-provider-create-request.json0000664000175000017500000000041613641427107031637 0ustar zuulzuul00000000000000{ "network": { "admin_state_up": true, "name": "net1", "provider:network_type": "vlan", "provider:physical_network": "public", "provider:segmentation_id": 2, "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e" } } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/network-multi-show-response.json0000664000175000017500000000261313641427107031023 0ustar zuulzuul00000000000000{ "network": { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2016-03-08T20:19:41", "dns_domain": "my-domain.org.", "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c", "ipv4_address_scope": null, "ipv6_address_scope": null, "l2_adjacency": false, "mtu": 1500, "name": "net1", "port_security_enabled": true, "project_id": "9bacb3c5d39d41a79512987f338cf177", "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e", "revision_number": 1, "router:external": false, "segments": [ { "provider:network_type": "vlan", "provider:physical_network": "public", "provider:segmentation_id": 2 }, { "provider:network_type": "flat", "provider:physical_network": "default", "provider:segmentation_id": 0 } ], "shared": false, "status": "ACTIVE", "subnets": [ "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" ], "tags": ["tag1,tag2"], "tenant_id": "4fd44f30292945e481c7b8a0c8908869", "updated_at": "2016-03-08T20:19:41", "vlan_transparent": false, "description": "", "is_default": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/network-show-response.json0000664000175000017500000000201513641427107027667 0ustar zuulzuul00000000000000{ "network": { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2016-03-08T20:19:41", "dns_domain": "my-domain.org.", "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", "ipv4_address_scope": null, "ipv6_address_scope": null, "l2_adjacency": false, "mtu": 1500, "name": "private-network", "port_security_enabled": true, "project_id": "4fd44f30292945e481c7b8a0c8908869", "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e", "revision_number": 1, "router:external": false, "shared": true, "status": "ACTIVE", "subnets": [ "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" ], "tags": ["tag1,tag2"], "tenant_id": "4fd44f30292945e481c7b8a0c8908869", "updated_at": "2016-03-08T20:19:41", "vlan_transparent": false, "description": "", "is_default": true } } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/versions-list-response.json0000664000175000017500000000042513641427107030044 0ustar zuulzuul00000000000000{ "versions": [ { "status": "CURRENT", "id": "v2.0", "links": [ { "href": "http://23.253.228.211:9696/v2.0", "rel": "self" } ] } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/network-update-response.json0000664000175000017500000000203013641427107030166 0ustar zuulzuul00000000000000{ "network": { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2016-03-08T20:19:41", "dns_domain": "my-domain.org.", "id": "1f370095-98f6-4079-be64-6d3d4a6adcc6", "ipv4_address_scope": null, "ipv6_address_scope": null, "l2_adjacency": false, "mtu": 1300, "name": "sample_network_5_updated", "port_security_enabled": true, "project_id": "4fd44f30292945e481c7b8a0c8908869", "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e", "revision_number": 2, "router:external": false, "shared": false, "status": "ACTIVE", "subnets": [ "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" ], "tags": ["tag1,tag2"], "tenant_id": "4fd44f30292945e481c7b8a0c8908869", "updated_at": "2016-03-08T20:19:41", "vlan_transparent": false, "description": "", "is_default": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/network-update-request.json0000664000175000017500000000030013641427107030016 0ustar zuulzuul00000000000000{ "network": { "dns_domain": "my-domain.org.", "name": "sample_network_5_updated", "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e", "mtu": 1300 } } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/network-provider-show-response.json0000664000175000017500000000221413641427107031520 0ustar zuulzuul00000000000000{ "network": { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2016-03-08T20:19:41", "dns_domain": "my-domain.org.", "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", "ipv4_address_scope": null, "ipv6_address_scope": null, "l2_adjacency": false, "mtu": 1500, "name": "private-network", "port_security_enabled": true, "project_id": "4fd44f30292945e481c7b8a0c8908869", "provider:network_type": "local", "provider:physical_network": null, "provider:segmentation_id": null, "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e", "revision_number": 1, "router:external": false, "shared": true, "status": "ACTIVE", "subnets": [ "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" ], "tags": ["tag1,tag2"], "tenant_id": "4fd44f30292945e481c7b8a0c8908869", "updated_at": "2016-03-08T20:19:41", "vlan_transparent": false, "description": "", "is_default": true } } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/network-multi-create-request.json0000664000175000017500000000074713641427107031146 0ustar zuulzuul00000000000000{ "network": { "segments": [ { "provider:segmentation_id": 2, "provider:physical_network": "public", "provider:network_type": "vlan" }, { "provider:physical_network": "default", "provider:network_type": "flat" } ], "name": "net1", "admin_state_up": true, "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e" } } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/network-multi-update-request.json0000664000175000017500000000056213641427107031160 0ustar zuulzuul00000000000000{ "network": { "segments": [ { "provider:segmentation_id": 2, "provider:physical_network": "public", "provider:network_type": "vlan" }, { "provider:physical_network": "default", "provider:network_type": "flat" } ] } } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/network-create-request.json0000664000175000017500000000032613641427107030007 0ustar zuulzuul00000000000000{ "network": { "name": "sample_network", "admin_state_up": true, "dns_domain": "my-domain.org.", "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e", "mtu": 1400 } } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/networks-bulk-create-response.json0000664000175000017500000000415713641427107031301 0ustar zuulzuul00000000000000{ "networks": [ { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2016-03-08T20:19:41", "dns_domain": "", "id": "bc1a76cb-8767-4c3a-bb95-018b822f2130", "ipv4_address_scope": null, "ipv6_address_scope": null, "l2_adjacency": true, "mtu": 1500, "name": "sample_network3", "project_id": "4fd44f30292945e481c7b8a0c8908869", "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e", "revision_number": 1, "router:external": false, "shared": false, "status": "ACTIVE", "subnets": [], "tags": ["tag1,tag2"], "tenant_id": "4fd44f30292945e481c7b8a0c8908869", "updated_at": "2016-03-08T20:19:41", "vlan_transparent": false, "description": "", "port_security_enabled": true, "is_default": false }, { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2016-03-08T20:19:41", "dns_domain": "", "id": "af374017-c9ae-4a1d-b799-ab73111476e2", "ipv4_address_scope": null, "ipv6_address_scope": null, "l2_adjacency": true, "mtu": 1500, "name": "sample_network4", "project_id": "4fd44f30292945e481c7b8a0c8908869", "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e", "revision_number": 1, "router:external": false, "shared": false, "status": "ACTIVE", "subnets": [], "tags": ["tag1,tag2"], "tenant_id": "4fd44f30292945e481c7b8a0c8908869", "updated_at": "2016-03-08T20:19:41", "vlan_transparent": false, "description": "", "port_security_enabled": true, "is_default": false } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/network-provider-update-request.json0000664000175000017500000000023113641427107031651 0ustar zuulzuul00000000000000{ "network": { "provider:network_type": "vlan", "provider:physical_network": "public", "provider:segmentation_id": 2 } } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/networks-list-response.json0000664000175000017500000000427013641427107030052 0ustar zuulzuul00000000000000{ "networks": [ { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2016-03-08T20:19:41", "dns_domain": "my-domain.org.", "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", "ipv4_address_scope": null, "ipv6_address_scope": null, "l2_adjacency": false, "mtu": 1500, "name": "net1", "port_security_enabled": true, "project_id": "4fd44f30292945e481c7b8a0c8908869", "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e", "revision_number": 1, "router:external": false, "shared": false, "status": "ACTIVE", "subnets": [ "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" ], "tenant_id": "4fd44f30292945e481c7b8a0c8908869", "updated_at": "2016-03-08T20:19:41", "vlan_transparent": true, "description": "", "is_default": false }, { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2016-03-08T20:19:41", "dns_domain": "my-domain.org.", "id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324", "ipv4_address_scope": null, "ipv6_address_scope": null, "l2_adjacency": false, "mtu": 1500, "name": "net2", "port_security_enabled": true, "project_id": "26a7980765d0414dbc1fc1f88cdb7e6e", "qos_policy_id": "bfdb6c39f71e4d44b1dfbda245c50819", "revision_number": 3, "router:external": false, "shared": false, "status": "ACTIVE", "subnets": [ "08eae331-0402-425a-923c-34f7cfe39c1b" ], "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e", "updated_at": "2016-03-08T20:19:41", "vlan_transparent": false, "description": "", "is_default": false } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/network-provider-create-response.json0000664000175000017500000000202513641427107032003 0ustar zuulzuul00000000000000{ "network": { "status": "ACTIVE", "subnets": [], "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2016-03-08T20:19:41", "dns_domain": "", "ipv4_address_scope": null, "ipv6_address_scope": null, "name": "net1", "provider:physical_network": "public", "admin_state_up": true, "project_id": "9bacb3c5d39d41a79512987f338cf177", "tags": ["tag1,tag2"], "tenant_id": "9bacb3c5d39d41a79512987f338cf177", "updated_at": "2016-03-08T20:19:41", "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e", "revision_number": 1, "router:external": false, "provider:network_type": "vlan", "l2_adjacency": true, "mtu": 1500, "shared": false, "id": "4e8e5957-649f-477b-9e5b-f1f75b21c03c", "provider:segmentation_id": 2, "description": "", "port_security_enabled": true, "is_default": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/networks/version-show-response.json0000664000175000017500000000146713641427107027675 0ustar zuulzuul00000000000000{ "resources": [ { "links": [ { "href": "http://23.253.228.211:9696/v2.0/subnets", "rel": "self" } ], "name": "subnet", "collection": "subnets" }, { "links": [ { "href": "http://23.253.228.211:9696/v2.0/networks", "rel": "self" } ], "name": "network", "collection": "networks" }, { "links": [ { "href": "http://23.253.228.211:9696/v2.0/ports", "rel": "self" } ], "name": "port", "collection": "ports" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/segments/0000775000175000017500000000000013641427200022436 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/segments/segment-update-request.json0000664000175000017500000000012513641427107027745 0ustar zuulzuul00000000000000{ "segment": { "name": "1", "description": "Segment One" } } neutron-lib-2.3.0/api-ref/source/v2/samples/segments/segment-create-request.json0000664000175000017500000000030213641427107027723 0ustar zuulzuul00000000000000{ "segment": { "network_id": "5c0cb560-4089-41dd-be29-469907a23b49", "segmentation_id": 2000, "network_type": "vlan", "physical_network": "segment-1" } } neutron-lib-2.3.0/api-ref/source/v2/samples/segments/segments-list-response.json0000664000175000017500000000143513641427107027774 0ustar zuulzuul00000000000000{ "segments": [ { "name": null, "network_id": "5c0cb560-4089-41dd-be29-469907a23b49", "segmentation_id": 2000, "network_type": "vlan", "physical_network": "segment-1", "revision_number": 1, "id": "57fe85e4-ca2f-4192-b3cd-d5c249d7a21f", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "description": null }, { "name": null, "network_id": "5c0cb560-4089-41dd-be29-469907a23b49", "segmentation_id": 2000, "network_type": "vlan", "physical_network": "segment-2", "revision_number": 3, "id": "f1364c3a-4fc1-4206-b2dc-3254bc25cbfc", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "description": null } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/segments/segment-show-response.json0000664000175000017500000000057113641427107027616 0ustar zuulzuul00000000000000{ "segment": { "name": null, "network_id": "5c0cb560-4089-41dd-be29-469907a23b49", "segmentation_id": 2000, "network_type": "vlan", "physical_network": "segment-1", "revision_number": 1, "id": "57fe85e4-ca2f-4192-b3cd-d5c249d7a21f", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "description": null } } neutron-lib-2.3.0/api-ref/source/v2/samples/segments/segment-update-response.json0000664000175000017500000000060113641427107030112 0ustar zuulzuul00000000000000{ "segment": { "name": "1", "network_id": "5c0cb560-4089-41dd-be29-469907a23b49", "segmentation_id": 2000, "network_type": "vlan", "physical_network": "segment-1", "revision_number": 4, "id": "57fe85e4-ca2f-4192-b3cd-d5c249d7a21f", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "description": "Segment One" } } neutron-lib-2.3.0/api-ref/source/v2/samples/segments/segment-create-response.json0000664000175000017500000000057113641427107030101 0ustar zuulzuul00000000000000{ "segment": { "name": null, "network_id": "5c0cb560-4089-41dd-be29-469907a23b49", "segmentation_id": 2000, "network_type": "vlan", "physical_network": "segment-1", "revision_number": 1, "id": "57fe85e4-ca2f-4192-b3cd-d5c249d7a21f", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "description": null } } neutron-lib-2.3.0/api-ref/source/v2/samples/rbac_policy/0000775000175000017500000000000013641427200023077 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/rbac_policy/rbac-policy-create-response.json0000664000175000017500000000057013641427107031303 0ustar zuulzuul00000000000000{ "rbac_policy": { "target_tenant": "0670b690f27e47a58b6a479d26004715", "tenant_id": "3de27ce0a2a54cc6ae06dc62dd0ec832", "object_type": "network", "object_id": "1f32f072-4d17-4811-b619-3623d018bd40", "action": "access_as_shared", "project_id": "3de27ce0a2a54cc6ae06dc62dd0ec832", "id": "2cf7523a-93b5-4e69-9360-6c6bf986bb7c" } }neutron-lib-2.3.0/api-ref/source/v2/samples/rbac_policy/rbac-policy-create-request.json0000664000175000017500000000032513641427107031133 0ustar zuulzuul00000000000000{ "rbac_policy": { "action": "access_as_shared", "object_type": "network", "target_tenant": "0670b690f27e47a58b6a479d26004715", "object_id": "1f32f072-4d17-4811-b619-3623d018bd40" } }neutron-lib-2.3.0/api-ref/source/v2/samples/rbac_policy/rbac-policy-show-response.json0000664000175000017500000000053313641427107031017 0ustar zuulzuul00000000000000{ "rbac_policy": { "target_tenant": "*", "tenant_id": "3de27ce0a2a54cc6ae06dc62dd0ec832", "object_type": "network", "object_id": "1f32f072-4d17-4811-b619-3623d018bd40", "action": "access_as_external", "project_id": "3de27ce0a2a54cc6ae06dc62dd0ec832", "id": "6d4c666e-1aad-465e-b670-4d112b760137" } }neutron-lib-2.3.0/api-ref/source/v2/samples/rbac_policy/rbac-policy-update-request.json0000664000175000017500000000006713641427107031155 0ustar zuulzuul00000000000000{ "rbac_policy": { "target_tenant": "*" } }neutron-lib-2.3.0/api-ref/source/v2/samples/rbac_policy/rbac-policy-update-response.json0000664000175000017500000000053313641427107031321 0ustar zuulzuul00000000000000{ "rbac_policy": { "target_tenant": "*", "tenant_id": "3de27ce0a2a54cc6ae06dc62dd0ec832", "object_type": "network", "object_id": "1f32f072-4d17-4811-b619-3623d018bd40", "action": "access_as_external", "project_id": "3de27ce0a2a54cc6ae06dc62dd0ec832", "id": "6d4c666e-1aad-465e-b670-4d112b760137" } }neutron-lib-2.3.0/api-ref/source/v2/samples/rbac_policy/rbac-policies-list-response.json0000664000175000017500000000060113641427107031316 0ustar zuulzuul00000000000000{ "rbac_policies": [ { "target_tenant": "*", "tenant_id": "3de27ce0a2a54cc6ae06dc62dd0ec832", "object_type": "network", "object_id": "1f32f072-4d17-4811-b619-3623d018bd40", "action": "access_as_external", "project_id": "3de27ce0a2a54cc6ae06dc62dd0ec832", "id":"6d4c666e-1aad-465e-b670-4d112b760137" } ] }neutron-lib-2.3.0/api-ref/source/v2/samples/availability-zones/0000775000175000017500000000000013641427200024417 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/availability-zones/azs-list-response.json0000664000175000017500000000041613641427107030723 0ustar zuulzuul00000000000000{ "availability_zones": [ { "state": "available", "resource": "router", "name": "nova" }, { "state": "available", "resource": "network", "name": "nova" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/0000775000175000017500000000000013641427200022274 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnetpool-update-response.json0000664000175000017500000000135313641427107030505 0ustar zuulzuul00000000000000{ "subnetpool": { "name": "my-new-subnetpool-name", "default_quota": null, "is_default": false, "project_id": "9fadcee8aa7c40cdb2114fff7d569c08", "tenant_id": "9fadcee8aa7c40cdb2114fff7d569c08", "prefixes": [ "2001:db8::/63", "2001:db8:0:2::/64" ], "min_prefixlen": 64, "address_scope_id": null, "ip_version": 6, "shared": false, "default_prefixlen": 64, "id": "03f761e6-eee0-43fc-a921-8acf64c14988", "max_prefixlen": 64, "description": "", "created_at": "2016-03-08T20:19:41", "updated_at": "2016-03-08T20:19:41", "revision_number": 2, "tags": ["tag1,tag2"] } } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnets-create-bulk-response.json0000664000175000017500000000422613641427107030714 0ustar zuulzuul00000000000000{ "subnets": [ { "allocation_pools": [ { "end": "192.168.199.254", "start": "192.168.199.2" } ], "cidr": "192.168.199.0/24", "dns_nameservers": [], "dns_publish_fixed_ip": false, "enable_dhcp": true, "gateway_ip": "192.168.199.1", "host_routes": [], "id": "0468a7a7-290d-4127-aedd-6c9449775a24", "ip_version": 4, "name": "", "network_id": "e6031bc2-901a-4c66-82da-f4c32ed89406", "segment_id": null, "project_id": "d19231fc08ec4bc4829b668040d34512", "tenant_id": "d19231fc08ec4bc4829b668040d34512", "created_at": "2016-10-10T14:35:47Z", "description": "", "ipv6_address_mode": null, "ipv6_ra_mode": null, "revision_number": 1, "service_types": [], "subnetpool_id": null, "tags": ["tag1,tag2"], "updated_at": "2016-10-10T14:35:47Z" }, { "allocation_pools": [ { "end": "10.56.7.254", "start": "10.56.4.2" } ], "cidr": "10.56.4.0/22", "dns_nameservers": [], "dns_publish_fixed_ip": false, "enable_dhcp": true, "gateway_ip": "10.56.4.1", "host_routes": [], "id": "b0e7435c-1512-45fb-aa9e-9a7c5932fb30", "ip_version": 4, "name": "", "network_id": "64239a54-dcc4-4b39-920b-b37c2144effa", "segment_id": null, "project_id": "d19231fc08ec4bc4829b668040d34512", "tenant_id": "d19231fc08ec4bc4829b668040d34512", "created_at": "2016-10-10T14:35:34Z", "description": "", "ipv6_address_mode": null, "ipv6_ra_mode": null, "revision_number": 1, "service_types": [], "subnetpool_id": null, "tags": ["tag1,tag2"], "updated_at": "2016-10-10T14:35:34Z" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnetpool-remove-prefixes-request.json0000664000175000017500000000004513641427107032172 0ustar zuulzuul00000000000000{ "prefixes": ["192.168.0.0/24"] } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnetpool-update-request.json0000664000175000017500000000044113641427107030334 0ustar zuulzuul00000000000000{ "subnetpool": { "name": "my-new-subnetpool-name", "prefixes": [ "2001:db8::/64", "2001:db8:0:1::/64", "2001:db8:0:2::/64" ], "min_prefixlen": 64, "default_prefixlen": 64, "max_prefixlen": 64 } } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnetpool-add-prefixes-response.json0000664000175000017500000000006613641427107031576 0ustar zuulzuul00000000000000{ "prefixes": ["192.168.0.0/23", "172.16.0.0/21"] } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnets-list-response.json0000664000175000017500000000423413641427107027470 0ustar zuulzuul00000000000000{ "subnets": [ { "name": "private-subnet", "enable_dhcp": true, "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324", "segment_id": null, "project_id": "26a7980765d0414dbc1fc1f88cdb7e6e", "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e", "dns_nameservers": [], "dns_publish_fixed_ip": false, "allocation_pools": [ { "start": "10.0.0.2", "end": "10.0.0.254" } ], "host_routes": [], "ip_version": 4, "gateway_ip": "10.0.0.1", "cidr": "10.0.0.0/24", "id": "08eae331-0402-425a-923c-34f7cfe39c1b", "created_at": "2016-10-10T14:35:34Z", "description": "", "ipv6_address_mode": null, "ipv6_ra_mode": null, "revision_number": 2, "service_types": [], "subnetpool_id": null, "tags": ["tag1,tag2"], "updated_at": "2016-10-10T14:35:34Z" }, { "name": "my_subnet", "enable_dhcp": true, "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", "segment_id": null, "project_id": "4fd44f30292945e481c7b8a0c8908869", "tenant_id": "4fd44f30292945e481c7b8a0c8908869", "dns_nameservers": [], "dns_publish_fixed_ip": false, "allocation_pools": [ { "start": "192.0.0.2", "end": "192.255.255.254" } ], "host_routes": [], "ip_version": 4, "gateway_ip": "192.0.0.1", "cidr": "192.0.0.0/8", "id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0b", "created_at": "2016-10-10T14:35:47Z", "description": "", "ipv6_address_mode": null, "ipv6_ra_mode": null, "revision_number": 2, "service_types": [], "subnetpool_id": null, "tags": ["tag1,tag2"], "updated_at": "2016-10-10T14:35:47Z" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnetpool-create-request.json0000664000175000017500000000041713641427107030320 0ustar zuulzuul00000000000000{ "subnetpool": { "name": "my-subnet-pool", "prefixes": [ "192.168.0.0/16", "10.10.0.0/21" ], "default_prefixlen": 25, "min_prefixlen": 24, "max_prefixlen": 30, "shared": "false" } } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnet-update-response.json0000664000175000017500000000155613641427107027620 0ustar zuulzuul00000000000000{ "subnet": { "name": "my_subnet", "enable_dhcp": true, "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324", "revision_number": 1, "segment_id": null, "project_id": "26a7980765d0414dbc1fc1f88cdb7e6e", "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e", "created_at": "2016-03-08T20:19:41", "dns_nameservers": [], "dns_publish_fixed_ip": false, "service_types": [], "allocation_pools": [ { "start": "10.0.0.2", "end": "10.0.0.254" } ], "host_routes": [], "ip_version": 4, "gateway_ip": "10.0.0.1", "cidr": "10.0.0.0/24", "updated_at": "2016-03-08T20:19:41", "id": "08eae331-0402-425a-923c-34f7cfe39c1b", "description": "", "tags": ["tag1,tag2"] } } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnet-show-response.json0000664000175000017500000000172513641427107027314 0ustar zuulzuul00000000000000{ "subnet": { "name": "my_subnet", "enable_dhcp": true, "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", "segment_id": null, "project_id": "4fd44f30292945e481c7b8a0c8908869", "tenant_id": "4fd44f30292945e481c7b8a0c8908869", "created_at": "2016-03-08T20:19:41", "dns_nameservers": [], "dns_publish_fixed_ip": false, "allocation_pools": [ { "start": "192.0.0.2", "end": "192.255.255.254" } ], "host_routes": [], "ip_version": 4, "gateway_ip": "192.0.0.1", "cidr": "192.0.0.0/8", "updated_at": "2016-03-08T20:19:41", "id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0b", "description": "", "ipv6_address_mode": null, "ipv6_ra_mode": null, "revision_number": 2, "service_types": [], "subnetpool_id": null, "tags": ["tag1,tag2"] } } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnet-create-request.json0000664000175000017500000000022413641427107027422 0ustar zuulzuul00000000000000{ "subnet": { "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", "ip_version": 4, "cidr": "192.168.199.0/24" } } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnetpool-create-response.json0000664000175000017500000000133713641427107030470 0ustar zuulzuul00000000000000{ "subnetpool": { "address_scope_id": null, "default_prefixlen": 25, "default_quota": null, "description": "", "id": "f49a1319-423a-4ee6-ba54-1d95a4f6cc68", "ip_version": 4, "is_default": false, "max_prefixlen": 30, "min_prefixlen": 24, "name": "my-subnet-pool", "prefixes": [ "10.10.0.0/21", "192.168.0.0/16" ], "project_id": "9fadcee8aa7c40cdb2114fff7d569c08", "revision_number": 1, "shared": false, "created_at": "2016-03-08T20:19:41", "updated_at": "2016-03-08T20:19:41", "tags": ["tag1,tag2"], "tenant_id": "9fadcee8aa7c40cdb2114fff7d569c08" } } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnet-update-request.json0000664000175000017500000000006613641427107027445 0ustar zuulzuul00000000000000{ "subnet": { "name": "my_subnet" } } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnetpool-show-response.json0000664000175000017500000000135113641427107030201 0ustar zuulzuul00000000000000{ "subnetpool": { "min_prefixlen": "64", "address_scope_id": null, "default_prefixlen": "64", "id": "03f761e6-eee0-43fc-a921-8acf64c14988", "max_prefixlen": "64", "name": "my-subnet-pool", "default_quota": null, "is_default": false, "project_id": "9fadcee8aa7c40cdb2114fff7d569c08", "tenant_id": "9fadcee8aa7c40cdb2114fff7d569c08", "created_at": "2016-03-08T20:19:41", "prefixes": [ "2001:db8:0:2::/64", "2001:db8::/63" ], "updated_at": "2016-03-08T20:19:41", "ip_version": 6, "shared": false, "description": "", "revision_number": 2, "tags": ["tag1,tag2"] } } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnets-create-bulk-request.json0000664000175000017500000000051413641427107030542 0ustar zuulzuul00000000000000{ "subnets": [ { "cidr": "192.168.199.0/24", "ip_version": 4, "network_id": "e6031bc2-901a-4c66-82da-f4c32ed89406" }, { "cidr": "10.56.4.0/22", "ip_version": 4, "network_id": "64239a54-dcc4-4b39-920b-b37c2144effa" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnet-create-response.json0000664000175000017500000000173313641427107027576 0ustar zuulzuul00000000000000{ "subnet": { "name": "", "enable_dhcp": true, "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", "segment_id": null, "project_id": "4fd44f30292945e481c7b8a0c8908869", "tenant_id": "4fd44f30292945e481c7b8a0c8908869", "dns_nameservers": [], "dns_publish_fixed_ip": false, "allocation_pools": [ { "start": "192.168.199.2", "end": "192.168.199.254" } ], "host_routes": [], "ip_version": 4, "gateway_ip": "192.168.199.1", "cidr": "192.168.199.0/24", "id": "3b80198d-4f7b-4f77-9ef5-774d54e17126", "created_at": "2016-10-10T14:35:47Z", "description": "", "ipv6_address_mode": null, "ipv6_ra_mode": null, "revision_number": 1, "service_types": [], "subnetpool_id": null, "tags": ["tag1,tag2"], "updated_at": "2016-10-10T14:35:47Z" } } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnetpool-remove-prefixes-response.json0000664000175000017500000000006613641427107032343 0ustar zuulzuul00000000000000{ "prefixes": ["192.168.1.0/24", "172.16.0.0/21"] } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnetpool-add-prefixes-request.json0000664000175000017500000000011013641427107031416 0ustar zuulzuul00000000000000{ "prefixes": ["192.168.0.0/24", "192.168.1.0/24", "172.16.0.0/21"] } neutron-lib-2.3.0/api-ref/source/v2/samples/subnets/subnetpools-list-response.json0000664000175000017500000000321413641427107030357 0ustar zuulzuul00000000000000{ "subnetpools": [ { "min_prefixlen": "64", "address_scope_id": null, "default_prefixlen": "64", "id": "03f761e6-eee0-43fc-a921-8acf64c14988", "max_prefixlen": "64", "name": "my-subnet-pool-ipv6", "default_quota": null, "is_default": false, "project_id": "9fadcee8aa7c40cdb2114fff7d569c08", "tenant_id": "9fadcee8aa7c40cdb2114fff7d569c08", "prefixes": [ "2001:db8:0:2::/64", "2001:db8::/63" ], "ip_version": 6, "shared": false, "description": "", "created_at": "2016-03-08T20:19:41", "updated_at": "2016-03-08T20:19:41", "revision_number": 2, "tags": ["tag1,tag2"] }, { "min_prefixlen": "24", "address_scope_id": null, "default_prefixlen": "25", "id": "f49a1319-423a-4ee6-ba54-1d95a4f6cc68", "max_prefixlen": "30", "name": "my-subnet-pool-ipv4", "default_quota": null, "is_default": false, "project_id": "9fadcee8aa7c40cdb2114fff7d569c08", "tenant_id": "9fadcee8aa7c40cdb2114fff7d569c08", "prefixes": [ "10.10.0.0/21", "192.168.0.0/16" ], "ip_version": 4, "shared": false, "description": "", "created_at": "2016-03-08T20:19:41", "updated_at": "2016-03-08T20:19:41", "revision_number": 2, "tags": ["tag1,tag2"] } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/0000775000175000017500000000000013641427200021414 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ipsecpolicies-list-response.json0000664000175000017500000000113713641427107027757 0ustar zuulzuul00000000000000{ "ipsecpolicies": [ { "name": "ipsecpolicy1", "transform_protocol": "esp", "auth_algorithm": "sha1", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes-128", "pfs": "group14", "project_id": "ccb81365fe36411a9011e90491fe1330", "tenant_id": "ccb81365fe36411a9011e90491fe1330", "lifetime": { "units": "seconds", "value": 3600 }, "id": "5291b189-fd84-46e5-84bd-78f40c05d69c", "description": "" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/vpnservice-create-request.json0000664000175000017500000000031513641427107027427 0ustar zuulzuul00000000000000{ "vpnservice": { "subnet_id": null, "router_id": "66e3b16c-8ce5-40fb-bb49-ab6d8dc3f2aa", "name": "myservice", "admin_state_up": true, "flavor_id": null } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/vpnservice-create-response.json0000664000175000017500000000100713641427107027574 0ustar zuulzuul00000000000000{ "vpnservice": { "router_id": "66e3b16c-8ce5-40fb-bb49-ab6d8dc3f2aa", "status": "PENDING_CREATE", "name": "myservice", "external_v6_ip": "2001:db8::1", "admin_state_up": true, "subnet_id": null, "project_id": "10039663455a446d8ba2cbb058b0f578", "tenant_id": "10039663455a446d8ba2cbb058b0f578", "external_v4_ip": "172.32.1.11", "id": "5c561d9d-eaea-45f6-ae3e-08d1a7080828", "description": "", "flavor_id": null } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/vpnservices-list-response.json0000664000175000017500000000111413641427107027466 0ustar zuulzuul00000000000000{ "vpnservices": [ { "router_id": "66e3b16c-8ce5-40fb-bb49-ab6d8dc3f2aa", "status": "PENDING_CREATE", "name": "myservice", "external_v6_ip": "2001:db8::1", "admin_state_up": true, "subnet_id": null, "project_id": "10039663455a446d8ba2cbb058b0f578", "tenant_id": "10039663455a446d8ba2cbb058b0f578", "external_v4_ip": "172.32.1.11", "id": "5c561d9d-eaea-45f6-ae3e-08d1a7080828", "description": "", "flavor_id": null } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/vpn-endpoint-group-update-request.json0000664000175000017500000000011313641427107031031 0ustar zuulzuul00000000000000{ "endpoint_group": { "description": "New description" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ipsec-site-connection-show-response.json0000664000175000017500000000177313641427107031341 0ustar zuulzuul00000000000000{ "ipsec_site_connection": { "status": "DOWN", "psk": "secret", "initiator": "bi-directional", "name": "vpnconnection1", "admin_state_up": true, "project_id": "10039663455a446d8ba2cbb058b0f578", "tenant_id": "10039663455a446d8ba2cbb058b0f578", "auth_mode": "psk", "peer_cidrs": [], "mtu": 1500, "peer_ep_group_id": "9ad5a7e0-6dac-41b4-b20d-a7b8645fddf1", "ikepolicy_id": "9b00d6b0-6c93-4ca5-9747-b8ade7bb514f", "vpnservice_id": "5c561d9d-eaea-45f6-ae3e-08d1a7080828", "dpd": { "action": "hold", "interval": 30, "timeout": 120 }, "route_mode": "static", "ipsecpolicy_id": "e6e23d0c-9519-4d52-8ea4-5b1f96d857b1", "local_ep_group_id": "3e1815dd-e212-43d0-8f13-b494fa553e68", "peer_address": "172.24.4.226", "peer_id": "172.24.4.226", "id": "851f280f-5639-4ea3-81aa-e298525ab74b", "description": "" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/vpnservice-update-request.json0000664000175000017500000000011313641427107027442 0ustar zuulzuul00000000000000{ "vpnservice": { "description": "Updated description" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ikepolicy-create-response.json0000664000175000017500000000100713641427107027400 0ustar zuulzuul00000000000000{ "ikepolicy": { "name": "ikepolicy1", "project_id": "ccb81365fe36411a9011e90491fe1330", "tenant_id": "ccb81365fe36411a9011e90491fe1330", "auth_algorithm": "sha1", "encryption_algorithm": "aes-128", "pfs": "group5", "phase1_negotiation_mode": "main", "lifetime": { "units": "seconds", "value": 7200 }, "ike_version": "v1", "id": "5522aff7-1b3c-48dd-9c3c-b50f016b73db", "description": "" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ikepolicy-show-response.json0000664000175000017500000000100713641427107027115 0ustar zuulzuul00000000000000{ "ikepolicy": { "name": "ikepolicy1", "project_id": "ccb81365fe36411a9011e90491fe1330", "tenant_id": "ccb81365fe36411a9011e90491fe1330", "auth_algorithm": "sha1", "encryption_algorithm": "aes-256", "pfs": "group5", "phase1_negotiation_mode": "main", "lifetime": { "units": "seconds", "value": 3600 }, "ike_version": "v1", "id": "5522aff7-1b3c-48dd-9c3c-b50f016b73db", "description": "" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/vpnservice-update-response.json0000664000175000017500000000067413641427107027624 0ustar zuulzuul00000000000000{ "vpnservice": { "router_id": "881b7b30-4efb-407e-a162-5630a7af3595", "status": "ACTIVE", "name": "myvpn", "admin_state_up": true, "subnet_id": null, "project_id": "26de9cd6cae94c8cb9f79d660d628e1f", "tenant_id": "26de9cd6cae94c8cb9f79d660d628e1f", "id": "41bfef97-af4e-4f6b-a5d3-4678859d2485", "description": "Updated description", "flavor_id": null } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ipsecpolicy-create-request.json0000664000175000017500000000051413641427107027567 0ustar zuulzuul00000000000000{ "ipsecpolicy": { "name": "ipsecpolicy1", "transform_protocol": "esp", "auth_algorithm": "sha1", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes-128", "pfs": "group5", "lifetime": { "units": "seconds", "value": 7200 } } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ikepolicies-list-response.json0000664000175000017500000000112513641427107027421 0ustar zuulzuul00000000000000{ "ikepolicies": [ { "name": "ikepolicy1", "project_id": "ccb81365fe36411a9011e90491fe1330", "tenant_id": "ccb81365fe36411a9011e90491fe1330", "auth_algorithm": "sha1", "encryption_algorithm": "aes-256", "pfs": "group5", "phase1_negotiation_mode": "main", "lifetime": { "units": "seconds", "value": 3600 }, "ike_version": "v1", "id": "5522aff7-1b3c-48dd-9c3c-b50f016b73db", "description": "" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ipsecpolicy-update-response.json0000664000175000017500000000102113641427107027746 0ustar zuulzuul00000000000000{ "ipsecpolicy": { "name": "ipsecpolicy1", "transform_protocol": "esp", "auth_algorithm": "sha1", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes-128", "pfs": "group14", "project_id": "ccb81365fe36411a9011e90491fe1330", "tenant_id": "ccb81365fe36411a9011e90491fe1330", "lifetime": { "units": "seconds", "value": 3600 }, "id": "5291b189-fd84-46e5-84bd-78f40c05d69c", "description": "" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/vpnservice-show-response.json0000664000175000017500000000100713641427107027311 0ustar zuulzuul00000000000000{ "vpnservice": { "router_id": "66e3b16c-8ce5-40fb-bb49-ab6d8dc3f2aa", "status": "PENDING_CREATE", "name": "myservice", "external_v6_ip": "2001:db8::1", "admin_state_up": true, "subnet_id": null, "project_id": "10039663455a446d8ba2cbb058b0f578", "tenant_id": "10039663455a446d8ba2cbb058b0f578", "external_v4_ip": "172.32.1.11", "id": "5c561d9d-eaea-45f6-ae3e-08d1a7080828", "description": "", "flavor_id": null } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ipsec-site-connections-list-response.json0000664000175000017500000000217613641427107031515 0ustar zuulzuul00000000000000{ "ipsec_site_connections": [ { "status": "PENDING CREATE", "psk": "secret", "initiator": "bi-directional", "name": "vpnconnection1", "admin_state_up": true, "project_id": "10039663455a446d8ba2cbb058b0f578", "tenant_id": "10039663455a446d8ba2cbb058b0f578", "auth_mode": "psk", "peer_cidrs": [], "mtu": 1500, "peer_ep_group_id": "9ad5a7e0-6dac-41b4-b20d-a7b8645fddf1", "ikepolicy_id": "9b00d6b0-6c93-4ca5-9747-b8ade7bb514f", "vpnservice_id": "5c561d9d-eaea-45f6-ae3e-08d1a7080828", "dpd": { "action": "hold", "interval": 30, "timeout": 120 }, "route_mode": "static", "ipsecpolicy_id": "e6e23d0c-9519-4d52-8ea4-5b1f96d857b1", "local_ep_group_id": "3e1815dd-e212-43d0-8f13-b494fa553e68", "peer_address": "172.24.4.226", "peer_id": "172.24.4.226", "id": "851f280f-5639-4ea3-81aa-e298525ab74b", "description": "" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ikepolicy-update-response.json0000664000175000017500000000100713641427107027417 0ustar zuulzuul00000000000000{ "ikepolicy": { "name": "ikepolicy1", "project_id": "ccb81365fe36411a9011e90491fe1330", "tenant_id": "ccb81365fe36411a9011e90491fe1330", "auth_algorithm": "sha1", "encryption_algorithm": "aes-256", "pfs": "group5", "phase1_negotiation_mode": "main", "lifetime": { "units": "seconds", "value": 3600 }, "ike_version": "v1", "id": "5522aff7-1b3c-48dd-9c3c-b50f016b73db", "description": "" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/vpn-endpoint-group-update-response.json0000664000175000017500000000057413641427107031212 0ustar zuulzuul00000000000000{ "endpoint_group": { "description": "New description", "project_id": "4ad57e7ce0b24fca8f12b9834d91079d", "tenant_id": "4ad57e7ce0b24fca8f12b9834d91079d", "endpoints": [ "10.2.0.0/24", "10.3.0.0/24" ], "type": "cidr", "id": "6ecd9cf3-ca64-46c7-863f-f2eb1b9e838a", "name": "peers" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ikepolicy-create-request.json0000664000175000017500000000050313641427107027232 0ustar zuulzuul00000000000000{ "ikepolicy": { "phase1_negotiation_mode": "main", "auth_algorithm": "sha1", "encryption_algorithm": "aes-128", "pfs": "group5", "lifetime": { "units": "seconds", "value": 7200 }, "ike_version": "v1", "name": "ikepolicy1" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ipsecpolicy-show-response.json0000664000175000017500000000102113641427107027444 0ustar zuulzuul00000000000000{ "ipsecpolicy": { "name": "ipsecpolicy1", "transform_protocol": "esp", "auth_algorithm": "sha1", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes-128", "pfs": "group14", "project_id": "ccb81365fe36411a9011e90491fe1330", "tenant_id": "ccb81365fe36411a9011e90491fe1330", "lifetime": { "units": "seconds", "value": 3600 }, "id": "5291b189-fd84-46e5-84bd-78f40c05d69c", "description": "" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/vpn-endpoint-group-create-request.json0000664000175000017500000000025113641427107031015 0ustar zuulzuul00000000000000{ "endpoint_group": { "endpoints": [ "10.2.0.0/24", "10.3.0.0/24" ], "type": "cidr", "name": "peers" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ipsec-site-connection-create-request.json0000664000175000017500000000113013641427107031441 0ustar zuulzuul00000000000000{ "ipsec_site_connection": { "psk": "secret", "initiator": "bi-directional", "ipsecpolicy_id": "e6e23d0c-9519-4d52-8ea4-5b1f96d857b1", "admin_state_up": true, "mtu": "1500", "peer_ep_group_id": "9ad5a7e0-6dac-41b4-b20d-a7b8645fddf1", "ikepolicy_id": "9b00d6b0-6c93-4ca5-9747-b8ade7bb514f", "vpnservice_id": "5c561d9d-eaea-45f6-ae3e-08d1a7080828", "local_ep_group_id": "3e1815dd-e212-43d0-8f13-b494fa553e68", "peer_address": "172.24.4.233", "peer_id": "172.24.4.233", "name": "vpnconnection1" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ipsec-site-connection-update-response.json0000664000175000017500000000201213641427107031626 0ustar zuulzuul00000000000000{ "ipsec_site_connection": { "status": "DOWN", "psk": "secret", "initiator": "bi-directional", "name": "vpnconnection1", "admin_state_up": true, "project_id": "10039663455a446d8ba2cbb058b0f578", "tenant_id": "10039663455a446d8ba2cbb058b0f578", "auth_mode": "psk", "peer_cidrs": [], "mtu": 2000, "peer_ep_group_id": "9ad5a7e0-6dac-41b4-b20d-a7b8645fddf1", "ikepolicy_id": "9b00d6b0-6c93-4ca5-9747-b8ade7bb514f", "vpnservice_id": "5c561d9d-eaea-45f6-ae3e-08d1a7080828", "dpd": { "action": "hold", "interval": 30, "timeout": 120 }, "route_mode": "static", "ipsecpolicy_id": "e6e23d0c-9519-4d52-8ea4-5b1f96d857b1", "local_ep_group_id": "3e1815dd-e212-43d0-8f13-b494fa553e68", "peer_address": "172.24.4.233", "peer_id": "172.24.4.233", "id": "851f280f-5639-4ea3-81aa-e298525ab74b", "description": "New description" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/vpn-endpoint-group-show-response.json0000664000175000017500000000055513641427107030707 0ustar zuulzuul00000000000000{ "endpoint_group": { "description": "", "project_id": "4ad57e7ce0b24fca8f12b9834d91079d", "tenant_id": "4ad57e7ce0b24fca8f12b9834d91079d", "endpoints": [ "10.2.0.0/24", "10.3.0.0/24" ], "type": "cidr", "id": "6ecd9cf3-ca64-46c7-863f-f2eb1b9e838a", "name": "peers" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ipsec-site-connection-create-response.json0000664000175000017500000000200513641427107031611 0ustar zuulzuul00000000000000{ "ipsec_site_connection": { "status": "PENDING_CREATE", "psk": "secret", "initiator": "bi-directional", "name": "vpnconnection1", "admin_state_up": true, "project_id": "10039663455a446d8ba2cbb058b0f578", "tenant_id": "10039663455a446d8ba2cbb058b0f578", "auth_mode": "psk", "peer_cidrs": [], "mtu": 1500, "peer_ep_group_id": "9ad5a7e0-6dac-41b4-b20d-a7b8645fddf1", "ikepolicy_id": "9b00d6b0-6c93-4ca5-9747-b8ade7bb514f", "vpnservice_id": "5c561d9d-eaea-45f6-ae3e-08d1a7080828", "dpd": { "action": "hold", "interval": 30, "timeout": 120 }, "route_mode": "static", "ipsecpolicy_id": "e6e23d0c-9519-4d52-8ea4-5b1f96d857b1", "local_ep_group_id": "3e1815dd-e212-43d0-8f13-b494fa553e68", "peer_address": "172.24.4.233", "peer_id": "172.24.4.233", "id": "851f280f-5639-4ea3-81aa-e298525ab74b", "description": "" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ipsec-site-connection-update-request.json0000664000175000017500000000007713641427107031471 0ustar zuulzuul00000000000000{ "ipsec_site_connection": { "mtu": "2000" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ipsecpolicy-update-request.json0000664000175000017500000000007013641427107027603 0ustar zuulzuul00000000000000{ "ipsecpolicy": { "pfs": "group14" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ikepolicy-update-request.json0000664000175000017500000000010713641427107027251 0ustar zuulzuul00000000000000{ "ikepolicy": { "encryption_algorithm": "aes-256" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/ipsecpolicy-create-response.json0000664000175000017500000000102013641427107027726 0ustar zuulzuul00000000000000{ "ipsecpolicy": { "name": "ipsecpolicy1", "transform_protocol": "esp", "auth_algorithm": "sha1", "encapsulation_mode": "tunnel", "encryption_algorithm": "aes-128", "pfs": "group5", "project_id": "ccb81365fe36411a9011e90491fe1330", "tenant_id": "ccb81365fe36411a9011e90491fe1330", "lifetime": { "units": "seconds", "value": 7200 }, "id": "5291b189-fd84-46e5-84bd-78f40c05d69c", "description": "" } } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/vpn-endpoint-groups-list-response.json0000664000175000017500000000145713641427107031067 0ustar zuulzuul00000000000000{ "endpoint_groups": [ { "description": "", "project_id": "4ad57e7ce0b24fca8f12b9834d91079d", "tenant_id": "4ad57e7ce0b24fca8f12b9834d91079d", "endpoints": [ "a3da778c-adfb-46db-88b3-d2ce53290a89" ], "type": "subnet", "id": "6bf34c7c-864c-4948-a6d4-db791669f9d4", "name": "locals" }, { "description": "", "project_id": "4ad57e7ce0b24fca8f12b9834d91079d", "tenant_id": "4ad57e7ce0b24fca8f12b9834d91079d", "endpoints": [ "10.2.0.0/24", "10.3.0.0/24" ], "type": "cidr", "id": "6ecd9cf3-ca64-46c7-863f-f2eb1b9e838a", "name": "peers" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/vpn/vpn-endpoint-group-create-response.json0000664000175000017500000000055513641427107031172 0ustar zuulzuul00000000000000{ "endpoint_group": { "description": "", "project_id": "4ad57e7ce0b24fca8f12b9834d91079d", "tenant_id": "4ad57e7ce0b24fca8f12b9834d91079d", "endpoints": [ "10.2.0.0/24", "10.3.0.0/24" ], "type": "cidr", "id": "6ecd9cf3-ca64-46c7-863f-f2eb1b9e838a", "name": "peers" } } neutron-lib-2.3.0/api-ref/source/v2/samples/routers/0000775000175000017500000000000013641427200022314 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/routers/router-remove-extraroutes-request.json0000664000175000017500000000027513641427107032105 0ustar zuulzuul00000000000000{ "router" : { "routes" : [ { "destination" : "10.0.3.0/24", "nexthop" : "10.0.0.13" }, { "destination" : "10.0.4.0/24", "nexthop" : "10.0.0.14" } ] } } neutron-lib-2.3.0/api-ref/source/v2/samples/routers/router-create-response.json0000664000175000017500000000213113641427107027627 0ustar zuulzuul00000000000000{ "router": { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2018-03-19T19:17:04Z", "description": "", "distributed": false, "external_gateway_info": { "enable_snat": true, "external_fixed_ips": [ { "ip_address": "172.24.4.6", "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf" } ], "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3" }, "flavor_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0", "ha": false, "id": "f8a44de0-fc8e-45df-93c7-f79bf3b01c95", "name": "router1", "routes": [], "revision_number": 1, "status": "ACTIVE", "updated_at": "2018-03-19T19:17:22Z", "project_id": "0bd18306d801447bb457a46252d82d13", "tenant_id": "0bd18306d801447bb457a46252d82d13", "service_type_id": null, "tags": ["tag1,tag2"], "conntrack_helpers": [] } } neutron-lib-2.3.0/api-ref/source/v2/samples/routers/router-update-request.json0000664000175000017500000000110213641427107027475 0ustar zuulzuul00000000000000{ "router": { "distributed": false, "external_gateway_info": { "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3", "enable_snat": true, "external_fixed_ips": [ { "ip_address": "172.24.4.6", "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf" } ], "routes": [ { "destination": "179.24.1.0/24", "nexthop": "172.24.3.99" } ] } } } neutron-lib-2.3.0/api-ref/source/v2/samples/routers/router-add-extraroutes-response.json0000664000175000017500000000062613641427107031506 0ustar zuulzuul00000000000000{ "router" : { "id" : "64e339bb-1a6c-47bd-9ee7-a0cf81a35172", "name" : "router1", "routes" : [ { "destination" : "10.0.1.0/24", "nexthop" : "10.0.0.11" }, { "destination" : "10.0.2.0/24", "nexthop" : "10.0.0.12" }, { "destination" : "10.0.3.0/24", "nexthop" : "10.0.0.13" }, { "destination" : "10.0.4.0/24", "nexthop" : "10.0.0.14" } ] } } neutron-lib-2.3.0/api-ref/source/v2/samples/routers/routers-list-response.json0000664000175000017500000000700213641427107027524 0ustar zuulzuul00000000000000{ "routers": [ { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2018-03-19T19:17:04Z", "description": "", "distributed": false, "external_gateway_info": { "enable_snat": true, "external_fixed_ips": [ { "ip_address": "172.24.4.3", "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf" }, { "ip_address": "2001:db8::c", "subnet_id": "0c56df5d-ace5-46c8-8f4c-45fa4e334d18" } ], "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3" }, "flavor_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0", "ha": false, "id": "915a14a6-867b-4af7-83d1-70efceb146f9", "name": "router2", "revision_number": 1, "routes": [ { "destination": "179.24.1.0/24", "nexthop": "172.24.3.99" } ], "status": "ACTIVE", "updated_at": "2018-03-19T19:17:22Z", "project_id": "0bd18306d801447bb457a46252d82d13", "tenant_id": "0bd18306d801447bb457a46252d82d13", "service_type_id": null, "tags": ["tag1,tag2"], "conntrack_helpers": [ { "protocol": "udp", "helper": "tftp", "port": 69 }, { "protocol": "tcp", "helper": "ftp", "port": 21 } ] }, { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2018-03-19T19:17:04Z", "description": "", "distributed": false, "external_gateway_info": { "enable_snat": true, "external_fixed_ips": [ { "ip_address": "172.24.4.6", "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf" }, { "ip_address": "2001:db8::9", "subnet_id": "0c56df5d-ace5-46c8-8f4c-45fa4e334d18" } ], "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3" }, "flavor_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0", "ha": false, "id": "f8a44de0-fc8e-45df-93c7-f79bf3b01c95", "name": "router1", "revision_number": 1, "routes": [], "status": "ACTIVE", "updated_at": "2018-03-19T19:17:22Z", "project_id": "0bd18306d801447bb457a46252d82d13", "tenant_id": "0bd18306d801447bb457a46252d82d13", "service_type_id": null, "tags": ["tag1,tag2"], "conntrack_helpers": [ { "protocol": "udp", "helper": "tftp", "port": 69 }, { "protocol": "tcp", "helper": "ftp", "port": 21 } ] } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/routers/router-add-interface-response.json0000664000175000017500000000065713641427107031065 0ustar zuulzuul00000000000000{ "id": "915a14a6-867b-4af7-83d1-70efceb146f9", "network_id": "91c013e2-d65a-474e-9177-c3e1799ca726", "port_id": "2dc46bcc-d1f2-4077-b99e-91ee28afaff0", "subnet_id": "a2f1f29d-571b-4533-907f-5803ab96ead1", "subnet_ids": [ "a2f1f29d-571b-4533-907f-5803ab96ead1" ], "project_id": "0bd18306d801447bb457a46252d82d13", "tenant_id": "0bd18306d801447bb457a46252d82d13", "tags": ["tag1,tag2"] } neutron-lib-2.3.0/api-ref/source/v2/samples/routers/router-add-interface-request.json0000664000175000017500000000007413641427107030710 0ustar zuulzuul00000000000000{ "subnet_id": "a2f1f29d-571b-4533-907f-5803ab96ead1" } neutron-lib-2.3.0/api-ref/source/v2/samples/routers/router-create-request.json0000664000175000017500000000066313641427107027471 0ustar zuulzuul00000000000000{ "router": { "name": "router1", "external_gateway_info": { "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3", "enable_snat": true, "external_fixed_ips": [ { "ip_address": "172.24.4.6", "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf" } ] }, "admin_state_up": true } } neutron-lib-2.3.0/api-ref/source/v2/samples/routers/router-remove-interface-request-with-port.json0000664000175000017500000000007213641427107033406 0ustar zuulzuul00000000000000{ "port_id": "2dc46bcc-d1f2-4077-b99e-91ee28afaff0" } neutron-lib-2.3.0/api-ref/source/v2/samples/routers/router-add-interface-request-with-port.json0000664000175000017500000000007213641427107032641 0ustar zuulzuul00000000000000{ "port_id": "2dc46bcc-d1f2-4077-b99e-91ee28afaff0" } neutron-lib-2.3.0/api-ref/source/v2/samples/routers/router-remove-interface-response.json0000664000175000017500000000065713641427107031632 0ustar zuulzuul00000000000000{ "id": "915a14a6-867b-4af7-83d1-70efceb146f9", "network_id": "91c013e2-d65a-474e-9177-c3e1799ca726", "port_id": "a5b7d209-dc02-4c46-a51f-805eadd3de64", "subnet_id": "4e5fe97c-82bc-432e-87d8-06d7e157dffa", "subnet_ids": [ "4e5fe97c-82bc-432e-87d8-06d7e157dffa" ], "project_id": "0bd18306d801447bb457a46252d82d13", "tags": ["tag1,tag2"], "tenant_id": "0bd18306d801447bb457a46252d82d13" } neutron-lib-2.3.0/api-ref/source/v2/samples/routers/router-add-extraroutes-request.json0000664000175000017500000000027513641427107031340 0ustar zuulzuul00000000000000{ "router" : { "routes" : [ { "destination" : "10.0.3.0/24", "nexthop" : "10.0.0.13" }, { "destination" : "10.0.4.0/24", "nexthop" : "10.0.0.14" } ] } } neutron-lib-2.3.0/api-ref/source/v2/samples/routers/router-remove-extraroutes-response.json0000664000175000017500000000041413641427107032246 0ustar zuulzuul00000000000000{ "router" : { "id" : "64e339bb-1a6c-47bd-9ee7-a0cf81a35172", "name" : "router1", "routes" : [ { "destination" : "10.0.1.0/24", "nexthop" : "10.0.0.11" }, { "destination" : "10.0.2.0/24", "nexthop" : "10.0.0.12" } ] } } neutron-lib-2.3.0/api-ref/source/v2/samples/routers/router-remove-interface-request.json0000664000175000017500000000007413641427107031455 0ustar zuulzuul00000000000000{ "subnet_id": "a2f1f29d-571b-4533-907f-5803ab96ead1" } neutron-lib-2.3.0/api-ref/source/v2/samples/routers/router-update-response.json0000664000175000017500000000232713641427107027655 0ustar zuulzuul00000000000000{ "router": { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2018-03-19T19:17:04Z", "description": "", "distributed": false, "external_gateway_info": { "enable_snat": true, "external_fixed_ips": [ { "ip_address": "172.24.4.6", "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf" } ], "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3" }, "flavor_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0", "ha": false, "id": "f8a44de0-fc8e-45df-93c7-f79bf3b01c95", "name": "router1", "revision_number": 3, "routes": [ { "destination": "179.24.1.0/24", "nexthop": "172.24.3.99" } ], "status": "ACTIVE", "updated_at": "2018-03-19T19:17:22Z", "project_id": "0bd18306d801447bb457a46252d82d13", "tenant_id": "0bd18306d801447bb457a46252d82d13", "service_type_id": null, "tags": ["tag1,tag2"], "conntrack_helpers": [] } } neutron-lib-2.3.0/api-ref/source/v2/samples/routers/router-show-response.json0000664000175000017500000000256513641427107027357 0ustar zuulzuul00000000000000{ "router": { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2018-03-19T19:17:04Z", "description": "", "distributed": false, "external_gateway_info": { "enable_snat": true, "external_fixed_ips": [ { "ip_address": "172.24.4.6", "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf" }, { "ip_address": "2001:db8::9", "subnet_id": "0c56df5d-ace5-46c8-8f4c-45fa4e334d18" } ], "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3" }, "flavor_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0", "ha": false, "id": "f8a44de0-fc8e-45df-93c7-f79bf3b01c95", "name": "router1", "revision_number": 1, "routes": [ { "destination": "179.24.1.0/24", "nexthop": "172.24.3.99" } ], "status": "ACTIVE", "updated_at": "2018-03-19T19:17:22Z", "project_id": "0bd18306d801447bb457a46252d82d13", "tenant_id": "0bd18306d801447bb457a46252d82d13", "service_type_id": null, "tags": ["tag1,tag2"], "conntrack_helpers": [] } } neutron-lib-2.3.0/api-ref/source/v2/samples/metering/0000775000175000017500000000000013641427200022423 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-label-rule-delete-request-json-http.txtneutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-label-rule-delete-request-json-http.tx0000664000175000017500000000036313641427107033516 0ustar zuulzuul00000000000000DELETE /v2.0/metering/metering-labels/37b31179-71ee-4f0a-b130-0eeb28e7ede7 HTTP/1.1 Host: controlnode:9696 User-Agent: python-neutronclient Content-Type: application/json Accept: application/json X-Auth-Token: c52a1b304fec4ca0ac85dc1741eec6e2 neutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-label-rule-show-request-json-http.txt0000664000175000017500000000036513641427107033422 0ustar zuulzuul00000000000000GET /v2.0/metering/metering-label-rules/9536641a-7d14-4dc5-afaf-93a973ce0eb8 HTTP/1.1 Host: controlnode:9696 User-Agent: python-neutronclient Content-Type: application/json Accept: application/json X-Auth-Token: c52a1b304fec4ca0ac85dc1741eec6e2 neutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-label-rules-list-response.json0000664000175000017500000000107113641427107032147 0ustar zuulzuul00000000000000{ "metering_label_rules": [ { "remote_ip_prefix": "20.0.0.0/24", "direction": "ingress", "metering_label_id": "e131d186-b02d-4c0b-83d5-0c0725c4f812", "id": "9536641a-7d14-4dc5-afaf-93a973ce0eb8", "excluded": false }, { "remote_ip_prefix": "10.0.0.0/24", "direction": "ingress", "metering_label_id": "e131d186-b02d-4c0b-83d5-0c0725c4f812", "id": "ffc6fd15-40de-4e7d-b617-34d3f7a93aec", "excluded": false } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-label-rule-show-response.json0000664000175000017500000000040713641427107031773 0ustar zuulzuul00000000000000{ "metering_label_rule": { "remote_ip_prefix": "20.0.0.0/24", "direction": "ingress", "metering_label_id": "e131d186-b02d-4c0b-83d5-0c0725c4f812", "id": "9536641a-7d14-4dc5-afaf-93a973ce0eb8", "excluded": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-label-create-response.json0000664000175000017500000000045513641427107031314 0ustar zuulzuul00000000000000{ "metering_label": { "project_id": "45345b0ee1ea477fac0f541b2cb79cd4", "tenant_id": "45345b0ee1ea477fac0f541b2cb79cd4", "description": "description of label1", "name": "label1", "id": "bc91b832-8465-40a7-a5d8-ba87de442266", "shared": false } } ././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-label-rule-delete-response-json-http.txtneutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-label-rule-delete-response-json-http.t0000664000175000017500000000001413641427107033465 0ustar zuulzuul00000000000000status: 204 neutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-label-show-response.json0000664000175000017500000000045213641427107031026 0ustar zuulzuul00000000000000{ "metering_label": { "project_id": "45345b0ee1ea477fac0f541b2cb79cd4", "tenant_id": "45345b0ee1ea477fac0f541b2cb79cd4", "description": "label1 description", "name": "label1", "id": "a6700594-5b7a-4105-8bfe-723b346ce866", "shared": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-labels-list-response.json0000664000175000017500000000121413641427107031201 0ustar zuulzuul00000000000000{ "metering_labels": [ { "project_id": "45345b0ee1ea477fac0f541b2cb79cd4", "tenant_id": "45345b0ee1ea477fac0f541b2cb79cd4", "description": "label1 description", "name": "label1", "id": "a6700594-5b7a-4105-8bfe-723b346ce866", "shared": false }, { "project_id": "45345b0ee1ea477fac0f541b2cb79cd4", "tenant_id": "45345b0ee1ea477fac0f541b2cb79cd4", "description": "label2 description", "name": "label2", "id": "e131d186-b02d-4c0b-83d5-0c0725c4f812", "shared": false } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-label-delete-response-json-http.txt0000664000175000017500000000001413641427107033074 0ustar zuulzuul00000000000000status: 204 neutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-label-show-request-json-http.txt0000664000175000017500000000036013641427107032450 0ustar zuulzuul00000000000000GET /v2.0/metering/metering-labels/a6700594-5b7a-4105-8bfe-723b346ce866 HTTP/1.1 Host: controlnode:9696 User-Agent: python-neutronclient Content-Type: application/json Accept: application/json X-Auth-Token: c52a1b304fec4ca0ac85dc1741eec6e2 neutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-label-rule-create-response.json0000664000175000017500000000040713641427107032256 0ustar zuulzuul00000000000000{ "metering_label_rule": { "remote_ip_prefix": "10.0.1.0/24", "direction": "ingress", "metering_label_id": "e131d186-b02d-4c0b-83d5-0c0725c4f812", "id": "00e13b58-b4f2-4579-9c9c-7ac94615f9ae", "excluded": false } } neutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-label-rule-create-request.json0000664000175000017500000000026613641427107032113 0ustar zuulzuul00000000000000{ "metering_label_rule": { "remote_ip_prefix": "10.0.1.0/24", "direction": "ingress", "metering_label_id": "e131d186-b02d-4c0b-83d5-0c0725c4f812" } } neutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-label-rules-list-request-json-http.txt0000664000175000017500000000032013641427107033567 0ustar zuulzuul00000000000000GET /v2.0/metering/metering-label-rules HTTP/1.1 Host: controlnode:9696 User-Agent: python-neutronclient Content-Type: application/json Accept: application/json X-Auth-Token: c52a1b304fec4ca0ac85dc1741eec6e2 neutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-labels-list-request-json-http.txt0000664000175000017500000000031313641427107032624 0ustar zuulzuul00000000000000GET /v2.0/metering/metering-labels HTTP/1.1 Host: controlnode:9696 User-Agent: python-neutronclient Content-Type: application/json Accept: application/json X-Auth-Token: c52a1b304fec4ca0ac85dc1741eec6e2 neutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-label-create-request.json0000664000175000017500000000015313641427107031141 0ustar zuulzuul00000000000000{ "metering_label": { "name": "label1", "description": "description of label1" } } neutron-lib-2.3.0/api-ref/source/v2/samples/metering/metering-label-delete-request-json-http.txt0000664000175000017500000000036313641427107032735 0ustar zuulzuul00000000000000DELETE /v2.0/metering/metering-labels/a6700594-5b7a-4105-8bfe-723b346ce866 HTTP/1.1 Host: controlnode:9696 User-Agent: python-neutronclient Content-Type: application/json Accept: application/json X-Auth-Token: c52a1b304fec4ca0ac85dc1741eec6e2 neutron-lib-2.3.0/api-ref/source/v2/samples/port_forwardings/0000775000175000017500000000000013641427200024202 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/port_forwardings/port-fowarding-update-response.json0000664000175000017500000000045213641427107033162 0ustar zuulzuul00000000000000{ "port_forwarding": { "protocol": "udp", "internal_ip_address": "10.0.0.14", "internal_port": 37, "internal_port_id": "99889dc2-19a7-4edb-b9d0-d2ace8d1e144", "external_port": 1960, "description": "Some description", "id": "725ade3c-9760-4880-8080-8fc2dbab9acc" } } neutron-lib-2.3.0/api-ref/source/v2/samples/port_forwardings/port-fowarding-update-request.json0000664000175000017500000000032013641427107033006 0ustar zuulzuul00000000000000{ "port_forwarding": { "protocol": "udp", "internal_port": 37, "internal_port_id": "99889dc2-19a7-4edb-b9d0-d2ace8d1e144", "external_port": 1960, "description": "Some description" } } neutron-lib-2.3.0/api-ref/source/v2/samples/port_forwardings/port-fowarding-show-response.json0000664000175000017500000000045213641427107032660 0ustar zuulzuul00000000000000{ "port_forwarding": { "protocol": "tcp", "internal_ip_address": "10.0.0.11", "internal_port": 25, "internal_port_id": "1238be08-a2a8-4b8d-addf-fb5e2250e480", "external_port": 2230, "description": "Some description", "id": "725ade3c-9760-4880-8080-8fc2dbab9acc" } } neutron-lib-2.3.0/api-ref/source/v2/samples/port_forwardings/port-fowarding-list-response.json0000664000175000017500000000113313641427107032650 0ustar zuulzuul00000000000000{ "port_forwardings": [ { "protocol": "tcp", "internal_ip_address": "10.0.0.24", "internal_port": 25, "internal_port_id": "070ef0b2-0175-4299-be5c-01fea8cca522", "external_port": 2229, "description": "Some description", "id": "1798dc82-c0ed-4b79-b12d-4c3c18f90eb2" }, { "protocol": "tcp", "internal_ip_address": "10.0.0.11", "internal_port": 25, "internal_port_id": "1238be08-a2a8-4b8d-addf-fb5e2250e480", "external_port": 2230, "description": "", "id": "e0a0274e-4d19-4eab-9e12-9e77a8caf3ea" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/port_forwardings/port-fowarding-create-request.json0000664000175000017500000000037013641427107032774 0ustar zuulzuul00000000000000{ "port_forwarding": { "protocol": "tcp", "internal_ip_address": "10.0.0.11", "internal_port": 25, "internal_port_id": "1238be08-a2a8-4b8d-addf-fb5e2250e480", "external_port": 2230, "description": "Some description" } } neutron-lib-2.3.0/api-ref/source/v2/samples/port_forwardings/port-fowarding-create-response.json0000664000175000017500000000045213641427107033143 0ustar zuulzuul00000000000000{ "port_forwarding": { "protocol": "tcp", "internal_ip_address": "10.0.0.11", "internal_port": 25, "internal_port_id": "1238be08-a2a8-4b8d-addf-fb5e2250e480", "external_port": 2230, "description": "Some description", "id": "725ade3c-9760-4880-8080-8fc2dbab9acc" } } neutron-lib-2.3.0/api-ref/source/v2/samples/conntrack_helpers/0000775000175000017500000000000013641427200024315 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/conntrack_helpers/conntrack-helper-update-response.json0000664000175000017500000000024213641427107033567 0ustar zuulzuul00000000000000{ "conntrack_helper": { "protocol": "udp", "id": "2fc1eebb-e0fa-4c40-868a-7ace444717e1", "helper": "tftp", "port": 69 } } neutron-lib-2.3.0/api-ref/source/v2/samples/conntrack_helpers/conntrack-helper-list-response.json0000664000175000017500000000055213641427107033264 0ustar zuulzuul00000000000000{ "conntrack_helpers": [ { "protocol": "udp", "id": "2fc1eebb-e0fa-4c40-868a-7ace444717e1", "helper": "tftp", "port": 6969 }, { "protocol": "tcp", "id": "ee7c890f-44fa-443d-9326-8574c1c3e5e1", "helper": "ftp", "port": 21 } ] }neutron-lib-2.3.0/api-ref/source/v2/samples/conntrack_helpers/conntrack-helper-create-response.json0000664000175000017500000000024113641427107033547 0ustar zuulzuul00000000000000{ "conntrack_helper": { "protocol": "tcp", "id": "32925de7-580e-4ca9-bfd7-c2c2cefbd2ad", "helper": "ftp", "port": 21 } } neutron-lib-2.3.0/api-ref/source/v2/samples/conntrack_helpers/conntrack-helper-create-request.json0000664000175000017500000000015513641427107033405 0ustar zuulzuul00000000000000{ "conntrack_helper": { "protocol": "udp", "port": 2121, "helper": "ftp" } } neutron-lib-2.3.0/api-ref/source/v2/samples/conntrack_helpers/conntrack-helper-update-request.json0000664000175000017500000000015413641427107033423 0ustar zuulzuul00000000000000{ "conntrack_helper": { "helper": "tftp", "protocol": "udp", "port": 69 } } neutron-lib-2.3.0/api-ref/source/v2/samples/conntrack_helpers/conntrack-helper-show-response.json0000664000175000017500000000024113641427107033264 0ustar zuulzuul00000000000000{ "conntrack_helper": { "protocol": "tcp", "id": "2fc1eebb-e0fa-4c40-868a-7ace444717e1", "helper": "ftp", "port": 21 } } neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/0000775000175000017500000000000013641427200023775 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-rule-create-response.json0000664000175000017500000000124213641427107033740 0ustar zuulzuul00000000000000{ "security_group_rule": { "direction": "ingress", "ethertype": "IPv4", "id": "2bc0accf-312e-429a-956e-e4407625eb62", "port_range_max": 80, "port_range_min": 80, "protocol": "tcp", "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "remote_ip_prefix": null, "security_group_id": "a7734e61-b545-452d-a3cd-0189cbd9747a", "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "revision_number": 1, "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "description": "" } } neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-rule-show-response.json0000664000175000017500000000114713641427107033461 0ustar zuulzuul00000000000000{ "security_group_rule": { "direction": "egress", "ethertype": "IPv6", "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff", "port_range_max": null, "port_range_min": null, "protocol": null, "remote_group_id": null, "remote_ip_prefix": null, "revision_number": 1, "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550" } } neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-create-response.json0000664000175000017500000000413013641427107032772 0ustar zuulzuul00000000000000{ "security_group": { "description": "security group for webservers", "id": "2076db17-a522-4506-91de-c6dd8e837028", "name": "new-webservers", "security_group_rules": [ { "direction": "egress", "ethertype": "IPv4", "id": "38ce2d8e-e8f1-48bd-83c2-d33cb9f50c3d", "port_range_max": null, "port_range_min": null, "protocol": null, "remote_group_id": null, "remote_ip_prefix": null, "security_group_id": "2076db17-a522-4506-91de-c6dd8e837028", "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "revision_number": 1, "revisio[n_number": 1, "tags": ["tag1,tag2"], "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "description": "" }, { "direction": "egress", "ethertype": "IPv6", "id": "565b9502-12de-4ffd-91e9-68885cff6ae1", "port_range_max": null, "port_range_min": null, "protocol": null, "remote_group_id": null, "remote_ip_prefix": null, "security_group_id": "2076db17-a522-4506-91de-c6dd8e837028", "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "revision_number": 1, "tags": ["tag1,tag2"], "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "description": "" } ], "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "revision_number": 1, "tags": ["tag1,tag2"], "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "stateful": true } } neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-create-request.json0000664000175000017500000000022513641427107032625 0ustar zuulzuul00000000000000{ "security_group": { "name": "new-webservers", "description": "security group for webservers", "stateful": true } } neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-update-request.json0000664000175000017500000000020513641427107032642 0ustar zuulzuul00000000000000{ "security_group": { "name": "mysecgroup", "description": "my security group", "stateful": true } } neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-rules-list-response.json0000664000175000017500000000543513641427107033643 0ustar zuulzuul00000000000000{ "security_group_rules": [ { "direction": "egress", "ethertype": "IPv6", "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff", "port_range_max": null, "port_range_min": null, "protocol": null, "remote_group_id": null, "remote_ip_prefix": null, "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "revision_number": 1, "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "description": "" }, { "direction": "egress", "ethertype": "IPv4", "id": "93aa42e5-80db-4581-9391-3a608bd0e448", "port_range_max": null, "port_range_min": null, "protocol": null, "remote_group_id": null, "remote_ip_prefix": null, "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "revision_number": 1, "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "description": "" }, { "direction": "ingress", "ethertype": "IPv6", "id": "c0b09f00-1d49-4e64-a0a7-8a186d928138", "port_range_max": null, "port_range_min": null, "protocol": null, "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "remote_ip_prefix": null, "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "revision_number": 2, "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "description": "" }, { "direction": "ingress", "ethertype": "IPv4", "id": "f7d45c89-008e-4bab-88ad-d6811724c51c", "port_range_max": null, "port_range_min": null, "protocol": null, "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "remote_ip_prefix": null, "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "revision_number": 1, "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "description": "" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-groups-list-response.json0000664000175000017500000000775513641427107032705 0ustar zuulzuul00000000000000{ "security_groups": [ { "description": "default", "id": "85cc3048-abc3-43cc-89b3-377341426ac5", "name": "default", "security_group_rules": [ { "direction": "egress", "ethertype": "IPv6", "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff", "port_range_max": null, "port_range_min": null, "protocol": null, "remote_group_id": null, "remote_ip_prefix": null, "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "revision_number": 1, "tags": ["tag1,tag2"], "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "description": "" }, { "direction": "egress", "ethertype": "IPv4", "id": "93aa42e5-80db-4581-9391-3a608bd0e448", "port_range_max": null, "port_range_min": null, "protocol": null, "remote_group_id": null, "remote_ip_prefix": null, "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "revision_number": 2, "tags": ["tag1,tag2"], "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "description": "" }, { "direction": "ingress", "ethertype": "IPv6", "id": "c0b09f00-1d49-4e64-a0a7-8a186d928138", "port_range_max": null, "port_range_min": null, "protocol": null, "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "remote_ip_prefix": null, "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "revision_number": 1, "tags": ["tag1,tag2"], "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "description": "" }, { "direction": "ingress", "ethertype": "IPv4", "id": "f7d45c89-008e-4bab-88ad-d6811724c51c", "port_range_max": null, "port_range_min": null, "protocol": null, "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "remote_ip_prefix": null, "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "revision_number": 1, "tags": ["tag1,tag2"], "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "description": "" } ], "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "revision_number": 8, "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "tags": ["tag1,tag2"], "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "stateful": true } ] } ././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-delete-request-json-http.txtneutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-delete-request-json-http.0000664000175000017500000000017113641427107033656 0ustar zuulzuul00000000000000DELETE /v2.0/security-groups/e470bdfc-4869-459b-a561-cb3377efae59 Content-Type: application/json Accept: application/json././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-delete-response-json-http.txtneutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-delete-response-json-http0000664000175000017500000000001313641427107033741 0ustar zuulzuul00000000000000status: 204neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-rule-create-request.json0000664000175000017500000000050613641427107033574 0ustar zuulzuul00000000000000{ "security_group_rule": { "direction": "ingress", "port_range_min": "80", "ethertype": "IPv4", "port_range_max": "80", "protocol": "tcp", "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "security_group_id": "a7734e61-b545-452d-a3cd-0189cbd9747a" } } neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-update-response.json0000664000175000017500000000075313641427107033020 0ustar zuulzuul00000000000000{ "security_group": { "security_group_rules": [], "project_id": "a52cdb9cc7854a39a23d3af73a40899e", "revision_number": 4, "tenant_id": "a52cdb9cc7854a39a23d3af73a40899e", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "id": "01fbade5-b664-42f6-83ae-4e214f4263fa", "name": "mysecgroup", "description": "my security group", "tags": ["tag1,tag2"], "stateful": true } } ././@LongLink0000000000000000000000000000015600000000000011217 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-rule-delete-response-json-http.txtneutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-rule-delete-response-json0000664000175000017500000000001313641427107033731 0ustar zuulzuul00000000000000status: 204neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-show-response.json0000664000175000017500000000721013641427107032511 0ustar zuulzuul00000000000000{ "security_group": { "description": "default", "id": "85cc3048-abc3-43cc-89b3-377341426ac5", "name": "default", "security_group_rules": [ { "direction": "egress", "ethertype": "IPv6", "id": "3c0e45ff-adaf-4124-b083-bf390e5482ff", "port_range_max": null, "port_range_min": null, "protocol": null, "remote_group_id": null, "remote_ip_prefix": null, "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "revision_number": 1, "tags": ["tag1,tag2"], "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "description": "" }, { "direction": "egress", "ethertype": "IPv4", "id": "93aa42e5-80db-4581-9391-3a608bd0e448", "port_range_max": null, "port_range_min": null, "protocol": null, "remote_group_id": null, "remote_ip_prefix": null, "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "revision_number": 2, "tags": ["tag1,tag2"], "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "description": "" }, { "direction": "ingress", "ethertype": "IPv6", "id": "c0b09f00-1d49-4e64-a0a7-8a186d928138", "port_range_max": null, "port_range_min": null, "protocol": null, "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "remote_ip_prefix": null, "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "revision_number": 1, "tags": ["tag1,tag2"], "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "description": "" }, { "direction": "ingress", "ethertype": "IPv4", "id": "f7d45c89-008e-4bab-88ad-d6811724c51c", "port_range_max": null, "port_range_min": null, "protocol": null, "remote_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "remote_ip_prefix": null, "security_group_id": "85cc3048-abc3-43cc-89b3-377341426ac5", "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "revision_number": 1, "tags": ["tag1,tag2"], "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "description": "" } ], "project_id": "e4f50856753b4dc6afee5fa6b9b6c550", "created_at": "2018-03-19T19:16:56Z", "updated_at": "2018-03-19T19:16:56Z", "revision_number": 4, "tags": ["tag1,tag2"], "tenant_id": "e4f50856753b4dc6afee5fa6b9b6c550", "stateful": true } } ././@LongLink0000000000000000000000000000015300000000000011214 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-rule-show-request-json-http.txtneutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-rule-show-request-json-ht0000664000175000017500000000013513641427107033717 0ustar zuulzuul00000000000000GET /v2.0/security-group-rules/3c0e45ff-adaf-4124-b083-bf390e5482ff Accept: application/json ././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-rule-delete-request-json-http.txtneutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-rule-delete-request-json-0000664000175000017500000000017613641427107033652 0ustar zuulzuul00000000000000DELETE /v2.0/security-group-rules/fc3c327a-b5b5-4cd3-9577-52893289ce08 Content-Type: application/json Accept: application/json././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-groups-list-request-json-http.txtneutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-groups-list-request-json-http.t0000664000175000017500000000006213641427107033735 0ustar zuulzuul00000000000000GET /v2.0/security-groups Accept: application/json././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-rules-list-request-json-http.txtneutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-rules-list-request-json-h0000664000175000017500000000007013641427107033707 0ustar zuulzuul00000000000000GET /v2.0/security-group-rules/ Accept: application/json././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-show-request-json-http.txtneutron-lib-2.3.0/api-ref/source/v2/samples/security-groups/security-group-show-request-json-http.tx0000664000175000017500000000012713641427107033751 0ustar zuulzuul00000000000000GET /v2.0/security-groups/85cc3048-abc3-43cc-89b3-377341426ac5 Accept: application/jsonneutron-lib-2.3.0/api-ref/source/v2/samples/network_segment_ranges/0000775000175000017500000000000013641427200025363 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000015600000000000011217 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/network_segment_ranges/network_segment_range-create-response.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/network_segment_ranges/network_segment_range-create-resp0000664000175000017500000000130313641427107034110 0ustar zuulzuul00000000000000{ "network_segment_range": { "id": "59b38ee8-6642-418a-88b7-756861606ecb", "name": "range_vlan_physnet1", "description": "network segment range for testing", "default": false, "shared": false, "tenant_id": "7011dc7fccac4efda89dc3b7f0d0975a", "project_id": "7011dc7fccac4efda89dc3b7f0d0975a", "network_type": "vlan", "physical_network": "physnet1", "minimum": 10, "maximum": 20, "available": [10,11,12,13,14,15,16,17,18,19,20], "used": {}, "created_at": "2019-03-04T04:49:28Z", "updated_at": "2019-03-04T04:49:28Z", "revision_number": 1, "tags": ["tag1,tag2"] } } ././@LongLink0000000000000000000000000000015600000000000011217 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/network_segment_ranges/network_segment_range-update-response.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/network_segment_ranges/network_segment_range-update-resp0000664000175000017500000000144113641427107034132 0ustar zuulzuul00000000000000{ "network_segment_range": { "id": "50089a13-4a9f-4421-85ba-5222e84610c3", "name": "new_range", "description": "network segment range updated for testing", "default": false, "shared": false, "tenant_id": "7011dc7fccac4efda89dc3b7f0d0975a", "project_id": "7011dc7fccac4efda89dc3b7f0d0975a", "network_type": "vxlan", "physical_network": null, "minimum": 10, "maximum": 20, "available": [10,11,12,13,14,15,16,19,20], "used": { "17": "5fc1cd2f16ab4c8fbba2e780891b9de3", "18": "87504c1c9d86439882ff90fdbfb096ad"}, "created_at": "2019-03-04T04:56:49Z", "updated_at": "2019-03-04T04:58:06Z", "revision_number": 2, "tags": ["tag1,tag2"] } } ././@LongLink0000000000000000000000000000015400000000000011215 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/network_segment_ranges/network_segment_range-show-response.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/network_segment_ranges/network_segment_range-show-respon0000664000175000017500000000145413641427107034171 0ustar zuulzuul00000000000000{ "network_segment_range": { "id": "59b38ee8-6642-418a-88b7-756861606ecb", "name": "range_vlan_physnet1", "description": "network segment range for testing", "default": false, "shared": false, "tenant_id": "7011dc7fccac4efda89dc3b7f0d0975a", "project_id": "7011dc7fccac4efda89dc3b7f0d0975a", "network_type": "vlan", "physical_network": "physnet1", "minimum": 10, "maximum": 20, "available": [10,11,12,13,14,15,16,19,20], "used": { "17": "5fc1cd2f16ab4c8fbba2e780891b9de3", "18": "87504c1c9d86439882ff90fdbfb096ad"} }, "created_at": "2019-03-04T04:49:28Z", "updated_at": "2019-03-04T04:49:28Z", "revision_number": 1, "tags": ["tag1,tag2"] } ././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/network_segment_ranges/network_segment_range-update-request.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/network_segment_ranges/network_segment_range-update-requ0000664000175000017500000000026713641427107034142 0ustar zuulzuul00000000000000{ "network_segment_range": { "name": "new_range", "minimum": 10, "maximum": 20, "description": "network segment range updated for testing" } } ././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/network_segment_ranges/network_segment_range-create-request.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/network_segment_ranges/network_segment_range-create-requ0000664000175000017500000000052413641427107034117 0ustar zuulzuul00000000000000{ "network_segment_range": { "name": "range_vlan_physnet1", "description": "network segment range for testing", "shared": false, "project_id": "7011dc7fccac4efda89dc3b7f0d0975a", "network_type": "vlan", "physical_network": "physnet1", "minimum": 10, "maximum": 20 } } ././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/network_segment_ranges/network_segment_ranges-list-response.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/network_segment_ranges/network_segment_ranges-list-respo0000664000175000017500000000324313641427107034167 0ustar zuulzuul00000000000000{ "network_segment_ranges": [ { "id": "59b38ee8-6642-418a-88b7-756861606ecb", "name": "range_vlan_physnet1", "description": "network segment range 1 for testing", "default": false, "shared": false, "tenant_id": "7011dc7fccac4efda89dc3b7f0d0975a", "project_id": "7011dc7fccac4efda89dc3b7f0d0975a", "network_type": "vlan", "physical_network": "physnet1", "minimum": 10, "maximum": 20, "available": [10,11,12,13,14,15,16,19,20], "used": { "17": "5fc1cd2f16ab4c8fbba2e780891b9de3", "18": "87504c1c9d86439882ff90fdbfb096ad"}, "created_at": "2019-03-04T04:49:28Z", "updated_at": "2019-03-04T04:49:28Z", "revision_number": 1, "tags": ["tag1,tag2"] }, { "id": "91ea6e31-3a6d-4541-8432-b49b4cacf893", "name": "range_vxlan", "description": "network segment range 2 for testing", "default": false, "shared": true, "tenant_id": null, "project_id": null, "network_type": "vxlan", "physical_network": null, "minimum": 40, "maximum": 50, "available": [40,41,43,44,46,47,48,49,50], "used": { "42": "07ac1127ee9647d48ce2626867104a13", "45": "d4fa62aa47d340d98d076801aa7e6ec4"}, "created_at": "2019-03-04T04:56:49Z", "updated_at": "2019-03-04T04:58:06Z", "revision_number": 2, "tags": ["tag1,tag2"] } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/0000775000175000017500000000000013641427200022601 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-policy-create-request.json0000664000175000017500000000023313641427107031531 0ustar zuulzuul00000000000000{ "firewall_policy": { "firewall_rules": [ "8722e0e0-9cc9-4490-9660-8c9a5732fbb0" ], "name": "test-policy" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-rules-list-response.json0000664000175000017500000000127713641427107031253 0ustar zuulzuul00000000000000{ "firewall_rules": [ { "action": "allow", "description": "", "destination_ip_address": null, "destination_port": "80", "enabled": true, "firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "id": "8722e0e0-9cc9-4490-9660-8c9a5732fbb0", "ip_version": 4, "name": "ALLOW_HTTP", "position": 1, "protocol": "tcp", "shared": false, "source_ip_address": null, "source_port": null, "project_id": "45977fa2dbd7482098dd68d0d8970117", "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-policies-list-response.json0000664000175000017500000000072013641427107031720 0ustar zuulzuul00000000000000{ "firewall_policies": [ { "audited": false, "description": "", "firewall_rules": [ "8722e0e0-9cc9-4490-9660-8c9a5732fbb0" ], "id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "name": "test-policy", "shared": false, "project_id": "45977fa2dbd7482098dd68d0d8970117", "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewalls-list-response.json0000664000175000017500000000101413641427107030273 0ustar zuulzuul00000000000000{ "firewalls": [ { "admin_state_up": true, "description": "", "firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "id": "3b0ef8f4-82c7-44d4-a4fb-6177f9a21977", "name": "", "status": "ACTIVE", "router_ids": [ "650bfd2f-7766-4a0d-839f-218f33e16998" ], "project_id": "45977fa2dbd7482098dd68d0d8970117", "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-update-request.json0000664000175000017500000000007613641427107030260 0ustar zuulzuul00000000000000{ "firewall": { "admin_state_up": "false" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-show-response.json0000664000175000017500000000071313641427107030122 0ustar zuulzuul00000000000000{ "firewall": { "admin_state_up": true, "description": "", "firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "id": "3b0ef8f4-82c7-44d4-a4fb-6177f9a21977", "name": "", "status": "ACTIVE", "router_ids": [ "650bfd2f-7766-4a0d-839f-218f33e16998" ], "project_id": "45977fa2dbd7482098dd68d0d8970117", "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-policy-show-response.json0000664000175000017500000000062213641427107031416 0ustar zuulzuul00000000000000{ "firewall_policy": { "audited": false, "description": "", "firewall_rules": [ "8722e0e0-9cc9-4490-9660-8c9a5732fbb0" ], "id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "name": "test-policy", "shared": false, "project_id": "45977fa2dbd7482098dd68d0d8970117", "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-policy-remove-rule-response.json0000664000175000017500000000062413641427107032702 0ustar zuulzuul00000000000000{ "audited": false, "description": "", "firewall_list": [], "firewall_rules": [ "a08ef905-0ff6-4784-8374-175fffe7dade", "8722e0e0-9cc9-4490-9660-8c9a5732fbb0" ], "id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "name": "test-policy", "shared": false, "project_id": "45977fa2dbd7482098dd68d0d8970117", "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-rule-show-response.json0000664000175000017500000000111313641427107031062 0ustar zuulzuul00000000000000{ "firewall_rule": { "action": "allow", "description": "", "destination_ip_address": null, "destination_port": "80", "enabled": true, "firewall_policy_id": null, "id": "8722e0e0-9cc9-4490-9660-8c9a5732fbb0", "ip_version": 4, "name": "ALLOW_HTTP", "position": null, "protocol": "tcp", "shared": false, "source_ip_address": null, "source_port": null, "project_id": "45977fa2dbd7482098dd68d0d8970117", "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-policy-insert-rule-response.json0000664000175000017500000000070413641427107032710 0ustar zuulzuul00000000000000{ "audited": false, "description": "", "firewall_list": [], "firewall_rules": [ "a08ef905-0ff6-4784-8374-175fffe7dade", "7bc34b8c-8d3b-4ada-a9c8-1f4c11c65692", "8722e0e0-9cc9-4490-9660-8c9a5732fbb0" ], "id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "name": "test-policy", "shared": false, "project_id": "45977fa2dbd7482098dd68d0d8970117", "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-rule-create-response.json0000664000175000017500000000111313641427107031345 0ustar zuulzuul00000000000000{ "firewall_rule": { "action": "allow", "description": "", "destination_ip_address": null, "destination_port": "80", "enabled": true, "firewall_policy_id": null, "id": "8722e0e0-9cc9-4490-9660-8c9a5732fbb0", "ip_version": 4, "name": "ALLOW_HTTP", "position": null, "protocol": "tcp", "shared": false, "source_ip_address": null, "source_port": null, "project_id": "45977fa2dbd7482098dd68d0d8970117", "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-policy-update-request.json0000664000175000017500000000026013641427107031550 0ustar zuulzuul00000000000000{ "firewall_policy": { "firewall_rules": [ "a08ef905-0ff6-4784-8374-175fffe7dade", "8722e0e0-9cc9-4490-9660-8c9a5732fbb0" ] } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-create-request.json0000664000175000017500000000020113641427107030227 0ustar zuulzuul00000000000000{ "firewall": { "admin_state_up": true, "firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-rule-update-request.json0000664000175000017500000000007213641427107031221 0ustar zuulzuul00000000000000{ "firewall_rule": { "shared": "true" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-create-response.json0000664000175000017500000000072313641427107030406 0ustar zuulzuul00000000000000{ "firewall": { "admin_state_up": true, "description": "", "firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "id": "3b0ef8f4-82c7-44d4-a4fb-6177f9a21977", "name": "", "status": "PENDING_CREATE", "router_ids": [ "650bfd2f-7766-4a0d-839f-218f33e16998" ], "project_id": "45977fa2dbd7482098dd68d0d8970117", "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-rule-create-request.json0000664000175000017500000000025713641427107031207 0ustar zuulzuul00000000000000{ "firewall_rule": { "action": "allow", "destination_port": "80", "enabled": true, "name": "ALLOW_HTTP", "protocol": "tcp" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-update-response.json0000664000175000017500000000072413641427107030426 0ustar zuulzuul00000000000000{ "firewall": { "admin_state_up": false, "description": "", "firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "id": "3b0ef8f4-82c7-44d4-a4fb-6177f9a21977", "name": "", "status": "PENDING_UPDATE", "router_ids": [ "650bfd2f-7766-4a0d-839f-218f33e16998" ], "project_id": "45977fa2dbd7482098dd68d0d8970117", "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-policy-remove-rule-request.json0000664000175000017500000000010313641427107032524 0ustar zuulzuul00000000000000{ "firewall_rule_id": "7bc34b8c-8d3b-4ada-a9c8-1f4c11c65692" } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-rule-update-response.json0000664000175000017500000000115113641427107031366 0ustar zuulzuul00000000000000{ "firewall_rule": { "action": "allow", "description": "", "destination_ip_address": null, "destination_port": "80", "enabled": true, "firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "id": "8722e0e0-9cc9-4490-9660-8c9a5732fbb0", "ip_version": 4, "name": "ALLOW_HTTP", "position": 1, "protocol": "tcp", "shared": true, "source_ip_address": null, "source_port": null, "project_id": "45977fa2dbd7482098dd68d0d8970117", "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-policy-update-response.json0000664000175000017500000000070613641427107031723 0ustar zuulzuul00000000000000{ "firewall_policy": { "audited": false, "description": "", "firewall_rules": [ "a08ef905-0ff6-4784-8374-175fffe7dade", "8722e0e0-9cc9-4490-9660-8c9a5732fbb0" ], "id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "name": "test-policy", "shared": false, "project_id": "45977fa2dbd7482098dd68d0d8970117", "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-policy-insert-rule-request.json0000664000175000017500000000023013641427107032534 0ustar zuulzuul00000000000000{ "firewall_rule_id": "7bc34b8c-8d3b-4ada-a9c8-1f4c11c65692", "insert_after": "a08ef905-0ff6-4784-8374-175fffe7dade", "insert_before": "" } neutron-lib-2.3.0/api-ref/source/v2/samples/firewalls/firewall-policy-create-response.json0000664000175000017500000000062213641427107031701 0ustar zuulzuul00000000000000{ "firewall_policy": { "audited": false, "description": "", "firewall_rules": [ "8722e0e0-9cc9-4490-9660-8c9a5732fbb0" ], "id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "name": "test-policy", "shared": false, "project_id": "45977fa2dbd7482098dd68d0d8970117", "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } } neutron-lib-2.3.0/api-ref/source/v2/samples/agents/0000775000175000017500000000000013641427200022072 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/agents/agent-dhcp-network-add-request.json0000664000175000017500000000006613641427107030712 0ustar zuulzuul00000000000000{"network_id": "1ae075ca-708b-4e66-b4a7-b7698632f05f"}neutron-lib-2.3.0/api-ref/source/v2/samples/agents/agent-l3-routers-list-response.json0000664000175000017500000000511713641427107030717 0ustar zuulzuul00000000000000{ "routers": [ { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "description": "", "distributed": false, "external_gateway_info": { "enable_snat": true, "external_fixed_ips": [ { "ip_address": "172.24.4.3", "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf" }, { "ip_address": "2001:db8::c", "subnet_id": "0c56df5d-ace5-46c8-8f4c-45fa4e334d18" } ], "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3" }, "flavor_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0", "ha": false, "id": "915a14a6-867b-4af7-83d1-70efceb146f9", "name": "router2", "revision_number": 1, "routes": [ { "destination": "179.24.1.0/24", "nexthop": "172.24.3.99" } ], "status": "ACTIVE", "project_id": "0bd18306d801447bb457a46252d82d13", "tenant_id": "0bd18306d801447bb457a46252d82d13", "service_type_id": null }, { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "description": "", "distributed": false, "external_gateway_info": { "enable_snat": true, "external_fixed_ips": [ { "ip_address": "172.24.4.6", "subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf" }, { "ip_address": "2001:db8::9", "subnet_id": "0c56df5d-ace5-46c8-8f4c-45fa4e334d18" } ], "network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3" }, "flavor_id": "f7b14d9a-b0dc-4fbe-bb14-a0f4970a69e0", "ha": false, "id": "f8a44de0-fc8e-45df-93c7-f79bf3b01c95", "name": "router1", "revision_number": 1, "routes": [], "status": "ACTIVE", "project_id": "0bd18306d801447bb457a46252d82d13", "tenant_id": "0bd18306d801447bb457a46252d82d13", "service_type_id": null } ] }neutron-lib-2.3.0/api-ref/source/v2/samples/agents/network-dhcp-agent-list-response.json0000664000175000017500000000160613641427107031304 0ustar zuulzuul00000000000000{ "agents": [ { "binary": "neutron-dhcp-agent", "description": null, "availability_zone": "nova", "heartbeat_timestamp": "2018-04-08 07:32:42", "admin_state_up": true, "alive": true, "topic": "dhcp_agent", "host": "mkm-instance01", "ha_state": null, "agent_type": "DHCP agent", "resource_versions": {}, "created_at": "2018-03-11 08:10:58", "started_at": "2018-03-11 08:10:58", "id": "b64f5c61-2210-41a6-869f-b51d7914511e", "configurations": { "subnets": 1, "dhcp_lease_duration": 86400, "dhcp_driver": "neutron.agent.linux.dhcp.Dnsmasq", "ports": 2, "log_agent_heartbeats": false, "networks": 1 } } ] }neutron-lib-2.3.0/api-ref/source/v2/samples/agents/agent-dhcp-networks-list-response.json0000664000175000017500000000427013641427107031467 0ustar zuulzuul00000000000000{ "networks": [ { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2016-03-08T20:19:41", "dns_domain": "my-domain.org.", "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22", "ipv4_address_scope": null, "ipv6_address_scope": null, "l2_adjacency": false, "mtu": 1500, "name": "net1", "port_security_enabled": true, "project_id": "4fd44f30292945e481c7b8a0c8908869", "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e", "revision_number": 1, "router:external": false, "shared": false, "status": "ACTIVE", "subnets": [ "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" ], "tenant_id": "4fd44f30292945e481c7b8a0c8908869", "updated_at": "2016-03-08T20:19:41", "vlan_transparent": true, "description": "", "is_default": false }, { "admin_state_up": true, "availability_zone_hints": [], "availability_zones": [ "nova" ], "created_at": "2016-03-08T20:19:41", "dns_domain": "my-domain.org.", "id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324", "ipv4_address_scope": null, "ipv6_address_scope": null, "l2_adjacency": false, "mtu": 1500, "name": "net2", "port_security_enabled": true, "project_id": "26a7980765d0414dbc1fc1f88cdb7e6e", "qos_policy_id": "bfdb6c39f71e4d44b1dfbda245c50819", "revision_number": 3, "router:external": false, "shared": false, "status": "ACTIVE", "subnets": [ "08eae331-0402-425a-923c-34f7cfe39c1b" ], "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e", "updated_at": "2016-03-08T20:19:41", "vlan_transparent": false, "description": "", "is_default": false } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/agents/agent-l3-router-remove-request.json0000664000175000017500000000007113641427107030702 0ustar zuulzuul00000000000000{ "router_id": "43e66290-79a4-415d-9eb9-7ff7919839e1" }neutron-lib-2.3.0/api-ref/source/v2/samples/agents/agent-update-request.json0000664000175000017500000000011513641427107027034 0ustar zuulzuul00000000000000{ "agent": { "description": "My OVS agent for OpenStack" } } neutron-lib-2.3.0/api-ref/source/v2/samples/agents/router-l3-agent-list-response.json0000664000175000017500000000201313641427107030524 0ustar zuulzuul00000000000000{ "agents": [ { "binary": "neutron-l3-agent", "description": null, "availability_zone": "nova", "heartbeat_timestamp": "2018-04-08 07:32:42", "admin_state_up": true, "alive": true, "topic": "l3_agent", "host": "mkm-instance01", "ha_state": null, "agent_type": "L3 agent", "resource_versions": {}, "created_at": "2018-03-11 08:10:58", "started_at": "2018-03-11 08:10:58", "id": "b64f5c61-2210-41a6-869f-b51d7914511e", "configurations": { "agent_mode": "legacy", "gateway_external_network_id": "", "handle_internal_only_routers": true, "routers": 3, "interfaces": 1, "floating_ips": 0, "interface_driver": "openvswitch", "log_agent_heartbeats": false, "ex_gw_ports": 1 } } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/agents/agent-l3-router-add-request.json0000664000175000017500000000007113641427107030135 0ustar zuulzuul00000000000000{ "router_id": "43e66290-79a4-415d-9eb9-7ff7919839e1" }neutron-lib-2.3.0/api-ref/source/v2/samples/agents/agents-list-response.json0000664000175000017500000001073613641427107027070 0ustar zuulzuul00000000000000{ "agents": [ { "binary": "neutron-openvswitch-agent", "description": null, "availability_zone": null, "heartbeat_timestamp": "2017-09-12 19:40:08", "admin_state_up": true, "alive": true, "id":" 04c62b91-b799-48b7-9cd5-2982db6df9c6", "topic": "N/A", "host": "agenthost1", "agent_type": "Open vSwitch agent", "started_at": "2017-09-12 19:35:38", "created_at": "2017-09-12 19:35:38", "resources_synced": true, "configurations": { "ovs_hybrid_plug": true, "in_distributed_mode": false, "datapath_type": "system", "vhostuser_socket_dir": "/var/run/openvswitch", "tunneling_ip": "172.16.78.191", "arp_responder_enabled": false, "devices": 0, "ovs_capabilities": { "datapath_types": [ "netdev", "system" ], "iface_types": [ "geneve", "gre", "internal", "ipsec_gre", "lisp", "patch", "stt", "system", "tap", "vxlan" ] }, "log_agent_heartbeats": false, "l2_population": false, "tunnel_types": [ "vxlan" ], "extensions": [ ], "enable_distributed_routing": false, "bridge_mappings": { "public": "br-ex" } } }, { "binary": "neutron-dhcp-agent", "description": null, "availability_zone": "nova", "heartbeat_timestamp": "2017-09-12 19:39:56", "admin_state_up": true, "alive": true, "id": "840d5d68-5759-4e9e-812f-f3bd19214c7f", "topic": "dhcp_agent", "host": "agenthost1", "agent_type" :"DHCP agent", "started_at": "2017-09-12 19:35:36", "created_at": "2017-09-12 19:35:36", "resources_synced": null, "configurations": { "subnets": 2, "dhcp_lease_duration": 86400, "dhcp_driver": "neutron.agent.linux.dhcp.Dnsmasq", "networks": 1, "log_agent_heartbeats": false, "ports": 3 } }, { "binary": "neutron-l3-agent", "description": null, "availability_zone": "nova", "heartbeat_timestamp": "2017-09-12 19:40:08", "admin_state_up": true, "alive": true, "id": "a09b81fc-5a42-46d3-a306-1a5d122a7787", "topic": "l3_agent", "host": "agenthost1", "agent_type": "L3 agent", "started_at": "2017-09-12 19:35:38", "created_at": "2017-09-12 19:35:38", "resources_synced": null, "configurations": { "agent_mode": "legacy", "gateway_external_network_id": "", "handle_internal_only_routers": true, "routers": 1, "interfaces": 2, "floating_ips": 0, "interface_driver": "openvswitch", "log_agent_heartbeats": false, "ex_gw_ports": 1 } }, { "binary": "neutron-metadata-agent", "description": null, "availability_zone": null, "heartbeat_timestamp": "2017-09-12 19:40:09", "admin_state_up": true, "alive": true, "id": "c876c9f7-1058-4b9b-90ed-20fb3f905ec4", "topic": "N/A", "host": "agenthost1", "agent_type": "Metadata agent", "started_at": "2017-09-12 19:35:39", "created_at": "2017-09-12 19:35:39", "resources_synced": null, "configurations": { "log_agent_heartbeats": false, "nova_metadata_host": "172.16.78.191", "nova_metadata_port": 8775, "metadata_proxy_socket": "/opt/stack/data/neutron/metadata_proxy" } } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/agents/agent-update-response.json0000664000175000017500000000323113641427107027204 0ustar zuulzuul00000000000000{ "agent": { "binary": "neutron-openvswitch-agent", "description": "My OVS agent for OpenStack", "availability_zone": null, "heartbeat_timestamp": "2017-09-12 19:40:38", "admin_state_up": true, "alive": true, "id": "04c62b91-b799-48b7-9cd5-2982db6df9c6", "topic": "N/A", "host": "agenthost1", "agent_type": "Open vSwitch agent", "started_at": "2017-09-12 19:35:38", "created_at": "2017-09-12 19:35:38", "resources_synced": true, "configurations": { "ovs_hybrid_plug": true, "in_distributed_mode": false, "datapath_type": "system", "vhostuser_socket_dir": "/var/run/openvswitch", "tunneling_ip": "172.16.78.191", "arp_responder_enabled": false, "devices": 0, "ovs_capabilities": { "datapath_types": [ "netdev", "system" ], "iface_types": [ "geneve", "gre", "internal", "ipsec_gre", "lisp", "patch", "stt", "system", "tap", "vxlan" ] }, "log_agent_heartbeats": false, "l2_population": false, "tunnel_types": [ "vxlan" ], "extensions": [], "enable_distributed_routing": false, "bridge_mappings": { "public": "br-ex" } } } } neutron-lib-2.3.0/api-ref/source/v2/samples/agents/agent-show-response.json0000664000175000017500000000320113641427107026677 0ustar zuulzuul00000000000000{ "agent": { "binary": "neutron-openvswitch-agent", "description": null, "availability_zone": null, "heartbeat_timestamp": "2017-09-12 19:40:38", "admin_state_up": true, "alive": true, "id": "04c62b91-b799-48b7-9cd5-2982db6df9c6", "topic": "N/A", "host": "agenthost1", "agent_type": "Open vSwitch agent", "started_at": "2017-09-12 19:35:38", "created_at": "2017-09-12 19:35:38", "resources_synced": true, "configurations": { "ovs_hybrid_plug": true, "in_distributed_mode": false, "datapath_type": "system", "vhostuser_socket_dir": "/var/run/openvswitch", "tunneling_ip": "172.16.78.191", "arp_responder_enabled": false, "devices": 0, "ovs_capabilities": { "datapath_types": [ "netdev", "system" ], "iface_types": [ "geneve", "gre", "internal", "ipsec_gre", "lisp", "patch", "stt", "system", "tap", "vxlan" ] }, "log_agent_heartbeats": false, "l2_population": false, "tunnel_types": [ "vxlan" ], "extensions": [], "enable_distributed_routing": false, "bridge_mappings": { "public": "br-ex" } } } } neutron-lib-2.3.0/api-ref/source/v2/samples/trunks/0000775000175000017500000000000013641427200022137 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/trunks/trunks-list-response.json0000664000175000017500000000110113641427107027164 0ustar zuulzuul00000000000000{ "trunks": [ { "status": "DOWN", "sub_ports": [], "name": "test", "admin_state_up": true, "project_id": "313be01bd0744cea86643c711c57012b", "tenant_id": "313be01bd0744cea86643c711c57012b", "created_at": "2016-10-05T20:11:16Z", "updated_at": "2016-10-05T20:11:16Z", "revision_number": 1, "port_id": "8027c4da-772f-4e43-bfbf-023b4a4e63de", "id": "ee98bdb4-a817-43af-943f-4318bff98f51", "description": "" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/trunks/trunk-create-request.json0000664000175000017500000000021313641427107027126 0ustar zuulzuul00000000000000{ "trunk": { "port_id": "8027c4da-772f-4e43-bfbf-023b4a4e63de", "name": "test", "admin_state_up": true } } neutron-lib-2.3.0/api-ref/source/v2/samples/trunks/trunk-update-request.json0000664000175000017500000000011713641427107027150 0ustar zuulzuul00000000000000{ "trunk": { "name": "foo", "admin_state_up": true } } neutron-lib-2.3.0/api-ref/source/v2/samples/trunks/trunk-update-response.json0000664000175000017500000000126613641427107027324 0ustar zuulzuul00000000000000{ "trunk": { "status": "DOWN", "sub_ports": [ { "segmentation_type": "vlan", "port_id": "4b4c691b-086d-43d2-8a65-5487e9434155", "segmentation_id": 44 } ], "name": "foo", "admin_state_up": true, "project_id": "145a14e4a64b49bf98baad8945dbd4f1", "tenant_id": "145a14e4a64b49bf98baad8945dbd4f1", "created_at": "2016-10-05T22:31:37Z", "updated_at": "2016-10-05T23:28:17Z", "revision_number": 9, "port_id": "8027c4da-772f-4e43-bfbf-023b4a4e63de", "id": "114a26b1-d124-4835-bb4f-021d3d886023", "description": "" } } neutron-lib-2.3.0/api-ref/source/v2/samples/trunks/trunks-create-response.json0000664000175000017500000000077413641427107027473 0ustar zuulzuul00000000000000{ "trunk": { "status": "DOWN", "sub_ports": [], "name": "test", "admin_state_up": true, "project_id": "145a14e4a64b49bf98baad8945dbd4f1", "tenant_id": "145a14e4a64b49bf98baad8945dbd4f1", "created_at": "2016-10-05T22:31:37Z", "updated_at": "2016-10-05T22:31:37Z", "revision_number": 1, "port_id": "8027c4da-772f-4e43-bfbf-023b4a4e63de", "id": "114a26b1-d124-4835-bb4f-021d3d886023", "description": "" } } neutron-lib-2.3.0/api-ref/source/v2/samples/trunks/trunk-details-show-response.json0000664000175000017500000000271113641427107030441 0ustar zuulzuul00000000000000{ "port": { "status": "DOWN", "created_at": "2016-10-05T20:05:14Z", "description": "", "admin_state_up": true, "network_id": "1cf9e069-365f-4a78-8784-616bc12c4c5a", "project_id": "313be01bd0744cea86643c711c57012b", "tenant_id": "313be01bd0744cea86643c711c57012b", "extra_dhcp_opts": [], "updated_at": "2016-10-05T20:05:14Z", "name": "test", "device_owner": "", "trunk_details": { "trunk_id": "8905d084-010c-46e8-a863-f21cb4441ab1", "sub_ports": [ { "segmentation_id": 33, "port_id": "70df9f3e-b409-4761-8304-ce029b2079f5", "segmentation_type": "vlan", "mac_address": "fa:16:3e:86:9b:dc" }, { "segmentation_id": 44, "port_id": "4b4c691b-086d-43d2-8a65-5487e9434155", "segmentation_type": "vlan", "mac_address": "fa:16:3e:fe:29:97" } ] }, "revision_number": 5, "mac_address": "fa:16:3e:5c:e9:a3", "fixed_ips": [ { "subnet_id": "76a059c0-b189-479f-882c-5e8bd464ea49", "ip_address": "40.0.0.3" } ], "id": "8027c4da-772f-4e43-bfbf-023b4a4e63de", "security_groups": ["da88a249-12ac-4221-9565-c406b6feeb48"], "device_id": "" } } neutron-lib-2.3.0/api-ref/source/v2/samples/trunks/trunk-show-response.json0000664000175000017500000000127113641427107027016 0ustar zuulzuul00000000000000{ "trunk": { "status": "DOWN", "sub_ports": [ { "segmentation_type": "vlan", "port_id": "4b4c691b-086d-43d2-8a65-5487e9434155", "segmentation_id": 44 } ], "name": "foo", "admin_state_up": true, "project_id": "145a14e4a64b49bf98baad8945dbd4f1", "tenant_id": "145a14e4a64b49bf98baad8945dbd4f1", "created_at": "2016-10-05T22:31:37Z", "updated_at": "2016-10-05T23:28:17Z", "revision_number": 9, "port_id": "8027c4da-772f-4e43-bfbf-023b4a4e63de", "id": "114a26b1-d124-4835-bb4f-021d3d886023", "description": "" } } neutron-lib-2.3.0/api-ref/source/v2/samples/trunks/trunk-list-subports-response.json0000664000175000017500000000027313641427107030671 0ustar zuulzuul00000000000000{ "sub_ports": [ { "segmentation_type": "vlan", "port_id": "4b4c691b-086d-43d2-8a65-5487e9434155", "segmentation_id": 44 } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/trunks/trunk-remove-subports-request.json0000664000175000017500000000015413641427107031043 0ustar zuulzuul00000000000000{ "sub_ports": [ { "port_id": "4b4c691b-086d-43d2-8a65-5487e9434155" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/trunks/trunk-remove-subports-response.json0000664000175000017500000000066713641427107031222 0ustar zuulzuul00000000000000{ "status": "DOWN", "sub_ports": [], "name": "test", "admin_state_up": true, "project_id": "145a14e4a64b49bf98baad8945dbd4f1", "tenant_id": "145a14e4a64b49bf98baad8945dbd4f1", "created_at": "2016-10-05T22:31:37Z", "updated_at": "2016-10-05T22:57:44Z", "revision_number": 3, "port_id": "8027c4da-772f-4e43-bfbf-023b4a4e63de", "id": "114a26b1-d124-4835-bb4f-021d3d886023", "description": "" } neutron-lib-2.3.0/api-ref/source/v2/samples/trunks/trunk-add-subports-response.json0000664000175000017500000000113213641427107030441 0ustar zuulzuul00000000000000{ "status": "DOWN", "sub_ports": [ { "segmentation_type": "vlan", "port_id": "4b4c691b-086d-43d2-8a65-5487e9434155", "segmentation_id": 44 } ], "name": "test", "admin_state_up": true, "project_id": "145a14e4a64b49bf98baad8945dbd4f1", "tenant_id": "145a14e4a64b49bf98baad8945dbd4f1", "created_at": "2016-10-05T22:31:37Z", "updated_at": "2016-10-05T22:52:04Z", "revision_number": 2, "port_id": "8027c4da-772f-4e43-bfbf-023b4a4e63de", "id": "114a26b1-d124-4835-bb4f-021d3d886023", "description": "" } neutron-lib-2.3.0/api-ref/source/v2/samples/trunks/trunk-add-subports-request.json0000664000175000017500000000027313641427107030300 0ustar zuulzuul00000000000000{ "sub_ports": [ { "segmentation_id": 44, "port_id": "4b4c691b-086d-43d2-8a65-5487e9434155", "segmentation_type": "vlan" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/0000775000175000017500000000000013641427200022743 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-policy-create-request.json0000664000175000017500000000023313641427107031673 0ustar zuulzuul00000000000000{ "firewall_policy": { "name": "test-policy", "firewall_rules": [ "8722e0e0-9cc9-4490-9660-8c9a5732fbb0" ] } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-rules-list-response.json0000664000175000017500000000144013641427107031405 0ustar zuulzuul00000000000000{ "firewall_rules": [ { "action": "allow", "description": "", "destination_firewall_group_id": null, "destination_ip_address": null, "destination_port": "80", "enabled": true, "firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "id": "8722e0e0-9cc9-4490-9660-8c9a5732fbb0", "ip_version": 4, "name": "ALLOW_HTTP", "position": 1, "project_id": "45977fa2dbd7482098dd68d0d8970117", "protocol": "tcp", "shared": false, "source_firewall_group_id": null, "source_ip_address": null, "source_port": null, "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-policies-list-response.json0000664000175000017500000000072013641427107032062 0ustar zuulzuul00000000000000{ "firewall_policies": [ { "audited": false, "description": "", "firewall_rules": [ "8722e0e0-9cc9-4490-9660-8c9a5732fbb0" ], "id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "name": "test-policy", "project_id": "45977fa2dbd7482098dd68d0d8970117", "shared": false, "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-group-update-response.json0000664000175000017500000000110213641427107031711 0ustar zuulzuul00000000000000{ "firewall_group": { "admin_state_up": false, "description": "", "egress_firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "ingress_firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "id": "3b0ef8f4-82c7-44d4-a4fb-6177f9a21977", "name": "", "ports": [ "650bfd2f-7766-4a0d-839f-218f33e16998" ], "shared": true, "project_id": "45977fa2dbd7482098dd68d0d8970117", "status": "PENDING_UPDATE", "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-policy-show-response.json0000664000175000017500000000062213641427107031560 0ustar zuulzuul00000000000000{ "firewall_policy": { "audited": false, "description": "", "firewall_rules": [ "8722e0e0-9cc9-4490-9660-8c9a5732fbb0" ], "id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "name": "test-policy", "project_id": "45977fa2dbd7482098dd68d0d8970117", "shared": false, "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-policy-remove-rule-response.json0000664000175000017500000000040313641427107033037 0ustar zuulzuul00000000000000{ "audited": false, "description": "", "firewall_rules": [], "id": "c9e15d6e-b6ba-4ef4-8715-985d1f100467", "name": "policy2", "project_id": "95573613ec554b4b8df9f2679c64557b", "shared": false, "tenant_id": "95573613ec554b4b8df9f2679c64557b" } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-rule-show-response.json0000664000175000017500000000124413641427107031231 0ustar zuulzuul00000000000000{ "firewall_rule": { "action": "allow", "description": "", "destination_firewall_group_id": null, "destination_ip_address": null, "destination_port": "80", "enabled": true, "firewall_policy_id": null, "id": "8722e0e0-9cc9-4490-9660-8c9a5732fbb0", "ip_version": 4, "name": "ALLOW_HTTP", "position": null, "project_id": "45977fa2dbd7482098dd68d0d8970117", "protocol": "tcp", "shared": false, "source_firewall_group_id": null, "source_ip_address": null, "source_port": null, "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-policy-insert-rule-response.json0000664000175000017500000000046113641427107033052 0ustar zuulzuul00000000000000{ "audited": false, "description": "", "firewall_rules": [ "acbdfead-eca2-4456-838c-8b531e47b9c7" ], "id": "c9e15d6e-b6ba-4ef4-8715-985d1f100467", "name": "policy2", "shared": false, "project_id": "95573613ec554b4b8df9f2679c64557b", "tenant_id": "95573613ec554b4b8df9f2679c64557b" } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-group-create-request.json0000664000175000017500000000033513641427107031533 0ustar zuulzuul00000000000000{ "firewall_group": { "admin_state_up": false, "egress_firewall_policy_id": "14c9d3c1-b472-44f9-8226-30dc4ffd454c", "ingress_firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-rule-create-response.json0000664000175000017500000000113713641427107031515 0ustar zuulzuul00000000000000{ "firewall_rule": { "action": "deny", "description": "", "destination_firewall_group_id": null, "destination_ip_address": null, "destination_port": null, "enabled": true, "id": "1fd59b2f-cc87-435f-a244-1df2c0cc3f70", "ip_version": 4, "name": "rule3", "project_id": "95573613ec554b4b8df9f2679c64557b", "protocol": null, "shared": false, "source_firewall_group_id": null, "source_ip_address": null, "source_port": null, "tenant_id": "95573613ec554b4b8df9f2679c64557b" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-policy-update-request.json0000664000175000017500000000026013641427107031712 0ustar zuulzuul00000000000000{ "firewall_policy": { "firewall_rules": [ "a08ef905-0ff6-4784-8374-175fffe7dade", "8722e0e0-9cc9-4490-9660-8c9a5732fbb0" ] } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-group-show-response.json0000664000175000017500000000064713641427107031424 0ustar zuulzuul00000000000000{ "firewall_group": { "admin_state_up": true, "description": "", "egress_firewall_policy_id": null, "id": "07411bda-0147-418b-af05-c8665630d937", "ingress_firewall_policy_id": null, "name": "", "project_id": "96108b04417b416e9b9bc788c11c42c9", "shared": false, "status": "INACTIVE", "tenant_id": "96108b04417b416e9b9bc788c11c42c9" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-rule-update-request.json0000664000175000017500000000007013641427107031361 0ustar zuulzuul00000000000000{ "firewall_rule": { "shared": true } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-groups-list-response.json0000664000175000017500000000120213641427107031566 0ustar zuulzuul00000000000000{ "firewall_groups": [ { "admin_state_up": true, "description": "", "egress_firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "id": "3b0ef8f4-82c7-44d4-a4fb-6177f9a21977", "ingress_firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "name": "", "ports": [ "650bfd2f-7766-4a0d-839f-218f33e16998" ], "shared": true, "project_id": "45977fa2dbd7482098dd68d0d8970117", "status": "ACTIVE", "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-rule-create-request.json0000664000175000017500000000025713641427107031351 0ustar zuulzuul00000000000000{ "firewall_rule": { "action": "allow", "destination_port": "80", "enabled": true, "name": "ALLOW_HTTP", "protocol": "tcp" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-policy-remove-rule-request.json0000664000175000017500000000010313641427107032666 0ustar zuulzuul00000000000000{ "firewall_rule_id": "7bc34b8c-8d3b-4ada-a9c8-1f4c11c65692" } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-group-update-request.json0000664000175000017500000000010413641427107031544 0ustar zuulzuul00000000000000{ "firewall_group": { "admin_state_up": "false" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-rule-update-response.json0000664000175000017500000000130213641427107031526 0ustar zuulzuul00000000000000{ "firewall_rule": { "action": "allow", "description": "", "destination_firewall_group_id": null, "destination_ip_address": null, "destination_port": "80", "enabled": true, "firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "id": "8722e0e0-9cc9-4490-9660-8c9a5732fbb0", "ip_version": 4, "name": "ALLOW_HTTP", "position": 1, "project_id": "45977fa2dbd7482098dd68d0d8970117", "protocol": "tcp", "shared": true, "source_firewall_group_id": null, "source_ip_address": null, "source_port": null, "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-policy-update-response.json0000664000175000017500000000070613641427107032065 0ustar zuulzuul00000000000000{ "firewall_policy": { "audited": false, "description": "", "firewall_rules": [ "a08ef905-0ff6-4784-8374-175fffe7dade", "8722e0e0-9cc9-4490-9660-8c9a5732fbb0" ], "id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "name": "test-policy", "project_id": "45977fa2dbd7482098dd68d0d8970117", "shared": false, "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-group-create-response.json0000664000175000017500000000110113641427107031671 0ustar zuulzuul00000000000000{ "firewall_group": { "admin_state_up": true, "description": "", "egress_firewall_policy_id": "1244ed87-b472-44f9-8226-30dc4ffd454c", "ingress_firewall_policy_id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "id": "3b0ef8f4-82c7-44d4-a4fb-6177f9a21977", "name": "", "ports": [ "650bfd2f-7766-4a0d-839f-218f33e16998" ], "project_id": "45977fa2dbd7482098dd68d0d8970117", "shared": true, "status": "PENDING_CREATE", "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-policy-insert-rule-request.json0000664000175000017500000000023013641427107032676 0ustar zuulzuul00000000000000{ "firewall_rule_id": "7bc34b8c-8d3b-4ada-a9c8-1f4c11c65692", "insert_after": "a08ef905-0ff6-4784-8374-175fffe7dade", "insert_before": "" } neutron-lib-2.3.0/api-ref/source/v2/samples/firewall-v2/firewall-policy-create-response.json0000664000175000017500000000062213641427107032043 0ustar zuulzuul00000000000000{ "firewall_policy": { "audited": false, "description": "", "firewall_rules": [ "8722e0e0-9cc9-4490-9660-8c9a5732fbb0" ], "id": "c69933c1-b472-44f9-8226-30dc4ffd454c", "name": "test-policy", "project_id": "45977fa2dbd7482098dd68d0d8970117", "shared": false, "tenant_id": "45977fa2dbd7482098dd68d0d8970117" } } neutron-lib-2.3.0/api-ref/source/v2/samples/extensions/0000775000175000017500000000000013641427200023010 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/extensions/extensions-list-response.json0000664000175000017500000001040013641427107030710 0ustar zuulzuul00000000000000{ "extensions": [ { "updated": "2013-01-20T00:00:00-00:00", "name": "Neutron Service Type Management", "links": [], "alias": "service-type", "description": "API for retrieving service providers for Neutron advanced services" }, { "updated": "2012-10-05T10:00:00-00:00", "name": "security-group", "links": [], "alias": "security-group", "description": "The security groups extension." }, { "updated": "2013-02-07T10:00:00-00:00", "name": "L3 Agent Scheduler", "links": [], "alias": "l3_agent_scheduler", "description": "Schedule routers among l3 agents" }, { "updated": "2013-03-28T10:00:00-00:00", "name": "Neutron L3 Configurable external gateway mode", "links": [], "alias": "ext-gw-mode", "description": "Extension of the router abstraction for specifying whether SNAT should occur on the external gateway" }, { "updated": "2014-02-03T10:00:00-00:00", "name": "Port Binding", "links": [], "alias": "binding", "description": "Expose port bindings of a virtual port to external application" }, { "updated": "2012-09-07T10:00:00-00:00", "name": "Provider Network", "links": [], "alias": "provider", "description": "Expose mapping of virtual networks to physical networks" }, { "updated": "2013-02-03T10:00:00-00:00", "name": "agent", "links": [], "alias": "agent", "description": "The agent management extension." }, { "updated": "2012-07-29T10:00:00-00:00", "name": "Quota management support", "links": [], "alias": "quotas", "description": "Expose functions for quotas management per tenant" }, { "updated": "2013-02-07T10:00:00-00:00", "name": "DHCP Agent Scheduler", "links": [], "alias": "dhcp_agent_scheduler", "description": "Schedule networks among dhcp agents" }, { "updated": "2013-06-27T10:00:00-00:00", "name": "Multi Provider Network", "links": [], "alias": "multi-provider", "description": "Expose mapping of virtual networks to multiple physical networks" }, { "updated": "2013-01-14T10:00:00-00:00", "name": "Neutron external network", "links": [], "alias": "external-net", "description": "Adds external network attribute to network resource." }, { "updated": "2012-07-20T10:00:00-00:00", "name": "Neutron L3 Router", "links": [], "alias": "router", "description": "Router abstraction for basic L3 forwarding between L2 Neutron networks and access to external networks via a NAT gateway." }, { "updated": "2013-07-23T10:00:00-00:00", "name": "Allowed Address Pairs", "links": [], "alias": "allowed-address-pairs", "description": "Provides allowed address pairs" }, { "updated": "2013-03-17T12:00:00-00:00", "name": "Neutron Extra DHCP opts", "links": [], "alias": "extra_dhcp_opt", "description": "Extra options configuration for DHCP. For example PXE boot options to DHCP clients can be specified (e.g. tftp-server, server-ip-address, bootfile-name)" }, { "updated": "2013-02-01T10:00:00-00:00", "name": "Neutron Extra Route", "links": [], "alias": "extraroute", "description": "Extra routes configuration for L3 router" }, { "updated": "2016-01-24T10:00:00-00:00", "name": "Neutron Port Data Plane Status", "links": [], "alias": "data-plane-status", "description": "Status of the underlying data plane." } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/extensions/extension-show-response.json0000664000175000017500000000031613641427107030537 0ustar zuulzuul00000000000000{ "extension": { "updated": "2013-02-03T10:00:00-00:00", "name": "agent", "links": [], "alias": "agent", "description": "The agent management extension." } } neutron-lib-2.3.0/api-ref/source/v2/samples/floatingips/0000775000175000017500000000000013641427200023130 5ustar zuulzuul00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/floatingips/floatingip-create-response.json0000664000175000017500000000220713641427107031263 0ustar zuulzuul00000000000000{ "floatingip": { "fixed_ip_address": "10.0.0.3", "floating_ip_address": "172.24.4.228", "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7", "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab", "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f", "status": "ACTIVE", "project_id": "4969c491a3c74ee4af974e6d800c62de", "tenant_id": "4969c491a3c74ee4af974e6d800c62de", "description": "floating ip for testing", "dns_domain": "my-domain.org.", "dns_name": "myfip", "created_at": "2016-12-21T01:36:04Z", "updated_at": "2016-12-21T01:36:04Z", "revision_number": 1, "port_details": { "status": "ACTIVE", "name": "", "admin_state_up": true, "network_id": "02dd8479-ef26-4398-a102-d19d0a7b3a1f", "device_owner": "compute:nova", "mac_address": "fa:16:3e:b1:3b:30", "device_id": "8e3941b4-a6e9-499f-a1ac-2a4662025cba" }, "tags": ["tag1,tag2"], "port_forwardings": [] } } neutron-lib-2.3.0/api-ref/source/v2/samples/floatingips/floating-ip-pools-list-response.json0000664000175000017500000000060413641427107032201 0ustar zuulzuul00000000000000{ "floatingip_pools": [ { "subnet_id": "cdec285c-b157-48aa-900c-e77f6bd958e5", "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e", "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324", "subnet_name": "public-subnet", "cidr": "192.0.0.0/8", "project_id": "26a7980765d0414dbc1fc1f88cdb7e6e" } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/floatingips/floatingip-disassociate-response.json0000664000175000017500000000131213641427107032467 0ustar zuulzuul00000000000000{ "floatingip": { "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f", "fixed_ip_address": null, "floating_ip_address": "172.24.4.228", "project_id": "4969c491a3c74ee4af974e6d800c62de", "tenant_id": "4969c491a3c74ee4af974e6d800c62de", "status": "ACTIVE", "port_id": null, "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7", "description": "for test", "created_at": "2016-12-21T10:55:50Z", "updated_at": "2016-12-22T03:13:49Z", "revision_number": 3, "port_details": null, "tags": ["tag1,tag2"], "port_forwardings": [] } } neutron-lib-2.3.0/api-ref/source/v2/samples/floatingips/floatingip-update-response.json0000664000175000017500000000220713641427107031302 0ustar zuulzuul00000000000000{ "floatingip": { "created_at": "2016-12-21T10:55:50Z", "description": "floating ip for testing", "dns_domain": "my-domain.org.", "dns_name": "myfip", "fixed_ip_address": "10.0.0.4", "floating_ip_address": "172.24.4.228", "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7", "port_id": "fc861431-0e6c-4842-a0ed-e2363f9bc3a8", "project_id": "4969c491a3c74ee4af974e6d800c62de", "revision_number": 3, "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f", "status": "ACTIVE", "tags": ["tag1,tag2"], "tenant_id": "4969c491a3c74ee4af974e6d800c62de", "updated_at": "2016-12-22T03:13:49Z", "port_details": { "status": "ACTIVE", "name": "", "admin_state_up": true, "network_id": "02dd8479-ef26-4398-a102-d19d0a7b3a1f", "device_owner": "compute:nova", "mac_address": "fa:16:3e:b1:3b:30", "device_id": "8e3941b4-a6e9-499f-a1ac-2a4662025cba" }, "port_forwardings": [] } } neutron-lib-2.3.0/api-ref/source/v2/samples/floatingips/floatingip-show-response.json0000664000175000017500000000221013641427107030772 0ustar zuulzuul00000000000000{ "floatingip": { "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f", "fixed_ip_address": "10.0.0.3", "floating_ip_address": "172.24.4.228", "project_id": "4969c491a3c74ee4af974e6d800c62de", "tenant_id": "4969c491a3c74ee4af974e6d800c62de", "status": "ACTIVE", "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab", "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7", "description": "floating ip for testing", "dns_domain": "my-domain.org.", "dns_name": "myfip", "created_at": "2016-12-21T01:36:04Z", "updated_at": "2016-12-21T01:36:04Z", "revision_number": 1, "port_details": { "status": "ACTIVE", "name": "", "admin_state_up": true, "network_id": "02dd8479-ef26-4398-a102-d19d0a7b3a1f", "device_owner": "compute:nova", "mac_address": "fa:16:3e:b1:3b:30", "device_id": "8e3941b4-a6e9-499f-a1ac-2a4662025cba" }, "tags": ["tag1,tag2"], "port_forwardings": [] } } neutron-lib-2.3.0/api-ref/source/v2/samples/floatingips/floatingip-update-request.json0000664000175000017500000000013013641427107031125 0ustar zuulzuul00000000000000{ "floatingip": { "port_id": "fc861431-0e6c-4842-a0ed-e2363f9bc3a8" } } neutron-lib-2.3.0/api-ref/source/v2/samples/floatingips/floatingip-create-request.json0000664000175000017500000000065213641427107031117 0ustar zuulzuul00000000000000{ "floatingip": { "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab", "subnet_id": "278d9507-36e7-403c-bb80-1d7093318fe6", "fixed_ip_address": "10.0.0.3", "floating_ip_address": "172.24.4.228", "description": "floating ip for testing", "dns_domain": "my-domain.org.", "dns_name": "myfip" } } neutron-lib-2.3.0/api-ref/source/v2/samples/floatingips/floatingip-disassociate-request.json0000664000175000017500000000006613641427107032326 0ustar zuulzuul00000000000000{ "floatingip": { "port_id": null } } neutron-lib-2.3.0/api-ref/source/v2/samples/floatingips/floating-ips-list-response.json0000664000175000017500000000642313641427107031237 0ustar zuulzuul00000000000000{ "floatingips": [ { "router_id": "d23abc8d-2991-4a55-ba98-2aaea84cc72f", "description": "for test", "dns_domain": "my-domain.org.", "dns_name": "myfip", "created_at": "2016-12-21T10:55:50Z", "updated_at": "2016-12-21T10:55:53Z", "revision_number": 1, "project_id": "4969c491a3c74ee4af974e6d800c62de", "tenant_id": "4969c491a3c74ee4af974e6d800c62de", "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", "fixed_ip_address": "10.0.0.3", "floating_ip_address": "172.24.4.228", "port_id": "ce705c24-c1ef-408a-bda3-7bbd946164ab", "id": "2f245a7b-796b-4f26-9cf9-9e82d248fda7", "status": "ACTIVE", "port_details": { "status": "ACTIVE", "name": "", "admin_state_up": true, "network_id": "02dd8479-ef26-4398-a102-d19d0a7b3a1f", "device_owner": "compute:nova", "mac_address": "fa:16:3e:b1:3b:30", "device_id": "8e3941b4-a6e9-499f-a1ac-2a4662025cba" }, "tags": ["tag1,tag2"], "port_forwardings": [] }, { "router_id": null, "description": "for test", "dns_domain": "my-domain.org.", "dns_name": "myfip2", "created_at": "2016-12-21T11:55:50Z", "updated_at": "2016-12-21T11:55:53Z", "revision_number": 2, "project_id": "4969c491a3c74ee4af974e6d800c62de", "tenant_id": "4969c491a3c74ee4af974e6d800c62de", "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", "fixed_ip_address": null, "floating_ip_address": "172.24.4.227", "port_id": null, "id": "61cea855-49cb-4846-997d-801b70c71bdd", "status": "DOWN", "port_details": null, "tags": ["tag1,tag2"], "port_forwardings": [] }, { "router_id": "0303bf18-2c52-479c-bd68-e0ad712a1639", "description": "for test with port forwarding", "dns_domain": "my-domain.org.", "dns_name": "myfip3", "created_at": "2018-06-15T02:12:48Z", "updated_at": "2018-06-15T02:12:57Z", "revision_number": 1, "project_id": "4969c491a3c74ee4af974e6d800c62de", "tenant_id": "4969c491a3c74ee4af974e6d800c62de", "floating_network_id": "376da547-b977-4cfe-9cba-275c80debf57", "fixed_ip_address": null, "floating_ip_address": "172.24.4.42", "port_id": null, "id": "898b198e-49f7-47d6-a7e1-53f626a548e6", "status": "ACTIVE", "tags": [], "port_forwardings": [ { "protocol": "tcp", "internal_ip_address": "10.0.0.19", "internal_port": 25, "external_port": 2225 }, { "protocol": "tcp", "internal_ip_address": "10.0.0.18", "internal_port": 16666, "external_port": 8786 } ] } ] } neutron-lib-2.3.0/api-ref/source/v2/samples/network-ip-availability/0000775000175000017500000000000013641427200025360 5ustar zuulzuul00000000000000././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/network-ip-availability/network-ip-availability-list.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/network-ip-availability/network-ip-availability-list.jso0000664000175000017500000000405413641427107033626 0ustar zuulzuul00000000000000{ "network_ip_availabilities": [ { "network_id": "4cf895c9-c3d1-489e-b02e-59b5c8976809", "network_name": "public", "subnet_ip_availability": [ { "cidr": "2001:db8::/64", "ip_version": 6, "subnet_id": "ca3f46c4-c6ff-4272-9be4-0466f84c6077", "subnet_name": "ipv6-public-subnet", "total_ips": 18446744073709552000, "used_ips": 1 }, { "cidr": "172.24.4.0/24", "ip_version": 4, "subnet_id": "cc02efc1-9d47-46bd-bab6-760919c836b5", "subnet_name": "public-subnet", "total_ips": 253, "used_ips": 1 } ], "project_id": "1a02cc95f1734fcc9d3c753818f03002", "tenant_id": "1a02cc95f1734fcc9d3c753818f03002", "total_ips": 253, "used_ips": 2 }, { "network_id": "6801d9c8-20e6-4b27-945d-62499f00002e", "network_name": "private", "subnet_ip_availability": [ { "cidr": "10.0.0.0/24", "ip_version": 4, "subnet_id": "44e70d00-80a2-4fb1-ab59-6190595ceb61", "subnet_name": "private-subnet", "total_ips": 253, "used_ips": 2 }, { "ip_version": 6, "cidr": "fdbf:ac66:9be8::/64", "subnet_id": "a90623df-00e1-4902-a675-40674385d74c", "subnet_name": "ipv6-private-subnet", "total_ips": 18446744073709552000, "used_ips": 2 } ], "project_id": "d56d3b8dd6894a508cf41b96b522328c", "tenant_id": "d56d3b8dd6894a508cf41b96b522328c", "total_ips": 18446744073709552000, "used_ips": 4 } ] } ././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000neutron-lib-2.3.0/api-ref/source/v2/samples/network-ip-availability/network-ip-availability-show.jsonneutron-lib-2.3.0/api-ref/source/v2/samples/network-ip-availability/network-ip-availability-show.jso0000664000175000017500000000170213641427107033630 0ustar zuulzuul00000000000000{ "network_ip_availability": { "used_ips": 4, "subnet_ip_availability": [ { "used_ips": 2, "subnet_id": "44e70d00-80a2-4fb1-ab59-6190595ceb61", "subnet_name": "private-subnet", "ip_version": 4, "cidr": "10.0.0.0/24", "total_ips": 253 }, { "used_ips": 2, "subnet_id": "a90623df-00e1-4902-a675-40674385d74c", "subnet_name": "ipv6-private-subnet", "ip_version": 6, "cidr": "fdbf:ac66:9be8::/64", "total_ips": 18446744073709552000 } ], "network_id": "6801d9c8-20e6-4b27-945d-62499f00002e", "project_id": "d56d3b8dd6894a508cf41b96b522328c", "tenant_id": "d56d3b8dd6894a508cf41b96b522328c", "total_ips": 18446744073709552000, "network_name": "private" } } neutron-lib-2.3.0/api-ref/source/v2/router-interface-fip.inc0000664000175000017500000000075713641427107023711 0ustar zuulzuul00000000000000.. -*- rst -*- ============================ Router Interface floating IP ============================ .. note:: Currently this extension ``router-interface-fip`` is only available for networking-midonet. This extension ``router-interface-fip`` indicates the ability to associate floating IPs to internal interfaces of a router. (Without this extension, floating IPs can be associated only to the gateway interface of a router.) This extension does not introduce any resources or attributes. neutron-lib-2.3.0/api-ref/source/v2/rbac-policy.inc0000664000175000017500000001135413641427107022056 0ustar zuulzuul00000000000000.. -*- rst -*- ============= RBAC Policies ============= Lists, shows details for, creates, updates, and deletes RBAC policies. The presence of the ``rbac-security-groups`` extension extends this API to support object types of ``security_group``. The presence of the ``rbac-address-scope`` extension extends this API to support object types of ``address-scope``. The presence of the ``rbac-subnetpool`` extension extends this API to support object types of ``subnetpool``. Show RBAC policy details ======================== .. rest_method:: GET /v2.0/rbac-policies/{rbac_policy_id} Show details for a given RBAC policy. You can control which response parameters are returned by using the fields query parameter. For information, see `Filtering and column selection `__. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - rbac_policy_id: rbac_policy_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - target_tenant: target_tenant - tenant_id: project_id-body-required - object_type: object_type - object_id: object_id - action: rbac_action - project_id: project_id - id: rbac_policy_id Response Example ---------------- .. literalinclude:: samples/rbac_policy/rbac-policy-show-response.json :language: javascript Update RBAC policy ================== .. rest_method:: PUT /v2.0/rbac-policies/{rbac_policy_id} Update RBAC policy for given tenant. Normal response codes: 200 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - rbac_policy_id: rbac_policy_id-path - target_tenant: target_tenant Request Example --------------- .. literalinclude:: samples/rbac_policy/rbac-policy-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - target_tenant: target_tenant - tenant_id: project_id-body-required - object_type: object_type - object_id: object_id - action: rbac_action - project_id: project_id - id: rbac_policy_id Response Example ---------------- .. literalinclude:: samples/rbac_policy/rbac-policy-update-response.json :language: javascript Delete RBAC policy ================== .. rest_method:: DELETE /v2.0/rbac-policies/{rbac_policy_id} Delete an RBAC policy. Normal response codes: 204 Error response codes: 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - rbac_policy_id: rbac_policy_id-path Response -------- There is no body content for the response of a successful DELETE request. List RBAC policies ================== .. rest_method:: GET /v2.0/rbac-policies List RBAC policies that belong to a given tenant. Use the ``fields`` query parameter to filter the response. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - target_tenant: target_tenant-query - tenant_id: project_id-query - object_type: object_type-query - object_id: object_id-query - action: rbac_action-query - project_id: project_id-query - id: id-query - sort_dir: sort_dir - sort_key: rbac-sort_key - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - target_tenant: target_tenant - tenant_id: project_id-body-required - object_type: object_type - object_id: object_id - action: rbac_action - project_id: project_id - id: rbac_policy_id Response Example ---------------- .. literalinclude:: samples/rbac_policy/rbac-policies-list-response.json :language: javascript Create RBAC policy ================== .. rest_method:: POST /v2.0/rbac-policies Create RBAC policy for given tenant. Normal response codes: 201 Error response codes: 400, 401 Request ------- .. rest_parameters:: parameters.yaml - target_tenant: target_tenant - object_type: object_type - object_id: object_id - action: rbac_action Request Example --------------- .. literalinclude:: samples/rbac_policy/rbac-policy-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - target_tenant: target_tenant - tenant_id: project_id-body-required - object_type: object_type - object_id: object_id - action: rbac_action - project_id: project_id - id: rbac_policy_id Response Example ---------------- .. literalinclude:: samples/rbac_policy/rbac-policy-create-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/logging_resource.inc0000664000175000017500000001145513641427107023211 0ustar zuulzuul00000000000000.. -*- rst -*- =================== Logging Resources =================== .. note:: Currently this extension ``logging-resource`` is only available for networking-midonet. Lists, shows information for, creates, updates and deletes logging resources. List Logging Resources ====================== .. rest_method:: GET /v2.0/logging/logging_resources Lists logging resources. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 403 Request ------- .. rest_parameters:: parameters.yaml - fields: fields Response -------- .. rest_parameters:: parameters.yaml - logging_resources: logging_resources - id: logging_resource_id-body - tenant_id: project_id - project_id: project_id - firewall_logs: firewall_logs - name: name - description: description - enabled: logging_resource_enabled Response Example ---------------- .. literalinclude:: samples/logging_resource/logging_resources-list-response.json :language: javascript Create Logging Resource ======================= .. rest_method:: POST /v2.0/logging/logging_resources Creates a logging resource. Normal response codes: 200 Error response codes: 400, 401, 403 Request ------- .. rest_parameters:: parameters.yaml - logging_resource: logging_resource - tenant_id: project_id-request - project_id: project_id-request - name: name-request - description: description-request - enabled: logging_resource_enabled-request Request Example --------------- .. literalinclude:: samples/logging_resource/logging_resource-create-request.json :language: javascript Response -------- .. rest_parameters:: parameters.yaml - logging_resource: logging_resource - id: logging_resource_id-body - tenant_id: project_id - project_id: project_id - firewall_logs: firewall_logs - name: name - description: description - enabled: logging_resource_enabled Response Example ---------------- .. literalinclude:: samples/logging_resource/logging_resource-create-response.json :language: javascript Show Logging Resource Details ============================= .. rest_method:: GET /v2.0/logging/logging_resources/{logging_resource_id} Shows details for a logging resource. Use the ``fields`` query parameter to control which fields are returned in the response body. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - logging_resource_id: logging_resource_id - fields: fields Response -------- .. rest_parameters:: parameters.yaml - logging_resource: logging_resource - id: logging_resource_id-body - tenant_id: project_id - project_id: project_id - firewall_logs: firewall_logs - name: name - description: description - enabled: logging_resource_enabled Response Example ---------------- .. literalinclude:: samples/logging_resource/logging_resource-show-response.json :language: javascript Update Logging Resource ======================= .. rest_method:: PUT /v2.0/logging/logging_resources/{logging_resource_id} Updates a logging resource. Normal response codes: 200 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - logging_resource_id: logging_resource_id - logging_resource: logging_resource - name: name-request-put - description: description-request-put - enabled: logging_resource_enabled-request-put Request Example ---------------- .. literalinclude:: samples/logging_resource/logging_resource-update-request.json :language: javascript Response -------- .. rest_parameters:: parameters.yaml - logging_resource: logging_resource - id: logging_resource_id-body - tenant_id: project_id - project_id: project_id - firewall_logs: firewall_logs - name: name - description: description - enabled: logging_resource_enabled Response Example ---------------- .. literalinclude:: samples/logging_resource/logging_resource-update-response.json :language: javascript Delete Logging Resource ======================= .. rest_method:: DELETE /v2.0/logging/logging_resources/{logging_resource_id} Deletes a logging resource. Normal response codes: 202 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - logging_resource_id: logging_resource_id Response -------- There is no body content for the response of a successful DELETE request. neutron-lib-2.3.0/api-ref/source/v2/parameters.yaml0000664000175000017500000046707613641427107022226 0ustar zuulzuul00000000000000 # variables in header # variables in path address_scope_id-path: description: | The ID of the address scope. in: path required: true type: string agent_id-path: description: | The ID of the agent. in: path required: true type: string bgpvpn-id-path: description: | The ID of the BGP VPN. in: path required: true type: string bgpvpn-network_association_id-path: description: | The ID of an association between a network and a BGP VPN. in: path required: true type: string bgpvpn-port_association_id-path: description: | The ID of an association between a port and a BGP VPN. in: path required: true type: string bgpvpn-router_association_id-path: description: | The ID of an association between a router and a BGP VPN. in: path required: true type: string connection_id-path: description: | The ID of the IPsec site-to-site connection. in: path required: true type: string conntrack_helper_id-path: description: | The ID of the conntrack helper. in: path required: true type: string dscp_rule_id: description: | The ID of the DSCP rule. in: path required: true type: string endpoint_group_id-path: description: | The ID of the VPN endpoint group. in: path required: true type: string extensions-alias-path: description: | The alias of an extension. in: path required: true type: string fip_port_forwarding_id-path: description: | The ID of the floating IP port forwarding. in: path required: true type: string firewall_group_id-path-required: description: | The ID of the firewall group. in: path required: true type: string firewall_id: description: | The ID of the firewall. in: path required: true type: string firewall_log_id: description: | The ID of the firewall log resource. in: path required: true type: string firewall_policy_id-path: description: | The ID of the firewall policy. in: path required: true type: string firewall_policy_id-path-required: description: | The ID of the firewall policy. in: path required: true type: string firewall_rule_id: description: | The ID for the firewall rule. in: path required: true type: string firewall_rule_id-path-required: description: | The ID for the firewall rule. in: path required: true type: string flavor_id: description: | The UUID of the flavor. in: path required: true type: string floatingip-id-path: description: | The ID of the floating IP address. in: path required: true type: string ikepolicy_id-path: description: | The ID of the IKE policy. in: path required: true type: string ipsecpolicy_id-path: description: | The ID of the IPsec policy. in: path required: true type: string log_id-path: description: | The ID of the log resource. in: path required: true type: string logging_resource_id: description: | The ID of the logging resource. in: path required: true type: string metering_label-id-path: description: | The ID of the metering label. in: path required: true type: string metering_label_rule-id-path: description: | The ID of the metering label rule. in: path required: true type: string network_id-path: description: | The ID of the network. in: path required: true type: string network_segment_range_id-path: description: | The ID of the network segment range. in: path required: true type: string port_id-path: description: | The ID of the port. in: path required: true type: string profile_id: description: | The UUID of the service profile. in: path required: true type: string project_id-path: description: | The ID of the project. in: path required: true type: string qos-policy-id-path: description: | The ID of the QoS policy. in: path required: true type: string qos-rule_id: description: | The ID of the QoS rule. in: path required: true type: string qos-rule_type: description: | The name of the QoS rule type. It should be one of the types returned by the List QoS rule types API, for example ``bandwidth_limit`` or ``dscp_marking``. in: path required: true type: string rbac_policy_id-path: description: | The ID of the RBAC policy. in: path required: true type: string resource_id: description: | The ID of resource which the tag is set on. in: path required: true type: string resource_type: description: | The type of resource which the tag is set on. in: path required: true type: string router_id: description: | The ID of the router. in: path required: true type: string router_name: description: | The name of the router. in: path required: true type: string security_group-id-path: description: | The ID of the security group. in: path required: true type: string security_group_rule-id-path: description: | The ID of the security group rule. in: path required: true type: string segment_id-path: description: | The UUID of the segment. in: path required: true type: string subnet_id-path: description: | The ID of the subnet. in: path required: true type: string subnetpool_id: description: | The UUID of the subnet pool. in: path required: true type: string tag: description: | The name for the tag. in: path required: true type: string trunk_id: description: | The ID of the trunk. in: path required: true type: string vpnservice_id-path: description: | The ID of the VPN service. in: path required: true type: string # variables in query address_scope-sort_key: description: | Sorts by an address scope attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``id`` - ``ip_version`` - ``name`` - ``project_id`` - ``shared`` - ``tenant_id`` in: query required: false type: string address_scope_id-query: description: | Filter the subnet pool list result by the address scope that is assigned to the subnet pool. in: query required: false type: string admin_state_up-query: description: | Filter the list result by the administrative state of the resource, which is up (``true``) or down (``false``). in: query required: false type: boolean admin_state_up_trunk-query: description: | Filter the trunk list result by the administrative state of the trunk, which is up (``true``) or down (``false``). in: query required: false type: boolean agent_type-query: description: | Filter the list result by the type of agent such as ``Open vSwitch agent`` or ``DHCP agent``. in: query required: false type: string alive-query: description: | Filter the list result based on whether the agent is alive and running. in: query required: false type: boolean availability_zone-query: description: | Filter the list result by the availability zone of the agent. in: query required: false type: string binary-query: description: | Filter the list result by the executable command used to start the agent such as ``neutron-openvswitch-agent`` or ``neutron-dhcp-agent``. in: query required: false type: string binding:host_id-query: description: | Filter the port list result by the ID of the host where the port resides. in: query required: false type: string cidr-query: description: | Filter the subnet list result by the CIDR of the subnet. in: query required: false type: string conntrack_helper-sort_key: description: | Sorts by a conntrack helper ID attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``id`` - ``helper`` - ``port`` - ``protocol`` in: query required: false type: string conntrack_helper_helper-query: description: | Filter the list result by the used helper. in: query required: false type: string conntrack_helper_port-query: description: | Filter the list result by the used port. in: query required: false type: integer conntrack_helper_protocol-query: description: | Filter the list result by the used protocol. in: query required: false type: string default_prefixlen-query: description: | Filter the subnet pool list result by the size of the prefix to allocate when the ``cidr`` or ``prefixlen`` attributes are omitted when you create the subnet. Default is ``min_prefixlen``. in: query required: false type: integer default_quota-query: description: | Filter the subnet pool list result by the quota on the prefix space that can be allocated from the subnet pool for project subnets. in: query required: false type: integer description-query: description: | Filter the list result by the human-readable description of the resource. in: query required: false type: string device_id-query: description: | Filter the port list result by the ID of the device that uses this port. For example, a server instance or a logical router. in: query required: false type: string device_owner-query: description: | Filter the port result list by the entity type that uses this port. For example, ``compute:nova`` (server instance), ``network:dhcp`` (DHCP agent) or ``network:router_interface`` (router interface). in: query required: false type: string direction-query: description: | Filter the security group rule list result by the direction in which the security group rule is applied, which is ``ingress`` or ``egress``. in: query required: false type: string dscp_mark-query: description: | Filter the list result by the DSCP mark value. in: query required: false type: integer ethertype-query: description: | Filter the security group rule list result by the ethertype of network traffic. The value must be ``IPv4`` or ``IPv6``. in: query required: false type: string excluded-query: description: | Filter the metering rule list result based on whether the metering rule exclude the traffic of a specific IP address with the ``remote_ip_prefix`` value. in: query required: false type: boolean external_port-query: description: | Filter the list result by the TCP/UDP/other protocol port number of the floating IP. in: query required: false type: integer fields: description: | The fields that you want the server to return. If no ``fields`` query parameter is specified, the networking API returns all attributes allowed by the policy settings. By using ``fields`` parameter, the API returns only the requested set of attributes. ``fields`` parameter can be specified multiple times. For example, if you specify ``fields=id&fields=name`` in the request URL, only ``id`` and ``name`` attributes will be returned. in: query required: false type: string fip_port_forwarding-sort_key: description: | Sorts by a floating IP port forwarding attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``id`` - ``internal_port_id`` - ``external_port`` - ``protocol`` in: query required: false type: string fip_port_forwarding_protocol-query: description: | Filter the list result by the used protocol. in: query required: false type: string fixed_ips-query: description: | Filter the port list result by the IP addresses for the port. This field has one or multiple entries. Each entry consists of IP address (``ip_address``), IP address substring (``ip_address_substr``) and/or the subnet ID from which the IP address is assigned (``subnet_id``). in: query required: false type: array flavor-enabled-query: description: | Filter the flavor list result based on whether the flavor is enabled or not. in: query required: false type: boolean flavor-service_type-query: description: | Filter the flavor list result by the type of the flavor. in: query required: false type: string flavor-sort_key: description: | Sorts by a flavor attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``description`` - ``enabled`` - ``id`` - ``name`` - ``service_type`` in: query required: false type: string floating_ip_address-query: description: | Filter the floating IP list result by the floating IP address. in: query required: false type: string floating_network_id-query: description: | Filter the floating IP list result by the ID of the network associated with the floating IP. in: query required: false type: string floatingip-fixed_ip_address-query: description: | Filter the floating IP list result by the fixed IP address that is associated with the floating IP address. in: query required: false type: string floatingip-port_id-query: description: | Filter the floating IP list result by the ID of a port associated with the floating IP. in: query required: false type: string floatingip-router_id-query: description: | Filter the floating IP list result by the ID of the router for the floating IP. in: query required: false type: string floatingip-sort_key: description: | Sorts by a floatingip attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``fixed_ip_address`` - ``floating_ip_address`` - ``floating_network_id`` - ``id`` - ``router_id`` - ``status`` - ``tenant_id`` - ``project_id`` in: query required: false type: string floatingip-status-query: description: | Filter the floating IP list result by the status of the floating IP. Values are ``ACTIVE``, ``DOWN`` and ``ERROR``. in: query required: false type: string host-query: description: | Filter the list result by the hostname of the system the agent is running on. in: query required: false type: string id-query: description: | Filter the list result by the ID of the resource. in: query required: false type: string internal_port_id-query: description: | Filter the list result by the ID of the internal Neutron port. in: query required: false type: string ip_allocation-query: description: | Filter the port list result based on if the ports use ``deferred``, ``immediate`` or no IP allocation (``none``). in: query required: false type: string ip_version-query: description: | Filter the list result by the IP protocol version. Valid value is ``4`` or ``6``. in: query required: false type: integer log-sort_key: description: | Sorts by a log attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``enabled`` - ``event`` - ``id`` - ``name`` - ``project_id`` - ``resource_id`` - ``resource_type`` - ``target_id`` in: query required: false type: string log_enabled-query: description: | Filter the log list result based on this log object is enabled (``true``) or disabled (``false``). in: query required: false type: boolean log_event-query: description: | Filter the log list result by the type of security events, which is ``ACCEPT``, ``DROP``, or ``ALL``. in: query required: false type: string mac_address-query: description: | Filter the port list result by the MAC address of the port. in: query required: false type: string mac_learning_enabled-query: description: | Filter the list result by the mac_learning_enabled state of the resource, which is enabled (``true``) or disabled (``false``). in: query required: false type: boolean max_burst_kbps-query: description: | Filter the list result by the maximum burst size (in kilobits). in: query required: false type: integer max_kbps-response-query: description: | Filter the list result by the maximum KBPS (kilobits per second) value. in: query required: false type: integer max_prefixlen-query: description: | Filter the subnet pool list result by the maximum prefix size that can be allocated from the subnet pool. in: query required: false type: integer metering_label-id-query: description: | Filter the metering rule list result by the ID of the metering label associated with this metering rule. in: query required: false type: string metering_label-sort_key: description: | Sorts by a metering label attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``id`` - ``shared`` - ``name`` - ``description`` - ``tenant_id`` - ``project_id`` in: query required: false type: string metering_label_rule-direction-query: description: | Filter the metering rule list result by the direction in which the metering rule is applied, which is ``ingress`` or ``egress``. in: query required: false type: string metering_label_rule-remote_ip_prefix-query: description: | Filter the metering rule list result by the remote IP prefix that the metering rule associates with. in: query required: false type: string metering_label_rule-sort_key: description: | Sorts by a metering label attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``id`` - ``metering_label_id`` - ``excluded`` - ``remote_ip_prefix`` - ``direction`` in: query required: false type: string min_kbps-query: description: | Filter the list result by the minimum KBPS (kilobits per second) value which should be available for port. in: query required: false type: integer min_prefixlen-query: description: | Filter the subnet pool list result by the smallest prefix that can be allocated from a subnet pool. in: query required: false type: integer mtu-query: description: | Filter the network list result by the maximum transmission unit (MTU) value to address fragmentation. Minimum value is ``68`` for IPv4, and ``1280`` for IPv6. in: query required: false type: integer name-query: description: | Filter the list result by the human-readable name of the resource. in: query required: false type: string network-name-query: description: | Filter the list result by the human-readable name of the network. in: query required: false type: string network-shared-query: description: | Filter the network list result based on if the network is shared across all tenants. in: query required: false type: boolean network-sort_key: description: | Sorts by a network attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``admin_state_up`` - ``availability_zone_hints`` - ``id`` - ``mtu`` - ``name`` - ``status`` - ``tenant_id`` - ``project_id`` in: query required: false type: string network-status-query: description: | Filter the network list result by network status. Values are ``ACTIVE``, ``DOWN``, ``BUILD`` or ``ERROR``. in: query required: false type: string network_id-query: description: | Filter the list result by the ID of the attached network. in: query required: false type: string network_ip_availability-network_id-query: description: | Filter the list result by the ID of the network whose IP availability detail is reported. in: query required: false type: string network_is_default-query: description: | Filter the network list result based on if the network is default pool or not. in: query required: false type: boolean network_segment_range-name-query: description: | Filter the network segment range list result based on the name of the range. in: query required: false type: string network_segment_range-network_type-query: description: | Filter the list result by the type of physical network that this network segment range is mapped to. For example, ``vlan``, ``vxlan``, or ``gre``. Valid values depend on a networking back-end. in: query required: false type: string network_segment_range-physical_network-query: description: | Filter the list result by the physical network where this network segment range is implemented. in: query required: false type: string network_segment_range-sort_key: description: | Sorts by a network segment range attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``id`` - ``name`` - ``project_id`` - ``tenant_id`` in: query required: false type: string network_segment_range_id-query: description: | Filter the network segment range list result based on the range ID. in: query required: false type: string not-tags-any-query: description: | A list of tags to filter the list result by. Resources that match any tag in this list will be excluded. Tags in query must be separated by comma. in: query required: false type: string not-tags-query: description: | A list of tags to filter the list result by. Resources that match all tags in this list will be excluded. Tags in query must be separated by comma. in: query required: false type: string object_id-query: description: | Filter the RBAC policy list result by the ID of the ``object_type`` resource. An ``object_type`` of ``network`` returns a network ID, an ``object_type`` of ``qos-policy`` returns a QoS policy ID, an ``object_type`` of ``security-group`` returns a security group ID, an `object_type`` of ``address-scope`` returns a address scope ID and an ``object_type`` of ``subnetpool`` returns a subnetpool ID. in: query required: false type: string object_type-query: description: | Filter the RBAC policy list result by the type of the object that the RBAC policy affects. Types include ``qos-policy``, ``network``, ``security-group``, ``address-scope`` or ``subnetpool``. in: query required: false type: string physical_network-query: description: | Filter the list result by the physical network where this network/segment is implemented. in: query required: false type: string port-sort_key: description: | Sorts by a port attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``admin_state_up`` - ``device_id`` - ``device_owner`` - ``id`` - ``ip_allocation`` - ``mac_address`` - ``name`` - ``network_id`` - ``project_id`` - ``status`` - ``tenant_id`` in: query required: false type: string port-status-query: description: | Filter the port list result by the port status. Values are ``ACTIVE``, ``DOWN``, ``BUILD`` and ``ERROR``. in: query required: false type: string port_range_max-query: description: | Filter the security group rule list result by the maximum port number in the range that is matched by the security group rule. in: query required: false type: integer port_range_min-query: description: | Filter the security group rule list result by the minimum port number in the range that is matched by the security group rule. in: query required: false type: integer project_id-query: description: | Filter the list result by the ID of the project that owns the resource. in: query required: false type: string protocol-query: description: | Filter the security group rule list result by the IP protocol. in: query required: false type: string provider:network_type-query: description: | Filter the list result by the type of physical network that this network/segment is mapped to. For example, ``flat``, ``vlan``, ``vxlan``, or ``gre``. Valid values depend on a networking back-end. in: query required: false type: string provider:physical_network-query: description: | Filter the list result by the physical network where this network/segment is implemented. in: query required: false type: string provider:segmentation_id-query: description: | Filter the list result by the ID of the isolated segment on the physical network. in: query required: false type: integer qos-rule-direction-query: description: | Filter the list result by the direction of the traffic to which the QoS rule is applied. Valid values are ``egress`` and ``ingress``. in: query required: false type: string qos-shared-query: description: | Filter the QoS policy list result based on whether this policy is shared across all projects. in: query required: false type: boolean qos-sort_key: description: | Sorts by a QOS policy attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``id`` - ``name`` - ``project_id`` - ``tenant_id`` in: query required: false type: string qos_bandwidth_limit_rule-sort_key: description: | Sorts by a bandwidth limit rule attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``direction`` - ``id`` - ``max_burst_kbps`` - ``max_kbps`` in: query required: false type: string qos_dscp_marking_rule-sort_key: description: | Sorts by a DSCP marking rule attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``dscp_mark`` - ``id`` in: query required: false type: string qos_is_default-query: description: | Filter the QoS policy list result based on whether this policy is the default policy. in: query required: false type: boolean qos_minimum_bandwidth_rule-sort_key: description: | Sorts by a minimum bandwidth rule attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``direction`` - ``id`` - ``min_kbps`` in: query required: false type: string rbac-sort_key: description: | Sorts by a RBAC policy attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``action`` - ``id`` - ``object_id`` - ``target_tenant`` - ``tenant_id`` - ``project_id`` in: query required: false type: string rbac_action-query: description: | Filter the RBAC policy list result by the action for the RBAC policy which is ``access_as_external`` or ``access_as_shared``. in: query required: false type: string remote_group_id-query: description: | Filter the security group rule list result by the ID of the remote group that associates with this security group rule. in: query required: false type: string remote_ip_prefix-query: description: | Filter the list result by the remote IP prefix that is matched by this security group rule. in: query required: false type: string resource-query: description: | Filter the list result by the resource type of the availability zone. The supported resource types are ``network`` and ``router``. in: query required: false type: string resource_log_id-query: description: | Filter the log list result by the ID of resource (e.g security group ID). in: query required: false type: string resource_log_type-query: description: | Filter the log list result by the resource type such as ``security_group``. in: query required: false type: string resource_target_log_id-query: description: | Filter the log list result by the ID of resource that is the logging target. in: query required: false type: string revision_number-query: description: | Filter the list result by the revision number of the resource. in: query required: false type: integer router-sort_key: description: | Sorts by a router attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``admin_state_up`` - ``flavor_id`` - ``id`` - ``name`` - ``status`` - ``tenant_id`` - ``project_id`` in: query required: false type: string router:external-query: description: | Filter the network list result based on whether the network has an external routing facility that's not managed by the networking service. in: query required: false type: boolean security_group-sort_key: description: | Sorts by a security group attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``id`` - ``name`` - ``tenant_id`` - ``project_id`` in: query required: false type: string security_group_rule-security_group_id-query: description: | Filter the security group rule list result by the ID of the security group that associates with this security group rule. in: query required: false type: string security_group_rule-sort_key: description: | Sorts by a security group rule attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``direction`` - ``ethertype`` - ``id`` - ``port_range_max`` - ``port_range_min`` - ``protocol`` - ``remote_group_id`` - ``remote_ip_prefix`` - ``security_group_id`` - ``tenant_id`` - ``project_id`` in: query required: false type: string segment-sort_key: description: | Sorts by a segment attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``id`` - ``name`` - ``network_id`` - ``network_type`` - ``physical_network`` - ``segmentation_id`` - ``tenant_id`` - ``project_id`` in: query required: false type: string service_profile-driver-query: description: | Filter the service profile list result by the driver that this profile uses. in: query required: false type: string service_profile-enabled-query: description: | Filter the service profile list result based on whether this service profile is enabled or not. in: query required: false type: boolean service_profile-sort_key: description: | Sorts by a service profile attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``description`` - ``driver`` - ``enabled`` - ``id`` - ``metainfo`` in: query required: false type: string shared-query: description: | Admin-only. Filter the list result based on whether the resource is shared across all projects. in: query required: false type: boolean sort_dir: description: | Sort direction. A valid value is ``asc`` (ascending) or ``desc`` (descending). You can specify multiple pairs of sort key and sort direction query parameters. in: query required: false type: string state-query: description: | Filter the list result by the state of the availability zone, which is either ``available`` or ``unavailable``. in: query required: false type: string subnet-dns_publish_fixed_ip-query: description: | Filter the subnet list result based on if ``dns_publish_fixed_ip`` is enabled or disabled for the subnet. in: query required: false type: boolean subnet-enable_dhcp-query: description: | Filter the subnet list result based on if DHCP is enabled or disabled for the subnet. in: query required: false type: boolean subnet-gateway_ip-query: description: | Filter the subnet list result by the gateway IP of this subnet. in: query required: false type: string subnet-ip_version-query: description: | Filter the subnet list result by the IP protocol version. Value is ``4`` or ``6``. in: query required: false type: integer subnet-ipv6_address_mode-query: description: | Filter the subnet list result by the IPv6 address modes specifies mechanisms for assigning IP addresses. Value is ``slaac``, ``dhcpv6-stateful``, ``dhcpv6-stateless`` or ``null``. in: query required: false type: string subnet-ipv6_ra_mode-query: description: | Filter the subnet list result by the IPv6 router advertisement specifies whether the networking service should transmit ICMPv6 packets for a subnet. Value is ``slaac``, ``dhcpv6-stateful``, ``dhcpv6-stateless`` or ``null``. in: query required: false type: string subnet-network_id-query: description: | Filter the subnet list result by the ID of the network to which the subnet belongs. in: query required: false type: string subnet-segment_id-query: description: | Filter the subnet list result by the ID of a network segment the subnet is associated with. It is available when ``segment`` extension is enabled. in: query required: false type: string subnet-sort_key: description: | Sorts by a subnet attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``cidr`` - ``enable_dhcp`` - ``gateway_ip`` - ``id`` - ``ip_version`` - ``ipv6_address_mode`` - ``ipv6_ra_mode`` - ``name`` - ``network_id`` - ``segment_id`` - ``subnetpool_id`` - ``tenant_id`` - ``project_id`` in: query required: false type: string subnet-subnetpool_id-query: description: | Filter the subnet list result by the ID of the subnet pool associated with the subnet. in: query required: false type: string subnetpool-sort_key: description: | Sorts by a subnetpool attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``address_scope_id`` - ``default_prefixlen`` - ``default_quota`` - ``id`` - ``ip_version`` - ``is_default`` - ``max_prefixlen`` - ``min_prefixlen`` - ``name`` - ``shared`` - ``tenant_id`` - ``project_id`` in: query required: false type: string subnetpool_is_default-query: description: | Filter the subnet pool list result based on if it is a default pool or not. in: query required: false type: boolean tags-any-query: description: | A list of tags to filter the list result by. Resources that match any tag in this list will be returned. Tags in query must be separated by comma. in: query required: false type: string tags-query: description: | A list of tags to filter the list result by. Resources that match all tags in this list will be returned. Tags in query must be separated by comma. in: query required: false type: string target_tenant-query: description: | Filter the RBAC policy list result by the ID of the tenant to which the RBAC policy will be enforced. in: query required: false type: string topic-query: description: | Filter the list result by the name of AMQP topic the agent is listening on such as ``dhcp_agent``. in: query required: false type: string trunk-sort_key: description: | Sorts by a trunk attribute. You can specify multiple pairs of sort key and sort direction query parameters. The sort keys are limited to: - ``admin_state_up`` - ``id`` - ``name`` - ``port_id`` - ``project_id`` - ``status`` - ``tenant_id`` in: query required: false type: string trunk-status-query: description: | Filter the trunk list result by the status for the trunk. Possible values are ``ACTIVE``, ``DOWN``, ``BUILD``, ``DEGRADED``, and ``ERROR``. in: query required: false type: string trunk_port_id-query: description: | Filter the trunk list result by the ID of the parent port. in: query required: false type: string verbose: description: | Show detailed information. in: query required: false type: boolean vlan_transparent-query: description: | Filter the network list by the VLAN transparency mode of the network, which is VLAN transparent (``true``) or not VLAN transparent (``false``). in: query required: false type: boolean # variables in body action: description: | The action that the API performs on traffic that matches the firewall rule. Valid value is ``allow`` or ``deny``. Default is ``deny``. in: body required: false type: string action-response: description: | The action that the API performs on traffic that matches the firewall rule. Valid value is ``allow``, ``deny`` or ``reject``. Default is ``deny``. in: body required: true type: string address: description: | The IP address of the member. format: ipv4 in: body required: true type: string address_scope: description: | An ``address scope`` object. in: body required: true type: object address_scope_id: description: | An address scope to assign to the subnet pool. in: body required: false type: object address_scope_id_body: description: | The ID of the address scope. in: body required: true type: string address_scopes: description: | A list of ``address scope`` objects. in: body required: true type: array admin_state_up: description: | The administrative state of the resource, which is up (``true``) or down (``false``). in: body required: true type: boolean admin_state_up-request: description: | The administrative state of the resource, which is up (``true``) or down (``false``). Default is ``true``. in: body required: false type: boolean admin_state_up_trunk: description: | The administrative state of the trunk, which is up (``true``) or down (``false``). in: body required: false type: boolean agent: description: | An ``agent`` object. in: body required: true type: object type: string agent_resources_synced: description: | The value ``null`` means no resource view synchronization to Placement was attempted. ``true`` / ``false`` values signify the success of the last synchronization attempt. Therefore the relevant resources in Placement can only be considered up to date if this attribute is ``true``. This attribute is read-only, it is only supposed to be updated internally, but it is readable for debugging purposes. Not all agent types track resources via Placement, therefore the value ``null`` does not necessarily means there is an error in the system. in: body required: false type: boolean agent_type: description: | The type of agent such as ``Open vSwitch agent`` or ``DHCP agent``. in: body required: true type: string agents: description: | A list of ``agent`` objects. in: body required: true type: array alias: description: | The alias for the extension. For example, "FOXNSOX", "os- availability-zone", "os-extended-quotas", "os- share-unmanage" or "os-used-limits." in: body required: true type: string alive: description: | Indicates the agent is alive and running. in: body required: true type: boolean 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``. While the ``ip_address`` is required, the ``mac_address`` will be taken from the port if not specified. The value of ``ip_address`` can be an IP Address or a CIDR (if supported by the underlying extension plugin). A server connected to the port can send a packet with source address which matches one of the specified allowed address pairs. in: body required: true type: array allowed_address_pairs-request: description: | A set of zero or more allowed address pair objects each where address pair object contains an ``ip_address`` and ``mac_address``. While the ``ip_address`` is required, the ``mac_address`` will be taken from the port if not specified. The value of ``ip_address`` can be an IP Address or a CIDR (if supported by the underlying extension plugin). A server connected to the port can send a packet with source address which matches one of the specified allowed address pairs. in: body required: false type: array audited: description: | Each time that the firewall policy or its associated rules are changed, the API sets this attribute to ``false``. To audit the policy, explicitly set this attribute to ``true``. in: body required: true type: boolean auth_algorithm: description: | The authentication hash algorithm. Valid values are ``sha1``, ``sha256``, ``sha384``, ``sha512``. The default is ``sha1``. in: body required: false type: string auth_mode: description: | The authentication mode. A valid value is ``psk``, which is the default. in: body required: false type: string availability_zone: description: | The availability zone of the agent. in: body required: true type: string availability_zone_hints: description: | The availability zone candidate for the network. in: body required: true type: array availability_zone_hints-request: description: | The availability zone candidate for the network. in: body required: false type: array availability_zones: description: | The availability zone for the network. in: body required: true type: array availability_zones-list: description: | A list of ``availability zone`` objects. in: body required: true type: array bandwidth_limit_rule: description: | A ``bandwidth_limit_rule`` object. in: body required: true type: object bandwidth_limit_rules: description: | A list of bandwidth limit rules associated with the QoS policy. in: body required: true type: array bgpvpn: description: | A ``bgpvpn`` object represents an MPLS network with which Neutron routers and/or networks may be associated in: body required: true type: object bgpvpn-advertise_extra_routes: description: | Boolean flag controlling whether or not the routes specified in the ``routes`` attribute of the router will be advertised to the BGPVPN. in: body required: true type: boolean bgpvpn-advertise_extra_routes-request: description: | Boolean flag controlling whether or not the routes specified in the ``routes`` attribute of the router will be advertised to the BGPVPN (default: true). in: body required: false type: boolean bgpvpn-advertise_fixed_ips: description: | Boolean flag controlling whether or not the fixed IPs of a port will be advertised to the BGPVPN. in: body required: true type: boolean bgpvpn-advertise_fixed_ips-request: description: | Boolean flag controlling whether or not the fixed IPs of a port will be advertised to the BGPVPN (default: true). in: body required: false type: boolean bgpvpn-export_targets: description: | Additional Route Targets that will be used for export. in: body required: false type: array bgpvpn-export_targets-required: description: | Additional Route Targets that will be used for export. in: body required: true type: array bgpvpn-id-body: description: | The ID of the BGP VPN. in: body required: true type: string bgpvpn-import_targets: description: | Additional Route Targets that will be imported. in: body required: false type: array bgpvpn-import_targets-required: description: | Additional Route Targets that will be imported. in: body required: true type: array bgpvpn-local_pref: description: | The default BGP LOCAL_PREF of routes that will be advertised to the BGPVPN (unless overridden per-route). in: body required: true type: integer bgpvpn-local_pref-request: description: | The default BGP LOCAL_PREF of routes that will be advertised to the BGPVPN (unless overridden per-route). Defaults to ``null``. in: body required: false type: integer bgpvpn-name: description: | The user meaningful name of the BGP VPN. in: body required: false type: string bgpvpn-name-required: description: | The user meaningful name of the BGP VPN. in: body required: true type: string bgpvpn-network_association: description: | A ``network_association`` object represents the binding of a BGP VPN to a Neutron network. in: body required: true type: object bgpvpn-network_association_id: description: | The ID of an association between a network and a BGP VPN. in: body required: true type: string bgpvpn-network_associations: description: | A list of ``network_association`` objects which represent bindings of MPLS networks to Neutron networks. in: body required: true type: object bgpvpn-network_id: description: | The ID of a Neutron network with which to associate the BGP VPN. in: body required: true type: string bgpvpn-networks: description: | This read-only list of network IDs reflects the associations defined by Network association API resources. in: body required: false type: array bgpvpn-networks-required: description: | This read-only list of network IDs reflects the associations defined by Network association API resources. in: body required: true type: array bgpvpn-port_association: description: | A ``port_association`` object represents the binding of a BGP VPN to a Neutron port. in: body required: true type: object bgpvpn-port_association_id: description: | The ID of an association between a port and a BGP VPN. in: body required: true type: string bgpvpn-port_associations: description: | A list of ``port_association`` objects which represent bindings of MPLS networks to Neutron ports. in: body required: true type: array bgpvpn-port_id: description: | The ID of a Neutron port with which to associate the BGP VPN. in: body required: true type: string bgpvpn-ports: description: | This read-only list of port IDs reflects the associations defined by Port association API resources (only present if the ``bgpvpn-routes-control`` API extension is enabled). in: body required: true type: array bgpvpn-route_distinguishers: description: | List of route distinguisher strings. If this parameter is specified, one of these RDs will be used to advertise VPN routes. in: body required: false type: array bgpvpn-route_distinguishers-required: description: | List of route distinguisher strings. If this parameter is specified, one of these RDs will be used to advertise VPN routes. in: body required: true type: array bgpvpn-route_targets: description: | Route Targets that will be both imported and used for export. in: body required: false type: array bgpvpn-route_targets-required: description: | Route Targets that will be both imported and used for export. in: body required: true type: array bgpvpn-router_association: description: | A ``router_association`` object represents the binding of a BGP VPN to a Neutron router. in: body required: true type: object bgpvpn-router_association_id: description: | The ID of an association between a router and a BGP VPN. in: body required: true type: string bgpvpn-router_associations: description: | A list of ``router_association`` objects which represent bindings of MPLS networks to Neutron routers. in: body required: true type: object bgpvpn-router_id: description: | The ID of a Neutron router with which to associate the BGP VPN. in: body required: true type: string bgpvpn-routers: description: | This read-only list of router IDs reflects the associations defined by Router association API resources. in: body required: false type: array bgpvpn-routers-required: description: | This read-only list of router IDs reflects the associations defined by Router association API resources. in: body required: true type: array bgpvpn-routes: description: | List of routes, each route being a dict with at least a ``type`` key, which can be ``prefix`` or ``bgpvpn``. For the ``prefix`` type, the IP prefix (v4 or v6) to advertise is specified in the ``prefix`` key. For the ``bgpvpn`` type, the ``bgpvpn_id`` key specifies the BGPVPN from which routes will be readvertised with the association port as the nexthop (any route carrying an RT among ``route_targets`` or ``import_targets`` of this BGPVPN, will be re-announced toward the RTs of the associated BGPVPN (``export_targets`` + ``route_targets``), with their next-hop/label pointing to this port). For both types, the ``local_pref`` key can be used to control the value of the BGP LOCAL_PREF of the routes that will be advertised. in: body required: true type: array bgpvpn-routes-request: description: | List of routes, each route being a dict with at least a ``type`` key, which can be ``prefix`` or ``bgpvpn``. For the ``prefix`` type, the IP prefix (v4 or v6) to advertise is specified in the ``prefix`` key. For the ``bgpvpn`` type, the ``bgpvpn_id`` key specifies the BGPVPN from which routes will be readvertised with the association port as the nexthop (any route carrying an RT among ``route_targets`` or ``import_targets`` of this BGPVPN, will be re-announced toward the RTs of the associated BGPVPN (``export_targets`` + ``route_targets``), with their next-hop/label pointing to this port). For both types, the ``local_pref`` key can be used to control the value of the BGP LOCAL_PREF of the routes that will be advertised. in: body required: false type: array bgpvpn-type: description: | Selection of the type of VPN and the technology behind it. Allowed values are ``l2`` or ``l3``. The default is l3. ``l2`` indicates a Layer 2 (i.e. bridged) attachment and ``l3`` indicates a Layer 3 (i.e. routed) attachment. in: body required: false type: string bgpvpn-type-required: description: | Selection of the type of VPN and the technology behind it. Allowed values are ``l2`` or ``l3``. The default is l3. ``l2`` indicates a Layer 2 (i.e. bridged) attachment and ``l3`` indicates a Layer 3 (i.e. routed) attachment. in: body required: true type: string bgpvpn-vni: description: | The globally-assigned VXLAN ``vni`` for the BGP VPN. in: body required: false type: integer bgpvpn-vni-required: description: | The globally-assigned VXLAN ``vni`` for the BGP VPN. in: body required: true type: integer bgpvpns: description: | A list of ``bgpvpn`` objects. Each ``bgpvpn`` object represents an MPLS network with which Neutron routers and/or networks may be associated in: body required: true type: array binary: description: | The executable command used to start the agent such as ``neutron-openvswitch-agent`` or ``neutron-dhcp-agent``. in: body required: true type: string binding:host_id: description: | The ID of the host where the port resides. in: body required: true type: string binding:host_id-request: description: | The ID of the host where the port resides. The default is an empty string. in: body required: false type: string binding:profile: 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. The networking API does not define a specific format of this field. in: body required: true type: object binding:profile-request: 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. The networking API does not define a specific format of this field. The default is an empty dictionary. in: body required: false type: object binding:vif_details: description: | A dictionary which contains additional information on the port. Currently the following fields are defined: ``port_filter`` and ``ovs_hybrid_plug``. ``port_filter`` is a boolean indicating the networking service provides port filtering features such as security group and/or anti MAC/IP spoofing. ``ovs_hybrid_plug`` is a boolean used to inform an API consumer like nova that the hybrid plugging strategy for OVS should be used. in: body required: true type: object binding:vif_type: description: | The type of which mechanism is used for the port. An API consumer like nova can use this to determine an appropriate way to attach a device (for example an interface of a virtual server) to the port. Available values currently defined includes ``ovs``, ``bridge``, ``macvtap``, ``hw_veb``, ``hostdev_physical``, ``vhostuser``, ``distributed`` and ``other``. There are also special values: ``unbound`` and ``binding_failed``. ``unbound`` means the port is not bound to a networking back-end. ``binding_failed`` means an error that the port failed to be bound to a networking back-end. in: body required: true type: string binding:vnic_type: 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. The valid values are ``normal``, ``macvtap``, ``direct``, ``baremetal``, ``direct-physical``, ``virtio-forwarder`` and ``smart-nic``. What type of vNIC is actually available depends on deployments. in: body required: true type: string binding:vnic_type-request: 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. The valid values are ``normal``, ``macvtap``, ``direct``, ``baremetal``, ``direct-physical``, ``virtio-forwarder`` and ``smart-nic``. What type of vNIC is actually available depends on deployments. The default is ``normal``. in: body required: false type: string cidr: description: | The CIDR of the subnet. in: body required: true type: string configurations: description: | An object containing configuration specific key/value pairs; the semantics of which are determined by the binary name and type. in: body required: true type: object connection_id-body-response: description: | The ID of the IPsec site-to-site connection. in: body required: false type: string conntrack_helper: description: | A router ``conntrack helper`` object. in: body required: true type: object conntrack_helper_helper-body: description: | The netfilter conntrack helper module. in: body required: true type: string conntrack_helper_helper-update: description: | The netfilter conntrack helper module. in: body required: false type: string conntrack_helper_id-body: description: | The ID of the conntrack helper. in: body required: true type: string conntrack_helper_port-body: description: | The network port for the netfilter conntrack target rule. in: body required: true type: integer conntrack_helper_port-update: description: | The network port for the netfilter conntrack target rule. in: body required: false type: integer conntrack_helper_protocol-body: description: | The network protocol for the netfilter conntrack target rule. in: body required: true type: string conntrack_helper_protocol-update: description: | The network protocol for the netfilter conntrack target rule. in: body required: false type: string conntrack_helpers: description: | A list of ``router conntrack helpers`` objects. in: body required: true type: array created_at_resource: description: | Time at which the resource has been created (in UTC ISO8601 format). in: body required: true type: string data_plane_status: description: | Status of the underlying data plane of a port. in: body required: true type: string data_plane_status-request: description: | Status of the underlying data plane of a port. in: body required: false type: string default: description: | Defines whether the provider is the default for the service type. If this value is ``true``, the provider is the default. If this value is ``false``, the provider is not the default. in: body required: true type: boolean default_prefixlen: description: | The size of the prefix to allocate when the ``cidr`` or ``prefixlen`` attributes are omitted when you create the subnet. Default is ``min_prefixlen``. in: body required: false type: integer default_quota: description: | A per-project quota on the prefix space that can be allocated from the subnet pool for project subnets. Default is no quota is enforced on allocations from the subnet pool. For IPv4 subnet pools, ``default_quota`` is measured in units of /32. For IPv6 subnet pools, ``default_quota`` is measured units of /64. All projects that use the subnet pool have the same prefix quota applied. in: body required: false type: integer description: description: | A human-readable description for the resource. in: body required: true type: string description-request: description: | A human-readable description for the resource. Default is an empty string. in: body required: false type: string description-request-put: description: | A human-readable description for the resource. in: body required: false type: string description_resource: description: | The description for the resource. in: body required: true type: string destination_firewall_group_id-body-optional: description: | The ID of the remote destination firewall group. in: body required: false type: string destination_firewall_group_id-body-required: description: | The ID of the remote destination firewall group. in: body required: true type: string destination_ip_address: description: | The destination IPv4 or IPv6 address or CIDR. No default. in: body required: false type: string destination_ip_address-response: description: | The destination IPv4 or IPv6 address or CIDR. No default. in: body required: true type: string destination_port: description: | The destination port or port range. A valid value is a port number, as an integer, or a port range, in the format of a ``:`` separated range. For a port range, include both ends of the range. For example, ``80:90``. in: body required: false type: string destination_port-response: description: | The destination port or port range. A valid value is a port number, as an integer, or a port range, in the format of a ``:`` separated range. For a port range, include both ends of the range. For example, ``80:90``. in: body required: true type: string device_id: description: | The ID of the device that uses this port. For example, a server instance or a logical router. in: body required: true type: string device_id-request: description: | The ID of the device that uses this port. For example, a server instance or a logical router. in: body required: false type: string device_owner: description: | The entity type that uses this port. For example, ``compute:nova`` (server instance), ``network:dhcp`` (DHCP agent) or ``network:router_interface`` (router interface). in: body required: true type: string device_owner-request: description: | The entity type that uses this port. For example, ``compute:nova`` (server instance), ``network:dhcp`` (DHCP agent) or ``network:router_interface`` (router interface). in: body required: false type: string direction: description: | Ingress or egress, which is the direction in which the security group rule is applied. in: body required: true type: string dns_assignment: description: | Data assigned to a port by the Networking internal DNS including the ``hostname``, ``ip_address`` and ``fqdn``. in: body required: true type: object dns_domain: description: | A valid DNS domain. in: body required: true type: string dns_domain-request: description: | A valid DNS domain. in: body required: false type: string dns_name: description: | A valid DNS name. in: body required: true type: string dns_name-request: description: | A valid DNS name. in: body required: false type: string dpd: description: | A dictionary with dead peer detection (DPD) protocol controls. in: body required: false type: object dscp_mark: description: | The DSCP mark value. in: body required: false type: integer dscp_mark-response: description: | The DSCP mark value. in: body required: true type: integer dscp_marking_rule: description: | A ``dscp_marking_rule`` object. in: body required: true type: object dscp_marking_rules: description: | A list of ``dscp_marking_rule`` objects. in: body required: true type: array egress_firewall_policy_id-body-optional: description: | The ID of the egress firewall policy for the firewall group. in: body required: false type: string egress_firewall_policy_id-body-required: description: | The ID of the egress firewall policy for the firewall group. in: body required: true type: string enabled: description: | Set to ``false`` to disable this rule in the firewall policy. Facilitates selectively turning off rules without having to disassociate the rule from the firewall policy. Valid value is ``true`` or ``false``. Default is ``true``. in: body required: false type: boolean enabled-body-required: description: | Indicates whether this resource is enabled or disabled. in: body required: true type: boolean enabled-response: description: | Set to ``false`` to disable this rule in the firewall policy. Facilitates selectively turning off rules without having to disassociate the rule from the firewall policy. Valid value is ``true`` or ``false``. Default is ``true``. in: body required: true type: boolean encapsulation_mode: description: | The encapsulation mode. A valid value is ``tunnel`` or ``transport``. Default is ``tunnel``. in: body required: false type: string encryption_algorithm: description: | The encryption algorithm. A valid value is ``3des``, ``aes-128``, ``aes-192``, ``aes-256``, and so on. Default is ``aes-128``. in: body required: false type: string endpoint_group_id-body-response: description: | The ID of the VPN endpoint group. in: body required: true type: string endpoints: description: | List of endpoints of the same type, for the endpoint group. The values will depend on type. in: body required: true type: array ethertype: description: | Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress or egress rules. in: body required: true type: string ethertype-request: description: | Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress or egress rules. in: body required: false type: string excluded: description: | Indicates whether to count the traffic of a specific IP address with the ``remote_ip_prefix`` value. in: body required: true type: boolean excluded-request: description: | Indicates whether to count the traffic of a specific IP address with the ``remote_ip_prefix`` value. Default is ``false``. in: body required: false type: boolean expected_codes: description: | The list of HTTP status codes expected in response from the member to declare it healthy. Specify one of the following values: - A single value, such as ``200`` - A list, such as ``200, 202`` - A range, such as ``200-204`` The default is 200. in: body required: false type: string expected_codes-response: description: | The list of HTTP status codes expected in response from the member to declare it healthy. Specify one of the following values: - A single value, such as ``200`` - A list, such as ``200, 202`` - A range, such as ``200-204`` The default is 200. in: body required: true type: string extension: description: | An ``extension`` object. in: body required: true type: object extension-alias-body: description: | The alias for the extension. For example "quotas" or "security-group". in: body required: true type: string extension-description: description: | The human-readable description for the resource. in: body required: true type: string extension-links: description: | List of links related to the extension. in: body required: true type: array extension-name: description: | Human-readable name of the resource. in: body required: true type: string extension-updated: description: | The date and timestamp when the extension was last updated. in: body required: true type: string extensions: description: | A list of ``extension`` objects. in: body required: true type: array external_port: description: | The TCP/UDP/other protocol port number of the port forwarding's floating IP address. in: body required: true type: integer external_port-update: description: | The TCP/UDP/other protocol port number of the port forwarding's floating IP address. in: body required: false type: integer external_v4_ip: description: | Read-only external (public) IPv4 address that is used for the VPN service. The VPN plugin sets this address if an IPv4 interface is available. in: body required: true type: string external_v6_ip: description: | Read-only external (public) IPv6 address that is used for the VPN service. The VPN plugin sets this address if an IPv6 interface is available. in: body required: true type: string extra_dhcp_opts: description: | A set of zero or more extra DHCP option pairs. An option pair consists of an option value and name. in: body required: true type: array extra_dhcp_opts-request: description: | A set of zero or more extra DHCP option pairs. An option pair consists of an option value and name. in: body required: false type: array fip_port_forwarding: description: | A ``floating IP port forwarding`` object. in: body required: true type: object fip_port_forwarding-description: description: | A text describing the rule, which helps users to manage/find easily theirs rules. in: body required: false type: string fip_port_forwarding_id-body: description: | The ID of the floating IP port forwarding. in: body required: true type: string fip_port_forwarding_protocol-body: description: | The IP protocol used in the floating IP port forwarding. in: body required: true type: string fip_port_forwarding_protocol-update: description: | The IP protocol used in the floating IP port forwarding. in: body required: false type: string fip_port_forwardings: description: | A list of ``floating IP port forwardings`` objects. in: body required: true type: array firewall: description: | A ``firewall`` object. in: body required: true type: object firewall-status: description: | The status of the firewall service. Values are ``ACTIVE``, ``INACTIVE``, ``ERROR``, ``DOWN``, ``PENDING_CREATE``, ``PENDING_UPDATE``, or ``PENDING_DELETE``. in: body required: true type: string firewall_group_admin_state_up-body-optional: description: | The administrative state of the firewall group, which is up (``true``) or down (``false``). Default is ``true``. in: body required: false type: boolean firewall_group_admin_state_up-body-required: description: | The administrative state of the firewall group, which is up (``true``) or down (``false``). Default is ``true``. in: body required: true type: boolean firewall_group_description-body-optional: description: | A human-readable description of the firewall group. in: body required: false type: object firewall_group_description-body-required: description: | A human-readable description of the firewall group. in: body required: true type: object firewall_group_id-body-required: description: | The ID of the firewall group. in: body required: true type: string firewall_group_name-body-optional: description: | A human-readable name for the firewall group. in: body required: false type: string firewall_group_name-body-required: description: | A human-readable name for the firewall group. in: body required: true type: string firewall_group_object: description: | A ``firewall_group`` object. in: body required: true type: object firewall_group_ports-body-optional: description: | A list of the IDs of the ports associated with the firewall group. in: body required: false type: array firewall_group_ports-body-required: description: | A list of the IDs of the ports associated with the firewall group. in: body required: true type: array firewall_group_shared-body-optional: description: | Indicates whether this firewall group is shared across all projects. in: body required: false type: boolean firewall_group_shared-body-required: description: | Indicates whether this firewall group is shared across all projects. in: body required: true type: boolean firewall_group_status-body-required: description: | The status of the firewall group. Valid values are ``ACTIVE``, ``INACTIVE``, ``ERROR``, ``PENDING_UPDATE``, or ``PENDING_DELETE``. in: body required: true type: string firewall_groups_object: description: | A list of ``firewall_group`` objects. in: body required: true type: array firewall_id-body: description: | The ID of the FWaaS v1 firewall. in: body required: true type: string firewall_list: description: | A list of the IDs of firewalls associated with the firewall policy. in: body required: true type: array firewall_log: description: | A ``firewall_log`` object. in: body required: true type: object firewall_log_id-body: description: | The ID of the firewall log resource. in: body required: true type: string firewall_logs: description: | A list of ``firewall_log`` objects. in: body required: true type: array firewall_policies: description: | A list of ``firewall_policy`` objects. in: body required: true type: array firewall_policies_object: description: | A list of ``firewall_policy`` objects. in: body required: true type: array firewall_policy: description: | A ``firewall_policy`` object. in: body required: true type: object firewall_policy_audited-body-optional: description: | Each time that the firewall policy or its associated rules are changed, the API sets this attribute to ``false``. To audit the policy, explicitly set this attribute to ``true``. in: body required: false type: boolean firewall_policy_audited-body-required: description: | Each time that the firewall policy or its associated rules are changed, the API sets this attribute to ``false``. To audit the policy, explicitly set this attribute to ``true``. in: body required: true type: boolean firewall_policy_description-body-optional: description: | A human-readable name of the firewall policy. in: body required: false type: string firewall_policy_description-body-required: description: | A human-readable name of the firewall policy. in: body required: true type: string firewall_policy_id: description: | Read-only attribute that the API populates with the ID of the firewall policy when you associate this firewall rule with a policy. You can associate a firewall rule with one policy at a time. You can update this association can to a different firewall policy. If you do not associate the rule with any policy, this attribute is ``null``. in: body required: false type: string firewall_policy_id-body: description: | The ID of the policy that is associated with the firewall. in: body required: true type: string firewall_policy_id-body-required: description: | The ID of the firewall policy. in: body required: true type: string firewall_policy_name-body-optional: description: | A human-readable name of the firewall policy. in: body required: false type: string firewall_policy_name-body-required: description: | A human-readable name of the firewall policy. in: body required: true type: string firewall_policy_object: description: | A ``firewall_policy`` object. in: body required: true type: object firewall_policy_shared-body-optional: description: | Set to ``true`` to make this firewall policy visible to other projects. Default is ``false``. in: body required: false type: boolean firewall_policy_shared-body-required: description: | Set to ``true`` to make this firewall policy visible to other projects. Default is ``false``. in: body required: true type: boolean firewall_rule: description: | A ``firewall_rule`` object. in: body required: true type: object firewall_rule_action-body-optional: description: | The action that the API performs on traffic that matches the firewall rule. Valid values are ``allow`` or ``deny``. Default is ``deny``. in: body required: false type: string firewall_rule_action-body-required: description: | The action that the API performs on traffic that matches the firewall rule. Valid values are ``allow`` or ``deny``. Default is ``deny``. in: body required: true type: string firewall_rule_description-body-optional: description: | A human-readable description of the firewall rule. in: body required: false type: string firewall_rule_description-body-required: description: | A human-readable description of the firewall rule. in: body required: true type: string firewall_rule_destination_ip_address-body-optional: description: | The destination IPv4 or IPv6 address or CIDR for the firewall rule. No default. in: body required: false type: string firewall_rule_destination_ip_address-body-required: description: | The destination IPv4 or IPv6 address or CIDR for the firewall rule. No default. in: body required: true type: string firewall_rule_destination_port-body-optional: description: | The destination port or port range for the firewall rule. A valid value is a port number, as an integer, or a port range, in the format of a ``:`` separated range. For a port range, include both ends of the range. For example, ``80:90``. in: body required: false type: string firewall_rule_destination_port-body-required: description: | The destination port or port range for the firewall rule. A valid value is a port number, as an integer, or a port range, in the format of a ``:`` separated range. For a port range, include both ends of the range. For example, ``80:90``. in: body required: true type: string firewall_rule_enabled-body-optional: description: | Set to ``false`` to disable this rule in the firewall policy. Facilitates selectively turning off rules without having to disassociate the rule from the firewall policy. Valid values are ``true`` or ``false``. Default is ``true``. in: body required: false type: boolean firewall_rule_enabled-body-required: description: | Set to ``false`` to disable this rule in the firewall policy. Facilitates selectively turning off rules without having to disassociate the rule from the firewall policy. Valid values are ``true`` or ``false``. Default is ``true``. in: body required: true type: boolean firewall_rule_id-body: description: | The ID of the firewall rule. in: body required: true type: string firewall_rule_id-body-required: description: | The ID of the firewall rule. in: body required: true type: string firewall_rule_insert_after-body-required: description: | The ID of the firewall_rule to insert the new rule after. The new rule will be inserted immediately after the specified firewall_rule. If both ``before`` and ``after`` values are supplied, the ``after`` value will be ignored. To insert a rule into a policy with no rules yet, the both the ``before`` and the ``after`` values must be "". in: body required: true type: string firewall_rule_insert_before-body-required: description: | The ID of the firewall_rule to insert the new rule before. The new rule will be inserted immediately before the specified firewall_rule. If both ``before`` and ``after`` values are supplied, the ``after`` value will be ignored. To insert a rule into a policy with no rules yet, the both the ``before`` and the ``after`` values must be "". in: body required: true type: string firewall_rule_ip_version-body-optional: description: | The IP protocol version for the firewall rule. Valid values are ``4`` or ``6``. Default is ``4``. in: body required: false type: integer firewall_rule_ip_version-body-required: description: | The IP protocol version for the firewall rule. Valid values are ``4`` or ``6``. Default is ``4``. in: body required: true type: integer firewall_rule_name-body-optional: description: | A human-readable name of the firewall rule. in: body required: false type: string firewall_rule_name-body-required: description: | A human-readable name of the firewall rule. in: body required: true type: string firewall_rule_object: description: | A ``firewall_rule`` object. in: body required: true type: object firewall_rule_protocol-body-optional: description: | The IP protocol for the firewall rule. Possible values are ``icmp``, ``tcp``, ``udp``, or ``null``. in: body required: false type: string firewall_rule_protocol-body-required: description: | The IP protocol for the firewall rule. Possible values are ``icmp``, ``tcp``, ``udp``, or ``null``. in: body required: true type: string firewall_rule_shared-body-optional: description: | Indicates whether this firewall rule is shared across all projects. in: body required: false type: boolean firewall_rule_shared-body-required: description: | Indicates whether this firewall rule is shared across all projects. in: body required: true type: boolean firewall_rule_source_ip_address-body-optional: description: | The source IPv4 or IPv6 address or CIDR for the firewall rule. No default. in: body required: false type: string firewall_rule_source_ip_address-body-required: description: | The source IPv4 or IPv6 address or CIDR for the firewall rule. No default. in: body required: true type: string firewall_rule_source_port-body-optional: description: | The source port or port range for the firewall rule. A valid value is a port number, as an integer, or a port range, in the format of a ``:`` separated range. For a port range, include both ends of the range. For example, ``80:90``. in: body required: false type: string firewall_rule_source_port-body-required: description: | The source port or port range for the firewall rule. A valid value is a port number, as an integer, or a port range, in the format of a ``:`` separated range. For a port range, include both ends of the range. For example, ``80:90``. in: body required: true type: string firewall_rules: description: | A list of the IDs for firewall rule associated with the firewall policy. in: body required: true type: array firewall_rules-body-optional: description: | A list of the IDs of the firewall rules associated with the firewall policy. in: body required: false type: array firewall_rules-body-required: description: | A list of the IDs of the firewall rules associated with the firewall policy. in: body required: true type: array firewall_rules_id: description: | A list of rules to associate with the firewall policy. in: body required: false type: array firewall_rules_object: description: | A list of ``firewall_rule`` objects. in: body required: true type: object firewalls: description: | A list of ``firewall_rule`` objects. in: body required: true type: array fixed_ips: description: | The IP addresses for the port. If the port has multiple IP addresses, this field has multiple entries. Each entry consists of IP address (``ip_address``) and the subnet ID from which the IP address is assigned (``subnet_id``). in: body required: true type: array fixed_ips-request: description: | The IP addresses for the port. If you would like to assign multiple IP addresses for the port, specify multiple entries in this field. Each entry consists of IP address (``ip_address``) and the subnet ID from which the IP address is assigned (``subnet_id``). * If you specify both a subnet ID and an IP address, OpenStack Networking tries to allocate the IP address on that subnet to the port. * If you specify only a subnet ID, OpenStack Networking allocates an available IP from that subnet to the port. * If you specify only an IP address, OpenStack Networking tries to allocate the IP address if the address is a valid IP for any of the subnets on the specified network. in: body required: false type: array flavor: description: | A ``flavor`` object. in: body required: true type: object flavor-description: description: | The human-readable description for the flavor. in: body required: true type: string flavor-description-request: description: | The human-readable description for the flavor. in: body required: false type: string flavor-enabled: description: | Indicates whether the flavor is enabled or not. Default is true. in: body required: true type: boolean flavor-enabled-request: description: | Indicates whether the flavor is enabled or not. Default is true. in: body required: false type: boolean flavor-id: description: | The ID of the flavor. in: body required: true type: string flavor-id-request: description: | The ID of the flavor. in: body required: false type: string flavor-id-response: description: | The ID of the flavor. in: body required: true type: string flavor-name: description: | Name of the flavor. in: body required: true type: string flavor-name-request: description: | Name of the flavor. in: body required: false type: string flavor-service_profiles: description: | Service profile UUIDs associated with this flavor. in: body required: true type: array flavor-service_type: description: | Service type for the flavor. Example: FIREWALL. in: body required: true type: string flavors: description: | A list of ``flavor`` objects. in: body required: true type: array floating_ip_address: description: | The floating IP address. in: body required: true type: string floating_ip_address-request: description: | The floating IP address. in: body required: false type: string floating_network_id: description: | The ID of the network associated with the floating IP. in: body required: true type: string floating_port_details: description: | The information of the port that this floating IP associates with. In particular, if the floating IP is associated with a port, this field contains some attributes of the associated port, including ``name``, ``network_id``, ``mac_address``, ``admin_state_up``, ``status``, ``device_id`` and ``device_owner``. If the floating IP is not associated with a port, this field is ``null``. in: body required: true type: string floatingip: description: | A ``floatingip`` object. When you associate a floating IP address with a VM, the instance has the same public IP address each time that it boots, basically to maintain a consistent IP address for maintaining DNS assignment. in: body required: true type: object floatingip-fixed_ip_address: description: | The fixed IP address that is associated with the floating IP address. in: body required: true type: string floatingip-fixed_ip_address-request: description: | The fixed IP address that is associated with the floating IP. If an internal port has multiple associated IP addresses, the service chooses the first IP address unless you explicitly define a fixed IP address in the ``fixed_ip_address`` parameter. in: body required: false type: string floatingip-id: description: | The ID of the floating IP address. in: body required: true type: string floatingip-port_forwardings: description: | The associated port forwarding resources for the floating IP. If the floating IP has multiple port forwarding resources, this field has multiple entries. Each entry consists of network IP protocol (``protocol``), the fixed IP address of internal neutron port (``internal_ip_address``), the TCP or UDP port used by internal neutron port (``internal_port``) and the TCP or UDP port used by floating IP (``external_port``). in: body required: true type: array floatingip-port_id: description: | The ID of a port associated with the floating IP. in: body required: true type: string floatingip-port_id-post-request: description: | The ID of a port associated with the floating IP. To associate the floating IP with a fixed IP at creation time, you must specify the identifier of the internal port. in: body required: false type: string floatingip-port_id-put-request: description: | The ID of a port associated with the floating IP. To associate the floating IP with a fixed IP, you must specify the ID of the internal port. To disassociate the floating IP, ``null`` should be specified. in: body required: true type: string floatingip-router_id: description: | The ID of the router for the floating IP. in: body required: true type: string floatingip-status: description: | The status of the floating IP. Values are ``ACTIVE``, ``DOWN`` and ``ERROR``. in: body required: true type: string floatingip-subnet_id: description: | The subnet ID on which you want to create the floating IP. in: body required: false type: string floatingip_pools: description: | A list of ``floatingip_pools`` objects. in: body required: true type: array floatingips: description: | A list of ``floatingip`` objects. in: body required: true type: array fw_event: description: | Type of firewall events to log. ``ACCEPT``, ``DROP``, or ``ALL``. in: body required: true type: string fw_event-request: description: | Type of firewall events to log. ``ACCEPT``, ``DROP``, or ``ALL``. Default is ``ALL``. in: body required: false type: string fw_event-request-put: description: | Type of firewall events to log. ``ACCEPT``, ``DROP``, or ``ALL``. in: body required: false type: string heartbeat_timestamp: description: | Time at which the last heartbeat was received. in: body required: true type: string host: description: | The hostname of the system the agent is running on. in: body required: true type: string id: description: | The ID of the resource. in: body required: true type: string id_autotopology: description: | The ID of the network for the auto allocated topology. in: body required: true type: string id_resource: description: | The ID for the resource. in: body required: true type: string ike_version: description: | The IKE version. A valid value is ``v1`` or ``v2``. Default is ``v1``. in: body required: false type: string ikepolicies: description: | A list of ``ikepolicy`` objects. in: body required: true type: array ikepolicy: description: | An ``ikepolicy`` object. in: body required: true type: object ikepolicy_id-body-request: description: | The ID of the IKE policy. in: body required: false type: string ikepolicy_id-body-response: description: | The ID of the IKE policy. in: body required: true type: string ingress_firewall_policy_id-body-optional: description: | The ID of the ingress firewall policy for the firewall group. in: body required: false type: string ingress_firewall_policy_id-body-required: description: | The ID of the ingress firewall policy for the firewall group. in: body required: true type: string initiator: description: | Indicates whether this VPN can only respond to connections or both respond to and initiate connections. A valid value is ``response- only`` or ``bi-directional``. Default is ``bi-directional``. in: body required: false type: string insert_after: description: | The ID of the firewall_rule. A new firewall_rule will be inserted after this firewall_rule. in: body required: false type: string insert_before: description: | The ID of the firewall_rule. A new firewall_rule will be inserted before this firewall_rule. in: body required: false type: string interfaces: description: | Router interfaces in: body required: true type: string internal_ip_address: description: | The fixed IPv4 address of the Neutron port associated to the floating IP port forwarding. in: body required: true type: string internal_ip_address-response: description: | The fixed IPv4 address of the Neutron port associated to the floating IP port forwarding. in: body required: true type: string internal_port: description: | The TCP/UDP/other protocol port number of the Neutron port fixed IP address associated to the floating ip port forwarding. in: body required: true type: integer internal_port-update: description: | The TCP/UDP/other protocol port number of the Neutron port fixed IP address associated to the floating ip port forwarding. in: body required: false type: integer internal_port_id: description: | The ID of the Neutron port associated to the floating IP port forwarding. in: body required: true type: string internal_port_id-update: description: | The ID of the Neutron port associated to the floating IP port forwarding. in: body required: false type: string interval: description: | The dead peer detection (DPD) interval, in seconds. A valid value is a positive integer. Default is 30. in: body required: false type: integer ip_address: description: | The IP address of an allowed address pair. in: body required: false type: string ip_allocation: description: | Indicates when ports use either ``deferred``, ``immediate`` or no IP allocation (``none``). in: body required: true type: string ip_version: description: | The IP protocol version. Valid value is ``4`` or ``6``. Default is ``4``. in: body required: false type: integer ip_version-required: description: | The IP protocol version. Valid value is ``4`` or ``6``. in: body required: true type: integer ip_version-response: description: | The IP protocol version. Valid value is ``4`` or ``6``. Default is ``4``. in: body required: true type: integer ipsec_site_connection: description: | An ``ipsec_site_connection`` object. in: body required: true type: object ipsec_site_connection-action: description: | The dead peer detection (DPD) action. A valid value is ``clear``, ``hold``, ``restart``, ``disabled``, or ``restart-by-peer``. Default value is ``hold``. in: body required: true type: string ipsec_site_connection-status: description: | Indicates whether the IPsec connection is currently operational. Values are ``ACTIVE``, ``DOWN``, ``BUILD``, ``ERROR``, ``PENDING_CREATE``, ``PENDING_UPDATE``, or ``PENDING_DELETE``. in: body required: true type: string ipsec_site_connection-timeout: description: | The dead peer detection (DPD) timeout in seconds. A valid value is a positive integer that is greater than the DPD ``interval`` value. Default is 120. in: body required: true type: integer ipsecpolicies: description: | A list of ``ipsecpolicy`` objects. in: body required: true type: array ipsecpolicy: description: | An ``ipsecpolicy`` object. in: body required: true type: object ipsecpolicy_id-body-request: description: | The ID of the IPsec policy. in: body required: false type: string ipsecpolicy_id-body-response: description: | The ID of the IPsec policy. in: body required: true type: string ipv4_address_scope: description: | The ID of the IPv4 address scope that the network is associated with. in: body required: true type: string ipv6_address_scope: description: | The ID of the IPv6 address scope that the network is associated with. in: body required: true type: string l2_adjacency: description: | Indicates whether L2 connectivity is available throughout the ``network``. in: body required: true type: boolean lifetime: description: | The lifetime of the security association. The lifetime consists of a unit and integer value. You can omit either the unit or value portion of the lifetime. Default unit is seconds and default value is 3600. in: body required: false type: object links: description: | The share links. in: body required: true type: array local_ep_group_id: description: | The ID for the endpoint group that contains private subnets for the local side of the connection. Yo must specify this parameter with the ``peer_ep_group_id`` parameter unless in backward- compatible mode where ``peer_cidrs`` is provided with a ``subnet_id`` for the VPN service. in: body required: false type: string local_id: description: | An ID to be used instead of the external IP address for a virtual router used in traffic between instances on different networks in east-west traffic. Most often, local ID would be domain name, email address, etc. If this is not configured then the external IP address will be used as the ID. in: body required: false type: string location: description: | Full URL to a service or server. format: uri in: body required: true type: string log: description: | A ``log`` object. in: body required: true type: object log_agent_heartbeats: description: | Log agent heartbeats configuration. in: body required: true type: boolean log_enabled: description: | Indicates whether this log object is enabled or disabled. in: body required: true type: boolean log_enabled-request: description: | Indicates whether this log object is enabled or disabled. Default is true. in: body required: false type: boolean log_enabled-request-put: description: | Indicates whether this log object is enabled or disabled. in: body required: false type: boolean log_event: description: | Type of security events to log. ``ACCEPT``, ``DROP``, or ``ALL``. in: body required: true type: string log_event-request: description: | Type of security events to log. ``ACCEPT``, ``DROP``, or ``ALL``. Default is ``ALL``. in: body required: false type: string log_id: description: | The ID of the log object. in: body required: true type: string loggable_resources: description: | A list of ``loggable_resource`` object. in: body required: true type: object logging_resource: description: | A ``logging_resource`` object. in: body required: true type: object logging_resource_enabled: description: | Indicates whether this logging resource is enabled or disabled. in: body required: true type: boolean logging_resource_enabled-request: description: | Indicates whether this logging resource is enabled or disabled. Default is false. in: body required: false type: boolean logging_resource_enabled-request-put: description: | Indicates whether this logging resource is enabled or disabled. in: body required: false type: boolean logging_resource_id-body: description: | The ID of the logging resource. in: body required: true type: string logging_resources: description: | A list of ``logging_resource`` objects. in: body required: true type: array logs: description: | A list of ``log`` objects. in: body required: true type: array mac_address: description: | The MAC address of the port. in: body required: true type: string mac_address-request: description: | The MAC address of the port. If unspecified, a MAC address is automatically generated. in: body required: false type: string mac_address-request-put: description: | The MAC address of the port. By default, only administrative users and users with advsvc role can change this value. in: body required: false type: string mac_learning_enabled: description: | A boolean value that indicates if MAC Learning is enabled on the associated port. in: body required: false type: boolean mac_learning_enabled-request: description: | A boolean value that indicates if MAC Learning is enabled on the associated port. in: body required: false type: boolean max_burst_kbps: description: | The maximum burst size (in kilobits). Default is ``0``. in: body required: false type: integer max_burst_kbps-response: description: | The maximum burst size (in kilobits). in: body required: true 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. in: body required: false type: integer max_kbps-response: 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. in: body required: true type: integer max_prefixlen: description: | The maximum prefix size that can be allocated from the subnet pool. For IPv4 subnet pools, default is ``32``. For IPv6 subnet pools, default is ``128``. in: body required: false type: integer metainfo: description: | JSON-formatted meta information. in: body required: false type: string metering_label: description: | A ``metering_label`` object. in: body required: true type: object metering_label-id: description: | The ID of the metering label. in: body required: true type: string metering_label-id-body: description: | The metering label ID associated with this metering rule. in: body required: true type: string metering_label-shared: description: | Indicates whether this metering label is shared across all projects. in: body required: true type: boolean metering_label-shared-request: description: | Indicates whether this metering label is shared across all projects. in: body required: false type: boolean metering_label_rule: description: | A ``metering_label_rule`` object. in: body required: true type: object metering_label_rule-direction: description: | Ingress or egress, which is the direction in which the metering rule is applied. in: body required: true type: string metering_label_rule-id: description: | The ID of the metering label rule. in: body required: true type: string metering_label_rule-remote_ip_prefix: description: | The remote IP prefix that is matched by this metering rule. in: body required: true type: string metering_label_rules: description: | A list of ``metering_label_rule`` objects. in: body required: true type: array metering_labels: description: | A list of ``metering_label`` objects. in: body required: true type: array min_kbps: description: | The minimum KBPS (kilobits per second) value which should be available for port. in: body required: true type: integer min_kbps-response: description: | The minimum KBPS (kilobits per second) value which should be available for port. in: body required: true type: integer min_prefixlen: description: | The smallest prefix that can be allocated from a subnet pool. For IPv4 subnet pools, default is ``8``. For IPv6 subnet pools, default is ``64``. in: body required: false type: integer minimum_bandwidth_rule: description: | A ``minimum_bandwidth_rule`` object. in: body required: true type: object minimum_bandwidth_rules: description: | A list of ``minimum_bandwidth_rule`` objects associated with the QoS policy. in: body required: true type: array mtu: description: | The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6. in: body required: true type: integer mtu-request: description: | The maximum transmission unit (MTU) value to address fragmentation. Minimum value is 68 for IPv4, and 1280 for IPv6. in: body required: false type: integer name: description: | Human-readable name of the resource. in: body required: true type: string name-request: description: | Human-readable name of the resource. Default is an empty string. in: body required: false type: string name-request-put: description: | Human-readable name of the resource. in: body required: false type: string name-segment: description: | Human-readable name of the segment. in: body required: false type: string name_resource: description: | The name of the resource. in: body required: false type: string network: description: | A ``network`` object. in: body required: true type: object network-admin_state_up: description: | The administrative state of the network, which is up (``true``) or down (``false``). in: body required: true type: boolean network-admin_state_up-request: description: | The administrative state of the network, which is up (``true``) or down (``false``). in: body required: false type: boolean network-id: description: | The ID of the network. in: body required: true type: string network-name: description: | Human-readable name of the network. in: body required: true type: string network-name-request: description: | Human-readable name of the network. in: body required: False type: string network-port_security_enabled: description: | The port security status of the network. Valid values are enabled (``true``) and disabled (``false``). This value is used as the default value of ``port_security_enabled`` field of a newly created port. in: body required: true type: boolean network-port_security_enabled-request: description: | The port security status of the network. Valid values are enabled (``true``) and disabled (``false``). This value is used as the default value of ``port_security_enabled`` field of a newly created port. in: body required: false type: boolean network-shared: description: | Indicates whether this network is shared across all tenants. By default, only administrative users can change this value. in: body required: true type: boolean network-status: description: | The network status. Values are ``ACTIVE``, ``DOWN``, ``BUILD`` or ``ERROR``. in: body required: true type: string network-subnets: description: | The associated subnets. in: body required: true type: array network_id: description: | The ID of the attached network. in: body required: true type: string network_ip_availabilities: description: | The ``network_ip_availabilities`` object. in: body required: true type: array network_ip_availability: description: | A ``network_ip_availability`` object. in: body required: true type: object network_ip_availability-network_id: description: | The ID of the network whose IP availability detail is reported. in: body required: true type: string network_ip_availability-subnet_id: description: | The ID of the subnet whose IP availability detail is reported. in: body required: true type: string network_is_default: description: | The network is default pool or not. in: body required: true type: boolean network_is_default-request: description: | The network is default or not. in: body required: false type: boolean network_segment_range-available: description: | List of available segmentation IDs in the network segment range. in: body required: true type: list network_segment_range-default: description: | Defines whether the network segment range is the default that is loaded from the host ML2 config file. in: body required: true type: boolean network_segment_range-maximum-body-optional: description: | The maximum segmentation ID of the network segment range. in: body required: false type: integer network_segment_range-maximum-body-required: description: | The maximum segmentation ID of the network segment range. in: body required: true type: integer network_segment_range-minimum-body-optional: description: | The minimum segmentation ID of the network segment range. in: body required: false type: integer network_segment_range-minimum-body-required: description: | The minimum segmentation ID of the network segment range. in: body required: true type: integer network_segment_range-name: description: | Human-readable name of the network segment range. in: body required: false type: string network_segment_range-network_type: description: | The type of physical network that maps to this network segment range resource. For example, ``vlan``, ``vxlan``, or ``gre``. Valid values depend on a networking back-end. in: body required: true type: string network_segment_range-physical_network-body-optional: description: | The physical network where this network segment range is implemented. in: body required: false type: string network_segment_range-physical_network-body-required: description: | The physical network where this network segment range is implemented. in: body required: true type: string network_segment_range-shared: description: | Indicates whether this network segment range is shared across all projects. in: body required: true type: boolean network_segment_range-used: description: | Mapping of which segmentation ID in the network segment range is used by which project. in: body required: true type: dict network_segment_range_id: description: | The UUID of the network segment range. in: body required: true type: string network_type: description: | The type of physical network that maps to this network resource. For example, ``flat``, ``vlan``, ``vxlan``, or ``gre``. in: body required: true type: string networks: description: | A list of ``network`` objects. in: body required: true type: array object_id: description: | The ID of the ``object_type`` resource. An ``object_type`` of ``network`` returns a network ID and an ``object_type`` of ``qos-policy`` returns a QoS ID. in: body required: true type: string object_type: description: | The type of the object that the RBAC policy affects. Types include ``qos-policy`` or ``network``. in: body required: true type: string peer_address: description: | The peer gateway public IPv4 or IPv6 address or FQDN. in: body required: true type: string peer_cidrs: description: | (Deprecated) Unique list of valid peer private CIDRs in the form < net_address > / < prefix > . in: body required: false type: array peer_ep_group_id: description: | The ID for the endpoint group that contains private CIDRs in the form < net_address > / < prefix > for the peer side of the connection. You must specify this parameter with the ``local_ep_group_id`` parameter unless in backward-compatible mode where ``peer_cidrs`` is provided with a ``subnet_id`` for the VPN service. in: body required: false type: string peer_id: description: | The peer router identity for authentication. A valid value is an IPv4 address, IPv6 address, e-mail address, key ID, or FQDN. Typically, this value matches the ``peer_address`` value. in: body required: true type: string pfs: description: | Perfect forward secrecy (PFS). A valid value is ``Group2``, ``Group5``, ``Group14``, and so on. Default is ``Group5``. in: body required: false type: string phase1_negotiation_mode: description: | The IKE mode. A valid value is ``main``, which is the default. in: body required: false type: string physical_network: description: | The physical network where this network/segment is implemented. in: body required: false type: string policies: description: | A list of QoS ``policy`` objects. in: body required: true type: array policy: description: | A QoS ``policy`` object. in: body required: true type: object port: description: | A ``port`` object. in: body required: true type: object port-resource: description: | Expose Placement resources (i.e.: ``minimum-bandwidth``) and traits (i.e.: ``vnic-type``, ``physnet``) requested by a port to Nova and Placement. A ``resource_request`` object contains a ``required`` key for the traits (generated from the ``vnic_type`` and the ``physnet``) required by the port, and a ``resources`` key for ``ingress`` and ``egress minimum-bandwidth`` need for the port. in: body required: false type: object port-security_groups: description: | The IDs of security groups applied to the port. in: body required: true type: array port-security_groups-request: description: | The IDs of security groups applied to the port. in: body required: false type: array port-status: description: | The port status. Values are ``ACTIVE``, ``DOWN``, ``BUILD`` and ``ERROR``. in: body required: true type: string port_id: description: | The ID of the port. in: body required: true type: string port_id-request: description: | The ID of the port. in: body required: false type: string port_id_subport: description: | The ID of the subport. in: body required: true type: string port_range_max: description: | The maximum port number in the range that is matched by the security group rule. If the protocol is TCP, UDP, DCCP, SCTP or UDP-Lite this value must be greater than or equal to the ``port_range_min`` attribute value. If the protocol is ICMP, this value must be an ICMP code. in: body required: true type: integer port_range_max-request: description: | The maximum port number in the range that is matched by the security group rule. If the protocol is TCP, UDP, DCCP, SCTP or UDP-Lite this value must be greater than or equal to the ``port_range_min`` attribute value. If the protocol is ICMP, this value must be an ICMP code. in: body required: false type: integer port_range_min: description: | The minimum port number in the range that is matched by the security group rule. If the protocol is TCP, UDP, DCCP, SCTP or UDP-Lite this value must be less than or equal to the ``port_range_max`` attribute value. If the protocol is ICMP, this value must be an ICMP type. in: body required: true type: integer port_range_min-request: description: | The minimum port number in the range that is matched by the security group rule. If the protocol is TCP, UDP, DCCP, SCTP or UDP-Lite this value must be less than or equal to the ``port_range_max`` attribute value. If the protocol is ICMP, this value must be an ICMP type. in: body required: false type: integer port_security_enabled: description: | The port security status. A valid value is enabled (``true``) or disabled (``false``). If port security is enabled for the port, security group rules and anti-spoofing rules are applied to the traffic on the port. If disabled, no such rules are applied. in: body required: true type: boolean port_security_enabled-request: description: | The port security status. A valid value is enabled (``true``) or disabled (``false``). If port security is enabled for the port, security group rules and anti-spoofing rules are applied to the traffic on the port. If disabled, no such rules are applied. in: body required: false type: boolean ports: description: | A list of ``port`` objects. in: body required: true type: array position: description: | Read-only attribute that the API assigns to this rule when it associates it with a firewall policy. This value indicates the position of this rule in that firewall policy. This position number starts at 1. If the firewall rule is not associated with any policy, the position is ``null``. in: body required: true type: integer prefixes: description: | A list of subnet prefixes to assign to the subnet pool. The API merges adjacent prefixes and treats them as a single prefix. Each subnet prefix must be unique among all subnet prefixes in all subnet pools that are associated with the address scope. in: body required: true type: array prefixes-response: description: | A list of the subnet prefixes currently assigned to the subnet pool. Adjacent prefixes are merged and treated as a single prefix. in: body required: true type: array prefixes_remove: description: | A list of subnet prefixes to remove from the subnet pool. The API splits larger prefixes when a subset prefix is removed, and merges any resulting adjacent prefixes to treat them as a single prefix. in: body required: true type: array project_id: description: | The ID of the project. in: body required: true type: string project_id-autotopology: description: | The ID of the project owning the auto allocated topology. in: body required: true type: string project_id-body-optional: description: | The ID of the project that owns the resource. in: body required: false type: string project_id-body-required: description: | The ID of the project that owns the resource. in: body required: true type: string project_id-request: description: | The ID of the project that owns the resource. Only administrative and users with advsvc role can specify a project ID other than their own. You cannot change this value through authorization policies. in: body required: false type: string protocol: description: | The IP protocol can be represented by a string, an integer, or ``null``. Valid string or integer values are ``any`` or ``0``, ``ah`` or ``51``, ``dccp`` or ``33``, ``egp`` or ``8``, ``esp`` or ``50``, ``gre`` or ``47``, ``icmp`` or ``1``, ``icmpv6`` or ``58``, ``igmp`` or ``2``, ``ipip`` or ``4``, ``ipv6-encap`` or ``41``, ``ipv6-frag`` or ``44``, ``ipv6-icmp`` or ``58``, ``ipv6-nonxt`` or ``59``, ``ipv6-opts`` or ``60``, ``ipv6-route`` or ``43``, ``ospf`` or ``89``, ``pgm`` or ``113``, ``rsvp`` or ``46``, ``sctp`` or ``132``, ``tcp`` or ``6``, ``udp`` or ``17``, ``udplite`` or ``136``, ``vrrp`` or ``112``. Additionally, any integer value between [0-255] is also valid. The string ``any`` (or integer ``0``) means ``all`` IP protocols. See the constants in ``neutron_lib.constants`` for the most up-to-date list of supported strings. in: body required: true type: string protocol-request: description: | The IP protocol can be represented by a string, an integer, or ``null``. Valid string or integer values are ``any`` or ``0``, ``ah`` or ``51``, ``dccp`` or ``33``, ``egp`` or ``8``, ``esp`` or ``50``, ``gre`` or ``47``, ``icmp`` or ``1``, ``icmpv6`` or ``58``, ``igmp`` or ``2``, ``ipip`` or ``4``, ``ipv6-encap`` or ``41``, ``ipv6-frag`` or ``44``, ``ipv6-icmp`` or ``58``, ``ipv6-nonxt`` or ``59``, ``ipv6-opts`` or ``60``, ``ipv6-route`` or ``43``, ``ospf`` or ``89``, ``pgm`` or ``113``, ``rsvp`` or ``46``, ``sctp`` or ``132``, ``tcp`` or ``6``, ``udp`` or ``17``, ``udplite`` or ``136``, ``vrrp`` or ``112``. Additionally, any integer value between [0-255] is also valid. The string ``any`` (or integer ``0``) means ``all`` IP protocols. See the constants in ``neutron_lib.constants`` for the most up-to-date list of supported strings. in: body required: false type: string protocol-response: description: | The IP protocol. Valid value is ``icmp``, ``tcp``, ``udp``, or ``null``. No default. in: body required: true type: string protocol_port: description: | The TCP or UDP port on which to listen. in: body required: true type: integer protocol_port-request: description: | The TCP or UDP port on which to listen. in: body required: true type: integer provider:network_type: description: | The type of physical network that this network is mapped to. For example, ``flat``, ``vlan``, ``vxlan``, or ``gre``. Valid values depend on a networking back-end. in: body required: true type: string provider:network_type-request: description: | The type of physical network that this network should be mapped to. For example, ``flat``, ``vlan``, ``vxlan``, or ``gre``. Valid values depend on a networking back-end. in: body required: false type: string provider:physical_network: description: | The physical network where this network/segment is implemented. in: body required: true type: string provider:physical_network-request: description: | The physical network where this network should be implemented. The Networking API v2.0 does not provide a way to list available physical networks. For example, the Open vSwitch plug-in configuration file defines a symbolic name that maps to specific bridges on each compute host. in: body required: false type: string provider:segmentation_id: description: | The ID of the isolated segment on the physical network. The ``network_type`` attribute defines the segmentation model. For example, if the ``network_type`` value is vlan, this ID is a vlan identifier. If the ``network_type`` value is gre, this ID is a gre key. in: body required: true type: integer provider:segmentation_id-request: description: | The ID of the isolated segment on the physical network. The ``network_type`` attribute defines the segmentation model. For example, if the ``network_type`` value is vlan, this ID is a vlan identifier. If the ``network_type`` value is gre, this ID is a gre key. in: body required: false type: integer psk: description: | The pre-shared key. A valid value is any string. in: body required: true type: string qos-backend-drivers: description: | List of loaded QoS drivers with supported rule type parameters with possible values for each. Each driver is represented by a dict with the keys ``name`` and ``supported_parameters``. Field ``name`` contains the name of a backend driver. Field ``supported_parameters`` contains a list of dicts with ``parameter_name``, ``parameter_type`` and ``parameter_values`` fields. The valid values for ``parameter_type`` are ``choices`` or ``range``. If ``parameter_type`` is ``choices`` then ``parameter_values`` contains a list of acceptable values, otherwise it contains a dict with keys of ``start`` and ``end`` which define the range of acceptable values. in: body required: true type: list qos-rule-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``. in: body required: false type: string qos-rule-direction-response: 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``. in: body required: true type: string qos-rule-direction-update: 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``. in: body required: false type: string qos-rule-direction-update-response: 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``. in: body required: true type: string qos-rule-type: description: | The type of QoS rule. in: body required: true type: string qos-rule-types: description: | A list of QoS ``rule_type`` objects. in: body required: true type: array qos-rules: description: | A set of zero or more policy rules. in: body required: true type: array qos-shared: description: | Indicates whether this policy is shared across all projects. in: body required: true type: boolean qos-shared-request: description: | Set to ``true`` to share this policy with other projects. Default is ``false``. in: body required: false type: boolean qos_bandwidth_limit_rule-id: description: | The ID of the QoS Bandwidth limit rule. in: body required: true type: string qos_dscp_marking_rule-id: description: | The ID of the QoS DSCP marking rule. in: body required: true type: string qos_is_default: description: | If ``true``, the QoS ``policy`` is the default policy. in: body required: true type: boolean qos_is_default-request: description: | If ``true``, the QoS ``policy`` is the default policy. in: body required: false type: boolean qos_minimum_bandwidth_rule-id: description: | The ID of the QoS minimum bandwidth rule. in: body required: true type: string qos_network_policy_id-port-response: description: | The ID of the QoS policy of the network where this port is plugged. in: body required: true type: string qos_policy-name: description: | Human-readable name of the resource. in: body required: false type: string qos_policy_id: description: | The ID of the QoS policy. in: body required: true type: string qos_policy_id-network-request: description: | The ID of the QoS policy associated with the network. in: body required: false type: string qos_policy_id-network-response: description: | The ID of the QoS policy associated with the network. in: body required: true type: string qos_policy_id-port-request: description: | QoS policy associated with the port. in: body required: false type: string qos_policy_id-port-response: description: | The ID of the QoS policy associated with the port. in: body required: true type: string quota: description: | A ``quota`` object. in: body required: true type: object quota-detail: description: | A ``quota`` detail object. Each key in the object corresponds to a resource type (``network``, ``port``, etc.) having a quota. The value for each resource type is itself an object (the quota set) containing the quota's ``used``, ``limit`` and ``reserved`` integer values. in: body required: true type: object quota-floatingip: description: | The number of floating IP addresses allowed for each project. A value of ``-1`` means no limit. in: body required: true type: integer quota-floatingip-request: description: | The number of floating IP addresses allowed for each project. A value of ``-1`` means no limit. in: body required: false type: integer quota-network: description: | The number of networks allowed for each project. A value of ``-1`` means no limit. in: body required: true type: integer quota-network-request: description: | The number of networks allowed for each project. A value of ``-1`` means no limit. in: body required: false type: integer quota-port: description: | The number of ports allowed for each project. A value of ``-1`` means no limit. in: body required: true type: integer quota-port-request: description: | The number of ports allowed for each project. A value of ``-1`` means no limit. in: body required: false type: integer quota-rbac_policy: description: | The number of role-based access control (RBAC) policies for each project. A value of ``-1`` means no limit. in: body required: true type: integer quota-rbac_policy-request: description: | The number of role-based access control (RBAC) policies for each project. A value of ``-1`` means no limit. in: body required: false type: integer quota-router: description: | The number of routers allowed for each project. A value of ``-1`` means no limit. in: body required: true type: integer quota-router-request: description: | The number of routers allowed for each project. A value of ``-1`` means no limit. in: body required: false type: integer quota-security_group: description: | The number of security groups allowed for each project. A value of ``-1`` means no limit. in: body required: true type: integer quota-security_group-request: description: | The number of security groups allowed for each project. A value of ``-1`` means no limit. in: body required: false type: integer quota-security_group_rule: description: | The number of security group rules allowed for each project. A value of ``-1`` means no limit. in: body required: true type: integer quota-security_group_rule-request: description: | The number of security group rules allowed for each project. A value of ``-1`` means no limit. in: body required: false type: integer quota-subnet: description: | The number of subnets allowed for each project. A value of ``-1`` means no limit. in: body required: true type: integer quota-subnet-request: description: | The number of subnets allowed for each project. A value of ``-1`` means no limit. in: body required: false type: integer quota-subnetpool: description: | The number of subnet pools allowed for each project. A value of ``-1`` means no limit. in: body required: true type: integer quota-subnetpool-request: description: | The number of subnet pools allowed for each project. A value of ``-1`` means no limit. in: body required: false type: integer quotas: description: | A list of quota objects. in: body required: true type: array rbac_action: description: | Action for the RBAC policy which is ``access_as_external`` or ``access_as_shared``. in: body required: true type: string rbac_policy_id: description: | The ID of the RBAC policy. in: body required: true type: string remote_group_id: description: | The remote group UUID to associate with this security group rule. You can specify either the ``remote_group_id`` or ``remote_ip_prefix`` attribute in the request body. in: body required: true type: string remote_group_id-request: description: | The remote group UUID to associate with this security group rule. You can specify either the ``remote_group_id`` or ``remote_ip_prefix`` attribute in the request body. in: body required: false type: string remote_ip_prefix: description: | The remote IP prefix that is matched by this security group rule. in: body required: true type: string remote_ip_prefix-request: description: | The remote IP prefix that is matched by this security group rule. in: body required: false type: string resource: description: | The resource type of the availability zone. The supported resource types are ``network`` and ``router``. in: body required: true type: string resource-collection: description: | Collection name of the resource. in: body required: true type: string resource-href: description: | Link to the resource. in: body required: true type: string resource-links: description: | List of links related to the resource. Each link is a dict with 'href' and 'rel'. in: body required: true type: array resource-name: description: | Name of the resource. in: body required: true type: string resource-rel: description: | Relationship between link and the resource. in: body required: true type: string resource_log_id: description: | The ID of resource log (e.g security group ID). in: body required: true type: string resource_log_id-request: description: | The ID of resource log (e.g security group ID). in: body required: false type: string resource_log_type: description: | The resource log type such as 'security_group'. in: body required: true type: string resource_target_log_id: description: | The ID of resource target log such as port ID. in: body required: true type: string resource_target_log_id-request: description: | The ID of resource target log such as port ID. in: body required: false type: string resource_versions: description: | version resource in: body required: true type: string resources: description: | List of resource objects. in: body required: true type: array revision_number: description: | The revision number of the resource. in: body required: true type: integer route_mode: description: | The route mode. A valid value is ``static``, which is the default. in: body required: false type: string router: description: | A ``router`` object. in: body required: true type: object router-availability_zone_hints: description: | The availability zone candidates for the router. It is available when ``router_availability_zone`` extension is enabled. in: body required: true type: array router-availability_zone_hints-request: description: | The availability zone candidates for the router. It is available when ``router_availability_zone`` extension is enabled. in: body required: false type: array router-availability_zones: description: | The availability zone(s) for the router. It is available when ``router_availability_zone`` extension is enabled. in: body required: true type: array router-conntrack_helpers: description: | The associated conntrack helper resources for the roter. If the router has multiple conntrack helper resources, this field has multiple entries. Each entry consists of netfilter conntrack helper (``helper``), the network protocol (``protocol``), the network port (``port``). in: body required: true type: array router-destination: description: | The destination CIDR. in: body required: true type: string router-distributed: description: | ``true`` indicates a distributed router. It is available when ``dvr`` extension is enabled. in: body required: true type: boolean router-distributed-request: description: | ``true`` indicates a distributed router. It is available when ``dvr`` extension is enabled. in: body required: false type: boolean router-enable_snat: description: | Enable Source NAT (SNAT) attribute. ``true`` means Network Address Translation (NAT) is enabled for traffic generated by subnets attached to the router when the traffic is sent to/received from the external network. ``false`` means no NAT is applied for traffic from/to the external network. It is available when ``ext-gw-mode`` extension is enabled. in: body required: true type: boolean router-enable_snat-request: description: | Enable Source NAT (SNAT) attribute. Default is ``true``. To persist this attribute value, set the ``enable_snat_by_default`` option in the ``neutron.conf`` file. It is available when ``ext-gw-mode`` extension is enabled. in: body required: false type: boolean router-external_fixed_ips: description: | IP address(es) of the external gateway of the router. It is a list of IP addresses. Each element of the list is a dictionary of ``ip_address`` and ``subnet_id``. in: body required: true type: array router-external_fixed_ips-request: description: | IP address(es) of the external gateway interface of the router. It is a list of IP addresses you would like to assign to the external gateway interface. Each element of ths list is a dictionary of ``ip_address`` and ``subnet_id``. in: body required: false type: array router-external_gateway_info: description: | The external gateway information of the router. If the router has an external gateway, this would be a dict with ``network_id``, ``enable_snat`` and ``external_fixed_ips``. Otherwise, this would be ``null``. in: body required: true type: object router-external_gateway_info-request: description: | The external gateway information of the router. If the router has an external gateway, this would be a dict with ``network_id``, ``enable_snat`` and ``external_fixed_ips``. Otherwise, this would be ``null``. in: body required: false type: object router-external_gateway_ports: description: | The external gateway ports. in: body required: true type: string router-flavor_id: description: | The ID of the flavor associated with the router. in: body required: true type: string router-flavor_id-optional: description: | The ID of the flavor associated with the router. in: body required: false type: string router-floating_ips: description: | Number of floating IPs in: body required: true type: string router-gw-port-id: description: | router gateway port ID in: body required: true type: string router-ha: description: | ``true`` indicates a highly-available router. It is available when ``l3-ha`` extension is enabled. in: body required: true type: boolean router-ha-request: description: | ``true`` indicates a highly-available router. It is available when ``l3-ha`` extension is enabled. in: body required: false type: boolean router-ha-vr-id: description: | router VR ID. in: body required: true type: string router-ha_state: description: | router ha state. in: body required: true type: string router-handle_internal_only_routers: description: | Router configuration to handle internal only routers. in: body required: true type: boolean router-id-body: description: | The ID of the router. in: body required: true type: string router-interface_driver: description: | Type of interface driver, i.e. ``neutron.agent.linux.interface.OVSInterfaceDriver``. in: body required: true type: string router-network_id: description: | Network ID which the router gateway is connected to. in: body required: true type: string router-network_id-interface: description: | Network ID which the router interface is connected to. in: body required: true type: string router-nexthop: description: | The IP address of the next hop for the corresponding destination. The next hop IP address must be a part of one of the subnets to which the router interfaces are connected. in: body required: true type: string router-port_id: description: | The ID of the port which represents the router interface. in: body required: true type: string router-port_id-request: description: | The ID of the port. One of ``subnet_id`` or ``port_id`` must be specified. in: body required: false type: string router-project_id-interface: description: | The ID of the project who owns the router interface. in: body required: true type: string router-routes: description: | The extra routes configuration for L3 router. A list of dictionaries with ``destination`` and ``nexthop`` parameters. It is available when ``extraroute`` extension is enabled. in: body required: true type: array router-routes-request: description: | The extra routes configuration for L3 router. A list of dictionaries with ``destination`` and ``nexthop`` parameters. It is available when ``extraroute`` extension is enabled. Default is an empty list (``[]``). in: body required: false type: array router-service_type_id: description: | The ID of the service type associated with the router. in: body required: true type: string router-service_type_id-request: description: | The ID of the service type associated with the router. in: body required: false type: string router-status: description: | The router status. in: body required: true type: string router-subnet_id: description: | The ID of the subnet which the router interface belongs to. in: body required: true type: string router-subnet_id-request: description: | The ID of the subnet. One of ``subnet_id`` or ``port_id`` must be specified. in: body required: false type: string router-subnet_ids: description: | A list of the ID of the subnet which the router interface belongs to. The list contains only one member. in: body required: true type: array router:external: description: | Indicates whether the network has an external routing facility that's not managed by the networking service. If the network is updated from external to internal the unused floating IPs of this network are automatically deleted when extension ``floatingip-autodelete-internal`` is present. in: body required: true type: boolean router:external-request: description: | Indicates whether the network has an external routing facility that's not managed by the networking service. in: body required: false type: boolean router_ids: description: | A list of IDs for routers that are associated with the firewall. in: body required: false type: array router_ids-response: description: | A list of IDs for routers that are associated with the firewall. in: body required: true type: array routers: description: | A list of ``router`` objects. in: body required: true type: array security_group: description: | A ``security_group`` object. in: body required: true type: object security_group-id: description: | The ID of the security group. in: body required: true type: string security_group_id: description: | The security group UUID to associate with this security group rule. in: body required: true type: string security_group_rule: description: | A ``security_group_rule`` object. in: body required: true type: object security_group_rule-id: description: | The ID of the security group rule. in: body required: true type: string security_group_rule-security_group_id: description: | The security group ID to associate with this security group rule. in: body required: true type: string security_group_rules: description: | A list of ``security_group_rule`` objects. Refer to :ref:`Security group rules ` for details. in: body required: true type: array security_groups: description: | One or more security group UUIDs. in: body required: false type: array security_groups-obj: description: | A list of ``security_group`` objects. in: body required: true type: array segment_id: description: | The UUID of the segment. in: body required: true type: string segmentation_id: description: | The segmentation ID for the subport. in: body required: false type: integer segmentation_type: description: | The segmentation type for the subport. Possible values include ``vlan`` and ``inherit``. When ``inherit`` is specified, a port gets its segmentation type from the network its connected to. in: body required: true type: string segmentation_type-request: description: | The segmentation type for the subport. Possible values include ``vlan`` and ``inherit``. When ``inherit`` is specified, a port gets its segmentation type from the network its connected to. in: body required: false type: string segments: description: | A list of provider ``segment`` objects. in: body required: true type: array segments-request: description: | A list of provider ``segment`` objects. in: body required: false type: array service_profile: description: | A ``service_profile`` object. in: body required: true type: object service_profile-description: description: | The human-readable description for the service profile. in: body required: true type: string service_profile-description-request: description: | The human-readable description for the service profile. in: body required: false type: string service_profile-driver: description: | Provider driver to use for this profile. in: body required: true type: string service_profile-driver-request: description: | Provider driver to use for this profile. in: body required: false type: string service_profile-enabled: description: | Indicates whether this service profile is enabled or not. Default is ``true``. in: body required: true type: boolean service_profile-enabled-request: description: | Indicates whether this service profile is enabled or not. Default is ``true``. in: body required: false type: boolean service_profile-id: description: | The UUID of the service profile. in: body required: true type: string service_profile-metainfo: description: | JSON-formatted meta information of the service profile. in: body required: true type: string service_profile-metainfo-request: description: | JSON-formatted meta information of the service profile. in: body required: false type: string service_profiles: description: | Service profile UUIDs associated with this flavor. in: body required: true type: array service_providers: description: | A list of ``service_provider`` objects. in: body required: true type: array service_type: description: | The service type, which is ``CORE``, ``DUMMY``, ``FIREWALL``, ``FLAVORS``, ``L3_ROUTER_NAT``, ``METERING``, ``QOS``, or ``VPN``. in: body required: true type: string shared: description: | Indicates whether this resource is shared across all projects. By default, only administrative users can change this value. in: body required: false type: boolean shared-response: description: | Indicates whether this resource is shared across all projects. in: body required: true type: boolean source_firewall_group_id-body-optional: description: | The ID of the remote source firewall group. in: body required: no type: string source_firewall_group_id-body-required: description: | The ID of the remote source firewall group. in: body required: true type: string source_ip_address: description: | The source IPv4 or IPv6 address or CIDR. in: body required: false type: string source_port: description: | The source port or port range. A valid value is a port number, as an integer, or a port range, in the format of a ``:`` separated range. For a port range, include both ends of the range. For example, ``80:90``. in: body required: true type: string source_port-response: description: | The source port or port range. A valid value is a port number, as an integer, or a port range, in the format of a ``:`` separated range. For a port range, include both ends of the range. For example, ``80:90``. in: body required: false type: string started_at: description: | Time at which the agent was started. in: body required: true type: string state: description: | The state of the availability zone, which is either ``available`` or ``unavailable``. in: body required: true type: string stateful_enabled: description: | Indicates if the security group is stateful or stateless. in: body required: false type: boolean status_description: description: | Human-readable description of the status. in: body required: true type: string sub_ports: description: | A list of ports associated with the trunk. in: body required: true type: array subnet-allocation_pools: description: | Allocation pools with ``start`` and ``end`` IP addresses for this subnet. in: body required: true type: array subnet-allocation_pools-request: description: | Allocation pools with ``start`` and ``end`` IP addresses for this subnet. If allocation_pools are not specified, OpenStack Networking automatically allocates pools for covering all IP addresses in the CIDR, excluding the address reserved for the subnet gateway by default. in: body required: false type: array subnet-dns_nameservers: description: | List of dns name servers associated with the subnet. in: body required: true type: array subnet-dns_nameservers-request: description: | List of dns name servers associated with the subnet. Default is an empty list. in: body required: false type: array subnet-dns_publish_fixed_ip: description: | Whether to publish DNS records for IPs from this subnet. in: body required: true type: boolean subnet-dns_publish_fixed_ip-request: description: | Whether to publish DNS records for IPs from this subnet. Default is ``false``. in: body required: false type: boolean subnet-enable_dhcp: description: | Indicates whether dhcp is enabled or disabled for the subnet. in: body required: true type: boolean subnet-enable_dhcp-request: description: | Indicates whether dhcp is enabled or disabled for the subnet. Default is ``true``. in: body required: false type: boolean subnet-gateway_ip: description: | Gateway IP of this subnet. If the value is ``null`` that implies no gateway is associated with the subnet. in: body required: true type: string subnet-gateway_ip-request: description: | Gateway IP of this subnet. If the value is ``null`` that implies no gateway is associated with the subnet. If the gateway_ip is not specified, OpenStack Networking allocates an address from the CIDR for the gateway for the subnet by default. in: body required: false type: string subnet-host_routes: description: | Additional routes for the subnet. A list of dictionaries with ``destination`` and ``nexthop`` parameters. in: body required: true type: array subnet-host_routes-request: description: | Additional routes for the subnet. A list of dictionaries with ``destination`` and ``nexthop`` parameters. Default value is an empty list. in: body required: false type: array subnet-id-body: description: | The ID of the subnet. in: body required: true type: string subnet-ip_version: description: | The IP protocol version. Value is ``4`` or ``6``. in: body required: true type: integer subnet-ipv6_address_mode: description: | The IPv6 address modes specifies mechanisms for assigning IP addresses. Value is ``slaac``, ``dhcpv6-stateful``, ``dhcpv6-stateless`` or ``null``. in: body required: true type: string subnet-ipv6_address_mode-request: description: | The IPv6 address modes specifies mechanisms for assigning IP addresses. Value is ``slaac``, ``dhcpv6-stateful``, ``dhcpv6-stateless``. in: body required: false type: string subnet-ipv6_ra_mode: description: | The IPv6 router advertisement specifies whether the networking service should transmit ICMPv6 packets, for a subnet. Value is ``slaac``, ``dhcpv6-stateful``, ``dhcpv6-stateless`` or ``null``. in: body required: true type: string subnet-ipv6_ra_mode-request: description: | The IPv6 router advertisement specifies whether the networking service should transmit ICMPv6 packets, for a subnet. Value is ``slaac``, ``dhcpv6-stateful``, ``dhcpv6-stateless``. in: body required: false type: string subnet-name: description: | Human-readable name of the resource. in: body required: true type: string subnet-name-request: description: | Human-readable name of the resource. Default is an empty string. in: body required: false type: string subnet-name-update-request: description: | Human-readable name of the resource. in: body required: false type: string subnet-network_id: description: | The ID of the network to which the subnet belongs. in: body required: true type: string subnet-obj: description: | A ``subnet`` object. in: body required: true type: object subnet-prefixlen-request: description: | The prefix length to use for subnet allocation from a subnet pool. If not specified, the ``default_prefixlen`` value of the subnet pool will be used. in: body required: false type: integer subnet-segment_id: description: | The ID of a network segment the subnet is associated with. It is available when ``segment`` extension is enabled. in: body required: true type: string subnet-segment_id-request: description: | The ID of a network segment the subnet is associated with. It is available when ``segment`` extension is enabled. in: body required: false type: string subnet-service_types: description: | The service types associated with the subnet. in: body required: true type: array subnet-service_types-optional: description: | The service types associated with the subnet. in: body required: false type: array subnet-subnetpool_id: description: | The ID of the subnet pool associated with the subnet. in: body required: true type: string subnet-subnetpool_id-request: description: | The ID of the subnet pool associated with the subnet. in: body required: false type: string subnet_id: description: | If you specify only a subnet UUID, OpenStack Networking allocates an available IP from that subnet to the port. If you specify both a subnet UUID and an IP address, OpenStack Networking tries to allocate the address to the port. in: body required: false type: string subnet_ip_availability: description: | A list of dictionaries showing subnet IP availability. It contains information for every subnet associated to the network. in: body required: true type: array subnet_name: description: | The name of the subnet. in: body required: true type: string subnetpool: description: | A ``subnetpool`` object. in: body required: true type: object subnetpool_id_body: description: | The ID of the subnet pool. in: body required: true type: string subnetpool_is_default: description: | The subnetpool is default pool or not. in: body required: true type: boolean subnetpool_is_default-request: description: | The subnetpool is default pool or not. in: body required: false type: boolean subnetpools: description: | A list of ``subnetpool`` objects. in: body required: true type: array subnets-obj: description: | A list of ``subnet`` objects. in: body required: true type: array tags: description: | The list of tags on the resource. in: body required: true type: array target_tenant: description: | The ID of the tenant to which the RBAC policy will be enforced. in: body required: true type: string topic: description: | The name of AMQP topic the agent is listening on such as ``dhcp_agent``. A special value of ``N/A`` is used when the agent doesn't use an AMQP topic. in: body required: true type: string total_ips: description: | The total number of IP addresses in a network. in: body required: true type: integer transform_protocol: description: | The transform protocol. A valid value is ``ESP``, ``AH``, or ``AH- ESP``. Default is ``ESP``. in: body required: false type: string trunk-status: description: | The status for the trunk. Possible values are ``ACTIVE``, ``DOWN``, ``BUILD``, ``DEGRADED``, and ``ERROR``. in: body required: true type: string trunk_details: description: | The details about the trunk. in: body required: false type: dict trunk_port_id: description: | The ID of the parent port. in: body required: true type: string units: description: | The units for the lifetime of the security association. The lifetime consists of a unit and integer value. You can omit either the unit or value portion of the lifetime. Default unit is seconds and default value is 3600. in: body required: false type: string updated: description: | The date and time stamp when the extension was last updated. in: body required: true type: string updated_at_resource: description: | Time at which the resource has been updated (in UTC ISO8601 format). in: body required: true type: string uplink_status_propagation: description: | The uplink status propagation of the port. Valid values are enabled (``true``) and disabled (``false``). in: body required: true type: boolean uplink_status_propagation-request: description: | The uplink status propagation of the port. Valid values are enabled (``true``) and disabled (``false``). in: body required: false type: boolean use_default_subnetpool: description: | Whether to allocate this subnet from the default subnet pool. in: body required: false type: boolean used_ips: description: | The number of used IP addresses of all subnets in a network. in: body required: true type: integer value: description: | The lifetime value, as a positive integer. The lifetime consists of a unit and integer value. You can omit either the unit or value portion of the lifetime. Default unit is seconds and default value is 3600. in: body required: false type: integer version-href: description: | Link to the API. in: body required: true type: string version-id: description: | Version of the API. in: body required: true type: string version-links: description: | List of version links. Each link is a dict with 'href' and 'rel'. in: body required: true type: array version-rel: description: | Relationship of link with the version. in: body required: true type: string version-status: description: | Status of the API, which can be ``CURRENT``, ``STABLE`` or ``DEPRECATED``. in: body required: true type: string versions: description: | List of versions. in: body required: true type: array vlan_transparent: description: | Indicates the VLAN transparency mode of the network, which is VLAN transparent (``true``) or not VLAN transparent (``false``). in: body required: true type: boolean vlan_transparent-request: description: | Indicates the VLAN transparency mode of the network, which is VLAN transparent (``true``) or not VLAN transparent (``false``). in: body required: false type: boolean vpn_endpoint_type: description: | The type of the endpoints in the group. A valid value is ``subnet``, ``cidr``, ``network``, ``router``, or ``vlan``. Only ``subnet`` and ``cidr`` are supported at this moment. in: body required: true type: string vpnservice: description: | A ``vpnservice`` object. in: body required: true type: object vpnservice-status: description: | Indicates whether IPsec VPN service is currently operational. Values are ``ACTIVE``, ``DOWN``, ``BUILD``, ``ERROR``, ``PENDING_CREATE``, ``PENDING_UPDATE``, or ``PENDING_DELETE``. in: body required: true type: string vpnservice_id-body-request: description: | The ID of the VPN service. in: body required: false type: string vpnservice_id-body-response: description: | The ID of the VPN service. in: body required: true type: string vpnservices: description: | A list of VPN service objects. in: body required: true type: array neutron-lib-2.3.0/api-ref/source/v2/security-group-rules.inc0000664000175000017500000001334713641427107024007 0ustar zuulzuul00000000000000.. -*- rst -*- .. _security_group_rules: =========================================== Security group rules (security-group-rules) =========================================== Lists, creates, shows information for, and deletes security group rules. Resource timestamps =================== The ``standard-attr-timestamp`` extension adds the ``created_at`` and ``updated_at`` attributes to all resources that have standard attributes. List security group rules ========================= .. rest_method:: GET /v2.0/security-group-rules Lists a summary of all OpenStack Networking security group rules that the project can access. The list provides the ID for each security group rule. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - remote_group_id: remote_group_id-query - direction: direction-query - protocol: protocol-query - ethertype: ethertype-query - port_range_max: port_range_max-query - security_group_id: security_group_rule-security_group_id-query - tenant_id: project_id-query - project_id: project_id-query - port_range_min: port_range_min-query - remote_ip_prefix: remote_ip_prefix-query - revision_number: revision_number-query - id: id-query - description: description-query - sort_dir: sort_dir - sort_key: security_group_rule-sort_key - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - security_group_rules: security_group_rules - remote_group_id: remote_group_id - direction: direction - protocol: protocol - ethertype: ethertype - port_range_max: port_range_max - security_group_id: security_group_rule-security_group_id - tenant_id: project_id - project_id: project_id - port_range_min: port_range_min - remote_ip_prefix: remote_ip_prefix - created_at: created_at_resource - updated_at: updated_at_resource - revision_number: revision_number - id: security_group_rule-id - description: description Response Example ---------------- .. literalinclude:: samples/security-groups/security-group-rules-list-response.json :language: javascript Create security group rule ========================== .. rest_method:: POST /v2.0/security-group-rules Creates an OpenStack Networking security group rule. Normal response codes: 201 Error response codes: 400, 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - security_group_rule: security_group_rule - remote_group_id: remote_group_id-request - direction: direction - protocol: protocol-request - ethertype: ethertype-request - port_range_max: port_range_max-request - security_group_id: security_group_rule-security_group_id - port_range_min: port_range_min-request - remote_ip_prefix: remote_ip_prefix-request - description: description-request Request Example --------------- .. literalinclude:: samples/security-groups/security-group-rule-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - security_group_rule: security_group_rule - remote_group_id: remote_group_id - direction: direction - protocol: protocol - ethertype: ethertype - port_range_max: port_range_max - security_group_id: security_group_rule-security_group_id - tenant_id: project_id - project_id: project_id - port_range_min: port_range_min - remote_ip_prefix: remote_ip_prefix - created_at: created_at_resource - updated_at: updated_at_resource - revision_number: revision_number - id: security_group_rule-id - description: description Response Example ---------------- .. literalinclude:: samples/security-groups/security-group-rule-create-response.json :language: javascript Show security group rule ======================== .. rest_method:: GET /v2.0/security-group-rules/{security_group_rule_id} Shows detailed information for a security group rule. The response body contains the following information about the security group rule: Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - security_group_rule_id: security_group_rule-id-path - verbose: verbose - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - security_group_rule: security_group_rule - remote_group_id: remote_group_id - direction: direction - protocol: protocol - ethertype: ethertype - port_range_max: port_range_max - security_group_id: security_group_rule-security_group_id - tenant_id: project_id - project_id: project_id - port_range_min: port_range_min - remote_ip_prefix: remote_ip_prefix - created_at: created_at_resource - updated_at: updated_at_resource - revision_number: revision_number - id: security_group_rule-id - description: description Response Example ---------------- .. literalinclude:: samples/security-groups/security-group-rule-show-response.json :language: javascript Delete security group rule ========================== .. rest_method:: DELETE /v2.0/security-group-rules/{security_group_rule_id} Deletes a rule from an OpenStack Networking security group. Normal response codes: 204 Error response codes: 401, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - security_group_rule_id: security_group_rule-id-path Response -------- There is no body content is returned on a successful DELETE request. neutron-lib-2.3.0/api-ref/source/v2/service-providers.inc0000664000175000017500000000175713641427107023333 0ustar zuulzuul00000000000000.. -*- rst -*- ================= Service providers ================= Lists service providers. List service providers ====================== .. rest_method:: GET /v2.0/service-providers Lists service providers and their associated service types. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - service_providers: service_providers - service_type: service_type - name: name - default: default Response Example ---------------- .. literalinclude:: samples/service-type-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/security-groups.inc0000664000175000017500000001613413641427107023037 0ustar zuulzuul00000000000000.. -*- rst -*- ================================= Security groups (security-groups) ================================= Lists, creates, shows information for, updates, and deletes security groups. Resource timestamps =================== The ``standard-attr-timestamp`` extension adds the ``created_at`` and ``updated_at`` attributes to all resources that have standard attributes. Tag extension ============= The ``standard-attr-tag`` adds Tag support for resources with standard attributes by adding the ``tags`` attribute allowing consumers to associate tags with resources. Stateful security groups extension (``stateful-security-group``) ================================================================ The stateful security group extension (``stateful-security-group``) adds the ``stateful`` field to security groups, allowing users to configure stateful or stateless security groups for ``ports``. The existing security groups will all be considered as stateful. Update of the ``stateful`` attribute is allowed when there is no port associated with the security group. List security groups ==================== .. rest_method:: GET /v2.0/security-groups Lists OpenStack Networking security groups to which the project has access. The response is an array of ``security_group`` objects which contains a list of ``security_group_rules`` objects. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - id: id-query - tenant_id: project_id-query - project_id: project_id-query - revision_number: revision_number-query - name: name-query - description: description-query - sort_dir: sort_dir - sort_key: security_group-sort_key - tags: tags-query - tags-any: tags-any-query - not-tags: not-tags-query - not-tags-any: not-tags-any-query - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - security_groups: security_groups-obj - id: security_group-id - tenant_id: project_id - project_id: project_id - created_at: created_at_resource - updated_at: updated_at_resource - revision_number: revision_number - name: name - description: description - security_group_rules: security_group_rules - tags: tags - stateful: stateful_enabled Response Example ---------------- .. literalinclude:: samples/security-groups/security-groups-list-response.json :language: javascript Create security group ===================== .. rest_method:: POST /v2.0/security-groups Creates an OpenStack Networking security group. This operation creates a security group with default security group rules for the IPv4 and IPv6 ether types. Normal response codes: 201 Error response codes: 400, 401, 409 Request ------- .. rest_parameters:: parameters.yaml - security_group: security_group - tenant_id: project_id - project_id: project_id - description: description-request - name: name - stateful: stateful_enabled Request Example --------------- .. literalinclude:: samples/security-groups/security-group-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - security_group: security_group - id: security_group-id - tenant_id: project_id - project_id: project_id - created_at: created_at_resource - updated_at: updated_at_resource - revision_number: revision_number - name: name - description: description - security_group_rules: security_group_rules - tags: tags - stateful: stateful_enabled Response Example ---------------- .. literalinclude:: samples/security-groups/security-group-create-response.json :language: javascript Show security group =================== .. rest_method:: GET /v2.0/security-groups/{security_group_id} Shows details for a security group. The associated security group rules are contained in the response. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - security_group_id: security_group-id-path - verbose: verbose - fields: fields Request Example --------------- .. literalinclude:: samples/security-groups/security-group-show-request-json-http.txt :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - security_group: security_group - id: security_group-id - tenant_id: project_id - project_id: project_id - created_at: created_at_resource - updated_at: updated_at_resource - revision_number: revision_number - name: name - description: description - security_group_rules: security_group_rules - tags: tags - stateful: stateful_enabled Response Example ---------------- .. literalinclude:: samples/security-groups/security-group-show-response.json :language: javascript Update security group ===================== .. rest_method:: PUT /v2.0/security-groups/{security_group_id} Updates a security group. Normal response codes: 200 Error response codes: 400, 401, 403, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - security_group_id: security_group-id-path - security_group: security_group - description: description-request - name: name Request Example --------------- .. literalinclude:: samples/security-groups/security-group-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - security_group: security_group - id: security_group-id - tenant_id: project_id - project_id: project_id - created_at: created_at_resource - updated_at: updated_at_resource - revision_number: revision_number - name: name - description: description - security_group_rules: security_group_rules - tags: tags - stateful: stateful_enabled Response Example ---------------- .. literalinclude:: samples/security-groups/security-group-update-response.json :language: javascript Delete security group ===================== .. rest_method:: DELETE /v2.0/security-groups/{security_group_id} Deletes an OpenStack Networking security group. This operation deletes an OpenStack Networking security group and its associated security group rules, provided that a port is not associated with the security group. If a port is associated with the security group 409 (Conflict) is returned. This operation does not require a request body. This operation does not return a response body. Normal response codes: 204 Error response codes: 401, 404, 409, 412 Request ------- .. rest_parameters:: parameters.yaml - security_group_id: security_group-id-path Request Example --------------- .. literalinclude:: samples/security-groups/security-group-delete-request-json-http.txt :language: javascript Response -------- There is no body content for the response of a successful DELETE request. neutron-lib-2.3.0/api-ref/source/v2/trunk-details.inc0000664000175000017500000000214113641427107022432 0ustar zuulzuul00000000000000.. -*- rst -*- ========================================= Trunk details extended attributes (ports) ========================================= The trunk_details extension attribute is available when showing a port resource that participates in a trunk as parent. The extension is useful for REST clients that may want to access trunk details when getting the parent port, and it allows them to avoid extra lookups. Show trunk details ================== .. rest_method:: GET /v2.0/ports/{port_id} Shows details for a port. The details available in the `trunk_details` attribute contain the trunk ID and the array showing information about the subports that belong to the trunk: the port UUID, the segmentation type, the segmentation ID, and the MAC address. Normal response codes: 200 Request ------- .. rest_parameters:: parameters.yaml - port_id: port_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - trunk_details: trunk_details Response Example ---------------- .. literalinclude:: ../v2/samples/trunks/trunk-details-show-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/versions.inc0000664000175000017500000000240113641427107021513 0ustar zuulzuul00000000000000.. -*- rst -*- .. needs:example_verification ============ API versions ============ Lists information for all Networking API versions. List API versions ================= .. rest_method:: GET / Lists information about all Networking API versions. Normal response codes: 200 Request ------- .. .. rest_parameters:: parameters.yaml Response Parameters ------------------- .. rest_parameters:: parameters.yaml - versions: versions - status: version-status - id: version-id - links: version-links - href: version-href - rel: version-rel Response Example ---------------- .. literalinclude:: samples/networks/versions-list-response.json :language: javascript Show API v2 details =================== .. rest_method:: GET /v2.0/ Shows details for Networking API v2.0. Normal response codes: 200 Error response codes: 401 Request ------- .. .. rest_parameters:: parameters.yaml Response Parameters ------------------- .. rest_parameters:: parameters.yaml - resources: resources - name: resource-name - collection: resource-collection - links: resource-links - href: resource-href - rel: resource-rel Response Example ---------------- .. literalinclude:: samples/networks/version-show-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/quotas.inc0000664000175000017500000001071713641427107021170 0ustar zuulzuul00000000000000.. -*- rst -*- ========================= Quotas extension (quotas) ========================= Lists default quotas, current quotas for projects with non-default quota values, and shows, updates, and resets quotas for a project. A quota value of ``-1`` means that quota has no limit. List quotas for projects with non-default quota values ====================================================== .. rest_method:: GET /v2.0/quotas Lists quotas for projects with non-default quota values. Normal response codes: 200 Error response codes: 401, 403 Request ------- Response Parameters ------------------- .. rest_parameters:: parameters.yaml - quotas: quotas - floatingip: quota-floatingip - network: quota-network - port: quota-port - project_id: project_id - rbac_policy: quota-rbac_policy - router: quota-router - security_group: quota-security_group - security_group_rule: quota-security_group_rule - subnet: quota-subnet - subnetpool: quota-subnetpool - tenant_id: project_id Response Example ---------------- .. literalinclude:: samples/quotas/quotas-list-response.json :language: javascript List quotas for a project ========================= .. rest_method:: GET /v2.0/quotas/{project_id} Lists quotas for a project. Normal response codes: 200 Error response codes: 401, 403 Request ------- .. rest_parameters:: parameters.yaml - project_id: project_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - quota: quota - floatingip: quota-floatingip - network: quota-network - port: quota-port - rbac_policy: quota-rbac_policy - router: quota-router - security_group: quota-security_group - security_group_rule: quota-security_group_rule - subnet: quota-subnet - subnetpool: quota-subnetpool Response Example ---------------- .. literalinclude:: samples/quotas/quotas-list-for-project-response.json :language: javascript Update quota for a project ========================== .. rest_method:: PUT /v2.0/quotas/{project_id} Updates quotas for a project. Use when non-default quotas are desired. Normal response codes: 200 Error response codes: 401, 403 Request ------- .. rest_parameters:: parameters.yaml - project_id: project_id-path - quota: quota - floatingip: quota-floatingip-request - network: quota-network-request - port: quota-port-request - rbac_policy: quota-rbac_policy-request - router: quota-router-request - security_group: quota-security_group-request - security_group_rule: quota-security_group_rule-request - subnet: quota-subnet-request - subnetpool: quota-subnetpool-request Request Example --------------- .. literalinclude:: samples/quotas/quotas-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - quota: quota - floatingip: quota-floatingip - network: quota-network - port: quota-port - rbac_policy: quota-rbac_policy - router: quota-router - security_group: quota-security_group - security_group_rule: quota-security_group_rule - subnet: quota-subnet - subnetpool: quota-subnetpool Response Example ---------------- .. literalinclude:: samples/quotas/quotas-update-response.json :language: javascript Reset quota for a project ========================= .. rest_method:: DELETE /v2.0/quotas/{project_id} Resets quotas to default values for a project. Normal response codes: 204 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - project_id: project_id-path Response -------- There is no body content for the response of a successful DELETE request. List default quotas for a project ================================= .. rest_method:: GET /v2.0/quotas/{project_id}/default Lists default quotas for a project. Normal response codes: 200 Error response codes: 401, 403 Request ------- .. rest_parameters:: parameters.yaml - project_id: project_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - quota: quota - floatingip: quota-floatingip - network: quota-network - port: quota-port - rbac_policy: quota-rbac_policy - router: quota-router - security_group: quota-security_group - security_group_rule: quota-security_group_rule - subnet: quota-subnet - subnetpool: quota-subnetpool Response Example ---------------- .. literalinclude:: samples/quotas/quotas-list-for-project-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/trunk.inc0000664000175000017500000002412413641427107021014 0ustar zuulzuul00000000000000.. -*- rst -*- ================ Trunk networking ================ The trunk extension can be used to multiplex packets coming from and going to multiple neutron logical networks using a single neutron logical port. A trunk is modeled in neutron as a collection of neutron logical ports. One port, called parent port, must be associated to a trunk and it is *the* port to be used to connect instances with neutron. A sequence of subports (or sub_ports) each typically belonging to distinct neutron networks, is also associated to a trunk, and each subport may have a segmentation type and ID used to mux/demux the traffic coming in and out of the parent port. In more details, the extension introduces the following resources: - **trunk**. A top level logical entity to model the group of neutron logical networks whose traffic flows through the trunk. - **sub_port**. An association to a neutron logical port with attributes segmentation_id and segmentation_type. Resource timestamps =================== The ``standard-attr-timestamp`` extension adds the ``created_at`` and ``updated_at`` attributes to all resources that have standard attributes. Tag extension ============= The ``standard-attr-tag`` adds Tag support for resources with standard attributes by adding the ``tags`` attribute allowing consumers to associate tags with resources. List trunks =========== .. rest_method:: GET /v2.0/trunks Lists trunks that are accessible to the user who submits the request. Default policy settings return only those trunks that are owned by the user who submits the request, unless an admin user submits the request. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see the Filtering_ section for more details. Normal response codes: 200 Error response codes: 401, 404 Request Parameters ------------------ .. rest_parameters:: parameters.yaml - admin_state_up: admin_state_up_trunk-query - description: description-query - id: id-query - name: name-query - port_id: trunk_port_id-query - revision_number: revision_number-query - status: trunk-status-query - tenant_id: project_id-query - project_id: project_id-query - sort_dir: sort_dir - sort_key: trunk-sort_key - tags: tags-query - tags-any: tags-any-query - not-tags: not-tags-query - not-tags-any: not-tags-any-query Response Parameters ------------------- .. rest_parameters:: parameters.yaml - admin_state_up: admin_state_up_trunk - created_at: created_at_resource - description: description_resource - id: id_resource - name: name_resource - port_id: trunk_port_id - revision_number: revision_number - status: trunk-status - tenant_id: project_id-request - project_id: project_id-request - sub_ports: sub_ports - updated_at: updated_at_resource - tags: tags Response Example ---------------- .. literalinclude:: ../v2/samples/trunks/trunks-list-response.json :language: javascript Create trunk ============ .. rest_method:: POST /v2.0/trunks Error codes: - ``400`` The operation returns this error code if the request is malformed, e.g. there are missing or invalid parameters in the request. - ``401`` The operation is not authorized. - ``404`` If the extension is not available or the port UUID of any of the specified ports is not found. - ``409`` The operation returns this error code for one of these reasons: - A port to be used as subport is in use by another trunk. - The segmentation type and segmentation ID are already in use in the trunk. - A port to be used as parent port is in use by another trunk or cannot be trunked. - A system configuration prevents the operation from succeeding. Normal response codes: 201 Error response codes: 400, 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - tenant_id: project_id - project_id: project_id - port_id: trunk_port_id - name: name_resource - description: description_resource - admin_state_up: admin_state_up_trunk - sub_ports: sub_ports Request Example --------------- .. literalinclude:: ../v2/samples/trunks/trunk-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - admin_state_up: admin_state_up_trunk - created_at: created_at_resource - description: description_resource - id: id_resource - name: name_resource - port_id: trunk_port_id - revision_number: revision_number - status: trunk-status - tenant_id: project_id - project_id: project_id - sub_ports: sub_ports - updated_at: updated_at_resource - tags: tags Response Example ---------------- .. literalinclude:: ../v2/samples/trunks/trunks-create-response.json :language: javascript Add subports to trunk ===================== .. rest_method:: PUT /v2.0/trunks/{trunk_id}/add_subports Normal response codes: 200 Error response codes: 400, 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - trunk_id: trunk_id - segmentation_id: segmentation_id - segmentation_type: segmentation_type-request - port_id: port_id_subport Request Example --------------- .. literalinclude:: ../v2/samples/trunks/trunk-add-subports-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - admin_state_up: admin_state_up_trunk - created_at: created_at_resource - description: description_resource - id: id_resource - name: name_resource - port_id: trunk_port_id - revision_number: revision_number - status: trunk-status - tenant_id: project_id - project_id: project_id - sub_ports: sub_ports - updated_at: updated_at_resource - tags: tags Response Example ---------------- .. literalinclude:: ../v2/samples/trunks/trunk-add-subports-response.json :language: javascript Delete subports from trunk ========================== .. rest_method:: PUT /v2.0/trunks/{trunk_id}/remove_subports Normal response codes: 200 Error response codes: 400, 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - trunk_id: trunk_id - port_id: port_id Request Example --------------- .. literalinclude:: ../v2/samples/trunks/trunk-remove-subports-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - admin_state_up: admin_state_up_trunk - created_at: created_at_resource - description: description_resource - id: id_resource - name: name_resource - port_id: trunk_port_id - revision_number: revision_number - status: trunk-status - tenant_id: project_id - project_id: project_id - sub_ports: sub_ports - updated_at: updated_at_resource - tags: tags Response Example ---------------- .. literalinclude:: ../v2/samples/trunks/trunk-remove-subports-response.json :language: javascript List subports for trunk ======================= .. rest_method:: GET /v2.0/trunks/{trunk_id}/get_subports Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - trunk_id: trunk_id Response Parameters ------------------- .. rest_parameters:: parameters.yaml - port_id: port_id_subport - segmentation_type: segmentation_type - segmentation_id: segmentation_id - tags: tags Response Example ---------------- .. literalinclude:: ../v2/samples/trunks/trunk-list-subports-response.json :language: javascript Update trunk ============ .. rest_method:: PUT /v2.0/trunks/{trunk_id} The update request is only for changing fields like name, description or admin_state_up. Setting the admin_state_up to False locks the trunk in that it prevents operations such as as adding/removing subports. Normal response codes: 200 Error response codes: 400, 401, 404, 409, 412 Request ------- .. rest_parameters:: parameters.yaml - name_resource: name_resource - admin_state_up_trunk: admin_state_up - description_resource: description_resource - trunk_id: trunk_id Request Example --------------- .. literalinclude:: ../v2/samples/trunks/trunk-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - admin_state_up: admin_state_up_trunk - created_at: created_at_resource - description: description_resource - id: id_resource - name: name_resource - port_id: trunk_port_id - revision_number: revision_number - status: trunk-status - tenant_id: project_id - project_id: project_id - sub_ports: sub_ports - updated_at: updated_at_resource - tags: tags Response Example ---------------- .. literalinclude:: ../v2/samples/trunks/trunk-update-response.json :language: javascript Show trunk ========== .. rest_method:: GET /v2.0/trunks/{trunk_id} Shows details for a trunk. Use the ``fields`` query parameter to control which fields are returned in the response body. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - trunk_id: trunk_id Response Parameters ------------------- .. rest_parameters:: parameters.yaml - admin_state_up: admin_state_up_trunk - created_at: created_at_resource - description: description_resource - id: id_resource - name: name_resource - port_id: trunk_port_id - revision_number: revision_number - status: trunk-status - tenant_id: project_id - project_id: project_id - sub_ports: sub_ports - updated_at: updated_at_resource - tags: tags Response Example ---------------- .. literalinclude:: ../v2/samples/trunks/trunk-show-response.json :language: javascript Delete trunk ============ .. rest_method:: DELETE /v2.0/trunks/{trunk_id} Deletes a trunk, if its state allows it. Normal response codes: 204 Error response codes: 401, 404, 409, 412 Request ------- .. rest_parameters:: parameters.yaml - trunk_id: trunk_id neutron-lib-2.3.0/api-ref/source/v2/network-ip-availability.inc0000664000175000017500000000526513641427107024425 0ustar zuulzuul00000000000000.. -*- rst -*- ======================================= Network IP availability and usage stats ======================================= The extension ``network-ip-availability`` allows users to list and show the network IP usage stats of all networks or of a specified network. By default policy configuration, only administrative users can use this API. Show Network IP Availability ============================ .. rest_method:: GET /v2.0/network-ip-availabilities/{network_id} Shows network IP availability details for a network. By default policy configuration, only administrative users can retrieve IP availability. Otherwise, ``Not Found (404)`` will be returned. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - network_id: network_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - network_ip_availability: network_ip_availability - network_id: network_ip_availability-network_id - network_name: network-name - tenant_id: project_id - project_id: project_id - total_ips: total_ips - used_ips: used_ips - subnet_ip_availability: subnet_ip_availability - subnet_id: network_ip_availability-subnet_id - subnet_name: subnet_name - ip_version: subnet-ip_version - cidr: cidr Response Example ---------------- .. literalinclude:: samples/network-ip-availability/network-ip-availability-show.json :language: javascript List Network IP Availability ============================ .. rest_method:: GET /v2.0/network-ip-availabilities Lists network IP availability of all networks. By default policy configuration, only administrative users can retrieve IP availabilities. Otherwise, an empty list will be returned. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - network_id: network_ip_availability-network_id-query - network_name: network-name-query - tenant_id: project_id-query - project_id: project_id-query - ip_version: ip_version-query Response Parameters ------------------- .. rest_parameters:: parameters.yaml - network_ip_availabilities: network_ip_availabilities - network_id: network_ip_availability-network_id - network_name: network-name - tenant_id: project_id - project_id: project_id - total_ips: total_ips - used_ips: used_ips - subnet_ip_availability: subnet_ip_availability - subnet_id: network_ip_availability-subnet_id - subnet_name: subnet_name - ip_version: subnet-ip_version - cidr: cidr Response Example ---------------- .. literalinclude:: samples/network-ip-availability/network-ip-availability-list.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/floatingippools.inc0000664000175000017500000000140513641427107023057 0ustar zuulzuul00000000000000==================================== Floating IP pools (floatingip_pools) ==================================== Lists floating IP pools. List floating IP Pools ====================== .. rest_method:: GET /v2.0/floatingip_pools Lists floating IP pools visible to the user. Normal response codes: 200 Error response codes: 401 Request ------- Response Parameters ------------------- .. rest_parameters:: parameters.yaml - floatingip_pools: floatingip_pools - subnet_id: subnet-id-body - network_id: subnet-network_id - subnet_name: subnet-name - tenant_id: project_id - project_id: project_id - cidr: cidr Response Example ---------------- .. literalinclude:: samples/floatingips/floating-ip-pools-list-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/l3-agent-scheduler.inc0000664000175000017500000000650213641427107023237 0ustar zuulzuul00000000000000.. -*- rst -*- ================== L3 agent scheduler ================== The L3 agent scheduler extension (``l3_agent_scheduler``) allows administrators to assign Neutron routers to Neutron L3 agents, and retrieve mappings between Neutron routers and L3 agents. List routers hosted by an L3 agent ================================== .. rest_method:: GET /v2.0/agents/{agent_id}/l3-routers Lists routers that an l3 agent hosts. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - agent_id: agent_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - routers: routers - id: router-id-body - tenant_id: project_id - project_id: project_id - name: name - description: description - admin_state_up: admin_state_up - status: router-status - external_gateway_info: router-external_gateway_info - revision_number: revision_number - routes: router-routes - destination: router-destination - nexthop: router-nexthop - distributed: router-distributed - ha: router-ha - availability_zone_hints: router-availability_zone_hints - availability_zones: router-availability_zones - service_type_id: router-service_type_id - flavor_id: router-flavor_id Response Example ---------------- .. literalinclude:: ../v2/samples/agents/agent-l3-routers-list-response.json :language: javascript Schedule router to an l3 agent ============================== .. rest_method:: POST /v2.0/agents/{agent_id}/l3-routers Add a router to an l3 agent. Normal response codes: 201 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - agent_id: agent_id-path - router_id: router-id-body Request Example --------------- .. literalinclude:: ../v2/samples/agents/agent-l3-router-add-request.json :language: javascript Response Parameters ------------------- null Response Example ---------------- There is no body content for the response of a successful POST request. Remove l3 router from an l3 agent ================================= .. rest_method:: DELETE /v2.0/agents/{agent_id}/l3-routers/{router_id} Removes a router from an l3 agent. Normal response codes: 204 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - agent_id: agent_id-path - router_id: router_id Response Example ---------------- There is no body content for the response of a successful DELETE request. List L3 agents hosting a router =============================== .. rest_method:: GET /v2.0/routers/{router_id}/l3-agents Lists l3 agents hosting a specific router. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - router_id: router_id Response Parameters ------------------- .. rest_parameters:: parameters.yaml - admin_state_up: admin_state_up - agents: agents - agent_type: agent_type - alive: alive - binary: binary - configurations: configurations - created_at: created_at_resource - description: description - heartbeat_timestamp: heartbeat_timestamp - host: host - id: id - started_at: started_at - topic: topic Response Example ---------------- .. literalinclude:: ../v2/samples/agents/router-l3-agent-list-response.json :language: javascriptneutron-lib-2.3.0/api-ref/source/v2/subnets.inc0000664000175000017500000003756313641427107021347 0ustar zuulzuul00000000000000.. -*- rst -*- ======= Subnets ======= Lists, shows details for, creates, updates, and deletes subnet resources. Default subnetpool extension ============================ The default subnetpool extension (``default-subnetpools``) allows administrative users to specify default subnetpools (one per IP version). Then users can specify the ``use_default_subnetpool`` attribute when creating a subnet, instead of having to specify the ``subnetpool_id`` attribute referencing the default subnetpool. Resource timestamps =================== The ``standard-attr-timestamp`` extension adds the ``created_at`` and ``updated_at`` attributes to all resources that have standard attributes. Subnet allocation extension =========================== Subnet allocation extension (``subnet_allocation``) enables allocation of subnets from a subnet pool. Subnet DNS publish fixed IP extension ===================================== The ``subnet-dns-publish-fixed-ip`` extension adds the ``dns_publish_fixed_ip`` attribute to subnets. It allows to select per subnet whether DNS records for fixed IPs are to be published in an external DNS service. Segment extension ================= The `Segments`_ (``segment``) extension makes it possible to associate a subnet with a specific L2 segment on the network, instead of spanning all the segments in the network. The association between network and subnet remains, but an optional ``segment_id`` field is added to the subnet so that it can be associated with a particular segment on the network. With multiple subnets on a network the ``segment_id`` is used to determine if the subnets are l2-adjacent or not. Subnets within a network are either all associated to segments, or none of them are associated to segments. Subnet segment_id writable extension ==================================== The subnet segment_id writable (``subnet-segmentid-writable``) extension enhances the `Segments`_ (``segment``) extension in that now the ``segment_id`` attribute is also available for write when a subnet is updated. Segment peer subnet host routes extension ========================================= The segment peer subnet host routes extension ( ``segments-peer-subnet-host-routes``) extension enhances the `Segments`_ (``segment``) extension in that now the ``host_routes`` property of the different `Subnets`_ (``subnets``) in a routed network gets routes to the peer subnets on different segments added automatically. This ensures that traffic within an L3 routed network stays within the network even when the default route is on a different host interface. Subnet service types extension ============================== Subnet service types extension (``subnet-service-types``) allows administrative users to set the desired port types for a subnet by adding the ``service_types`` attributes to ``subnets``. (For example, the ``network:floatingip_agent_gateway`` service type enables DVR floating IP agent gateway ports to use the subnet to minimize public IP address consumption). Tag extension ============= The ``standard-attr-tag`` adds Tag support for resources with standard attributes by adding the ``tags`` attribute allowing consumers to associate tags with resources. List subnets ============ .. rest_method:: GET /v2.0/subnets Lists subnets that the project has access to. Default policy settings return only subnets owned by the project of the user submitting the request, unless the user has administrative role. You can control which attributes are returned by using the fields query parameter. You can filter results by using query string parameters. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - id: id-query - tenant_id: project_id-query - project_id: project_id-query - name: name-query - enable_dhcp: subnet-enable_dhcp-query - network_id: subnet-network_id-query - ip_version: subnet-ip_version-query - gateway_ip: subnet-gateway_ip-query - cidr: cidr-query - description: description-query - ipv6_address_mode: subnet-ipv6_address_mode-query - ipv6_ra_mode: subnet-ipv6_ra_mode-query - revision_number: revision_number-query - segment_id: subnet-segment_id-query - shared: shared-query - sort_dir: sort_dir - sort_key: subnet-sort_key - subnetpool_id: subnet-subnetpool_id-query - tags: tags-query - tags-any: tags-any-query - not-tags: not-tags-query - not-tags-any: not-tags-any-query - dns_publish_fixed_ip: subnet-dns_publish_fixed_ip-query - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - subnets: subnets-obj - id: subnet-id-body - tenant_id: project_id - project_id: project_id - name: subnet-name - enable_dhcp: subnet-enable_dhcp - network_id: subnet-network_id - dns_nameservers: subnet-dns_nameservers - allocation_pools: subnet-allocation_pools - host_routes: subnet-host_routes - ip_version: subnet-ip_version - gateway_ip: subnet-gateway_ip - cidr: cidr - created_at: created_at_resource - description: description - ipv6_address_mode: subnet-ipv6_address_mode - ipv6_ra_mode: subnet-ipv6_ra_mode - revision_number: revision_number - segment_id: subnet-segment_id - service_types: subnet-service_types - subnetpool_id: subnet-subnetpool_id - updated_at: updated_at_resource - tags: tags - dns_publish_fixed_ip: subnet-dns_publish_fixed_ip Response Example ---------------- .. literalinclude:: samples/subnets/subnets-list-response.json :language: javascript Create subnet ============= .. rest_method:: POST /v2.0/subnets Creates a subnet on a network. OpenStack Networking does not try to derive the correct IP version from the CIDR. If you do not specify the ``gateway_ip`` attribute, OpenStack Networking allocates an address from the CIDR for the gateway for the subnet. To specify a subnet without a gateway, set the ``gateway_ip`` attribute to ``null`` in the request body. If you do not specify the ``allocation_pools`` attribute, OpenStack Networking automatically allocates pools for covering all IP addresses in the CIDR, excluding the address reserved for the subnet gateway. Otherwise, you can explicitly specify allocation pools as shown in the following example. When you specify both the ``allocation_pools`` and ``gateway_ip`` attributes, you must ensure that the gateway IP does not overlap with the allocation pools; otherwise, the call returns the ``Conflict (409)`` response code. A subnet can have one or more name servers and host routes. Hosts in this subnet use the name servers. Devices with IP addresses from this subnet, not including the local subnet route, use the host routes. Specify the ``ipv6_ra_mode`` and ``ipv6_address_mode`` attributes to create subnets that support IPv6 configurations, such as stateless address autoconfiguration (SLAAC), DHCPv6 stateful, and DHCPv6 stateless configurations. A subnet can optionally be associated with a network segment when it is created by specifying the ``segment_id`` of a valid segment on the specified network. A network with subnets associated in this way is called a routed network. On any given network, all of the subnets must be associated with segments or none of them can be. Neutron enforces this invariant. Currently, routed networks are only supported for provider networks. Normal response codes: 201 Error response codes: 400, 401, 403, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - subnet: subnet-obj - tenant_id: project_id-request - project_id: project_id-request - name: subnet-name-request - enable_dhcp: subnet-enable_dhcp-request - network_id: subnet-network_id - dns_nameservers: subnet-dns_nameservers-request - allocation_pools: subnet-allocation_pools-request - host_routes: subnet-host_routes-request - ip_version: subnet-ip_version - gateway_ip: subnet-gateway_ip-request - cidr: cidr - prefixlen: subnet-prefixlen-request - description: description-request - ipv6_address_mode: subnet-ipv6_address_mode-request - ipv6_ra_mode: subnet-ipv6_ra_mode-request - segment_id: subnet-segment_id-request - subnetpool_id: subnet-subnetpool_id-request - use_default_subnetpool: use_default_subnetpool - service_types: subnet-service_types-optional - dns_publish_fixed_ip: subnet-dns_publish_fixed_ip-request Request Example --------------- .. literalinclude:: samples/subnets/subnet-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - subnet: subnet-obj - id: subnet-id-body - tenant_id: project_id - project_id: project_id - name: subnet-name - enable_dhcp: subnet-enable_dhcp - network_id: subnet-network_id - dns_nameservers: subnet-dns_nameservers - allocation_pools: subnet-allocation_pools - host_routes: subnet-host_routes - ip_version: subnet-ip_version - gateway_ip: subnet-gateway_ip - cidr: cidr - created_at: created_at_resource - description: description - ipv6_address_mode: subnet-ipv6_address_mode - ipv6_ra_mode: subnet-ipv6_ra_mode - revision_number: revision_number - service_types: subnet-service_types - subnetpool_id: subnet-subnetpool_id - segment_id: subnet-segment_id - updated_at: updated_at_resource - tags: tags - dns_publish_fixed_ip: subnet-dns_publish_fixed_ip Response Example ---------------- .. literalinclude:: samples/subnets/subnet-create-response.json :language: javascript Bulk create subnet ================== .. rest_method:: POST /v2.0/subnets Creates multiple subnets in a single request. Specify a list of subnets in the request body. The bulk create operation is always atomic. Either all or no subnets in the request body are created. Normal response codes: 201 Error response codes: 400, 401, 403, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - subnets: subnets-obj - tenant_id: project_id-request - project_id: project_id-request - name: subnet-name-request - enable_dhcp: subnet-enable_dhcp-request - network_id: subnet-network_id - dns_nameservers: subnet-dns_nameservers-request - allocation_pools: subnet-allocation_pools-request - host_routes: subnet-host_routes-request - ip_version: subnet-ip_version - gateway_ip: subnet-gateway_ip-request - cidr: cidr - prefixlen: subnet-prefixlen-request - description: description-request - ipv6_address_mode: subnet-ipv6_address_mode-request - ipv6_ra_mode: subnet-ipv6_ra_mode-request - segment_id: subnet-segment_id-request - subnetpool_id: subnet-subnetpool_id-request - use_default_subnetpool: use_default_subnetpool - service_types: subnet-service_types-optional - dns_publish_fixed_ip: subnet-dns_publish_fixed_ip-request Request Example --------------- .. literalinclude:: samples/subnets/subnets-create-bulk-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - subnets: subnets-obj - id: subnet-id-body - tenant_id: project_id - project_id: project_id - name: subnet-name - enable_dhcp: subnet-enable_dhcp - network_id: subnet-network_id - dns_nameservers: subnet-dns_nameservers - allocation_pools: subnet-allocation_pools - host_routes: subnet-host_routes - ip_version: subnet-ip_version - gateway_ip: subnet-gateway_ip - cidr: cidr - created_at: created_at_resource - description: description - ipv6_address_mode: subnet-ipv6_address_mode - ipv6_ra_mode: subnet-ipv6_ra_mode - revision_number: revision_number - segment_id: subnet-segment_id - service_types: subnet-service_types - subnetpool_id: subnet-subnetpool_id - updated_at: updated_at_resource - tags: tags - dns_publish_fixed_ip: subnet-dns_publish_fixed_ip Response Example ---------------- .. literalinclude:: samples/subnets/subnets-create-bulk-response.json :language: javascript Show subnet details =================== .. rest_method:: GET /v2.0/subnets/{subnet_id} Shows details for a subnet. Use the fields query parameter to filter the results. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - subnet_id: subnet_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - subnet: subnet-obj - id: subnet-id-body - tenant_id: project_id - project_id: project_id - created_at: created_at_resource - name: subnet-name - enable_dhcp: subnet-enable_dhcp - network_id: subnet-network_id - dns_nameservers: subnet-dns_nameservers - allocation_pools: subnet-allocation_pools - host_routes: subnet-host_routes - ip_version: subnet-ip_version - gateway_ip: subnet-gateway_ip - cidr: cidr - updated_at: updated_at_resource - description: description - ipv6_address_mode: subnet-ipv6_address_mode - ipv6_ra_mode: subnet-ipv6_ra_mode - revision_number: revision_number - segment_id: subnet-segment_id - service_types: subnet-service_types - subnetpool_id: subnet-subnetpool_id - tags: tags - dns_publish_fixed_ip: subnet-dns_publish_fixed_ip Response Example ---------------- .. literalinclude:: samples/subnets/subnet-show-response.json :language: javascript Update subnet ============= .. rest_method:: PUT /v2.0/subnets/{subnet_id} Updates a subnet. Some attributes, such as IP version (ip_version), CIDR (cidr), and segment (segment_id) cannot be updated. Attempting to update these attributes results in a ``400 Bad Request`` error. Normal response codes: 200 Error response codes: 400, 401, 403, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - subnet_id: subnet_id-path - name: subnet-name-update-request - enable_dhcp: subnet-enable_dhcp-request - dns_nameservers: subnet-dns_nameservers-request - allocation_pools: subnet-allocation_pools-request - host_routes: subnet-host_routes-request - gateway_ip: subnet-gateway_ip-request - description: description-request - service_types: subnet-service_types-optional - segment_id: subnet-segment_id-request - dns_publish_fixed_ip: subnet-dns_publish_fixed_ip-request Request Example --------------- .. literalinclude:: samples/subnets/subnet-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - subnet: subnet-obj - id: subnet-id-body - tenant_id: project_id - project_id: project_id - name: subnet-name - enable_dhcp: subnet-enable_dhcp - network_id: subnet-network_id - dns_nameservers: subnet-dns_nameservers - allocation_pools: subnet-allocation_pools - host_routes: subnet-host_routes - ip_version: subnet-ip_version - gateway_ip: subnet-gateway_ip - cidr: cidr - created_at: created_at_resource - description: description - ipv6_address_mode: subnet-ipv6_address_mode - ipv6_ra_mode: subnet-ipv6_ra_mode - revision_number: revision_number - segment_id: subnet-segment_id - service_types: subnet-service_types - subnetpool_id: subnet-subnetpool_id - updated_at: updated_at_resource - tags: tags - dns_publish_fixed_ip: subnet-dns_publish_fixed_ip Response Example ---------------- .. literalinclude:: samples/subnets/subnet-update-response.json :language: javascript Delete subnet ============= .. rest_method:: DELETE /v2.0/subnets/{subnet_id} Deletes a subnet. The operation fails if subnet IP addresses are still allocated. Normal response codes: 204 Error response codes: 401, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - subnet_id: subnet_id-path Response -------- There is no body content for the response of a successful DELETE request. neutron-lib-2.3.0/api-ref/source/v2/metering.inc0000664000175000017500000002043713641427107021466 0ustar zuulzuul00000000000000.. -*- rst -*- ================================================================= Metering labels and rules (metering-labels, metering-label-rules) ================================================================= Creates, modifies, and deletes OpenStack Layer3 metering labels and rules. List metering labels ==================== .. rest_method:: GET /v2.0/metering/metering-labels Lists all L3 metering labels that belong to the project. The list shows the ID for each metering label. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - description: description-query - tenant_id: project_id-query - project_id: project_id-query - shared: shared-query - id: id-query - name: name-query - sort_dir: sort_dir - sort_key: metering_label-sort_key - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - metering_labels: metering_labels - description: description - tenant_id: project_id - project_id: project_id - shared: metering_label-shared - id: metering_label-id - name: name Response Example ---------------- .. literalinclude:: samples/metering/metering-labels-list-response.json :language: javascript Create metering label ===================== .. rest_method:: POST /v2.0/metering/metering-labels Creates an L3 metering label. Normal response codes: 201 Error response codes: 400, 401, 403 Request ------- .. rest_parameters:: parameters.yaml - metering_label: metering_label - shared: metering_label-shared-request - description: description-request - name: name-request - tenant_id: project_id-request - project_id: project_id-request Request Example --------------- .. literalinclude:: samples/metering/metering-label-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - metering_label: metering_label - description: description - tenant_id: project_id - project_id: project_id - shared: metering_label-shared - id: metering_label-id - name: name Response Example ---------------- .. literalinclude:: samples/metering/metering-label-create-response.json :language: javascript Show metering label details =========================== .. rest_method:: GET /v2.0/metering/metering-labels/{metering_label_id} Shows details for a metering label. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - metering_label_id: metering_label-id-path Request Example --------------- .. literalinclude:: samples/metering/metering-label-show-request-json-http.txt :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - metering_label: metering_label - description: description - tenant_id: project_id - project_id: project_id - shared: metering_label-shared - id: metering_label-id - name: name Response Example ---------------- .. literalinclude:: samples/metering/metering-label-show-response.json :language: javascript Delete metering label ===================== .. rest_method:: DELETE /v2.0/metering/metering-labels/{metering_label_id} Deletes an L3 metering label. Normal response codes: 204 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - metering_label_id: metering_label-id-path Request Example --------------- .. literalinclude:: samples/metering/metering-label-delete-request-json-http.txt :language: javascript Response -------- There is no body content for the response of a successful DELETE request. List metering label rules ========================= .. rest_method:: GET /v2.0/metering/metering-label-rules Lists a summary of all L3 metering label rules that belong to the project. The list shows the ID for each metering label rule. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - direction: metering_label_rule-direction-query - remote_ip_prefix: metering_label_rule-remote_ip_prefix-query - excluded : excluded-query - metering_label_id: metering_label-id-query - id: id-query - sort_dir: sort_dir - sort_key: metering_label_rule-sort_key - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - metering_label_rules: metering_label_rules - direction: metering_label_rule-direction - remote_ip_prefix: metering_label_rule-remote_ip_prefix - excluded : excluded - metering_label_id: metering_label-id-body - id: metering_label_rule-id Response Example ---------------- .. literalinclude:: samples/metering/metering-label-rules-list-response.json :language: javascript Create metering label rule ========================== .. rest_method:: POST /v2.0/metering/metering-label-rules Creates an L3 metering label rule. Normal response codes: 201 Error response codes: 400, 401, 403, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - metering_label_rule: metering_label_rule - remote_ip_prefix: metering_label_rule-remote_ip_prefix - direction: metering_label_rule-direction - metering_label_id: metering_label-id-body - excluded: excluded-request Request Example --------------- .. literalinclude:: samples/metering/metering-label-rule-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - metering_label_rule: metering_label_rule - direction: metering_label_rule-direction - remote_ip_prefix: metering_label_rule-remote_ip_prefix - excluded : excluded - metering_label_id: metering_label-id-body - id: metering_label_rule-id Response Example ---------------- .. literalinclude:: samples/metering/metering-label-rule-create-response.json :language: javascript Show metering label rule details ================================ .. rest_method:: GET /v2.0/metering/metering-label-rules/{metering_label_rule_id} Shows details for a metering label rule. The response body shows this information for each metering label rule: - ``direction``. Either ingress or egress. - ``excluded``. Either ``true`` or ``false``. - The ID for the metering label rule. - The remote IP prefix. - The metering label ID for the metering label with which the rule is associated. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - metering_label_rule_id: metering_label_rule-id-path Request Example --------------- .. literalinclude:: samples/metering/metering-label-rule-show-request-json-http.txt :language: javascript Response Paramters ------------------ .. rest_parameters:: parameters.yaml - metering_label_rule: metering_label_rule - direction: metering_label_rule-direction - remote_ip_prefix: metering_label_rule-remote_ip_prefix - excluded : excluded - metering_label_id: metering_label-id-body - id: metering_label_rule-id Response Example ---------------- .. literalinclude:: samples/metering/metering-label-rule-show-response.json :language: javascript Delete metering label rule ========================== .. rest_method:: DELETE /v2.0/metering/metering-label-rules/{metering_label_rule_id} Deletes an L3 metering label rule. Normal response codes: 204 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - metering_label_rule_id: metering_label_rule-id-path Request Example --------------- .. literalinclude:: samples/metering/metering-label-rule-delete-request-json-http.txt :language: javascript Response -------- There is no body content for the response of a successful DELETE request. neutron-lib-2.3.0/api-ref/source/v2/firewall_log.inc0000664000175000017500000001204413641427107022315 0ustar zuulzuul00000000000000.. -*- rst -*- =============== Firewall Logs =============== .. note:: Currently this extension ``logging-resource`` is only available for networking-midonet. Lists, shows information for, creates, updates and deletes firewall logs. List Firewall Logs ================== .. rest_method:: GET /v2.0/logging/logging_resources/{logging_resource_id}/firewall_logs Lists firewall logs. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 403 Request ------- .. rest_parameters:: parameters.yaml - logging_resource_id: logging_resource_id - fields: fields Response -------- .. rest_parameters:: parameters.yaml - firewall_logs: firewall_logs - logging_resource_id: logging_resource_id-body - id: firewall_log_id-body - tenant_id: project_id - project_id: project_id - description: description - fw_event: fw_event - firewall_id: firewall_id-body Response Example ---------------- .. literalinclude:: samples/firewall_log/firewall_logs-list-response.json :language: javascript Create Firewall Log =================== .. rest_method:: POST /v2.0/logging/logging_resources/{logging_resource_id}/firewall_logs Creates a firewall log. Normal response codes: 200 Error response codes: 400, 401, 403 Request ------- .. rest_parameters:: parameters.yaml - logging_resource_id: logging_resource_id - firewall_log: firewall_log - tenant_id: project_id-request - project_id: project_id-request - description: description-request - fw_event: fw_event-request - firewall_id: firewall_id-body Request Example --------------- .. literalinclude:: samples/firewall_log/firewall_log-create-request.json :language: javascript Response -------- .. rest_parameters:: parameters.yaml - firewall_log: firewall_log - logging_resource_id: logging_resource_id-body - id: firewall_log_id-body - tenant_id: project_id - project_id: project_id - description: description - fw_event: fw_event - firewall_id: firewall_id-body Response Example ---------------- .. literalinclude:: samples/firewall_log/firewall_log-create-response.json :language: javascript Show Firewall Log Details ========================= .. rest_method:: GET /v2.0/logging/logging_resources/{logging_resource_id}/firewall_logs/{firewall_log_id} Shows details for a firewall log. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - logging_resource_id: logging_resource_id - firewall_log_id: firewall_log_id - fields: fields Response -------- .. rest_parameters:: parameters.yaml - firewall_log: firewall_log - logging_resource_id: logging_resource_id-body - id: firewall_log_id-body - tenant_id: project_id - project_id: project_id - description: description - fw_event: fw_event - firewall_id: firewall_id-body Response Example ---------------- .. literalinclude:: samples/firewall_log/firewall_log-show-response.json :language: javascript Update Firewall Log =================== .. rest_method:: PUT /v2.0/logging/logging_resources/{logging_resource_id}/firewall_logs/{firewall_log_id} Updates a firewall log. Normal response codes: 200 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - logging_resource_id: logging_resource_id - firewall_log_id: firewall_log_id - firewall_log: firewall_log - description: description-request-put - fw_event: fw_event-request-put Request Example ---------------- .. literalinclude:: samples/firewall_log/firewall_log-update-request.json :language: javascript Response -------- .. rest_parameters:: parameters.yaml - firewall_log: firewall_log - logging_resource_id: logging_resource_id-body - id: firewall_log_id-body - tenant_id: project_id - project_id: project_id - description: description - fw_event: fw_event - firewall_id: firewall_id-body Response Example ---------------- .. literalinclude:: samples/firewall_log/firewall_log-update-response.json :language: javascript Delete Firewall Log =================== .. rest_method:: DELETE /v2.0/logging/logging_resources/{logging_resource_id}/firewall_logs/{firewall_log_id} Deletes a firewall log. Normal response codes: 202 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - logging_resource_id: logging_resource_id - firewall_log_id: firewall_log_id Response -------- There is no body content for the response of a successful DELETE request. neutron-lib-2.3.0/api-ref/source/v2/logging.inc0000664000175000017500000001444313641427107021302 0ustar zuulzuul00000000000000.. -*- rst -*- ============ Log resource ============ The ``logging`` extension lists, creates, shows information for, and updates log resource. Resource timestamps =================== The ``standard-attr-timestamp`` extension adds the ``created_at`` and ``updated_at`` attributes to all resources that have standard attributes. List logs ========= .. rest_method:: GET /v2.0/log/logs Lists all log resources associated with your project. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. The list might be empty. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - id: id-query - name: name-query - description: description-query - tenant_id: project_id-query - project_id: project_id-query - event: log_event-query - revision_number: revision_number-query - resource_type: resource_log_type-query - resource_id: resource_log_id-query - target_id: resource_target_log_id-query - enabled: log_enabled-query - sort_dir: sort_dir - sort_key: log-sort_key - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - logs: logs - id: log_id - name: name - created_at: created_at_resource - description: description - tenant_id: project_id - project_id: project_id - event: log_event - revision_number: revision_number - resource_type: resource_log_type - resource_id: resource_log_id - target_id: resource_target_log_id - updated_at: updated_at_resource - enabled: log_enabled Response Example ---------------- .. literalinclude:: samples/logs/log-list-response.json :language: javascript Create log ========== .. rest_method:: POST /v2.0/log/logs Creates a log resource. Creates a log resource by using the configuration that you define in the request object. A response object is returned. The object contains a unique ID. If the caller is not an administrative user, this call returns the HTTP ``Forbidden (403)`` response code. Users with an administrative role can create policies on behalf of other projects by specifying a project ID that is different than their own. Normal response codes: 201 Error response codes: 400, 401, 403, 409 Request ------- .. rest_parameters:: parameters.yaml - log: log - name: name-request - description: description-request - tenant_id: project_id-request - project_id: project_id-request - event: log_event-request - resource_type: resource_log_type - resource_id: resource_log_id-request - target_id: resource_target_log_id-request - enabled: log_enabled-request Request Example --------------- .. literalinclude:: samples/logs/log-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - log: log - id: log_id - name: name - created_at: created_at_resource - description: description - tenant_id: project_id - project_id: project_id - event: log_event - revision_number: revision_number - resource_type: resource_log_type - resource_id: resource_log_id - target_id: resource_target_log_id - updated_at: updated_at_resource - enabled: log_enabled Request Example --------------- .. literalinclude:: samples/logs/log-create-response.json :language: javascript Show log ======== .. rest_method:: GET /v2.0/log/logs/{log_id} Shows details log resource. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - log_id: log_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - log: log - id: log_id - name: name - created_at: created_at_resource - description: description - tenant_id: project_id - project_id: project_id - event: log_event - revision_number: revision_number - resource_type: resource_log_type - resource_id: resource_log_id - target_id: resource_target_log_id - updated_at: updated_at_resource - enabled: log_enabled Response Example ---------------- .. literalinclude:: samples/logs/log-show-response.json :language: javascript Update log ========== .. rest_method:: PUT /v2.0/log/logs/{log_id} Updates a log resource. Normal response codes: 200 Error response codes: 400, 401, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - log_id: log_id-path - log: log - name: name-request - description: description-request - enabled: log_enabled-request-put Request Example --------------- .. literalinclude:: samples/logs/log-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - log: log - id: log_id - name: name - created_at: created_at_resource - description: description - tenant_id: project_id - project_id: project_id - event: log_event - revision_number: revision_number - resource_type: resource_log_type - resource_id: resource_log_id - target_id: resource_target_log_id - updated_at: updated_at_resource - enabled: log_enabled Response Example ---------------- .. literalinclude:: samples/logs/log-update-response.json :language: javascript Delete log ========== .. rest_method:: DELETE /v2.0/log/logs/{log_id} Deletes a log resource. Normal response codes: 204 Error response codes: 400, 401, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - log_id: log_id-path Response -------- There is no body content for the response of a successful DELETE request. ================= Loggable resource ================= List loggable resources ======================= .. rest_method:: GET /v2.0/log/loggable-resources Lists all resource log types are supporting. Normal response codes: 200 Error response codes: 401 Request ------- Response Parameters ------------------- .. rest_parameters:: parameters.yaml - loggable_resources: loggable_resources - type: resource_log_type Response Example ---------------- .. literalinclude:: samples/logs/loggable_resources-list-response.json :language: javascriptneutron-lib-2.3.0/api-ref/source/v2/auto-topology.inc0000664000175000017500000000307713641427107022477 0ustar zuulzuul00000000000000.. -*- rst -*- ========================= Auto Allocated Topologies ========================= Show details and delete the auto allocated topology for a given project. This API is only available when the ``auto-allocated-topology`` extension is enabled. Show auto allocated topology details ==================================== .. rest_method:: GET /v2.0/auto-allocated-topology/{project_id} Shows details for an auto allocated topology. Use the ``fields`` query parameter to control which fields are returned in the response body. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - project_id: project_id-path - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - id: id_autotopology - tenant_id: project_id-autotopology Response Example ---------------- .. literalinclude:: samples/auto-topology/topo-show-response.json :language: javascript Delete the auto allocated topology ================================== .. rest_method:: DELETE /v2.0/auto-allocated-topology/{project_id} Deletes the auto allocated topology. Normal response codes: 204 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - project_id: project_id-path Response -------- There is no body content for the response of a successful DELETE request. neutron-lib-2.3.0/api-ref/source/v2/bgpvpn-overview.inc0000664000175000017500000001414613641427107023014 0ustar zuulzuul00000000000000======================= BGP - MPLS VPN Overview ======================= The ``bgpvpn`` extension implements the BGP VPN Interconnection API which provides the ability to associate OpenStack networks and/or routers with Multiprotocol Label Switching (MPLS) Virtual Private Networks (VPNs) via Border Gateway Protocol (BGP) peering. BGP-MPLS VPNs are commonly provided by telecommunications service providers to customers in addition to or instead of Internet connectivity for Wide Area Networking. This API enables the interconnection with these WAN VPNs using *Route Targets* to indicate the desired network(s). On Route Targets ================ ``route_targets``, ``import_targets``, ``export_targets`` attributes - The set of RTs used for import is the union of ``route_targets`` and ``import_targets``. - The set of RTs used for export is the union of ``route_targets`` and ``export_targets``. At least one of ``route_targets``, ``import_targets`` or ``export_targets`` options will typically be defined, but the API will not enforce that and all lists can be empty. For instance, in the very typical use case where the BGP VPN uses a single Route Target for both import and export, the route_targets parameter alone is enough and will contain one Route target. On Route Distinguishers (RDs) ============================= The ``route_distinguishers`` parameter is optional and provides an indication of the RDs that shall be used for routes announced for Neutron networks. The contract is that when a list of RDs is specified, the backend will use, for a said advertisement of a route, one of these RDs. The motivation for having a list rather than only one RD is to allow the support for multihoming a VPN prefix (typically for resiliency, load balancing or anycast). A backend may or may not support this behavior, and should report an API error in the latter case. When not specified, the backend will use automatically-assigned RDs (for instance : RDs derived from the Provider Edge (PE) IP). Valid strings for Route Distinguishers and Route Targets ======================================================== Valid strings for a Route Target or a Route Distinguisher are the following: - <2-byte AS#>:<32bit-number> - <4-byte AS#>:<16bit-number> - <4-byte IPv4>:<16bit-number> On VXLAN VNI ============ VXLAN is one option among others that could be used for BGP E-VPNs. When VXLAN is used on a hardware platform the use of a locally-assigned id may not be always possible which introduces the need to configure a globally-assigned VXLAN VNI. The optional ``vni`` attribute is an admin-only parameter and allows the admin to enforce the use of a chosen globally-assigned VXLAN VNI for the said BGPVPN. The default when no VNI is specified and the VXLAN encapsulation is used, is to let the backend choose the VNI in advertised routes, and use the VNI in received routes for transmitted traffic. The backend will conform to E-VPN overlay specs. Valid range for the ``vni`` attribute is [1, 2\ :sup:`24`\ -1]. Control of routes advertised to BGPVPNs ======================================= With the ``bgpvpn`` extension, when associations between networks or routers and BGVPNs are defined, the routes corresponding to fixed IPs of neutron ports will be advertised to BGPVPNs. For router associations, extra routes of the router ('routes' attribute of a ``router`` resource) may also be advertised to BGPVPNs. To provide more flexibility, the ``bgpvpn-routes-control`` extension provides a way to: - advertise other routes to a BGPVPN, for instances a prefix that is reachable via a neutron port, or routes leaked from another BGPVPN; this is implemented thanks to the ``routes`` attribute of a BGPVPN port association - not advertise the fixed IPs of a neutron port to a BGPVPN, which can be particularly relevant when other IP prefixes are reachable via the port; this is implemented thanks to the ``advertise_fixed_ips`` attribute of a BGPVPN port association - explicitly control whether extra routes of a router are to be advertised to a BGPVPN; this is implemented thanks to the ``advertise_extra_routes`` attribute of a BGPVPN router association. .. note:: This feature is under development for the Rocky release - optionally control the value of the LOCAL_PREF BGP attribute of advertised routes, for all routes of a BGPVPN (thanks to the ``local_pref`` attribute of a BGPVPN resource) and/or per route (thanks to the ``local_pref`` in a port association route) ====================== BGP - MPLS VPN Caveats ====================== Association constraints ======================= A given BGP VPN can be associated to multiple networks and/or multiple routers. To avoid any ambiguity on semantics in particular the context of processing associated to a router (e.g. NAT or FWaaS), if a given subnet in a network is bound to a router, this API does not allow to both associate the network to an L3 BGP VPN and the router to the same or to a distinct L3 BGP VPN. Moreover, for BGP VPNs of type L3, there are possible cases of IP prefix overlaps that can't be detected by the service plugin before BGP routes are received, for which the behavior is left undefined by these specifications (i.e. which of the overlapping routes is being used) and will depend on the backend. This applies for both router associations and network associations in the case where traffic is forwarded by a router and the destination IP belongs both to a prefix of a BGP VPN associated with the router or with the network originating the traffic, and to a prefix of a subnet bound to the router; in such a case whether the traffic will be delivered to the subnet or to the BGP VPN is not defined by this API. Connectivity Impact inside OpenStack Neutron ============================================ Creating two BGP VPNs with RTs resulting in both VPNs to exchange routes, and then associating these two BGP VPNs to two networks, will result in establishing interconnectivity between these two networks, this simply being the result of applying BGP VPN Route Target semantics (i.e. without making prefixes to OpenStack networks a particular case). This similarly applies to router associations. neutron-lib-2.3.0/api-ref/source/v2/bgpvpn-port_associations.inc0000664000175000017500000001576413641427107024720 0ustar zuulzuul00000000000000================= Port Associations ================= Port associations are available if the ``bgpvpn-routes-control`` extension is available. Associating or disassociating a BGPVPN to a Port is done by manipulating a Port association API resource as a sub-resource of the BGPVPN resource. The semantic behind this API call is a form of policy-based routing: the traffic from the given Port will be processed according to dataplane lookups specific to this Port. This means, in particular that Ports belonging to a given neutron network will possibly see a different L2 or L3 connectivity if they have different BGPVPN associations. When, a port association is defined for a given port, and at the same time, a network association is defined for the port's network, both associations are considered simultaneously active and the connectivity will be established between the port and the BGPVPNs in both associations. This is true also in the case where multiple associations are made, and for a router associations of a router connected to the port's network. Port routes =========== Additionally to providing Port-level granularity in the definition of BGPVPN connectivity, port associations also provide a way to control the advertisement of routes other than only the fixed IPs of neutron ports. So-called static routes are defined as follows: to indicate that prefix 20.1.0.0/16 is reachable via port A and should be advertised accordingly in BGPVPN X, a port association is defined between port A and BGPVPN X, with the ``routes`` attribute set to ``[ {'type': 'prefix', 'prefix': '20.1.0.0/16'} ]``. Route leaking of the routes of a given BGPVPN into another BGPVPN belonging to the same tenant, is supported similarily: to indicate that all the prefixes advertised to BGPVPN Y are reachable via port A (i.e. the routes tagged with at least an RT belonging to ``route_targets`` or ``import_targets`` of BGPVPN Y), and that they should be leaked into BGPVPN X, a port association is defined between port A and BGPVPN X, with the ``routes`` attribute set to ``[ {'type': 'bgpvpn', 'bgpvpn_id': } ]``. Control of BGP LOCAL_PREF attribute =================================== The BGP LOCAL_PREF for a specific route can be controlled to take a different value than the one defined in the BGPVPN ``local_pref`` attribute, by adding a ``'local_pref': VALUE`` in a route in the ``routes`` attribute (see example in port association Update request). List Port Associations ====================== .. rest_method:: GET /v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/port_associations Lists port associations for a given BGP VPN. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - bgpvpn_id: bgpvpn-id-path - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - port_associations: bgpvpn-port_associations - id: bgpvpn-port_association_id - port_id: bgpvpn-port_id - project_id: project_id - routes: bgpvpn-routes - advertise_fixed_ips: bgpvpn-advertise_fixed_ips Response Example ---------------- .. literalinclude:: samples/bgpvpn/port_associations/port_association-list-response.json :language: javascript Create Port Association ======================= .. rest_method:: POST /v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/port_associations Creates a port association for a given BGP VPN Normal response codes: 201 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - bgpvpn_id: bgpvpn-id-path - port_association: bgpvpn-port_association - port_id: bgpvpn-port_id - routes: bgpvpn-routes-request - advertise_fixed_ips: bgpvpn-advertise_fixed_ips-request Request Example --------------- .. literalinclude:: samples/bgpvpn/port_associations/port_association-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - port_association: bgpvpn-port_association - id: bgpvpn-port_association_id - port_id: bgpvpn-port_id - project_id: project_id - routes: bgpvpn-routes - advertise_fixed_ips: bgpvpn-advertise_fixed_ips Response Example ---------------- .. literalinclude:: samples/bgpvpn/port_associations/port_association-create-response.json :language: javascript Show Port Association details ============================= .. rest_method:: GET /v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/port_associations/{port_association_id} Shows details for a port association. Normal response codes: 200 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - bgpvpn_id: bgpvpn-id-path - port_association_id: bgpvpn-port_association_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - port_association: bgpvpn-port_association - id: bgpvpn-port_association_id - port_id: bgpvpn-port_id - project_id: project_id - routes: bgpvpn-routes - advertise_fixed_ips: bgpvpn-advertise_fixed_ips Response Example ---------------- .. literalinclude:: samples/bgpvpn/port_associations/port_association-show-response.json :language: javascript Update a Port Association ========================= .. rest_method:: PUT /v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/port_associations/{port_association_id} Updates a port Association. Normal response codes: 201 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - bgpvpn_id: bgpvpn-id-path - port_association_id: bgpvpn-port_association_id-path - port_association: bgpvpn-port_association - routes: bgpvpn-routes-request - advertise_fixed_ips: bgpvpn-advertise_fixed_ips-request Request Example --------------- .. literalinclude:: samples/bgpvpn/port_associations/port_association-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - port_association: bgpvpn-port_association - id: bgpvpn-port_association_id - port_id: bgpvpn-port_id - project_id: project_id - routes: bgpvpn-routes - advertise_fixed_ips: bgpvpn-advertise_fixed_ips Response Example ---------------- .. literalinclude:: samples/bgpvpn/port_associations/port_association-update-response.json :language: javascript Delete Port Association ======================= .. rest_method:: DELETE /v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/port_associations/{port_association_id} Deletes a port association. Normal response codes: 204 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - bgpvpn_id: bgpvpn-id-path - port_association_id: bgpvpn-port_association_id-path Response -------- There is no body content for the response of a successful DELETE request. neutron-lib-2.3.0/api-ref/source/v2/network_segment_ranges.inc0000664000175000017500000002017413641427107024424 0ustar zuulzuul00000000000000.. -*- rst -*- ====================== Network Segment Ranges ====================== The network segment range extension exposes the segment range management to be administered via the Neutron API. It introduces the `network-segment-range` resource for tenant network segment allocation. In addition, it introduces the ability for the administrator to control the segment ranges globally or on a per-tenant basis. Lists, shows details for, creates, updates, and deletes network segment ranges. The network segment ranges API is admin-only. Resource timestamps =================== The ``standard-attr-timestamp`` extension adds the ``created_at`` and ``updated_at`` attributes to all resources that have standard attributes. Tag extension ============= The ``standard-attr-tag`` adds tag support for resources with standard attributes by adding the ``tags`` attribute allowing consumers to associate tags with resources. Show network segment range details ================================== .. rest_method:: GET /v2.0/network_segment_ranges/{network_segment_range_id} Shows details for a network segment range. You can control which response parameters are returned by using the fields query parameter. For information, see `Filtering and column selection `__. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - network_segment_range_id: network_segment_range_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - id: network_segment_range_id - name: name - description: description - default: network_segment_range-default - shared: network_segment_range-shared - tenant_id: project_id - project_id: project_id - network_type: network_segment_range-network_type - physical_network: network_segment_range-physical_network-body-required - minimum: network_segment_range-minimum-body-required - maximum: network_segment_range-maximum-body-required - available: network_segment_range-available - used: network_segment_range-used - revision_number: revision_number - created_at: created_at_resource - updated_at: updated_at_resource - tags: tags Response Example ---------------- .. literalinclude:: samples/network_segment_ranges/network_segment_range-show-response.json :language: javascript Update network segment range ============================ .. rest_method:: PUT /v2.0/network_segment_ranges/{network_segment_range_id} Updates a network segment range. Normal response codes: 200 Error response codes: 400, 401, 403, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - network_segment_range_id: network_segment_range_id-path - name: name-request - description: description-request - minimum: network_segment_range-minimum-body-optional - maximum: network_segment_range-maximum-body-optional - tags: tags-query - tags-any: tags-any-query - not-tags: not-tags-query - not-tags-any: not-tags-any-query Request Example --------------- .. literalinclude:: samples/network_segment_ranges/network_segment_range-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - id: network_segment_range_id - name: name - description: description - default: network_segment_range-default - shared: network_segment_range-shared - tenant_id: project_id - project_id: project_id - network_type: network_segment_range-network_type - physical_network: network_segment_range-physical_network-body-required - minimum: network_segment_range-minimum-body-required - maximum: network_segment_range-maximum-body-required - available: network_segment_range-available - used: network_segment_range-used - revision_number: revision_number - created_at: created_at_resource - updated_at: updated_at_resource - tags: tags Response Example ---------------- .. literalinclude:: samples/network_segment_ranges/network_segment_range-update-response.json :language: javascript Delete network segment range ============================ .. rest_method:: DELETE /v2.0/network_segment_ranges/{network_segment_range_id} Deletes a network segment range. Normal response codes: 204 Error response codes: 401, 404, 409, 412 Request ------- .. rest_parameters:: parameters.yaml - network_segment_range_id: network_segment_range_id-path Response -------- There is no body content for the response of a successful DELETE request. List network segment ranges =========================== .. rest_method:: GET /v2.0/network_segment_ranges Lists network segment ranges to which the admin has access. Use the ``fields`` query parameter to filter the response. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - id: network_segment_range_id-query - name: network_segment_range-name-query - tenant_id: project_id-query - project_id: project_id-query - network_type: network_segment_range-network_type-query - physical_network: network_segment_range-physical_network-query - sort_dir: sort_dir - sort_key: network_segment_range-sort_key - tags: tags-query - tags-any: tags-any-query - not-tags: not-tags-query - not-tags-any: not-tags-any-query - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - id: network_segment_range_id - name: name - description: description - default: network_segment_range-default - shared: network_segment_range-shared - tenant_id: project_id - project_id: project_id - network_type: network_segment_range-network_type - physical_network: network_segment_range-physical_network-body-required - minimum: network_segment_range-minimum-body-required - maximum: network_segment_range-maximum-body-required - available: network_segment_range-available - used: network_segment_range-used - revision_number: revision_number - created_at: created_at_resource - updated_at: updated_at_resource - tags: tags Response Example ---------------- .. literalinclude:: samples/network_segment_ranges/network_segment_ranges-list-response.json :language: javascript Create network segment range ============================ .. rest_method:: POST /v2.0/network_segment_ranges Creates a network segment range. Normal response codes: 201 Error response codes: 400, 401 Request ------- .. rest_parameters:: parameters.yaml - name: network_segment_range-name - description: description-request - shared: network_segment_range-shared - project_id: project_id-body-optional - network_type: network_segment_range-network_type - physical_network: network_segment_range-physical_network-body-optional - minimum: network_segment_range-minimum-body-required - maximum: network_segment_range-minimum-body-required Request Example --------------- .. literalinclude:: samples/network_segment_ranges/network_segment_range-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - id: network_segment_range_id - name: name - description: description - default: network_segment_range-default - shared: network_segment_range-shared - tenant_id: project_id - project_id: project_id - network_type: network_segment_range-network_type - physical_network: network_segment_range-physical_network-body-required - minimum: network_segment_range-minimum-body-required - maximum: network_segment_range-maximum-body-required - available: network_segment_range-available - used: network_segment_range-used - revision_number: revision_number - created_at: created_at_resource - updated_at: updated_at_resource - tags: tags Response Example ---------------- .. literalinclude:: samples/network_segment_ranges/network_segment_range-create-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/ports.inc0000664000175000017500000005310213641427107021016 0ustar zuulzuul00000000000000.. -*- rst -*- ===== Ports ===== Lists, shows details for, creates, updates, and deletes ports. Allowed address pairs ===================== The ``allowed-address-pairs`` extension adds an ``allowed_address_pairs`` attribute to ports. The value of ``allowed_address_pairs`` is an array of allowed address pair objects, each having an ``ip_address`` and a ``mac_address``. The set of allowed address pairs defines IP and MAC address that the port can use when sending packets if ``port_security_enabled`` is ``true`` (see the ``port-security`` extension). Note that while the ``ip_address`` is required in each allowed address pair, the ``mac_address`` is optional and will be taken from the port if not specified. .. warning:: If a security group with a ``remote_group_id`` rule is used by a port, adding an address pair with IP address ``0.0.0.0/0`` (``ANY``) will bypass all rules with source IP address restrictions for all ports which use the same security group. Data plane status extension =========================== The data plane port extension (``data-plane-status``) adds a new attribute ``data_plane_status`` to represent the status of the underlying data plane. This attribute is to be managed by entities outside of the Networking service, while the ``status`` attribute is managed by Networking service. Both status attributes are independent from one another. Supported data plane status values: - ``null``: no status being reported; default value - ``ACTIVE``: the underlying data plane is up and running - ``DOWN``: no traffic can flow from/to the port DNS integration =============== The ``dns-integration`` extension adds the ``dns_name`` and ``dns_assignment`` attributes to port resources. While the ``dns_name`` can be set on create and update operations, the ``dns_assignment`` is read-only and shows the ``hostname``, ``ip_address`` and ``fqdn`` for the port's internal DNS assignment. To enable the ``dns_domain`` on port resources, the ``dns-domain-ports`` extension must be used in conjunction with the ``dns-integration`` extension. When enabled and set, a port level ``dns_domain`` take precedence over a ``dns_domain`` specified in the port's network allowing per-port DNS domains. Extra DHCP option (``extra_dhcp_opt``) extension ================================================ The extra DHCP option (``extra_dhcp_opt``) extension enables extra DHCP configuration options on ``ports``. For example, PXE boot options to DHCP clients can be specified (e.g. tftp-server, server-ip-address, bootfile-name). The value of the ``extra_dhcp_opt`` attribute is an array of DHCP option objects, where each object contains an ``opt_name`` and ``opt_value`` (string values) as well as an optional ``ip_version`` (the acceptable values are either the integer ``4`` or ``6``). IP allocation extension ======================= The IP allocation extension (``ip_allocation``) adds a new read-only attribute ``ip_allocation`` that indicates when ports use deferred, immediate or no IP allocation. IP Substring Filtering ====================== The ``ip-substring-filtering`` extension adds support for filtering ports by using part of an IP address. Mac learning extension ====================== The ``mac_learning_enabled`` extension extends neutron ports providing the ability to enable MAC learning on the associated port via the ```mac_learning_enabled``` attribute. Port binding extended attributes ================================ The port binding extension (``binding``) allows administrative users to specify and retrieve physical binding information of ports. The extension defines several attributes whose names have a prefix ``binding:`` including ``binding:host_id``, ``binding:vnic_type``, ``binding:vif_type``, ``binding:vif_details``, and ``binding:profile``. Port resource request ===================== The port resource request extension (``port-resource-request``) allows administrative users (including Nova) to retrieve the Placement resources and traits needed by a port by introducing the ``resource_request`` to ``port`` resources. Port security ============= The ``port-security`` extension adds the ``port_security_enabled`` boolean attribute to ports. If a ``port-security`` value is not specified during port creation, a port will inherit the ``port_security_enabled`` from the network its connected to. QoS extension ============= The :ref:`QoS ` extension (``qos``) makes it possible to define QoS policies and associate these to the ports by introducing the ``qos_policy_id`` attribute. The policies should be created before they are associated to the ports. QoS network policy ================== The ``qos-port-network-policy`` extension adds the read only parameter ``qos_network_policy_id`` to the port responses. This parameter contains the QoS policy ID of the network where this port is plugged. Regenerate mac address extension ================================ The Port MAC address regenerate extension (``port-mac-address-regenerate``) makes it possible to regenerate the mac address of a port. When passing ``'null'`` (``None``) as the ``mac_address`` on port update, a new mac address will be generated and set on the port. Resource timestamps =================== The ``standard-attr-timestamp`` extension adds the ``created_at`` and ``updated_at`` attributes to all resources that have standard attributes. Tag extension ============= The ``standard-attr-tag`` adds Tag support for resources with standard attributes by adding the ``tags`` attribute allowing consumers to associate tags with resources. Uplink status propagation ========================= The ``uplink-status-propagation`` extension adds ``uplink_status_propagation`` attribute to port. If this attribute is set to ``true``, uplink status propagation is enabled. If this attribute is not specified, it is default to ``false`` which indicates uplink status propagation is disabled. Show port details ================= .. rest_method:: GET /v2.0/ports/{port_id} Shows details for a port. Use the ``fields`` query parameter to control which fields are returned in the response body. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - port_id: port_id-path - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - port: port - admin_state_up: admin_state_up - allowed_address_pairs: allowed_address_pairs - binding:host_id: binding:host_id - binding:profile: binding:profile - binding:vif_details: binding:vif_details - binding:vif_type: binding:vif_type - binding:vnic_type: binding:vnic_type - created_at: created_at_resource - data_plane_status: data_plane_status - description: description - device_id: device_id - device_owner: device_owner - dns_assignment: dns_assignment - dns_domain: dns_domain - dns_name: dns_name - extra_dhcp_opts: extra_dhcp_opts - fixed_ips: fixed_ips - id: id - ip_allocation: ip_allocation - mac_address: mac_address - name: name - network_id: network_id - port_security_enabled: port_security_enabled - project_id: project_id - qos_network_policy_id: qos_network_policy_id-port-response - qos_policy_id: qos_policy_id-port-response - revision_number: revision_number - resource_request: port-resource - security_groups: port-security_groups - status: port-status - tags: tags - tenant_id: project_id - updated_at: updated_at_resource - uplink_status_propagation: uplink_status_propagation - mac_learning_enabled: mac_learning_enabled Response Example ---------------- .. literalinclude:: samples/ports/port-show-response.json :language: javascript Response Example (admin user) ----------------------------- .. literalinclude:: samples/ports/port-bind-show-response.json :language: javascript Update port =========== .. rest_method:: PUT /v2.0/ports/{port_id} Updates a port. You can update information for a port, such as its symbolic name and associated IPs. When you update IPs for a port, any previously associated IPs are removed, returned to the respective subnet allocation pools, and replaced by the IPs in the request body. Therefore, this operation replaces the ``fixed_ip`` attribute when you specify it in the request body. If the updated IP addresses are not valid or are already in use, the operation fails and the existing IP addresses are not removed from the port. When you update security groups for a port and the operation succeeds, any associated security groups are removed and replaced by the security groups in the request body. Therefore, this operation replaces the ``security_groups`` attribute when you specify it in the request body. If the security groups are not valid, the operation fails and the existing security groups are not removed from the port. Only admins and users with a specific role can update the data plane status (default role: ``data_plane_integrator``). Normal response codes: 200 Error response codes: 400, 401, 403, 404, 409, 412 Request ------- .. rest_parameters:: parameters.yaml - port_id: port_id-path - port: port - admin_state_up: admin_state_up-request - allowed_address_pairs: allowed_address_pairs-request - binding:host_id: binding:host_id-request - binding:profile: binding:profile-request - binding:vnic_type: binding:vnic_type-request - data_plane_status: data_plane_status-request - description: description-request - device_id: device_id-request - device_owner: device_owner-request - dns_domain: dns_domain-request - dns_name: dns_name-request - extra_dhcp_opts: extra_dhcp_opts-request - fixed_ips: fixed_ips-request - mac_address: mac_address-request-put - name: name-request - port_security_enabled: port_security_enabled-request - qos_policy_id: qos_policy_id-port-request - security_groups: port-security_groups-request - mac_learning_enabled: mac_learning_enabled-request Request Example --------------- .. literalinclude:: samples/ports/port-update-request.json :language: javascript Request Example (admin user) ---------------------------- .. literalinclude:: samples/ports/port-bind-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - port: port - admin_state_up: admin_state_up - allowed_address_pairs: allowed_address_pairs - binding:host_id: binding:host_id - binding:profile: binding:profile - binding:vif_details: binding:vif_details - binding:vif_type: binding:vif_type - binding:vnic_type: binding:vnic_type - created_at: created_at_resource - data_plane_status: data_plane_status - description: description - device_id: device_id - device_owner: device_owner - dns_assignment: dns_assignment - dns_domain: dns_domain - dns_name: dns_name - extra_dhcp_opts: extra_dhcp_opts - fixed_ips: fixed_ips - id: id - ip_allocation: ip_allocation - mac_address: mac_address - name: name - network_id: network_id - port_security_enabled: port_security_enabled - project_id: project_id - qos_network_policy_id: qos_network_policy_id-port-response - qos_policy_id: qos_policy_id-port-response - revision_number: revision_number - resource_request: port-resource - security_groups: port-security_groups - status: port-status - tags: tags - tenant_id: project_id - updated_at: updated_at_resource - uplink_status_propagation: uplink_status_propagation - mac_learning_enabled: mac_learning_enabled Response Example ---------------- .. literalinclude:: samples/ports/port-update-response.json :language: javascript Response Example (admin user) ----------------------------- .. literalinclude:: samples/ports/port-bind-update-response.json :language: javascript Delete port =========== .. rest_method:: DELETE /v2.0/ports/{port_id} Deletes a port. Any IP addresses that are associated with the port are returned to the respective subnets allocation pools. Normal response codes: 204 Error response codes: 401, 403, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - port_id: port_id-path Response -------- There is no body content for the response of a successful DELETE request. List ports ========== .. rest_method:: GET /v2.0/ports Lists ports to which the user has access. Default policy settings return only those ports that are owned by the project of the user who submits the request, unless the request is submitted by a user with administrative rights. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. If the ``ip-substring-filtering`` extension is enabled, the Neutron API supports IP address substring filtering on the ``fixed_ips`` attribute. If you specify an IP address substring (``ip_address_substr``) in an entry of the ``fixed_ips`` attribute, the Neutron API will list all ports that have an IP address matching the substring. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - admin_state_up: admin_state_up-query - binding:host_id: binding:host_id-query - description: description-query - device_id: device_id-query - device_owner: device_owner-query - fixed_ips: fixed_ips-query - id: id-query - ip_allocation: ip_allocation-query - mac_address: mac_address-query - name: name-query - network_id: network_id-query - project_id: project_id-query - revision_number: revision_number-query - sort_dir: sort_dir - sort_key: port-sort_key - status: port-status-query - tenant_id: project_id-query - tags: tags-query - tags-any: tags-any-query - not-tags: not-tags-query - not-tags-any: not-tags-any-query - fields: fields - mac_learning_enabled: mac_learning_enabled-query Response Parameters ------------------- .. rest_parameters:: parameters.yaml - ports: ports - admin_state_up: admin_state_up - allowed_address_pairs: allowed_address_pairs - binding:host_id: binding:host_id - binding:profile: binding:profile - binding:vif_details: binding:vif_details - binding:vif_type: binding:vif_type - binding:vnic_type: binding:vnic_type - created_at: created_at_resource - data_plane_status: data_plane_status - description: description - device_id: device_id - device_owner: device_owner - dns_assignment: dns_assignment - dns_domain: dns_domain - dns_name: dns_name - extra_dhcp_opts: extra_dhcp_opts - fixed_ips: fixed_ips - id: id - ip_allocation: ip_allocation - mac_address: mac_address - name: name - network_id: network_id - port_security_enabled: port_security_enabled - project_id: project_id - qos_network_policy_id: qos_network_policy_id-port-response - qos_policy_id: qos_policy_id-port-response - revision_number: revision_number - resource_request: port-resource - security_groups: port-security_groups - status: port-status - tags: tags - tenant_id: project_id - updated_at: updated_at_resource - uplink_status_propagation: uplink_status_propagation - mac_learning_enabled: mac_learning_enabled Response Example ---------------- .. literalinclude:: samples/ports/ports-list-response.json :language: javascript Response Example (admin user) ----------------------------- .. literalinclude:: samples/ports/ports-bind-list-response.json :language: javascript Create port =========== .. rest_method:: POST /v2.0/ports Creates a port on a network. To define the network in which to create the port, specify the ``network_id`` attribute in the request body. Normal response codes: 201 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - port: port - admin_state_up: admin_state_up-request - allowed_address_pairs: allowed_address_pairs-request - binding:host_id: binding:host_id-request - binding:profile: binding:profile-request - binding:vnic_type: binding:vnic_type-request - description: description-request - device_id: device_id-request - device_owner: device_owner-request - dns_domain: dns_domain-request - dns_name: dns_name-request - extra_dhcp_opts: extra_dhcp_opts-request - fixed_ips: fixed_ips-request - mac_address: mac_address-request - name: name-request - network_id: network_id - port_security_enabled: port_security_enabled-request - project_id: project_id-request - qos_policy_id: qos_policy_id-port-request - security_groups: port-security_groups-request - tenant_id: project_id-request - uplink_status_propagation: uplink_status_propagation-request - mac_learning_enabled: mac_learning_enabled-request Request Example --------------- .. literalinclude:: samples/ports/port-create-request.json :language: javascript Request Example (admin user) ---------------------------- .. literalinclude:: samples/ports/port-bind-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - port: port - admin_state_up: admin_state_up - allowed_address_pairs: allowed_address_pairs - binding:host_id: binding:host_id - binding:profile: binding:profile - binding:vif_details: binding:vif_details - binding:vif_type: binding:vif_type - binding:vnic_type: binding:vnic_type - created_at: created_at_resource - data_plane_status: data_plane_status - description: description - device_id: device_id - device_owner: device_owner - dns_assignment: dns_assignment - dns_domain: dns_domain - dns_name: dns_name - extra_dhcp_opts: extra_dhcp_opts - fixed_ips: fixed_ips - id: id - ip_allocation: ip_allocation - mac_address: mac_address - name: name - network_id: network_id - port_security_enabled: port_security_enabled - project_id: project_id - qos_network_policy_id: qos_network_policy_id-port-response - qos_policy_id: qos_policy_id-port-response - revision_number: revision_number - resource_request: port-resource - security_groups: port-security_groups - status: port-status - tags: tags - tenant_id: project_id - updated_at: updated_at_resource - uplink_status_propagation: uplink_status_propagation - mac_learning_enabled: mac_learning_enabled Response Example ---------------- .. literalinclude:: samples/ports/port-create-response.json :language: javascript Response Example (admin user) ----------------------------- .. literalinclude:: samples/ports/port-bind-create-response.json :language: javascript Bulk create ports ================= .. rest_method:: POST /v2.0/ports Creates multiple ports in a single request. Specify a list of ports in the request body. Guarantees the atomic completion of the bulk operation. Normal response codes: 201 Error response codes: 400, 401, 403, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - ports: ports - admin_state_up: admin_state_up-request - allowed_address_pairs: allowed_address_pairs-request - binding:host_id: binding:host_id-request - binding:profile: binding:profile-request - binding:vnic_type: binding:vnic_type-request - description: description-request - device_id: device_id-request - device_owner: device_owner-request - dns_domain: dns_domain-request - dns_name: dns_name-request - extra_dhcp_opts: extra_dhcp_opts-request - fixed_ips: fixed_ips-request - mac_address: mac_address-request - name: name-request - network_id: network_id - port_security_enabled: port_security_enabled-request - project_id: project_id-request - qos_policy_id: qos_policy_id-port-request - security_groups: port-security_groups-request - tenant_id: project_id-request - uplink_status_propagation: uplink_status_propagation-request - mac_learning_enabled: mac_learning_enabled-request Request Example --------------- .. literalinclude:: samples/ports/ports-bulk-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - ports: ports - admin_state_up: admin_state_up - allowed_address_pairs: allowed_address_pairs - binding:host_id: binding:host_id - binding:profile: binding:profile - binding:vif_details: binding:vif_details - binding:vif_type: binding:vif_type - binding:vnic_type: binding:vnic_type - created_at: created_at_resource - data_plane_status: data_plane_status - description: description - device_id: device_id - device_owner: device_owner - dns_assignment: dns_assignment - dns_domain: dns_domain - dns_name: dns_name - extra_dhcp_opts: extra_dhcp_opts - fixed_ips: fixed_ips - id: id - ip_allocation: ip_allocation - mac_address: mac_address - name: name - network_id: network_id - port_security_enabled: port_security_enabled - project_id: project_id - qos_network_policy_id: qos_network_policy_id-port-response - qos_policy_id: qos_policy_id-port-response - revision_number: revision_number - security_groups: port-security_groups - status: port-status - tags: tags - tenant_id: project_id - updated_at: updated_at_resource - uplink_status_propagation: uplink_status_propagation - mac_learning_enabled: mac_learning_enabled Response Example ---------------- .. literalinclude:: samples/ports/ports-bulk-create-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/agents.inc0000664000175000017500000001040413641427107021126 0ustar zuulzuul00000000000000.. -*- rst -*- ====== Agents ====== Lists, shows details for, updates, and deletes agents. Agent Resources Synced Extension ================================ The ``agent-resources-synced`` extension adds the ``resources_synced`` attribute to agents. Availability Zone Extension =========================== The ``availability_zone`` extension adds the ``availability_zone`` attribute to agents. ``availability_zone`` is the name of the availability zone that the agent is running on. List all agents =============== .. rest_method:: GET /v2.0/agents Shows details for an agent. Use the ``fields`` query parameter to control which fields are returned in the response body. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - admin_state_up: admin_state_up-query - agent_type: agent_type-query - alive: alive-query - availability_zone: availability_zone-query - binary: binary-query - description: description-query - host: host-query - id: id-query - topic: topic-query - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - admin_state_up: admin_state_up - agents: agents - agent_type: agent_type - alive: alive - availability_zone: availability_zone - binary: binary - configurations: configurations - created_at: created_at_resource - description: description - heartbeat_timestamp: heartbeat_timestamp - host: host - id: id - resources_synced: agent_resources_synced - started_at: started_at - topic: topic Response Example ---------------- .. literalinclude:: samples/agents/agents-list-response.json :language: javascript Show agent details ================== .. rest_method:: GET /v2.0/agents/{agent_id} Shows details for an agent. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - agent_id: agent_id-path - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - admin_state_up: admin_state_up - agent: agent - agent_type: agent_type - alive: alive - availability_zone: availability_zone - binary: binary - configurations: configurations - created_at: created_at_resource - description: description - heartbeat_timestamp: heartbeat_timestamp - host: host - id: id - resources_synced: agent_resources_synced - started_at: started_at - topic: topic Response Example ---------------- .. literalinclude:: samples/agents/agent-show-response.json :language: javascript Update agent ============== .. rest_method:: PUT /v2.0/agents/{agent_id} Updates an agent. Normal response codes: 200 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - agent_id: agent_id-path - admin_state_up: admin_state_up-request - description: description-request Request Example --------------- .. literalinclude:: samples/agents/agent-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - admin_state_up: admin_state_up - agent: agent - agent_type: agent_type - alive: alive - availability_zone: availability_zone - binary: binary - configurations: configurations - created_at: created_at_resource - description: description - heartbeat_timestamp: heartbeat_timestamp - host: host - id: id - resources_synced: agent_resources_synced - started_at: started_at - topic: topic Response Example ---------------- .. literalinclude:: samples/agents/agent-update-response.json :language: javascript Delete agent ============ .. rest_method:: DELETE /v2.0/agents/{agent_id} Agents that won't be used anymore can be removed. Before deleting agents via API, the agent should be stopped/disabled. Normal response codes: 204 Error response codes: 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - agent_id: agent_id-path Response -------- There is no body content for the response of a successful DELETE request. neutron-lib-2.3.0/api-ref/source/v2/intro.inc0000664000175000017500000004664713641427107021022 0ustar zuulzuul00000000000000.. -*- rst -*- .. needs:method_verification .. needs:parameter_verification .. needs:example_verification .. needs:body_verification ========= API guide ========= This section introduces readers to OpenStack Networking (v2) API, provides guidelines on how to use it, and describes common features available to users throughout all Networking APIs. General information =================== The Networking API v2.0 is a RESTful HTTP service that uses all aspects of the HTTP protocol including methods, URIs, media types, response codes, and so on. Providers can use existing features of the protocol including caching, persistent connections, and content compression. For example, providers who employ a caching layer can respond with a ``203`` code instead of a ``200`` code when a request is served from the cache. Additionally, providers can offer support for conditional ``GET`` requests by using ETags, or they may send a redirect in response to a ``GET`` request. Create clients so that these differences are accounted for. Authentication and authorization ================================ The Networking API v2.0 uses the `OpenStack Identity service `_ as the default authentication service. When Keystone is enabled, users that submit requests to the OpenStack Networking service must provide an authentication token in ``X-Auth-Token`` request header. You obtain the token by authenticating to the Keystone endpoint. When Keystone is enabled, the ``project_id`` attribute is not required in create requests because the project ID is derived from the authentication token. NOTE: Currently the Networking API accepts the deprecated ``tenant_id`` attribute for the project ID for backward compatibility. The default authorization settings allow only administrative users to create resources on behalf of a different project. OpenStack Networking uses information received from Keystone to authorize user requests. OpenStack Networking handles the following types of authorization policies: - **Operation-based policies** specify access criteria for specific operations, possibly with fine-grained control over specific attributes. - **Resource-based policies** access a specific resource. Permissions might or might not be granted depending on the permissions configured for the resource. Currently available for only the network resource. The actual authorization policies enforced in OpenStack Networking might vary from deployment to deployment. Request and response formats ============================ The Networking API v2.0 supports JSON data serialization request and response formats only. Request format -------------- The Networking API v2.0 only accepts requests with the JSON data serialization format. The ``Content-Type`` header is ignored. Tenant and project attributes in requests ----------------------------------------- Starting with the Newton release of the Networking service, the Networking API accepts the ``project_id`` attribute in addition to the ``tenant_id`` attribute in requests. The ``tenant_id`` attribute is accepted for backward compatibility. If both the ``project_id`` and the ``tenant_id`` attribute are provided in the same request, their values must be identical. To determine whether a Networking API v2.0 endpoint supports the ``project_id`` attribute in requests, check that the ``project-id`` API extension is enabled (see Extensions_). Response format --------------- The Networking API v2.0 always responds with the JSON data serialization format. The ``Accept`` header is ignored. Query extension A ``.json`` extension can be added to the request URI. For example, the ``.json`` extension in the following requests are equivalent: - GET *publicURL*/networks - GET *publicURL*/networks.json Tenant and project attributes in responses ------------------------------------------ Starting with the Newton release of the Networking service, the Networking API returns a ``project_id`` attribute in responses, while still returning a ``tenant_id`` attribute for backward compatibility. The values will always be identical. To determine whether a Networking API v2.0 endpoint returns the ``project_id`` attribute in responses, check that the ``project-id`` API extension is enabled (see Extensions_). .. _filtering: Filtering and column selection ============================== The Networking API v2.0 supports filtering based on all top level attributes of a resource. Filters are applicable to all list requests. For example, the following request returns all networks named ``foobar``: .. code:: GET /v2.0/networks?name=foobar When you specify multiple filters using different fields, the Networking API v2.0 returns only objects that meet all filtering criteria. The operation applies an AND condition among different filter fields. OpenStack Networking offers an OR mechanism for filters by repeating the field with the different OR criteria. For example, to find all networks named ``foobar`` OR ``bizbaz``: .. code:: GET /v2.0/networks?name=foobar&name=bizbaz ORs and ANDs can be combined. For example, if you want all networks with admin_state_up=True and shared=True and named ``foobar`` or ``bizbaz``: .. code:: GET /v2.0/networks?name=foobar&name=bizbaz&admin_state_up=True&shared=True List of resources is supported in GET requests. For example, if you want the information of two specific ports that ``id`` is ``port_id_A`` or ``port_id_B``: .. code:: GET /v2.0/ports?id=port_id_A&id=port_id_B It treats ID filters as list and return ports with those 2 IDs. Starting from Rocky release, the Networking API might support filtering attributes with empty value. For example, the request below lists all ports that have ``device_id`` attribute with empty value (which are unbound ports). .. code:: GET /v2.0/networks?device_id= To determine if this feature is supported, a user can check whether the ``empty-string-filtering`` extension API is available. Starting from Rocky release, the Networking API will perform validation on filtering attributes if the API extension ``filter-validation`` is available. If an API request contains an unknown or unsupported parameter, the server will return a ``400`` response instead of silently ignoring the invalid input. Note ---- By default, OpenStack Networking returns all attributes for any show or list call. The Networking API v2.0 has a mechanism to limit the set of attributes returned. For example, return ``id``. You can use the ``fields`` query parameter to control the attributes returned from the Networking API v2.0. For example, the following request returns only ``id`` and ``name`` for each network: .. code:: GET /v2.0/networks.json?fields=id&fields=name Synchronous versus asynchronous plug-in behavior ================================================ The Networking API v2.0 presents a logical model of network connectivity consisting of networks, ports, and subnets. It is up to the OpenStack Networking plug-in to communicate with the underlying infrastructure to ensure packet forwarding is consistent with the logical model. A plug-in might perform these operations asynchronously. When an API client modifies the logical model by issuing an HTTP ``POST``, ``PUT``, or ``DELETE`` request, the API call might return before the plug-in modifies underlying virtual and physical switching devices. However, an API client is guaranteed that all subsequent API calls properly reflect the changed logical model. For example, if a client issues an HTTP ``PUT`` request to set the attachment for a port, there is no guarantee that packets sent by the interface named in the attachment are forwarded immediately when the HTTP call returns. However, it is guaranteed that a subsequent HTTP ``GET`` request to view the attachment on that port returns the new attachment value. You can use the ``status`` attribute with the network and port resources to determine whether the OpenStack Networking plug-in has successfully completed the configuration of the resource. Bulk-create =========== The Networking API v2.0 enables you to create several objects of the same type in the same API request. Bulk create operations use exactly the same API syntax as single create operations except that you specify a list of objects rather than a single object in the request body. Bulk operations are always performed atomically, meaning that either all or none of the objects in the request body are created. If a particular plug-in does not support atomic operations, the Networking API v2.0 emulates the atomic behavior so that users can expect the same behavior regardless of the particular plug-in running in the background. OpenStack Networking might be deployed without support for bulk operations and when the client attempts a bulk create operation, a ``400`` Bad request error is returned. Pagination ========== To reduce load on the service, list operations will return a maximum number of items at a time. To navigate the collection, the parameters ``limit``, ``marker`` and ``page_reverse`` can be set in the URI. For example: .. code:: ?limit=100&marker=1234&page_reverse=False The ``marker`` parameter is the ID of the last item in the previous list. The ``limit`` parameter sets the page size. The ``page_reverse`` parameter sets the page direction. These parameters are optional. If the client requests a limit beyond the maximum limit configured by the deployment, the server returns the maximum limit number of items. For convenience, list responses contain atom ``next`` links and ``previous`` links. The last page in the list requested with ``page_reverse=False`` will not contain ``next`` link, and the last page in the list requested with ``page_reverse=True`` will not contain ``previous`` link. The following examples illustrate two pages with three items. The first page was retrieved through: .. code:: GET http://127.0.0.1:9696/v2.0/networks.json?limit=2 Pagination is an optional feature of OpenStack Networking API, and it might be disabled. If pagination is disabled, the pagination parameters will be ignored and return all the items. If a particular plug-in does not support pagination operations, and pagination is enabled, the Networking API v2.0 will emulate the pagination behavior so that users can expect the same behavior regardless of the particular plug-in running in the background. To determine if pagination is supported, a user can check whether the 'pagination' extension API is available. **Example Network collection, first page: JSON request** .. code:: GET /v2.0/networks.json?limit=2 HTTP/1.1 Host: 127.0.0.1:9696 Content-Type: application/json Accept: application/json **Example Network collection, first page: JSON response** .. code:: { "networks": [ { "admin_state_up": true, "id": "396f12f8-521e-4b91-8e21-2e003500433a", "name": "net3", "provider:network_type": "vlan", "provider:physical_network": "physnet1", "provider:segmentation_id": 1002, "router:external": false, "shared": false, "status": "ACTIVE", "subnets": [], "tenant_id": "20bd52ff3e1b40039c312395b04683cf" "project_id": "20bd52ff3e1b40039c312395b04683cf" }, { "admin_state_up": true, "id": "71c1e68c-171a-4aa2-aca5-50ea153a3718", "name": "net2", "provider:network_type": "vlan", "provider:physical_network": "physnet1", "provider:segmentation_id": 1001, "router:external": false, "shared": false, "status": "ACTIVE", "subnets": [], "tenant_id": "20bd52ff3e1b40039c312395b04683cf" "project_id": "20bd52ff3e1b40039c312395b04683cf" } ], "networks_links": [ { "href": "http://127.0.0.1:9696/v2.0/networks.json?limit=2&marker=71c1e68c-171a-4aa2-aca5-50ea153a3718", "rel": "next" }, { "href": "http://127.0.0.1:9696/v2.0/networks.json?limit=2&marker=396f12f8-521e-4b91-8e21-2e003500433a&page_reverse=True", "rel": "previous" } ] } The last page won't show the ``next`` links **Example Network collection, last page: JSON request** .. code:: GET /v2.0/networks.json?limit=2&marker=71c1e68c-171a-4aa2-aca5-50ea153a3718 HTTP/1.1 Host: 127.0.0.1:9696 Content-Type: application/json Accept: application/json **Example Network collection, last page: JSON response** .. code:: { "networks": [ { "admin_state_up": true, "id": "b3680498-03da-4691-896f-ef9ee1d856a7", "name": "net1", "provider:network_type": "vlan", "provider:physical_network": "physnet1", "provider:segmentation_id": 1000, "router:external": false, "shared": false, "status": "ACTIVE", "subnets": [], "tenant_id": "c05140b3dc7c4555afff9fab6b58edc2" "project_id": "c05140b3dc7c4555afff9fab6b58edc2" } ], "networks_links": [ { "href": "http://127.0.0.1:9696/v2.0/networks.json?limit=2&marker=b3680498-03da-4691-896f-ef9ee1d856a7&page_reverse=True", "rel": "previous" } ] } Sorting ======= You can use the ``sort_key`` and ``sort_dir`` parameters to sort the results of list operations. Currently sorting does not work with extended attributes of resource. The ``sort_key`` and ``sort_dir`` can be repeated, and the number of ``sort_key`` and ``sort_dir`` provided must be same. The ``sort_dir`` parameter indicates in which direction to sort. Acceptable values are ``asc`` (ascending) and ``desc`` (descending). Sorting is optional feature of OpenStack Networking API, and it might be disabled. If sorting is disabled, the sorting parameters are ignored. If a particular plug-in does not support sorting operations and sorting is enabled, the Networking API v2.0 emulates the sorting behavior so that users can expect the same behavior regardless of the particular plug-in that runs in the background. To determine if sorting is supported, a user can check whether the 'sorting' extension API is available. Starting from Rocky release, the Networking API performs validation on sorting attributes if the API extension ``sort-key-validation`` is available. If an API request contains an unknown or unsupported sort key, the server will return a ``400`` response instead of silently ignoring the invalid input. .. _Extensions: Extensions ========== The Networking API v2.0 is extensible. The purpose of Networking API v2.0 extensions is to: - Introduce new features in the API without requiring a version change. - Introduce vendor-specific niche functionality. - Act as a proving ground for experimental functionalities that might be included in a future version of the API. To programmatically determine which extensions are available, issue a ``GET`` request on the ``v2.0/extensions`` URI. To query extensions individually by unique alias, issue a ``GET`` request on the ``/v2.0/extensions/*alias_name*`` URI. Use this method to easily determine if an extension is available. If the extension is not available, a ``404 Not Found`` response is returned. You can extend existing core API resources with new actions or extra attributes. Also, you can add new resources as extensions. Extensions usually have tags that prevent conflicts with other extensions that define attributes or resources with the same names, and with core resources and attributes. Because an extension might not be supported by all plug-ins, the availability of an extension varies with deployments and the specific plug-in in use. Faults ====== The Networking API v2.0 returns an error response if a failure occurs while processing a request. OpenStack Networking uses only standard HTTP error codes. ``4nn`` errors indicate problems in the particular request being sent from the client. +-------+--------------------------------------------------------------+ | Error | Description | +=======+==============================================================+ |``400``| Bad request | | | Malformed request URI or body requested admin state invalid | | | Invalid values entered | | | Bulk operations disallowed | | | Validation failed | | | Method not allowed for request body (such as trying to | | | update attributes that can be specified at create-time only) | +-------+--------------------------------------------------------------+ |``404``| Not Found | | | Non existent URI | | | Resource not found | +-------+--------------------------------------------------------------+ |``409``| Conflict | | | Port configured on network | | | IP allocated on subnet | | | Conflicting IP allocation pools for subnet | +-------+--------------------------------------------------------------+ |``412``| Precondition failed | | | The revision number is mismatched | +-------+--------------------------------------------------------------+ |``500``| Internal server error | | | Internal OpenStack Networking error | +-------+--------------------------------------------------------------+ |``503``| Service unavailable | | | Failure in Mac address generation | +-------+--------------------------------------------------------------+ Users submitting requests to the Networking API v2.0 might also receive the following errors: - ``401 Unauthorized`` - If invalid credentials are provided. - ``403 Forbidden`` - If the user cannot access a specific resource or perform the requested operation. Revisions ========= The ``Resource revision numbers`` extension (``standard-attr-revisions``) adds the ``revision_number`` attribute to all API resources that support standard attributes. This includes networks, ports, subnets, subnet pools, floating IPs, routers, logs, security groups/rules, network segments, QoS policies and trunks. As you'd expect, the ``revision_number`` indicates the number of updates a particular resource has undergone and is read-only. In addition, the ``If-Match constraints based on revision_number`` extension (``revision-if-match``) allows API consumers to leverage the ``If-Match`` HTTP header to conditionally update/delete a resource when the HTTP ``If-Match`` header matches the ``revision_number`` of the said resource. If the HTTP ``If-Match`` header doesn't match the ``revision_number`` of the resource, users will receive the following errors: - ``412 Precondition failed`` - Update/Delete the target resource has been denied due to the mismatch of revision number. neutron-lib-2.3.0/api-ref/source/v2/vpnaas.inc0000664000175000017500000007401713641427107021147 0ustar zuulzuul00000000000000.. -*- rst -*- ================================================================================================== VPNaaS 2.0 (vpn, vpnservices, ikepolicies, ipsecpolicies, endpoint-groups, ipsec-site-connections) ================================================================================================== The Virtual-Private-Network-as-a-Service (VPNaaS) extension enables OpenStack projects to extend private networks across the public telecommunication infrastructure. This initial implementation of the VPNaaS extension provides: - Site-to-site VPN that connects two private networks. - Multiple VPN connections per project. - IKEv1 policy support with 3des, aes-128, aes-256, or aes-192 encryption. - IPsec policy support with 3des, aes-128, aes-192, or aes-256 encryption, sha1 authentication, ESP, AH, or AH-ESP transform protocol, and tunnel or transport mode encapsulation. - Dead Peer Detection (DPD) with hold, clear, restart, disabled, or restart-by-peer actions. This extension introduces these resources: - ``service``. A parent object that associates VPN with a specific subnet and router. - ``ikepolicy``. The Internet Key Exchange (IKE) policy that identifies the authentication and encryption algorithm to use during phase one and two negotiation of a VPN connection. - ``ipsecpolicy``. The IP security policy that specifies the authentication and encryption algorithm and encapsulation mode to use for the established VPN connection. - ``ipsec-site-connection``. Details for the site-to-site IPsec connection, including the peer CIDRs, MTU, authentication mode, peer address, DPD settings, and status. VPN Endpoint Groups =================== The ``endpoint-groups`` extension adds support for defining one or more endpoints of a specific type, and can be used to specify both local and peer endpoints for IPsec connections. VPN Flavors =========== The ``vpn-flavors`` extension adds the ``flavor_id`` attribute to ``vpnservices`` resources. During vpnservice creation, if a ``flavor_id`` is passed, it is used to find the provider for the driver which would handle the newly created vpnservice. List IKE policies ================= .. rest_method:: GET /v2.0/vpn/ikepolicies Lists IKE policies. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 403 Request ------- .. rest_parameters:: parameters.yaml - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - ikepolicies: ikepolicies - name: name-request - description: description-request - tenant_id: project_id - project_id: project_id - auth_algorithm: auth_algorithm - encryption_algorithm: encryption_algorithm - pfs: pfs - value: value - phase1_negotiation_mode: phase1_negotiation_mode - units: units - lifetime: lifetime - id: ikepolicy_id-body-response - ike_version: ike_version Response Example ---------------- .. literalinclude:: samples/vpn/ikepolicies-list-response.json :language: javascript Create IKE policy ================= .. rest_method:: POST /v2.0/vpn/ikepolicies Creates an IKE policy. The IKE policy is used for phases one and two negotiation of the VPN connection. You can specify both the authentication and encryption algorithms for connections. Normal response codes: 201 Error response codes: 400, 401 Request ------- .. rest_parameters:: parameters.yaml - ikepolicy: ikepolicy - name: name-request - description: description-request - tenant_id: project_id - project_id: project_id - auth_algorithm: auth_algorithm - encryption_algorithm: encryption_algorithm - pfs: pfs - value: value - phase1_negotiation_mode: phase1_negotiation_mode - units: units - lifetime: lifetime - ike_version: ike_version Request Example --------------- .. literalinclude:: samples/vpn/ikepolicy-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - ikepolicies: ikepolicies - ikepolicy: ikepolicy - name: name-request - description: description-request - tenant_id: project_id - project_id: project_id - auth_algorithm: auth_algorithm - encryption_algorithm: encryption_algorithm - pfs: pfs - value: value - phase1_negotiation_mode: phase1_negotiation_mode - units: units - lifetime: lifetime - id: ikepolicy_id-body-response - ike_version: ike_version Response Example ---------------- .. literalinclude:: samples/vpn/ikepolicy-create-response.json :language: javascript Show IKE policy details ======================= .. rest_method:: GET /v2.0/vpn/ikepolicies/{ikepolicy_id} Shows details for an IKE policy. Normal response codes: 200 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - ikepolicy_id: ikepolicy_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - ikepolicies: ikepolicies - ikepolicy: ikepolicy - name: name-request - description: description-request - tenant_id: project_id - project_id: project_id - auth_algorithm: auth_algorithm - encryption_algorithm: encryption_algorithm - pfs: pfs - value: value - phase1_negotiation_mode: phase1_negotiation_mode - units: units - lifetime: lifetime - id: ikepolicy_id-body-response - ike_version: ike_version Response Example ---------------- .. literalinclude:: samples/vpn/ikepolicy-show-response.json :language: javascript Update IKE policy ================= .. rest_method:: PUT /v2.0/vpn/ikepolicies/{ikepolicy_id} Updates policy settings in an IKE policy. Normal response codes: 200 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - ikepolicy_id: ikepolicy_id-path - ikepolicy: ikepolicy - description: description-request - auth_algorithm: auth_algorithm - name: name-request - encryption_algorithm: encryption_algorithm - pfs: pfs - value: value - phase1_negotiation_mode: phase1_negotiation_mode - units: units - lifetime: lifetime - ike_version: ike_version Request Example --------------- .. literalinclude:: samples/vpn/ikepolicy-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - ikepolicies: ikepolicies - ikepolicy: ikepolicy - description: description-request - tenant_id: project_id - project_id: project_id - auth_algorithm: auth_algorithm - name: name-request - encryption_algorithm: encryption_algorithm - pfs: pfs - value: value - phase1_negotiation_mode: phase1_negotiation_mode - units: units - lifetime: lifetime - id: ikepolicy_id-body-response - ike_version: ike_version Response Example ---------------- .. literalinclude:: samples/vpn/ikepolicy-update-response.json :language: javascript Remove IKE policy ================= .. rest_method:: DELETE /v2.0/vpn/ikepolicies/{ikepolicy_id} Removes an IKE policy. Normal response codes: 204 Error response codes: 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - ikepolicy_id: ikepolicy_id-path Response -------- There is no body content for the response of a successful DELETE request. List IPsec policies =================== .. rest_method:: GET /v2.0/vpn/ipsecpolicies Lists all IPsec policies. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 403 Request ------- .. rest_parameters:: parameters.yaml - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - ipsecpolicies: ipsecpolicies - description: description-request - tenant_id: project_id - project_id: project_id - auth_algorithm: auth_algorithm - encapsulation_mode: encapsulation_mode - encryption_algorithm: encryption_algorithm - pfs: pfs - value: value - transform_protocol: transform_protocol - units: units - lifetime: lifetime - id: ipsecpolicy_id-body-response - name: name-request Response Example ---------------- .. literalinclude:: samples/vpn/ipsecpolicies-list-response.json :language: javascript Create IPsec policy =================== .. rest_method:: POST /v2.0/vpn/ipsecpolicies Creates an IP security (IPsec) policy. The IPsec policy specifies the authentication and encryption algorithms and encapsulation mode to use for the established VPN connection. Normal response codes: 201 Error response codes: 400, 401 Request ------- .. rest_parameters:: parameters.yaml - ipsecpolicy: ipsecpolicy - description: description-request - tenant_id: project_id - project_id: project_id - auth_algorithm: auth_algorithm - encapsulation_mode: encapsulation_mode - encryption_algorithm: encryption_algorithm - pfs: pfs - value: value - transform_protocol: transform_protocol - units: units - lifetime: lifetime - name: name-request Request Example --------------- .. literalinclude:: samples/vpn/ipsecpolicy-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - ipsecpolicies: ipsecpolicies - ipsecpolicy: ipsecpolicy - description: description-request - tenant_id: project_id - project_id: project_id - auth_algorithm: auth_algorithm - encapsulation_mode: encapsulation_mode - encryption_algorithm: encryption_algorithm - pfs: pfs - value: value - transform_protocol: transform_protocol - units: units - lifetime: lifetime - id: ipsecpolicy_id-body-response - name: name-request Response Example ---------------- .. literalinclude:: samples/vpn/ipsecpolicy-create-response.json :language: javascript Show IPsec policy ================= .. rest_method:: GET /v2.0/vpn/ipsecpolicies/{ipsecpolicy_id} Shows details for an IPsec policy. Normal response codes: 200 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - ipsecpolicy_id: ipsecpolicy_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - ipsecpolicies: ipsecpolicies - ipsecpolicy: ipsecpolicy - description: description-request - tenant_id: project_id - project_id: project_id - auth_algorithm: auth_algorithm - encapsulation_mode: encapsulation_mode - encryption_algorithm: encryption_algorithm - pfs: pfs - value: value - transform_protocol: transform_protocol - units: units - lifetime: lifetime - id: ipsecpolicy_id-body-response - name: name-request Response Example ---------------- .. literalinclude:: samples/vpn/ipsecpolicy-show-response.json :language: javascript Update IPsec policy =================== .. rest_method:: PUT /v2.0/vpn/ipsecpolicies/{ipsecpolicy_id} Updates policy settings in an IPsec policy. Normal response codes: 200 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - ipsecpolicy_id: ipsecpolicy_id-path - ipsecpolicy: ipsecpolicy - description: description-request - transform_protocol: transform_protocol - auth_algorithm: auth_algorithm - encapsulation_mode: encapsulation_mode - encryption_algorithm: encryption_algorithm - pfs: pfs - value: value - units: units - lifetime: lifetime - name: name-request Request Example --------------- .. literalinclude:: samples/vpn/ipsecpolicy-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - ipsecpolicies: ipsecpolicies - ipsecpolicy: ipsecpolicy - description: description-request - tenant_id: project_id - project_id: project_id - auth_algorithm: auth_algorithm - encapsulation_mode: encapsulation_mode - encryption_algorithm: encryption_algorithm - pfs: pfs - value: value - transform_protocol: transform_protocol - units: units - lifetime: lifetime - id: ipsecpolicy_id-body-response - name: name-request Response Example ---------------- .. literalinclude:: samples/vpn/ipsecpolicy-update-response.json :language: javascript Remove IPsec policy =================== .. rest_method:: DELETE /v2.0/vpn/ipsecpolicies/{ipsecpolicy_id} Removes an IPsec policy. Normal response codes: 204 Error response codes: 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - ipsecpolicy_id: ipsecpolicy_id-path Response -------- There is no body content for the response of a successful DELETE request. List IPsec connections ====================== .. rest_method:: GET /v2.0/vpn/ipsec-site-connections Lists all IPsec connections. Use the ``fields`` query parameter to control which fields are returned in the response body. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 403 Request ------- .. rest_parameters:: parameters.yaml - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - auth_mode: auth_mode - ikepolicy_id: ikepolicy_id-body-response - vpnservice_id: vpnservice_id-body-response - local_ep_group_id: local_ep_group_id - peer_address: peer_address - id: connection_id-body-response - route_mode: route_mode - ipsecpolicy_id: ipsecpolicy_id-body-response - peer_id: peer_id - status: ipsec_site_connection-status - psk: psk - description: description-request - initiator: initiator - peer_cidrs: peer_cidrs - name: name-request - admin_state_up: admin_state_up - tenant_id: project_id - project_id: project_id - interval: interval - mtu: mtu - peer_ep_group_id: peer_ep_group_id - dpd: dpd - timeout: ipsec_site_connection-timeout - action: ipsec_site_connection-action - local_id: local_id Response Example ---------------- .. literalinclude:: samples/vpn/ipsec-site-connections-list-response.json :language: javascript Create IPsec connection ======================= .. rest_method:: POST /v2.0/vpn/ipsec-site-connections Creates a site-to-site IPsec connection for a service. Normal response codes: 201 Error response codes: 400, 401 Request ------- .. rest_parameters:: parameters.yaml - ipsec_site_connection: ipsec_site_connection - auth_mode: auth_mode - ikepolicy_id: ikepolicy_id-body-request - vpnservice_id: vpnservice_id-body-request - local_ep_group_id: local_ep_group_id - peer_address: peer_address - route_mode: route_mode - ipsecpolicy_id: ipsecpolicy_id-body-request - peer_id: peer_id - psk: psk - description: description-request - initiator: initiator - peer_cidrs: peer_cidrs - name: name-request - admin_state_up: admin_state_up - tenant_id: project_id - project_id: project_id - interval: interval - mtu: mtu - peer_ep_group_id: peer_ep_group_id - dpd: dpd - timeout: ipsec_site_connection-timeout - action: ipsec_site_connection-action - local_id: local_id Request Example --------------- .. literalinclude:: samples/vpn/ipsec-site-connection-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - ipsec_site_connection: ipsec_site_connection - auth_mode: auth_mode - ikepolicy_id: ikepolicy_id-body-response - vpnservice_id: vpnservice_id-body-response - local_ep_group_id: local_ep_group_id - peer_address: peer_address - id: connection_id-body-response - route_mode: route_mode - ipsecpolicy_id: ipsecpolicy_id-body-response - peer_id: peer_id - status: ipsec_site_connection-status - psk: psk - description: description-request - initiator: initiator - peer_cidrs: peer_cidrs - name: name-request - admin_state_up: admin_state_up - tenant_id: project_id - project_id: project_id - interval: interval - mtu: mtu - peer_ep_group_id: peer_ep_group_id - dpd: dpd - timeout: ipsec_site_connection-timeout - action: ipsec_site_connection-action - local_id: local_id Response Example ---------------- .. literalinclude:: samples/vpn/ipsec-site-connection-create-response.json :language: javascript Show IPsec connection ===================== .. rest_method:: GET /v2.0/vpn/ipsec-site-connections/{connection_id} Shows details for an IPsec connection. Normal response codes: 200 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - connection_id: connection_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - auth_mode: auth_mode - ikepolicy_id: ikepolicy_id-body-response - vpnservice_id: vpnservice_id-body-response - local_ep_group_id: local_ep_group_id - peer_address: peer_address - id: connection_id-body-response - ipsec_site_connection: ipsec_site_connection - route_mode: route_mode - ipsecpolicy_id: ipsecpolicy_id-body-response - peer_id: peer_id - status: ipsec_site_connection-status - psk: psk - description: description-request - initiator: initiator - peer_cidrs: peer_cidrs - name: name-request - admin_state_up: admin_state_up - tenant_id: project_id - project_id: project_id - interval: interval - mtu: mtu - peer_ep_group_id: peer_ep_group_id - dpd: dpd - timeout: ipsec_site_connection-timeout - action: ipsec_site_connection-action - local_id: local_id Response Example ---------------- .. literalinclude:: samples/vpn/ipsec-site-connection-show-response.json :language: javascript Update IPsec connection ======================= .. rest_method:: PUT /v2.0/vpn/ipsec-site-connections/{connection_id} Updates connection settings for an IPsec connection. Normal response codes: 200 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - connection_id: connection_id-path - ipsec_site_connection: ipsec_site_connection - psk: psk - initiator: initiator - description: description-request - admin_state_up: admin_state_up - interval: interval - peer_cidrs: peer_cidrs - mtu: mtu - peer_ep_group_id: peer_ep_group_id - local_ep_group_id: local_ep_group_id - dpd: dpd - timeout: ipsec_site_connection-timeout - action: ipsec_site_connection-action - peer_address: peer_address - peer_id: peer_id - name: name-request - local_id: local_id Request Example --------------- .. literalinclude:: samples/vpn/ipsec-site-connection-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - auth_mode: auth_mode - ikepolicy_id: ikepolicy_id-body-response - vpnservice_id: vpnservice_id-body-response - local_ep_group_id: local_ep_group_id - peer_address: peer_address - id: connection_id-body-response - ipsec_site_connection: ipsec_site_connection - route_mode: route_mode - ipsecpolicy_id: ipsecpolicy_id-body-response - peer_id: peer_id - status: ipsec_site_connection-status - psk: psk - description: description-request - initiator: initiator - peer_cidrs: peer_cidrs - name: name-request - admin_state_up: admin_state_up - tenant_id: project_id - project_id: project_id - interval: interval - mtu: mtu - peer_ep_group_id: peer_ep_group_id - dpd: dpd - timeout: ipsec_site_connection-timeout - action: ipsec_site_connection-action - local_id: local_id Response Example ---------------- .. literalinclude:: samples/vpn/ipsec-site-connection-update-response.json :language: javascript Remove IPsec connection ======================= .. rest_method:: DELETE /v2.0/vpn/ipsec-site-connections/{connection_id} Removes an IPsec connection. Normal response codes: 204 Error response codes: 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - connection_id: connection_id-path Response -------- There is no body content for the response of a successful DELETE request. List VPN endpoint groups ======================== .. rest_method:: GET /v2.0/vpn/endpoint-groups Lists VPN endpoint groups. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 403 Request ------- .. rest_parameters:: parameters.yaml - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - endpoints: endpoints - name: name-request - description: description-request - tenant_id: project_id - project_id: project_id - type: vpn_endpoint_type - id: endpoint_group_id-body-response Response Example ---------------- .. literalinclude:: samples/vpn/vpn-endpoint-groups-list-response.json :language: javascript Create VPN endpoint group ========================= .. rest_method:: POST /v2.0/vpn/endpoint-groups Creates a VPN endpoint group. The endpoint group contains one or more endpoints of a specific type that you can use to create a VPN connections. Normal response codes: 201 Error response codes: 400, 401 Request ------- .. rest_parameters:: parameters.yaml - tenant_id: project_id - project_id: project_id - endpoints: endpoints - type: vpn_endpoint_type - description: description-request - name: name-request Request Example --------------- .. literalinclude:: samples/vpn/vpn-endpoint-group-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - endpoints: endpoints - description: description-request - tenant_id: project_id - project_id: project_id - type: vpn_endpoint_type - id: endpoint_group_id-body-response - name: name-request Response Example ---------------- .. literalinclude:: samples/vpn/vpn-endpoint-group-create-response.json :language: javascript Show VPN endpoint group ======================= .. rest_method:: GET /v2.0/vpn/endpoint-groups/{endpoint_group_id} Shows details for a VPN endpoint group. Normal response codes: 200 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - endpoint_group_id: endpoint_group_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - endpoints: endpoints - description: description-request - tenant_id: project_id - project_id: project_id - type: vpn_endpoint_type - id: endpoint_group_id-body-response - name: name-request Response Example ---------------- .. literalinclude:: samples/vpn/vpn-endpoint-group-show-response.json :language: javascript Update VPN endpoint group ========================= .. rest_method:: PUT /v2.0/vpn/endpoint-groups/{endpoint_group_id} Updates settings for a VPN endpoint group. Normal response codes: 200 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - description: description-request - name: name-request - endpoint_group_id: endpoint_group_id-path Request Example --------------- .. literalinclude:: samples/vpn/vpn-endpoint-group-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - endpoints: endpoints - description: description-request - tenant_id: project_id - project_id: project_id - type: vpn_endpoint_type - id: endpoint_group_id-body-response - name: name-request Response Example ---------------- .. literalinclude:: samples/vpn/vpn-endpoint-group-update-response.json :language: javascript Remove VPN endpoint group ========================= .. rest_method:: DELETE /v2.0/vpn/endpoint-groups/{endpoint_group_id} Removes a VPN endpoint group. Normal response codes: 204 Error response codes: 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - endpoint_group_id: endpoint_group_id-path Response -------- There is no body content for the response of a successful DELETE request. List VPN services ================= .. rest_method:: GET /v2.0/vpn/vpnservices Lists all VPN services. The list might be empty. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 403 Request ------- .. rest_parameters:: parameters.yaml - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - vpnservices: vpnservices - router_id: router_id - status: vpnservice-status - name: name-request - external_v6_ip: external_v6_ip - admin_state_up: admin_state_up - subnet_id: subnet_id - tenant_id: project_id - project_id: project_id - external_v4_ip: external_v4_ip - id: vpnservice_id-body-response - description: description-request - flavor_id: flavor-id-response Response Example ---------------- .. literalinclude:: samples/vpn/vpnservices-list-response.json :language: javascript Create VPN service ================== .. rest_method:: POST /v2.0/vpn/vpnservices Creates a VPN service. The service is associated with a router. After you create the service, it can contain multiple VPN connections. An optional ``flavor_id`` attribute can be passed to enable dynamic selection of an appropriate provider if configured by the operator. It is only available when ``vpn-flavors`` extension is enabled. The basic selection algorithm chooses the provider in the first service profile currently associated with flavor. This option can only be set in ``POST`` operation. Normal response codes: 201 Error response codes: 400, 401 Request ------- .. rest_parameters:: parameters.yaml - vpnservice: vpnservice - router_id: router_id - description: description-request - admin_state_up: admin_state_up - subnet_id: subnet_id - tenant_id: project_id - project_id: project_id - name: name-request - flavor_id: flavor-id-request Request Example --------------- .. literalinclude:: samples/vpn/vpnservice-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - vpnservice: vpnservice - router_id: router_id - status: vpnservice-status - name: name-request - external_v6_ip: external_v6_ip - admin_state_up: admin_state_up - subnet_id: subnet_id - tenant_id: project_id - project_id: project_id - external_v4_ip: external_v4_ip - id: vpnservice_id-body-response - description: description-request - flavor_id: flavor-id-response Response Example ---------------- .. literalinclude:: samples/vpn/vpnservice-create-response.json :language: javascript Show VPN service details ======================== .. rest_method:: GET /v2.0/vpn/vpnservices/{service_id} Shows details for a VPN service. If the user is not an administrative user and the VPN service object does not belong to the tenant account for the user, the operation returns the ``Forbidden (403)`` response code. Normal response codes: 200 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - service_id: vpnservice_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - vpnservice: vpnservice - router_id: router_id - status: vpnservice-status - name: name-request - external_v6_ip: external_v6_ip - admin_state_up: admin_state_up - subnet_id: subnet_id - tenant_id: project_id - project_id: project_id - external_v4_ip: external_v4_ip - id: vpnservice_id-body-response - description: description-request - flavor_id: flavor-id-response Response Example ---------------- .. literalinclude:: samples/vpn/vpnservice-show-response.json :language: javascript Update VPN service ================== .. rest_method:: PUT /v2.0/vpn/vpnservices/{service_id} Updates a VPN service. Updates the attributes of a VPN service. You cannot update a service with a ``PENDING_*`` status. Normal response codes: 200 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - vpnservice: vpnservice - description: description-request - name: name-request - admin_state_up: admin_state_up - service_id: vpnservice_id-path Request Example --------------- .. literalinclude:: samples/vpn/vpnservice-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - vpnservice: vpnservice - router_id: router_id - status: vpnservice-status - name: name-request - external_v6_ip: external_v6_ip - admin_state_up: admin_state_up - subnet_id: subnet_id - tenant_id: project_id - project_id: project_id - external_v4_ip: external_v4_ip - id: vpnservice_id-body-response - description: description-request - flavor_id: flavor-id-response Response Example ---------------- .. literalinclude:: samples/vpn/vpnservice-update-response.json :language: javascript Remove VPN service ================== .. rest_method:: DELETE /v2.0/vpn/vpnservices/{service_id} Removes a VPN service. If the service has connections, the request is rejected. Normal response codes: 204 Error response codes: 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - service_id: vpnservice_id-path Response -------- There is no body content for the response of a successful DELETE request. neutron-lib-2.3.0/api-ref/source/v2/flavors.inc0000664000175000017500000003171213641427107021326 0ustar zuulzuul00000000000000.. -*- rst -*- ===================================================================== Networking Flavors Framework v2.0 (CURRENT) (flavor, service_profile) ===================================================================== Extension that allows user selection of operator-curated flavors during resource creation. Users can check if flavor available by performing a GET on the /v2.0/extensions/flavors. If it is unavailable,there is an 404 error response (itemNotFound). Refer `Show extension details <#show-extension-details>`__ for more details. List flavors ============ .. rest_method:: GET /v2.0/flavors Lists all flavors visible to the project. The list can be empty. Standard query parameters are supported on the URI. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. If Neutron configuration supports pagination by overriding allow_pagination = false, the ``marker`` query parameter can set the last element id the client has seen and ``limit`` set the maximum number of items to return. if Neutron configuration has allow_sorting = true, ``sort_key`` and ``sort_dir`` pairs can be used where sort direction is 'asc' or 'desc'. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - id: id-query - service_type: flavor-service_type-query - name: name-query - description: description-query - enabled: flavor-enabled-query - sort_dir: sort_dir - sort_key: flavor-sort_key - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - flavors: flavors - id: flavor-id - service_type: flavor-service_type - name: flavor-name - description: flavor-description - enabled: flavor-enabled - service_profiles: flavor-service_profiles Response Example ---------------- .. literalinclude:: samples/flavors/flavors-list-response.json :language: javascript Create flavor ============= .. rest_method:: POST /v2.0/flavors Creates a flavor. This operation establishes a new flavor. The service_type to which the flavor applies is a required parameter. The corresponding service plugin must have been activated as part of the configuration. Check `Service providers <#list-service-providers>`__ for how to see currently loaded service types. Additionally the service plugin needs to support the use of flavors. Creation currently limited to administrators. Other users will receive a ``Forbidden 403`` response code with a response body NeutronError message expressing that creation is disallowed by policy. Until one or more service profiles are associated with the flavor by the operator, attempts to use the flavor during resource creations will currently return a ``Not Found 404`` with a response body that indicates no service profile could be found. If the API cannot fulfill the request due to insufficient data or data that is not valid, the service returns the HTTP ``Bad Request (400)`` response code with information about the failure in the response body. Validation errors require that you correct the error and submit the request again. Normal response codes: 201 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - flavor: flavor - service_type: flavor-service_type - enabled: flavor-enabled-request - description: flavor-description-request - name: flavor-name-request Request Example --------------- .. literalinclude:: samples/flavors/flavor-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - flavor: flavor - id: flavor-id - service_type: flavor-service_type - name: flavor-name - description: flavor-description - enabled: flavor-enabled - service_profiles: flavor-service_profiles Response Example ---------------- .. literalinclude:: samples/flavors/flavor-create-response.json :language: javascript Show flavor details =================== .. rest_method:: GET /v2.0/flavors/{flavor_id} Shows details for a flavor. This operation returns a flavor object by ID. If you are not an administrative user and the flavor object is not visible to your project account, the service returns the HTTP ``Forbidden (403)`` response code. Normal response codes: 200 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - flavor_id: flavor_id Response Parameters ------------------- .. rest_parameters:: parameters.yaml - flavor: flavor - id: flavor-id - service_type: flavor-service_type - name: flavor-name - description: flavor-description - enabled: flavor-enabled - service_profiles: flavor-service_profiles Response Example ---------------- .. literalinclude:: samples/flavors/flavor-show-response.json :language: javascript Update flavor ============= .. rest_method:: PUT /v2.0/flavors/{flavor_id} Updates a flavor. The service_type cannot be updated as there may be associated service profiles and consumers depending on the value. Normal response codes: 200 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - flavor_id: flavor_id - flavor: flavor - name: flavor-name-request - description: flavor-description-request - enabled: flavor-enabled-request Request Example --------------- .. literalinclude:: samples/flavors/flavor-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - flavor: flavor - id: flavor-id - service_type: flavor-service_type - name: flavor-name - description: flavor-description - enabled: flavor-enabled - service_profiles: flavor-service_profiles Response Example ---------------- .. literalinclude:: samples/flavors/flavor-update-response.json :language: javascript Delete flavor ============= .. rest_method:: DELETE /v2.0/flavors/{flavor_id} Deletes a flavor. Normal response codes: 204 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - flavor_id: flavor_id Response -------- No body content is returned on a successful DELETE. Associate flavor with a service profile ======================================= .. rest_method:: POST /v2.0/flavors/{flavor_id}/service_profiles Associate a flavor with a service profile. A flavor can be associated with more than one profile. Will return ``409 Conflict`` if association already exists. Normal response codes: 201 Error response codes: 400, 401, 403, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - flavor_id: flavor_id - service_profile: service_profile - id: service_profile-id Request Example --------------- .. literalinclude:: samples/flavors/flavor-associate-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - service_profile: service_profile - id: id Response Example ---------------- .. literalinclude:: samples/flavors/flavor-associate-response.json :language: javascript Disassociate a flavor. ====================== .. rest_method:: DELETE /v2.0/flavors/{flavor_id}/service_profiles/{profile_id} Disassociate a flavor from a service profile. Normal response codes: 204 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - profile_id: profile_id - flavor_id: flavor_id Response -------- No body content is returned on a successful disassociation. List service profiles ===================== .. rest_method:: GET /v2.0/service_profiles Lists all service profiles visible for the tenant account. The list can be empty. Standard query parameters are supported on the URI. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - id: id-query - enabled: service_profile-enabled-query - driver: service_profile-driver-query - description: description-query - sort_dir: sort_dir - sort_key: service_profile-sort_key Response Parameters ------------------- .. rest_parameters:: parameters.yaml - service_profiles: service_profiles - id: service_profile-id - enabled: service_profile-enabled - driver: service_profile-driver - description: service_profile-description - metainfo: service_profile-metainfo Response Example ---------------- .. literalinclude:: samples/flavors/service-profiles-list-response.json :language: javascript Create service profile ====================== .. rest_method:: POST /v2.0/service_profiles Creates a service profile. This operation establishes a new service profile that can be associated with one or more flavors. Either metadata or a driver is required. If a driver is specified but does not exist, call will return a ``Not found 404`` error with the response body explaining that the driver could not be found. Creation currently limited to administrators. Other users will receive a ``Forbidden 403`` response code with a response body NeutronError message expressing that creation is disallowed by policy. If the API cannot fulfill the request due to insufficient data or data that is not valid, the service returns the HTTP ``Bad Request (400)`` response code with information about the failure in the response body. Validation errors require that you correct the error and submit the request again. Normal response codes: 201 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - service_profile: service_profile - description: service_profile-description-request - metainfo: service_profile-metainfo-request - enabled: service_profile-enabled-request - driver: service_profile-driver-request Request Example --------------- .. literalinclude:: samples/flavors/service-profile-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - service_profile: service_profile - id: service_profile-id - enabled: service_profile-enabled - driver: service_profile-driver - description: service_profile-description - metainfo: service_profile-metainfo Response Example ---------------- .. literalinclude:: samples/flavors/service-profile-create-response.json :language: javascript Show service profile details ============================ .. rest_method:: GET /v2.0/service_profiles/{profile_id} Shows details for a service profile. This operation returns a service profile object by ID. If you are not an administrative user and the object is not visible to your tenant account, the service returns the HTTP ``Forbidden (403)`` response code. Normal response codes: 200 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - profile_id: profile_id Response Parameters ------------------- .. rest_parameters:: parameters.yaml - service_profile: service_profile - id: service_profile-id - enabled: service_profile-enabled - driver: service_profile-driver - description: service_profile-description - metainfo: service_profile-metainfo Response Example ---------------- .. literalinclude:: samples/flavors/service-profile-show-response.json :language: javascript Update service profile ====================== .. rest_method:: PUT /v2.0/service_profiles/{profile_id} Updates a service profile. Normal response codes: 200 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - profile_id: profile_id - service_profile: service_profile - enabled: service_profile-enabled-request - driver: service_profile-driver-request - description: service_profile-description-request - metainfo: service_profile-metainfo-request Request Example --------------- .. literalinclude:: samples/flavors/service-profile-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - service_profile: service_profile - id: service_profile-id - enabled: service_profile-enabled - driver: service_profile-driver - description: service_profile-description - metainfo: service_profile-metainfo Response Example ---------------- .. literalinclude:: samples/flavors/service-profile-update-response.json :language: javascript Delete service profile ====================== .. rest_method:: DELETE /v2.0/service_profiles/{profile_id} Deletes a service profile. Attempting to delete a service profile that is currently associated with a flavor will return a ``Conflict 409`` with a response body containing an in use message. Either metadata or a driver is required. Normal response codes: 204 Error response codes: 401, 403, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - profile_id: profile_id Response -------- No body content is returned on a successful DELETE. neutron-lib-2.3.0/api-ref/source/v2/availability_zones.inc0000664000175000017500000000134513641427107023541 0ustar zuulzuul00000000000000.. -*- rst -*- ================== Availability Zones ================== Lists availability zones. List all availability zones =========================== .. rest_method:: GET /v2.0/availability_zones Lists all availability zones. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - state: state-query - resource: resource-query - name: name-query Response Parameters ------------------- .. rest_parameters:: parameters.yaml - availability_zones: availability_zones-list - state: state - resource: resource - name: name Response Example ---------------- .. literalinclude:: samples/availability-zones/azs-list-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/routers.inc0000664000175000017500000005264513641427107021365 0ustar zuulzuul00000000000000.. -*- rst -*- ================= Routers (routers) ================= A ``router`` is a logical entity for forwarding packets across internal subnets and NATting them on external networks through an appropriate external gateway. This resource is provided when ``router`` extension is enabled. Distributed virtual router extension ==================================== The ``dvr`` extension enables the functionality of configuring a router as a distributed virtual router, adding ``distributed`` parameter. Extra routes extension ====================== The extra route extension (``extraroute``) extends ``router`` resources adding a ``routes`` attribute that contains an array of route objects. Each route object has a ``destination`` and ``nexthop`` attribute representing the route. When the ``extraroute-atomic`` extension is also available you can add or remove a set of extra routes atomically on the server side. For details please see below. Extra routes (atomic) extension =============================== The extra route atomic extension (``extraroute-atomic``) extends the ``router`` resource by adding two member actions (``add_extraroutes`` / ``remove_extraroutes``) to edit the set of extra routes atomically on the server side. HA capability for router extension (``l3-ha``) ======================================================= The L3 HA extension ``l3-ha``, adds the ``ha`` attribute which enables HA capability to routers when set to ``true``. L3 external gateway mode extension (``ext-gw-mode``) ======================================================= The ``ext-gw-mode`` extension of the router abstraction for specifying whether SNAT should occur on the external gateway. The ``ext-gw-mode`` extension allows enabling configurable external gateway modes, adds the ``external_gateway_info`` attribute to ``routers`` and allows definitions for ``network_id``, ``enable_snat`` and ``external_fixed_ips``. L3 flavors extension (``l3-flavors``) ===================================== The router flavor extension (``l3-flavors``) adds the ``flavor_id`` attribute to routers, allowing requests to be dispatched to different drivers depending on the flavor associated with a given router. Resource timestamps =================== The ``standard-attr-timestamp`` extension adds the ``created_at`` and ``updated_at`` attributes to all resources that have standard attributes. Router admin state down before update extension =============================================== The ``router-admin-state-down-before-update`` extension adds the requirement that the administrative state of a distributed virtual router (DVR) be set to DOWN (``admin_state_up=False``) prior to modifying the ``distributed`` parameter of the router. The API will return an error response code of 400 if the router's ``distributed`` attribute is modified without first setting the router's ``admin_state_up=False``. This extension requires the ``dvr`` extension. Router availability zone extension ================================== The ``router_availability_zone`` extension adds the ``availability_zones`` and ``availability_zone_hints`` attributes to ``routers``, allowing scheduling based on availability zones and hints. This extension requires ``router`` and ``availability_zone`` extensions. Router service type extension (``router-service-type``) ======================================================= The ``router-service-type`` extension enables associating a service type with a router by introducing the ``service_type_id`` parameter that can be used to associate the router with an existing ``service-provider``, see `Service providers`_. Tag extension ============= The ``standard-attr-tag`` adds Tag support for resources with standard attributes by adding the ``tags`` attribute allowing consumers to associate tags with resources. L3 conntrack helpers extension (``expose-l3-conntrack-helper``) =============================================================== The router conntrack helper extension (``expose-l3-conntrack-helper``) adds the ``conntrack_helpers`` field to routers, allowing configurable netfilter CT target rules for ``routers``. List routers ============ .. rest_method:: GET /v2.0/routers Lists logical routers that the project who submits the request can access. Default policy settings return only those routers that the project who submits the request owns, unless an administrative user submits the request. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - id: id-query - tenant_id: project_id-query - project_id: project_id-query - name: name-query - description: description-query - admin_state_up: admin_state_up-query - revision_number: revision_number-query - sort_dir: sort_dir - sort_key: router-sort_key - tags: tags-query - tags-any: tags-any-query - not-tags: not-tags-query - not-tags-any: not-tags-any-query - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - routers: routers - id: router-id-body - tenant_id: project_id - project_id: project_id - name: name - description: description - admin_state_up: admin_state_up - status: router-status - external_gateway_info: router-external_gateway_info - revision_number: revision_number - routes: router-routes - destination: router-destination - nexthop: router-nexthop - distributed: router-distributed - ha: router-ha - availability_zone_hints: router-availability_zone_hints - availability_zones: router-availability_zones - service_type_id: router-service_type_id - flavor_id: router-flavor_id - created_at: created_at_resource - updated_at: updated_at_resource - tags: tags - conntrack_helpers: router-conntrack_helpers Response Example ---------------- .. literalinclude:: samples/routers/routers-list-response.json :language: javascript Create router ============= .. rest_method:: POST /v2.0/routers Creates a logical router. This operation creates a logical router. The logical router does not have any internal interface and it is not associated with any subnet. You can optionally specify an external gateway for a router at create time. The external gateway for the router must be plugged into an external network. An external network has its ``router:external`` extended field set to ``true``. To specify an external gateway, the ID of the external network must be passed in the ``network_id`` parameter of the ``external_gateway_info`` attribute in the request body. Normal response codes: 201 Error response codes: 400, 401 Request ------- .. rest_parameters:: parameters.yaml - router: router - tenant_id: project_id-request - project_id: project_id-request - name: name-request - description: description-request - admin_state_up: admin_state_up-request - external_gateway_info: router-external_gateway_info-request - distributed: router-distributed-request - ha: router-ha-request - availability_zone_hints: router-availability_zone_hints-request - service_type_id: router-service_type_id-request - flavor_id: router-flavor_id-optional Request Example --------------- .. literalinclude:: samples/routers/router-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - router: router - id: router-id-body - tenant_id: project_id - project_id: project_id - name: name - description: description - admin_state_up: admin_state_up - status: router-status - external_gateway_info: router-external_gateway_info - revision_number: revision_number - routes: router-routes - destination: router-destination - nexthop: router-nexthop - distributed: router-distributed - ha: router-ha - availability_zone_hints: router-availability_zone_hints - availability_zones: router-availability_zones - service_type_id: router-service_type_id - flavor_id: router-flavor_id - created_at: created_at_resource - updated_at: updated_at_resource - tags: tags - conntrack_helpers: router-conntrack_helpers Response Example ---------------- .. literalinclude:: samples/routers/router-create-response.json :language: javascript Show router details =================== .. rest_method:: GET /v2.0/routers/{router_id} Shows details for a router. Use the ``fields`` query parameter to control which fields are returned in the response body. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - router_id: router_id - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - router: router - id: router-id-body - tenant_id: project_id - project_id: project_id - name: name - description: description - admin_state_up: admin_state_up - status: router-status - external_gateway_info: router-external_gateway_info - revision_number: revision_number - routes: router-routes - destination: router-destination - nexthop: router-nexthop - distributed: router-distributed - ha: router-ha - availability_zone_hints: router-availability_zone_hints - availability_zones: router-availability_zones - service_type_id: router-service_type_id - flavor_id: router-flavor_id - created_at: created_at_resource - updated_at: updated_at_resource - tags: tags - conntrack_helpers: router-conntrack_helpers Response Example ---------------- .. literalinclude:: samples/routers/router-show-response.json :language: javascript Update router ============= .. rest_method:: PUT /v2.0/routers/{router_id} Updates a logical router. This operation does not enable the update of router interfaces. To update a router interface, use the add router interface and remove router interface operations. Normal response codes: 200 Error response codes: 400, 401, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - router: router - external_gateway_info: router-external_gateway_info-request - ha: router-ha-request - name: name - admin_state_up: admin_state_up - router_id: router_id - description: description-request - routes: router-routes-request - distributed: router-distributed-request Request Example --------------- .. literalinclude:: samples/routers/router-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - router: router - id: router-id-body - tenant_id: project_id - project_id: project_id - name: name - description: description - admin_state_up: admin_state_up - status: router-status - external_gateway_info: router-external_gateway_info - revision_number: revision_number - routes: router-routes - destination: router-destination - nexthop: router-nexthop - distributed: router-distributed - ha: router-ha - availability_zone_hints: router-availability_zone_hints - availability_zones: router-availability_zones - service_type_id: router-service_type_id - flavor_id: router-flavor_id - created_at: created_at_resource - updated_at: updated_at_resource - tags: tags - conntrack_helpers: router-conntrack_helpers Response Example ---------------- .. literalinclude:: samples/routers/router-update-response.json :language: javascript Delete router ============= .. rest_method:: DELETE /v2.0/routers/{router_id} Deletes a logical router and, if present, its external gateway interface. This operation fails if the router has attached interfaces. Use the remove router interface operation to remove all router interfaces before you delete the router. Normal response codes: 204 Error response codes: 401, 404, 409, 412 Request ------- .. rest_parameters:: parameters.yaml - router_id: router_id Response -------- There is no body content for the response of a successful DELETE request. Add interface to router ======================= .. rest_method:: PUT /v2.0/routers/{router_id}/add_router_interface Adds an internal interface to a logical router. This means a specified subnet is attached to a router as an internal router interface. Specify the ID of a subnet or port in the request body: - Subnet ID. The gateway IP address for the subnet is used as an IP address of the created router interface. - Port ID. The IP address associated with the port is used as an IP address of the created router interface. When you specify an IPv6 subnet, this operation adds the subnet to an existing internal port with same network ID, on the router. If a port with the same network ID does not exist, this operation creates a port on the router for that subnet. The limitation of one IPv4 subnet per router port remains, though a port can contain any number of IPv6 subnets that belong to the same network ID. When you use the ``port-create`` command to add a port and then call ``router-interface-add`` with this port ID, this operation adds the port to the router if the following conditions are met: - The port has no more than one IPv4 subnet. - The IPv6 subnets, if any, on the port do not have same network ID as the network ID of IPv6 subnets on any other ports. If you specify both subnet ID and port ID, this operation returns the ``Bad Request (400)`` response code. If the port is already in use, this operation returns the ``Conflict (409)`` response code. This operation returns a port ID that is either: - The same ID that is passed in the request body when a port is specified. - The ID of a port that this operation creates to attach the subnet to the router. After you run this operation, the operation sets: - The ``device_id`` attribute of this port to the router ID - The ``device_owner`` attribute to ``network:router_interface`` Normal response codes: 200 Error response codes: 400, 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - router_id: router_id - subnet_id: router-subnet_id-request - port_id: router-port_id-request Request Example --------------- .. literalinclude:: samples/routers/router-add-interface-request.json :language: javascript or .. literalinclude:: samples/routers/router-add-interface-request-with-port.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - id: router-id-body - subnet_id: router-subnet_id - subnet_ids: router-subnet_ids - tenant_id: router-project_id-interface - project_id: router-project_id-interface - port_id: router-port_id - network_id: router-network_id-interface - tags: tags Response Example ---------------- .. literalinclude:: samples/routers/router-add-interface-response.json :language: javascript Remove interface from router ============================ .. rest_method:: PUT /v2.0/routers/{router_id}/remove_router_interface Deletes an internal interface from a logical router. This operation deletes an internal router interface, which detaches a subnet from the router. If this subnet ID is the last subnet on the port, this operation deletes the port itself. You must specify either a subnet ID or port ID in the request body; the operation uses this value to identify which router interface to deletes. You can also specify both a subnet ID and port ID. If you specify both IDs, the subnet ID must correspond to the subnet ID of the first IP address on the port. Otherwise, this operation returns the ``Conflict (409)`` response code with information about the affected router and interface. If you try to delete the router interface for subnets that are used by one or more ``routes``, this operation returns the ``Conflict (409)`` response. In this case, you first need to delete such routes from the router. If the router or the subnet and port do not exist or are not visible to you, this operation returns the ``Not Found (404)`` response code. As a consequence of this operation, the operation removes the port connecting the router with the subnet from the subnet for the network. Normal response codes: 200 Error response codes: 400, 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - router_id: router_id - subnet_id: router-subnet_id-request - port_id: router-port_id-request Request Example --------------- .. literalinclude:: samples/routers/router-remove-interface-request.json :language: javascript or .. literalinclude:: samples/routers/router-remove-interface-request-with-port.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - id: router-id-body - subnet_id: router-subnet_id - subnet_ids: router-subnet_ids - tenant_id: router-project_id-interface - project_id: router-project_id-interface - port_id: router-port_id - network_id: router-network_id-interface - tags: tags Response Example ---------------- .. literalinclude:: samples/routers/router-remove-interface-response.json :language: javascript Add extra routes to router ========================== .. rest_method:: PUT /v2.0/routers/{router_id}/add_extraroutes Atomically adds a set of extra routes to the router's already existing extra routes. This operation is a variation on updating the router's ``routes`` parameter. In all ways it works the same, except the extra routes sent in the request body do not replace the existing set of extra routes. Instead the extra routes sent are added to the existing set of extra routes. The use of the add_extraroutes/remove_extraroutes member actions is preferred to updating the ``routes`` attribute in all cases when concurrent updates to the set of extra routes are possible. The addition's corner cases behave the following way: * When (destinationA, nexthopA) is to be added but it is already present that is accepted and the request succeeds. * Two or more routes with the same destination but with different nexthops are all accepted. * A route whose destination overlaps the destination of existing routes (e.g. ``192.168.1.0/24`` and ``192.168.1.0/22``) can be added and existing routes are left untouched. The format of the request body is the same as the format of a PUT request to the router changing the ``routes`` parameter only. The response codes and response body are the same as to the update of the ``routes`` parameter. That is the whole router object is returned including the ``routes`` parameter which represents the result of the addition. Normal response codes: 200 Error response codes: 400, 401, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - router_id: router_id - routes: router-routes Request Example --------------- .. literalinclude:: samples/routers/router-add-extraroutes-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - id: router-id-body - name: router_name - routes: router-routes Response Example ---------------- .. literalinclude:: samples/routers/router-add-extraroutes-response.json :language: javascript Remove extra routes from router =============================== .. rest_method:: PUT /v2.0/routers/{router_id}/remove_extraroutes Atomically removes a set of extra routes from the router's already existing extra routes. This operation is a variation on updating the router's ``routes`` parameter. In all ways it works the same, except the extra routes sent in the request body do not replace the existing set of extra routes. Instead the the extra routes sent are removed from the existing set of extra routes. The use of the add_extraroutes/remove_extraroutes member actions is preferred to updating the ``routes`` attribute in all cases when concurrent updates to the set of extra routes are possible. The removal's corner cases behave the following way: * An extra route is only removed if there is an exact match (including the ``destination`` and ``nexthop``) between the route sent and the route already present. * When (destinationA, nexthopA) is to be removed but it is already missing that is accepted and the request succeeds. The format of the request body is the same as the format of a PUT request to the router changing the ``routes`` parameter only. However the routes sent are not meant to overwrite the whole ``routes`` parameter, but they are meant to be removed from the existing set. The response codes and response body are the same as to the update of the ``routes`` parameter. That is the whole router object is returned including the ``routes`` parameter which represents the result of the removal. Normal response codes: 200 Error response codes: 400, 401, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - router_id: router_id - routes: router-routes Request Example --------------- .. literalinclude:: samples/routers/router-remove-extraroutes-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - id: router-id-body - name: router_name - routes: router-routes Response Example ---------------- .. literalinclude:: samples/routers/router-remove-extraroutes-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/floatingips.inc0000664000175000017500000002700513641427107022171 0ustar zuulzuul00000000000000========================== Floating IPs (floatingips) ========================== DNS integration =============== The ``dns-integration`` extension adds the ``dns_name`` and ``dns_domain`` attributes to floating IPs allowing them to be specified at creation time. The data in these attributes will be published in an external DNS service when Neutron is configured to integrate with such a service. Floating IP port details ======================== The ``fip-port-details`` extension adds the ``port_details`` attribute to floating IPs. The value of this attribute contains information of the associated port. Floating IP port forwardings ============================ The ``expose-port-forwarding-in-fip`` extension adds the ``port_forwardings`` attribute to floating IPs. The value of this attribute contains the information of associated port forwarding resources. Resource timestamps =================== The ``standard-attr-timestamp`` extension adds the ``created_at`` and ``updated_at`` attributes to all resources that have standard attributes. Tag extension ============= The ``standard-attr-tag`` adds Tag support for resources with standard attributes by adding the ``tags`` attribute allowing consumers to associate tags with resources. List floating IPs ================= .. rest_method:: GET /v2.0/floatingips Lists floating IPs visible to the user. Default policy settings return only the floating IPs owned by the user's project, unless the user has admin role. This example request lists floating IPs in JSON format: :: GET /v2.0/floatingips Accept: application/json Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - id: id-query - router_id: floatingip-router_id-query - status: floatingip-status-query - tenant_id: project_id-query - project_id: project_id-query - revision_number: revision_number-query - description: description-query - floating_network_id: floating_network_id-query - fixed_ip_address: floatingip-fixed_ip_address-query - floating_ip_address: floating_ip_address-query - port_id: floatingip-port_id-query - sort_dir: sort_dir - sort_key: floatingip-sort_key - tags: tags-query - tags-any: tags-any-query - not-tags: not-tags-query - not-tags-any: not-tags-any-query - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - floatingips: floatingips - id: floatingip-id - router_id: floatingip-router_id - status: floatingip-status - tenant_id: project_id - project_id: project_id - created_at: created_at_resource - updated_at: updated_at_resource - revision_number: revision_number - description: description - dns_domain: dns_domain - dns_name: dns_name - port_details: floating_port_details - floating_network_id: floating_network_id - fixed_ip_address: floatingip-fixed_ip_address - floating_ip_address: floating_ip_address - port_id: floatingip-port_id - tags: tags - port_forwardings: floatingip-port_forwardings Response Example ---------------- .. literalinclude:: samples/floatingips/floating-ips-list-response.json :language: javascript Create floating IP ================== .. rest_method:: POST /v2.0/floatingips Creates a floating IP, and, if you specify port information, associates the floating IP with an internal port. To associate the floating IP with an internal port, specify the port ID attribute in the request body. If you do not specify a port ID in the request, you can issue a PUT request instead of a POST request. Default policy settings enable only administrative users to set floating IP addresses and some non-administrative users might require a floating IP address. If you do not specify a floating IP address in the request, the operation automatically allocates one. By default, this operation associates the floating IP address with a single fixed IP address that is configured on an OpenStack Networking port. If a port has multiple IP addresses, you must specify the ``fixed_ip_address`` attribute in the request body to associate a fixed IP address with the floating IP address. You can create floating IPs on only external networks. When you create a floating IP, you must specify the ID of the network on which you want to create the floating IP. Alternatively, you can create a floating IP on a subnet in the external network, based on the costs and quality of that subnet. You must configure an IP address with the internal OpenStack Networking port that is associated with the floating IP address. The operation returns the ``Bad Request (400)`` response code for one of reasons: - The network is not external, such as ``router:external=False``. - The internal OpenStack Networking port is not associated with the floating IP address. - The requested floating IP address does not fall in the subnet range for the external network. - The fixed IP address is not valid. If the port ID is not valid, this operation returns ``404`` response code. The operation returns the ``Conflict (409)`` response code for one of reasons: - The requested floating IP address is already in use. - The internal OpenStack Networking port and fixed IP address are already associated with another floating IP. Normal response codes: 201 Error response codes: 400, 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - floatingip: floatingip - tenant_id: project_id - project_id: project_id - floating_network_id: floating_network_id - fixed_ip_address: floatingip-fixed_ip_address-request - floating_ip_address: floating_ip_address-request - port_id: floatingip-port_id-post-request - subnet_id: floatingip-subnet_id - description: description-request - dns_domain: dns_domain-request - dns_name: dns_name-request Request Example --------------- .. literalinclude:: samples/floatingips/floatingip-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - floatingip: floatingip - router_id: floatingip-router_id - status: floatingip-status - description: description - dns_domain: dns_domain - dns_name: dns_name - port_details: floating_port_details - tenant_id: project_id - created_at: created_at_resource - updated_at: updated_at_resource - revision_number: revision_number - project_id: project_id - floating_network_id: floating_network_id - fixed_ip_address: floatingip-fixed_ip_address - floating_ip_address: floating_ip_address - port_id: floatingip-port_id - id: floatingip-id - tags: tags - port_forwardings: floatingip-port_forwardings Response Example ---------------- .. literalinclude:: samples/floatingips/floatingip-create-response.json :language: javascript Show floating IP details ======================== .. rest_method:: GET /v2.0/floatingips/{floatingip_id} Shows details for a floating IP. Use the ``fields`` query parameter to control which fields are returned in the response body. For information, see `Filtering and Column Selection `__. This example request shows details for a floating IP in JSON format. This example also filters the result by the ``fixed_ip_address`` and ``floating_ip_address`` fields. :: GET /v2.0/floatingips/{floatingip_id}?fields=fixed_ip_address & fields=floating_ip_address Accept: application/json Normal response codes: 200 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - floatingip_id: floatingip-id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - floatingip: floatingip - router_id: floatingip-router_id - status: floatingip-status - description: description - dns_domain: dns_domain - dns_name: dns_name - port_details: floating_port_details - tenant_id: project_id - created_at: created_at_resource - updated_at: updated_at_resource - revision_number: revision_number - project_id: project_id - floating_network_id: floating_network_id - fixed_ip_address: floatingip-fixed_ip_address - floating_ip_address: floating_ip_address - port_id: floatingip-port_id - id: floatingip-id - tags: tags - port_forwardings: floatingip-port_forwardings Response Example ---------------- .. literalinclude:: samples/floatingips/floatingip-show-response.json :language: javascript Update floating IP ================== .. rest_method:: PUT /v2.0/floatingips/{floatingip_id} Updates a floating IP and its association with an internal port. The association process is the same as the process for the create floating IP operation. To disassociate a floating IP from a port, set the ``port_id`` attribute to null or omit it from the request body. This example updates a floating IP: :: PUT /v2.0/floatingips/{floatingip_id} Accept: application/json Depending on the request body that you submit, this request associates a port with or disassociates a port from a floating IP. Normal response codes: 200 Error response codes: 400, 401, 404, 409, 412 Request ------- .. rest_parameters:: parameters.yaml - floatingip: floatingip - floatingip_id: floatingip-id-path - port_id: floatingip-port_id-put-request - fixed_ip_address: floatingip-fixed_ip_address-request - description: description-request Request Example --------------- .. literalinclude:: samples/floatingips/floatingip-update-request.json :language: javascript Request Example (disassociate) ------------------------------ .. literalinclude:: samples/floatingips/floatingip-disassociate-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - floatingip: floatingip - router_id: floatingip-router_id - status: floatingip-status - tenant_id: project_id - project_id: project_id - floating_network_id: floating_network_id - fixed_ip_address: floatingip-fixed_ip_address - floating_ip_address: floating_ip_address - port_id: floatingip-port_id - id: floatingip-id - created_at: created_at_resource - updated_at: updated_at_resource - revision_number: revision_number - description: description - dns_domain: dns_domain - dns_name: dns_name - port_details: floating_port_details - tags: tags - port_forwardings: floatingip-port_forwardings Response Example ---------------- .. literalinclude:: samples/floatingips/floatingip-update-response.json :language: javascript Response Example (disassociate) ------------------------------- .. literalinclude:: samples/floatingips/floatingip-disassociate-response.json :language: javascript Delete floating IP ================== .. rest_method:: DELETE /v2.0/floatingips/{floatingip_id} Deletes a floating IP and, if present, its associated port. This example deletes a floating IP: :: DELETE /v2.0/floatingips/{floatingip_id} Accept: application/json Normal response codes: 204 Error response codes: 401, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - floatingip_id: floatingip-id-path Response -------- There is no body content for the response of a successful DELETE request. neutron-lib-2.3.0/api-ref/source/v2/dhcp-agent-scheduler.inc0000664000175000017500000000744213641427107023643 0ustar zuulzuul00000000000000.. -*- rst -*- ==================== DHCP agent scheduler ==================== The DHCP agent scheduler extension (``dhcp_agent_scheduler``) enables administrators to assign DHCP servers for Neutron networks to given Neutron DHCP agents, and retrieve mappings between Neutron networks and DHCP agents. List networks hosted by a DHCP agent ==================================== .. rest_method:: GET /v2.0/agents/{agent_id}/dhcp-networks Lists networks that a DHCP agent hosts. Normal response codes: 200 Error response codes: 401, 403 Request ------- .. rest_parameters:: parameters.yaml - agent_id: agent_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - network: network - admin_state_up: network-admin_state_up - availability_zone_hints: availability_zone_hints - availability_zones: availability_zones - created_at: created_at_resource - dns_domain: dns_domain - id: network-id - ipv4_address_scope: ipv4_address_scope - ipv6_address_scope: ipv6_address_scope - l2_adjacency: l2_adjacency - mtu: mtu - name: network-name - port_security_enabled: network-port_security_enabled - project_id: project_id - provider:network_type: provider:network_type - provider:physical_network: provider:physical_network - provider:segmentation_id: provider:segmentation_id - qos_policy_id: qos_policy_id - revision_number: revision_number - router:external: router:external - segments: segments - shared: network-shared - status: network-status - subnets: network-subnets - tenant_id: project_id - updated_at: updated_at_resource - vlan_transparent: vlan_transparent - description: description - is_default: network_is_default Response Example ---------------- .. literalinclude:: samples/agents/agent-dhcp-networks-list-response.json :language: javascript Schedule a network to a DHCP agent ================================== .. rest_method:: POST /v2.0/agents/{agent_id}/dhcp-networks Add a network to a DHCP agent Normal response codes: 201 Error response codes: 400, 403, 409, 404 Request ------- .. rest_parameters:: parameters.yaml - agent_id: agent_id-path - network_id: network-id Request Example --------------- .. literalinclude:: samples/agents/agent-dhcp-network-add-request.json :language: javascript Response Parameters ------------------- null Response Example ---------------- There is no body content for the response of a successful POST request. Remove network from a DHCP agent ================================ .. rest_method:: DELETE /v2.0/agents/{agent_id}/dhcp-networks/{network_id} Removes a network from a dhcp agent. Normal response codes: 204 Error response codes: 401, 403, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - agent_id: agent_id-path - network_id: network_id Response Example ---------------- There is no body content for the response of a successful DELETE request. List DHCP agents hosting a network ================================== .. rest_method:: GET /v2.0/networks/{network_id}/dhcp-agents Lists DHCP agents hosting a network. Normal response codes: 200 Error response codes: 401, 403 Request ------- .. rest_parameters:: parameters.yaml - network_id: network_id Response Parameters ------------------- .. rest_parameters:: parameters.yaml - admin_state_up: admin_state_up - agents: agents - agent_type: agent_type - alive: alive - binary: binary - configurations: configurations - created_at: created_at_resource - description: description - heartbeat_timestamp: heartbeat_timestamp - host: host - id: id - started_at: started_at - topic: topic Response Example ---------------- .. literalinclude:: samples/agents/network-dhcp-agent-list-response.json :language: javascriptneutron-lib-2.3.0/api-ref/source/v2/networks.inc0000664000175000017500000005141713641427107021532 0ustar zuulzuul00000000000000.. -*- rst -*- .. needs:method_verification .. NOTE(amotoki): method_verification will be removed after sorting methods in the recommended order. ======== Networks ======== Lists, shows details for, creates, updates, and deletes networks. Address Scopes Extension ======================== The ``address-scope`` extension adds the ``ipv4_address_scope`` and ``ipv6_address_scope`` attributes to networks. ``ipv4_address_scope`` is the ID of the IPv4 address scope that the network is associated with. ``ipv6_address_scope`` is the ID of the IPv6 address scope that the network is associated with. Auto Allocated Topology ======================= The ``auto-allocated-topology`` extension adds the ``is_default`` boolean attribute to networks. This value indicates the network should be used when auto allocating topologies. DNS integration =============== The ``dns-integration`` extension adds the ``dns_domain`` attribute to networks. The ``dns_domain`` of a network in conjunction with the ``dns_name`` attribute of its ports will be published in an external DNS service when Neutron is configured to integrate with such a service. External network ================ The ``external-net`` extension adds the ``router:external`` attribute to networks. This boolean attribute indicates the network has an external routing facility that's not managed by the networking service. FloatingIP autodelete internal ============================== The ``floatingip-autodelete-internal`` shim extension signals that the update of a network's ``router:external`` attribute from ``true`` to ``false`` autodeletes the unused Floating IPs of that network. L2 adjacency extension ====================== The ``l2_adjacency`` extension provides display of L2 Adjacency for ``networks`` by adding the read-only ``l2_adjacency`` attribute. This is a boolean value where ``true`` means that you can expect L2 connectivity throughout the Network and ``false`` means that there is no guarantee of L2 connectivity. This value is read-only and is derived from the current state of ``segments`` within the ``network``. MTU extensions ============== The ``net-mtu`` extension allows plug-ins to expose the MTU that is guaranteed to pass through the data path of the segments in the network. This extension introduces a read-only ``mtu`` attribute. A newer ``net-mtu-writable`` extension enhances ``net-mtu`` in that now the ``mtu`` attribute is available for write (both when creating as well as updating networks). Multiple provider extension =========================== The ``multi-provider`` extension allows administrative users to define multiple physical bindings for a logical network. To define multiple physical bindings for a network, include a ``segments`` list in the request body of network creation request. Each element in the ``segments`` list has the same structure as the provider network attributes. These attributes are ``provider:network_type``, ``provider:physical_network``, and ``provider:segmentation_id``. The same validation rules are applied to each element in the ``segments`` list. Note that you cannot use the provider extension and the multiple provider extension for a single logical network. Network availability zone extension =================================== The ``network_availability_zone`` extension provides support of availability zone for networks, exposing ``availability_zone_hints`` and ``availability_zones`` attributes. Port security ============= The ``port-security`` extension adds the ``port_security_enabled`` boolean attribute to networks. At the network level, ``port_security_enabled`` defines the default value for new ports attached to the network; they will inherit the value of their network's ``port_security_enabled`` unless explicitly set on the port itself. While the default value for ``port_security_enabled`` is ``true``, this can be changed by updating the respective network. Note that changing a value of ``port_security_enabled`` on a network, does not cascade the value to ports attached to the network. Provider extended attributes ============================ The ``provider`` extension allows administrative users to define a physical binding of a logical network. This extension provides three additional attributes: ``provider:network_type``, ``provider:physical_network`` and ``provider:segmentation_id``. The validation rules for these attributes vary across ``provider:network_type``. For example, ``vlan`` and ``flat`` network types require ``provider:physical_network`` attribute, but ``vxlan`` network type does not. Most Networking plug-ins (e.g. ML2 Plugin) and drivers do not support updating any provider related attributes. Check your plug-in whether it supports updating. QoS extension ============= The :ref:`QoS ` extension (``qos``) makes it possible to define QoS policies and associate these to the networks by introducing the ``qos_policy_id`` attribute. The policies should be created before they are associated to the networks. Resource timestamps =================== The ``standard-attr-timestamp`` extension adds the ``created_at`` and ``updated_at`` attributes to all resources that have standard attributes. Tag extension ============= The ``standard-attr-tag`` adds Tag support for resources with standard attributes by adding the ``tags`` attribute allowing consumers to associate tags with resources. VLAN transparency extension =========================== The ``vlan-transparent`` extension enables plug-ins that support VLAN transparency to deliver VLAN transparent trunk networks. This extension introduces a ``vlan_transparent`` attribute to control the VLAN transparency of the network. If the service does not support VLAN transparency and a user requests a VLAN transparent network, the plug-in refuses to create one and returns an appropriate error to the user. Show network details ==================== .. rest_method:: GET /v2.0/networks/{network_id} Shows details for a network. Use the ``fields`` query parameter to control which fields are returned in the response body. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - network_id: network_id-path - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - network: network - admin_state_up: network-admin_state_up - availability_zone_hints: availability_zone_hints - availability_zones: availability_zones - created_at: created_at_resource - dns_domain: dns_domain - id: network-id - ipv4_address_scope: ipv4_address_scope - ipv6_address_scope: ipv6_address_scope - l2_adjacency: l2_adjacency - mtu: mtu - name: network-name - port_security_enabled: network-port_security_enabled - project_id: project_id - provider:network_type: provider:network_type - provider:physical_network: provider:physical_network - provider:segmentation_id: provider:segmentation_id - qos_policy_id: qos_policy_id-network-response - revision_number: revision_number - router:external: router:external - segments: segments - shared: network-shared - status: network-status - subnets: network-subnets - tenant_id: project_id - updated_at: updated_at_resource - vlan_transparent: vlan_transparent - description: description - is_default: network_is_default - tags: tags Response Example ---------------- .. literalinclude:: samples/networks/network-show-response.json :language: javascript Response Example (admin user; single segment mapping) ----------------------------------------------------- .. literalinclude:: samples/networks/network-provider-show-response.json :language: javascript Response Example (admin user; multiple segment mappings) -------------------------------------------------------- .. literalinclude:: samples/networks/network-multi-show-response.json :language: javascript Update network ============== .. rest_method:: PUT /v2.0/networks/{network_id} Updates a network. Normal response codes: 200 Error response codes: 400, 401, 403, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - network_id: network_id-path - network: network - admin_state_up: network-admin_state_up-request - dns_domain: dns_domain-request - mtu: mtu-request - name: network-name-request - port_security_enabled: network-port_security_enabled-request - provider:network_type: provider:network_type - provider:physical_network: provider:physical_network - provider:segmentation_id: provider:segmentation_id - qos_policy_id: qos_policy_id-network-request - router:external: router:external-request - segments: segments - shared: shared - description: description-request - is_default: network_is_default-request Request Example --------------- .. literalinclude:: samples/networks/network-update-request.json :language: javascript Request Example (admin user; single segment mapping) ---------------------------------------------------- .. literalinclude:: samples/networks/network-provider-update-request.json :language: javascript Request Example (admin user; multiple segment mappings) ------------------------------------------------------- .. literalinclude:: samples/networks/network-multi-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - network: network - admin_state_up: network-admin_state_up - availability_zone_hints: availability_zone_hints - availability_zones: availability_zones - created_at: created_at_resource - dns_domain: dns_domain - id: network-id - ipv4_address_scope: ipv4_address_scope - ipv6_address_scope: ipv6_address_scope - l2_adjacency: l2_adjacency - mtu: mtu - name: network-name - port_security_enabled: network-port_security_enabled - project_id: project_id - provider:network_type: provider:network_type - provider:physical_network: provider:physical_network - provider:segmentation_id: provider:segmentation_id - qos_policy_id: qos_policy_id-network-response - revision_number: revision_number - router:external: router:external - segments: segments - shared: network-shared - status: network-status - subnets: network-subnets - tenant_id: project_id - updated_at: updated_at_resource - description: description - is_default: network_is_default - tags: tags Response Example ---------------- This is an example when a regular user without administrative roles sends a PUT request. Response examples for administrative users are similar to responses of `Show network details <#show-network-details>`__ and `Create network <#create-network>`__. See them for details. .. literalinclude:: samples/networks/network-update-response.json :language: javascript Delete network ============== .. rest_method:: DELETE /v2.0/networks/{network_id} Deletes a network and its associated resources. Normal response codes: 204 Error response codes: 401, 404, 409, 412 Request ------- .. rest_parameters:: parameters.yaml - network_id: network_id-path Response -------- There is no body content for the response of a successful DELETE request. List networks ============= .. rest_method:: GET /v2.0/networks Lists networks to which the project has access. Default policy settings return only networks that the project who submits the request owns, unless an administrative user submits the request. In addition, networks shared with the project who submits the request are also returned. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. .. TODO(amotoki): Add description on tag filtering to the general API overview. You can also use the ``tags``, ``tags-any``, ``not-tags``, ``not-tags-any`` query parameter to filter the response with tags. For information, see `REST API Impact `__. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - admin_state_up: admin_state_up-query - id: id-query - mtu: mtu-query - name: name-query - project_id: project_id-query - provider:network_type: provider:network_type-query - provider:physical_network: provider:physical_network-query - provider:segmentation_id: provider:segmentation_id-query - revision_number: revision_number-query - router:external: router:external-query - shared: network-shared-query - status: network-status-query - tenant_id: project_id-query - vlan_transparent: vlan_transparent-query - description: description-query - is_default: network_is_default-query - tags: tags-query - tags-any: tags-any-query - not-tags: not-tags-query - not-tags-any: not-tags-any-query - sort_dir: sort_dir - sort_key: network-sort_key - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - networks: networks - admin_state_up: network-admin_state_up - availability_zone_hints: availability_zone_hints - availability_zones: availability_zones - created_at: created_at_resource - dns_domain: dns_domain - id: network-id - ipv4_address_scope: ipv4_address_scope - ipv6_address_scope: ipv6_address_scope - l2_adjacency: l2_adjacency - mtu: mtu - name: network-name - port_security_enabled: network-port_security_enabled - project_id: project_id - provider:network_type: provider:network_type - provider:physical_network: provider:physical_network - provider:segmentation_id: provider:segmentation_id - qos_policy_id: qos_policy_id-network-response - revision_number: revision_number - router:external: router:external - segments: segments - shared: network-shared - status: network-status - subnets: network-subnets - tenant_id: project_id - updated_at: updated_at_resource - vlan_transparent: vlan_transparent - description: description - is_default: network_is_default - tags: tags Response Example ---------------- .. literalinclude:: samples/networks/networks-list-response.json :language: javascript Response Example (admin user) ----------------------------- When Administrative users request to list networks, physical segment information bound to the networks are also returned in a response. In this example, a network ``net1`` is mapped to a single network segment and a network ``net2`` is mapped to multiple network segments. .. literalinclude:: samples/networks/networks-provider-list-response.json :language: javascript Create network ============== .. rest_method:: POST /v2.0/networks Creates a network. A request body is optional. An administrative user can specify another project ID, which is the project that owns the network, in the request body. Normal response codes: 201 Error response codes: 400, 401 Request ------- .. rest_parameters:: parameters.yaml - network: network - admin_state_up: network-admin_state_up-request - dns_domain: dns_domain-request - mtu: mtu-request - name: network-name-request - port_security_enabled: network-port_security_enabled-request - project_id: project_id-request - provider:network_type: provider:network_type-request - provider:physical_network: provider:physical_network-request - provider:segmentation_id: provider:segmentation_id-request - qos_policy_id: qos_policy_id-network-request - router:external: router:external-request - segments: segments-request - shared: shared - tenant_id: project_id-request - vlan_transparent: vlan_transparent-request - description: description-request - is_default: network_is_default-request - availability_zone_hints: availability_zone_hints-request Request Example --------------- .. literalinclude:: samples/networks/network-create-request.json :language: javascript Request Example (admin user; single segment mapping) ---------------------------------------------------- .. literalinclude:: samples/networks/network-provider-create-request.json :language: javascript Request Example (admin user; multiple segment mappings) ------------------------------------------------------- .. literalinclude:: samples/networks/network-multi-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - network: network - admin_state_up: network-admin_state_up - availability_zone_hints: availability_zone_hints - availability_zones: availability_zones - created_at: created_at_resource - dns_domain: dns_domain - id: network-id - ipv4_address_scope: ipv4_address_scope - ipv6_address_scope: ipv6_address_scope - l2_adjacency: l2_adjacency - mtu: mtu - name: network-name - port_security_enabled: network-port_security_enabled - project_id: project_id - provider:network_type: provider:network_type - provider:physical_network: provider:physical_network - provider:segmentation_id: provider:segmentation_id - qos_policy_id: qos_policy_id-network-response - revision_number: revision_number - router:external: router:external - segments: segments - shared: network-shared - status: network-status - subnets: network-subnets - tenant_id: project_id - updated_at: updated_at_resource - vlan_transparent: vlan_transparent - description: description - is_default: network_is_default - tags: tags Response Example ---------------- .. literalinclude:: samples/networks/network-create-response.json :language: javascript Response Example (admin user; single segment mapping) ----------------------------------------------------- .. literalinclude:: samples/networks/network-provider-create-response.json :language: javascript Response Example (admin user; multiple segment mappings) -------------------------------------------------------- .. literalinclude:: samples/networks/network-multi-create-response.json :language: javascript Bulk create networks ==================== .. rest_method:: POST /v2.0/networks Creates multiple networks in a single request. In the request body, specify a list of networks. The bulk create operation is always atomic. Either all or no networks in the request body are created. Normal response codes: 201 Error response codes: 400, 401 Request ------- .. rest_parameters:: parameters.yaml - networks: networks - admin_state_up: network-admin_state_up-request - dns_domain: dns_domain-request - mtu: mtu-request - name: network-name-request - port_security_enabled: network-port_security_enabled-request - project_id: project_id-request - provider:network_type: provider:network_type-request - provider:physical_network: provider:physical_network-request - provider:segmentation_id: provider:segmentation_id-request - qos_policy_id: qos_policy_id-network-request - router:external: router:external-request - segments: segments-request - shared: shared - tenant_id: project_id-request - vlan_transparent: vlan_transparent-request - description: description-request - availability_zone_hints: availability_zone_hints-request Request Example --------------- .. literalinclude:: samples/networks/networks-bulk-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - networks: networks - admin_state_up: network-admin_state_up - availability_zone_hints: availability_zone_hints - availability_zones: availability_zones - created_at: created_at_resource - dns_domain: dns_domain - id: network-id - ipv4_address_scope: ipv4_address_scope - ipv6_address_scope: ipv6_address_scope - l2_adjacency: l2_adjacency - mtu: mtu - name: network-name - port_security_enabled: network-port_security_enabled - project_id: project_id - provider:network_type: provider:network_type - provider:physical_network: provider:physical_network - provider:segmentation_id: provider:segmentation_id - qos_policy_id: qos_policy_id-network-response - revision_number: revision_number - router:external: router:external - segments: segments - shared: network-shared - status: network-status - subnets: network-subnets - tenant_id: project_id - updated_at: updated_at_resource - vlan_transparent: vlan_transparent - description: description - is_default: network_is_default - tags: tags Response Example ---------------- .. literalinclude:: samples/networks/networks-bulk-create-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/qos.inc0000664000175000017500000006156113641427107020461 0ustar zuulzuul00000000000000.. -*- rst -*- .. _quality-of-service: ============== QoS rule types ============== Lists and shows information for QoS rule types available in current deployment. Rule type details ================= The ``qos-rule-type-details`` extension adds the ``drivers`` attribute to QoS rule types. The ``drivers`` attribute's value is a list of driver objects. Each driver object represents a loaded backend QoS driver and includes the driver's ``name`` as well as a list of its ``supported_parameters`` and acceptable values. List QoS rule types =================== .. rest_method:: GET /v2.0/qos/rule-types Lists available qos rule types. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401 Response Parameters ------------------- .. rest_parameters:: parameters.yaml - rule_types: qos-rule-types - type: qos-rule-type Response Example ---------------- .. literalinclude:: samples/qos/rule_types-list-response.json :language: javascript Show QoS rule type details ========================== .. rest_method:: GET /v2.0/qos/rule-types/{rule_type} Shows details for an available QoS rule type. You can control which response parameters are returned by using the fields query parameter. For information, see `Filtering and column selection `__. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - rule_type: qos-rule_type Response Parameters ------------------- .. rest_parameters:: parameters.yaml - type: qos-rule-type - drivers: qos-backend-drivers Response Example ---------------- .. literalinclude:: samples/qos/rule_type-details-response.json :language: javascript ================== QoS policies (qos) ================== Lists, creates, deletes, shows information for, and updates QoS policies. Resource timestamps extension ============================= The ``standard-attr-timestamp`` extension adds the ``created_at`` and ``updated_at`` attributes to all resources that have standard attributes. QoS default extension ===================== The QoS default extension (``qos-default``) allows a per project default QoS policy by adding the ``is_default`` attribute to ``policy`` resources. Tag extension ============= The ``standard-attr-tag`` adds Tag support for resources with standard attributes by adding the ``tags`` attribute allowing consumers to associate tags with resources. List QoS policies ================= .. rest_method:: GET /v2.0/qos/policies Lists all QoS policies associated with your project. One policy can contain more than one rule type. The list might be empty. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - description: description-query - tenant_id: project_id-query - project_id: project_id-query - revision_number: revision_number-query - shared: qos-shared-query - id: id-query - is_default: qos_is_default-query - name: name-query - tags: tags-query - tags-any: tags-any-query - not-tags: not-tags-query - not-tags-any: not-tags-any-query - sort_dir: sort_dir - sort_key: qos-sort_key - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - policies: policies - description: description - tenant_id: project_id - project_id: project_id - revision_number: revision_number - shared: qos-shared - id: qos_policy_id - is_default: qos_is_default - rules: qos-rules - name: name - created_at: created_at_resource - updated_at: updated_at_resource - tags: tags Response Example ---------------- .. literalinclude:: samples/qos/policies-list-response.json :language: javascript Create QoS policy ================= .. rest_method:: POST /v2.0/qos/policies Creates a QoS policy. Creates a QoS policy by using the configuration that you define in the request object. A response object is returned. The object contains a unique ID. By the default policy configuration, if the caller is not an administrative user, this call returns the HTTP ``Forbidden (403)`` response code. Users with an administrative role can create policies on behalf of other projects by specifying a project ID that is different than their own. Normal response codes: 201 Error response codes: 401, 403, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - policy: policy - description: description-request - tenant_id: project_id-request - project_id: project_id-request - shared: qos-shared-request - is_default: qos_is_default-request - name: qos_policy-name Request Example --------------- .. literalinclude:: samples/qos/policy-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - policy: policy - description: description - tenant_id: project_id - project_id: project_id - revision_number: revision_number - shared: qos-shared - rules: qos-rules - id: qos_policy_id - is_default: qos_is_default - name: name - created_at: created_at_resource - updated_at: updated_at_resource Response Example ---------------- .. literalinclude:: samples/qos/policy-create-response.json :language: javascript Show QoS policy details ======================= .. rest_method:: GET /v2.0/qos/policies/{policy_id} Shows details for a QoS policy. One policy can contain more than one rule type. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - policy: policy - description: description - tenant_id: project_id - project_id: project_id - revision_number: revision_number - shared: qos-shared - rules: qos-rules - id: qos_policy_id - is_default: qos_is_default - name: name - created_at: created_at_resource - updated_at: updated_at_resource Response Example ---------------- .. literalinclude:: samples/qos/policy-show-response.json :language: javascript Update QoS policy ================= .. rest_method:: PUT /v2.0/qos/policies/{policy_id} Updates a QoS policy. If the request is valid, the service returns the ``Accepted (202)`` response code. Normal response codes: 202 Error response codes: 400, 401, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path - policy: policy - description: description-request - is_default: qos_is_default-request - shared: qos-shared-request - name: qos_policy-name Request Example --------------- .. literalinclude:: samples/qos/policy-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - policy: policy - description: description - tenant_id: project_id - project_id: project_id - revision_number: revision_number - shared: qos-shared - id: qos_policy_id - is_default: qos_is_default - rules: qos-rules - name: name - created_at: created_at_resource - updated_at: updated_at_resource Response Example ---------------- .. literalinclude:: samples/qos/policy-update-response.json :language: javascript Delete QoS policy ================= .. rest_method:: DELETE /v2.0/qos/policies/{policy_id} Deletes a QoS policy. Normal response codes: 204 Error response codes: 400, 401, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path Response -------- There is no body content for the response of a successful DELETE request. ========================= QoS bandwidth limit rules ========================= Lists, creates, deletes, shows information for, and updates QoS bandwidth limit rules. Bandwidth limit direction ========================= The ``qos-bw-limit-direction`` extension adds the ``direction`` attribute to QoS rule types. The ``direction`` attribute allows to configure QoS bandwidth limit rule with specific direction: ``ingress`` or ``egress``. Default is ``egress``. List bandwidth limit rules for QoS policy ========================================= .. rest_method:: GET /v2.0/qos/policies/{policy_id}/bandwidth_limit_rules Lists all bandwidth limit rules for a QoS policy. The list might be empty. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path - max_kbps: max_kbps-response-query - id: id-query - max_burst_kbps: max_burst_kbps-query - direction: qos-rule-direction-query - sort_dir: sort_dir - sort_key: qos_bandwidth_limit_rule-sort_key Response Parameters ------------------- .. rest_parameters:: parameters.yaml - bandwidth_limit_rules: bandwidth_limit_rules - max_kbps: max_kbps-response - id: qos_bandwidth_limit_rule-id - max_burst_kbps: max_burst_kbps-response - direction: qos-rule-direction-response - tags: tags Response Example ---------------- .. literalinclude:: samples/qos/bandwidth_limit_rules-list-response.json :language: javascript Create bandwidth limit rule =========================== .. rest_method:: POST /v2.0/qos/policies/{policy_id}/bandwidth_limit_rules Creates a bandwidth limit rule for a QoS policy. Normal response codes: 201 Error response codes: 400, 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path - bandwidth_limit_rule: bandwidth_limit_rule - max_kbps: max_kbps - max_burst_kbps: max_burst_kbps - direction: qos-rule-direction Request Example --------------- .. literalinclude:: samples/qos/bandwidth_limit_rule-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - bandwidth_limit_rule: bandwidth_limit_rule - max_kbps: max_kbps-response - id: qos_bandwidth_limit_rule-id - max_burst_kbps: max_burst_kbps-response - direction: qos-rule-direction-response - tags: tags Response Example ---------------- .. literalinclude:: samples/qos/bandwidth_limit_rule-create-response.json :language: javascript Show bandwidth limit rule details ================================= .. rest_method:: GET /v2.0/qos/policies/{policy_id}/bandwidth_limit_rules/{rule_id} Shows details for a bandwidth limit rule for a QoS policy. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path - rule_id: qos-rule_id Response Parameters ------------------- .. rest_parameters:: parameters.yaml - bandwidth_limit_rule: bandwidth_limit_rule - max_kbps: max_kbps-response - id: qos_bandwidth_limit_rule-id - max_burst_kbps: max_burst_kbps-response - direction: qos-rule-direction-response - tags: tags Response Example ---------------- .. literalinclude:: samples/qos/bandwidth_limit_rule-show-response.json :language: javascript Update bandwidth limit rule =========================== .. rest_method:: PUT /v2.0/qos/policies/{policy_id}/bandwidth_limit_rules/{rule_id} Updates a bandwidth limit rule for a QoS policy. If the request is valid, the service returns the ``Accepted (202)`` response code. Normal response codes: 202 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path - rule_id: qos-rule_id - bandwidth_limit_rule: bandwidth_limit_rule - max_kbps: max_kbps - max_burst_kbps: max_burst_kbps - direction: qos-rule-direction-update Request Example --------------- .. literalinclude:: samples/qos/bandwidth_limit_rule-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - bandwidth_limit_rule: bandwidth_limit_rule - max_kbps: max_kbps-response - id: qos_bandwidth_limit_rule-id - max_burst_kbps: max_burst_kbps-response - direction: qos-rule-direction-update-response - tags: tags Response Example ---------------- .. literalinclude:: samples/qos/bandwidth_limit_rule-update-response.json :language: javascript Delete bandwidth limit rule =========================== .. rest_method:: DELETE /v2.0/qos/policies/{policy_id}/bandwidth_limit_rules/{rule_id} Deletes a bandwidth limit rule for a QoS policy. Normal response codes: 204 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path - rule_id: qos-rule_id Response -------- There is no body content for the response of a successful DELETE request. ====================== QoS DSCP marking rules ====================== Lists, creates, deletes, shows information for, and updates QoS DSCP marking rules. List DSCP marking rules for QoS policy ====================================== .. rest_method:: GET /v2.0/qos/policies/{policy_id}/dscp_marking_rules Lists all DSCP marking rules for a QoS policy. The list may be empty. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path - dscp_mark: dscp_mark-query - id: id-query - sort_dir: sort_dir - sort_key: qos_dscp_marking_rule-sort_key Response Parameters ------------------- .. rest_parameters:: parameters.yaml - dscp_marking_rules: dscp_marking_rules - dscp_mark: dscp_mark-response - id: qos_dscp_marking_rule-id - tags: tags Response Example ---------------- .. literalinclude:: samples/qos/dscp_marking_rules-list-response.json :language: javascript Create DSCP marking rule ======================== .. rest_method:: POST /v2.0/qos/policies/{policy_id}/dscp_marking_rules Creates a DSCP marking rule for a QoS policy. Normal response codes: 201 Error response codes: 400, 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path - dscp_marking_rule: dscp_marking_rule - dscp_mark: dscp_mark Request Example --------------- .. literalinclude:: samples/qos/dscp_marking_rule-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - dscp_marking_rule: dscp_marking_rule - dscp_mark: dscp_mark-response - id: qos_dscp_marking_rule-id - tags: tags Response Example ---------------- .. literalinclude:: samples/qos/dscp_marking_rule-create-response.json :language: javascript Show DSCP marking rule details ============================== .. rest_method:: GET /v2.0/qos/policies/{policy_id}/dscp_marking_rules/{dscp_rule_id} Shows details for a DSCP marking rule for a QoS policy. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path - dscp_rule_id: dscp_rule_id Response Parameters ------------------- .. rest_parameters:: parameters.yaml - dscp_marking_rule: dscp_marking_rule - dscp_mark: dscp_mark - id: qos_dscp_marking_rule-id - tags: tags Response Example ---------------- .. literalinclude:: samples/qos/dscp_marking_rule-show-response.json :language: javascript Update DSCP marking rule ======================== .. rest_method:: PUT /v2.0/qos/policies/{policy_id}/dscp_marking_rules/{dscp_rule_id} Updates a DSCP marking rule for a QoS policy. If the request is valid, the service returns the ``Accepted (202)`` response code. Normal response codes: 202 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path - dscp_rule_id: dscp_rule_id - dscp_marking_rule: dscp_marking_rule - dscp_mark: dscp_mark Request Example --------------- .. literalinclude:: samples/qos/dscp_marking_rule-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - dscp_marking_rule: dscp_marking_rule - dscp_mark: dscp_mark-response - id: qos_dscp_marking_rule-id - tags: tags Response Example ---------------- .. literalinclude:: samples/qos/dscp_marking_rule-update-response.json :language: javascript Delete DSCP marking rule ======================== .. rest_method:: DELETE /v2.0/qos/policies/{policy_id}/dscp_marking_rules/{dscp_rule_id} Deletes a DSCP marking rule for a QoS policy. Normal response codes: 204 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path - dscp_rule_id: dscp_rule_id Response -------- There is no body content for the response of a successful DELETE request. =========================== QoS minimum bandwidth rules =========================== Lists, creates, deletes, shows information for, and updates QoS minimum bandwidth rules. List minimum bandwidth rules for QoS policy =========================================== .. rest_method:: GET /v2.0/qos/policies/{policy_id}/minimum_bandwidth_rules Lists all minimum bandwidth rules for a QoS policy. The list might be empty. You can control which response parameters are returned by using the fields query parameter. For information, see `Filtering and column selection `__. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path - min_kbps: min_kbps-query - id: id-query - direction: qos-rule-direction-query - sort_dir: sort_dir - sort_key: qos_minimum_bandwidth_rule-sort_key Response Parameters ------------------- .. rest_parameters:: parameters.yaml - minimum_bandwidth_rules: minimum_bandwidth_rules - min_kbps: min_kbps-response - id: qos_minimum_bandwidth_rule-id - direction: qos-rule-direction-response - tags: tags Response Example ---------------- .. literalinclude:: samples/qos/minimum_bandwidth_rules-list-response.json :language: javascript Create minimum bandwidth rule ============================= .. rest_method:: POST /v2.0/qos/policies/{policy_id}/minimum_bandwidth_rules Creates a minimum bandwidth rule for a QoS policy. Normal response codes: 201 Error response codes: 400, 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path - minimum_bandwidth_rule: minimum_bandwidth_rule - min_kbps: min_kbps - direction: qos-rule-direction Request Example --------------- .. literalinclude:: samples/qos/minimum_bandwidth_rule-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - minimum_bandwidth_rule: minimum_bandwidth_rule - min_kbps: min_kbps-response - id: qos_minimum_bandwidth_rule-id - direction: qos-rule-direction-response - tags: tags Response Example ---------------- .. literalinclude:: samples/qos/minimum_bandwidth_rule-create-response.json :language: javascript Show minimum bandwidth rule details =================================== .. rest_method:: GET /v2.0/qos/policies/{policy_id}/minimum_bandwidth_rules/{rule_id} Shows details for a minimum bandwidth rule for a QoS policy. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path - rule_id: qos-rule_id Response Parameters ------------------- .. rest_parameters:: parameters.yaml - minimum_bandwidth_rule: minimum_bandwidth_rule - min_kbps: min_kbps-response - id: qos_minimum_bandwidth_rule-id - direction: qos-rule-direction-response - tags: tags Response Example ---------------- .. literalinclude:: samples/qos/minimum_bandwidth_rule-show-response.json :language: javascript Update minimum bandwidth rule ============================= .. rest_method:: PUT /v2.0/qos/policies/{policy_id}/minimum_bandwidth_rules/{rule_id} Updates a minimum bandwidth rule for a QoS policy. If the request is valid, the service returns the ``Accepted (202)`` response code. Normal response codes: 202 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path - rule_id: qos-rule_id - minimum_bandwidth_rule: minimum_bandwidth_rule - min_kbps: min_kbps - direction: qos-rule-direction-update Request Example --------------- .. literalinclude:: samples/qos/minimum_bandwidth_rule-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - minimum_bandwidth_rule: minimum_bandwidth_rule - min_kbps: min_kbps-response - id: qos_minimum_bandwidth_rule-id - direction: qos-rule-direction-update-response - tags: tags Response Example ---------------- .. literalinclude:: samples/qos/minimum_bandwidth_rule-update-response.json :language: javascript Delete minimum bandwidth rule ============================= .. rest_method:: DELETE /v2.0/qos/policies/{policy_id}/minimum_bandwidth_rules/{rule_id} Deletes a minimum bandwidth rule for a QoS policy. Normal response codes: 204 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - policy_id: qos-policy-id-path - rule_id: qos-rule_id Response -------- There is no body content for the response of a successful DELETE request. ================================== Quality of Service rules alias API ================================== The purpose of this API extension is to enable callers to execute the requests to delete, show and update QoS rules without specifying the corresponding policy ID. Otherwise, these requests have the exact same behavior as their counterparts described in other parts of this documentation. The requests available in this API extension are: Show bandwidth limit rule details alias ======================================= .. rest_method:: GET /v2.0/qos/alias_bandwidth_limit_rules/{rule_id} Please refer to `Show bandwidth limit rule details <#show-bandwidth-limit-rule-details>`__ for more information on the request, response and return codes. Update bandwidth limit rule alias ================================= .. rest_method:: PUT /v2.0/qos/alias_bandwidth_limit_rules/{rule_id} Please refer to `Update bandwidth limit rule <#update-bandwidth-limit-rule>`__ for more information on the request, response and return codes. Delete bandwidth limit rule alias ================================= .. rest_method:: DELETE /v2.0/qos/alias_bandwidth_limit_rules/{rule_id} Please refer to `Delete bandwidth limit rule <#delete-bandwidth-limit-rule>`__ for more information on the request, response and return codes. Show DSCP marking rule details alias ==================================== .. rest_method:: GET /v2.0/qos/alias_dscp_marking_rules/{dscp_rule_id} Please refer to `Show DSCP marking rule details <#show-dscp-marking-rule-details>`__ for more information on the request, response and return codes. Update DSCP marking rule alias ============================== .. rest_method:: PUT /v2.0/qos/alias_dscp_marking_rules/{dscp_rule_id} Please refer to `Update DSCP marking rule <#update-dscp-marking-rule>`__ for more information on the request, response and return codes. Delete DSCP marking rule alias ============================== .. rest_method:: DELETE /v2.0/qos/alias_dscp_marking_rules/{dscp_rule_id} Please refer to `Delete DSCP marking rule <#delete-dscp-marking-rule>`__ for more information on the request, response and return codes. Show minimum bandwidth rule details alias ========================================= .. rest_method:: GET /v2.0/qos/alias_minimum_bandwidth_rules/{rule_id} Please refer to `Show minimum bandwidth rule details <#show-minimum-bandwidth-rule-details>`__ for more information on the request, response and return codes. Update minimum bandwidth rule alias =================================== .. rest_method:: PUT /v2.0/qos/alias_minimum_bandwidth_rules/{rule_id} Please refer to `Update minimum bandwidth rule <#update-minimum-bandwidth-rule>`__ for more information on the request, response and return codes. Delete minimum bandwidth rule alias =================================== .. rest_method:: DELETE /v2.0/qos/alias_minimum_bandwidth_rules/{rule_id} Please refer to `Delete minimum bandwidth rule <#delete-minimum-bandwidth-rule>`__ for more information on the request, response and return codes. neutron-lib-2.3.0/api-ref/source/v2/fip-port-forwarding.inc0000664000175000017500000001473313641427107023556 0ustar zuulzuul00000000000000.. -*- rst -*- ============================ Floating IPs port forwarding ============================ Lists, creates, shows details for, updates, and deletes floating IPs port forwardings. Port forwarding rule description ========================================= The ``floating-ip-port-forwarding-description`` extension adds the ``description`` attribute to the floating IP port forwardings. The value of the ``description`` attribute contains a text describing the rule, which helps users to manage/find easily theirs rules. Show port forwarding ==================== .. rest_method:: GET /v2.0/floatingips/{floatingip_id}/port_forwardings/{port_forwarding_id} Shows information for a floating IP port forwarding. Use the ``fields`` query parameter to control which fields are returned in the response body. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 400, 404 Request ------- .. rest_parameters:: parameters.yaml - floatingip_id: floatingip-id-path - port_forwarding_id: fip_port_forwarding_id-path - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - port_forwarding: fip_port_forwarding - id: fip_port_forwarding_id-body - internal_port_id: internal_port_id - internal_ip_address: internal_ip_address-response - internal_port: internal_port - external_port: external_port - protocol: fip_port_forwarding_protocol-body - description: fip_port_forwarding-description Response Example ---------------- .. literalinclude:: samples/port_forwardings/port-fowarding-show-response.json :language: javascript Update a port forwarding ======================== .. rest_method:: PUT /v2.0/floatingips/{floatingip_id}/port_forwardings/{port_forwarding_id} Updates a floating IP port forwarding. Normal response codes: 200 Error response codes: 400, 404 Request ------- .. rest_parameters:: parameters.yaml - floatingip_id: floatingip-id-path - port_forwarding_id: fip_port_forwarding_id-path - port_forwarding: fip_port_forwarding - internal_port_id: internal_port_id-update - internal_ip_address: internal_ip_address - internal_port: internal_port-update - external_port: external_port-update - protocol: fip_port_forwarding_protocol-update Request Example --------------- .. literalinclude:: samples/port_forwardings/port-fowarding-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - port_forwarding: fip_port_forwarding - id: fip_port_forwarding_id-body - internal_port_id: internal_port_id - internal_ip_address: internal_ip_address-response - internal_port: internal_port - external_port: external_port - protocol: fip_port_forwarding_protocol-body - description: fip_port_forwarding-description Response Example ---------------- .. literalinclude:: samples/port_forwardings/port-fowarding-update-response.json :language: javascript Delete a floating IP port forwarding ==================================== .. rest_method:: DELETE /v2.0/floatingips/{floatingip_id}/port_forwardings/{port_forwarding_id} Deletes a floating IP port forwarding. Normal response codes: 204 Error response codes: 404 Request ------- .. rest_parameters:: parameters.yaml - floatingip_id: floatingip-id-path - port_forwarding_id: fip_port_forwarding_id-path Response -------- There is no body content for the response of a successful DELETE request. List floating IP port forwardings ================================= .. rest_method:: GET /v2.0/floatingips/{floatingip_id}/port_forwardings Lists floating IP port forwardings that the project has access to. Default policy settings return only the port forwardings associated to floating IPs owned by the project of the user submitting the request, unless the user has administrative role. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 400, 404 Request ------- .. rest_parameters:: parameters.yaml - floatingip_id: floatingip-id-path - id: id-query - internal_port_id: internal_port_id-query - external_port: external_port-query - protocol: fip_port_forwarding_protocol-query - sort_key: fip_port_forwarding-sort_key - sort_dir: sort_dir - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - port_forwardings: fip_port_forwardings - id: fip_port_forwarding_id-body - internal_port_id: internal_port_id - internal_ip_address: internal_ip_address-response - internal_port: internal_port - external_port: external_port - protocol: fip_port_forwarding_protocol-body - description: fip_port_forwarding-description Response Example ---------------- .. literalinclude:: samples/port_forwardings/port-fowarding-list-response.json :language: javascript Create port forwarding ====================== .. rest_method:: POST /v2.0/floatingips/{floatingip_id}/port_forwardings Creates a floating IP port forwarding. Normal response codes: 201 Error response codes: 400, 404 Request ------- .. rest_parameters:: parameters.yaml - floatingip_id: floatingip-id-path - port_forwarding: fip_port_forwarding - internal_port_id: internal_port_id - internal_ip_address: internal_ip_address - internal_port: internal_port - external_port: external_port - protocol: fip_port_forwarding_protocol-body - description: fip_port_forwarding-description Request Example --------------- .. literalinclude:: samples/port_forwardings/port-fowarding-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - port_forwarding: fip_port_forwarding - id: fip_port_forwarding_id-body - internal_port_id: internal_port_id - internal_ip_address: internal_ip_address-response - internal_port: internal_port - external_port: external_port - protocol: fip_port_forwarding_protocol-body - description: fip_port_forwarding-description Response Example ---------------- .. literalinclude:: samples/port_forwardings/port-fowarding-create-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/subnetpool_prefix_ops.inc0000664000175000017500000000320513641427107024276 0ustar zuulzuul00000000000000.. -*- rst -*- ===================================================== Subnet pool prefix operations (subnetpool-prefix-ops) ===================================================== Add and remove prefixes from a subnet pool prefix list. Add prefixes ============ .. rest_method:: PUT /v2.0/subnetpools/{subnetpool_id}/add_prefixes Adds prefixes to a subnet pool. Normal response codes: 200 Error response codes: 400, 401, 403, 404, 409, 412 Request ------- .. rest_parameters:: parameters.yaml - subnetpool_id: subnetpool_id - prefixes: prefixes Request Example --------------- .. literalinclude:: samples/subnets/subnetpool-add-prefixes-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - prefixes: prefixes-response Response Example ---------------- .. literalinclude:: samples/subnets/subnetpool-add-prefixes-response.json :language: javascript Remove prefixes =============== .. rest_method:: PUT /v2.0/subnetpools/{subnetpool_id}/remove_prefixes Remove prefixes from a subnet pool. Normal response codes: 200 Error response codes: 400, 401, 403, 404, 409, 412 Request ------- .. rest_parameters:: parameters.yaml - subnetpool_id: subnetpool_id - prefixes: prefixes_remove Request Example --------------- .. literalinclude:: samples/subnets/subnetpool-remove-prefixes-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - prefixes: prefixes-response Response Example ---------------- .. literalinclude:: samples/subnets/subnetpool-remove-prefixes-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/l3-conntrack-helper.inc0000664000175000017500000001206413641427107023424 0ustar zuulzuul00000000000000.. -*- rst -*- ========================================== Routers Conntrack Helper (CT) target rules ========================================== Lists, creates, shows details for, updates, and deletes router conntrack helper (CT) target rules. Show conntrack helper ===================== .. rest_method:: GET /v2.0/routers/{router_id}/conntrack_helpers/{conntrack_helper_id} Shows information for a router conntrack helper. Use the ``fields`` query parameter to control which fields are returned in the response body. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 400, 404 Request ------- .. rest_parameters:: parameters.yaml - router_id: router_id - conntrack_helper_id: conntrack_helper_id-path - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - conntrack_helper: conntrack_helper - helper: conntrack_helper_helper-body - id: conntrack_helper_id-body - protocol: conntrack_helper_protocol-body - port: conntrack_helper_port-body Response Example ---------------- .. literalinclude:: samples/conntrack_helpers/conntrack-helper-show-response.json :language: javascript Update a conntrack helper ========================= .. rest_method:: PUT /v2.0/routers/{router_id}/conntrack_helpers/{conntrack_helper_id} Updates a router conntrack helper. Normal response codes: 200 Error response codes: 400, 404 Request ------- .. rest_parameters:: parameters.yaml - router_id: router_id - conntrack_helper_id: conntrack_helper_id-path - helper: conntrack_helper_helper-update - protocol: conntrack_helper_protocol-update - port: conntrack_helper_port-update Request Example --------------- .. literalinclude:: samples/conntrack_helpers/conntrack-helper-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - conntrack_helper: conntrack_helper - id: conntrack_helper_id-body - helper: conntrack_helper_helper-body - protocol: conntrack_helper_protocol-body - port: conntrack_helper_port-body Response Example ---------------- .. literalinclude:: samples/conntrack_helpers/conntrack-helper-update-response.json :language: javascript Delete a conntrack helper ========================= .. rest_method:: DELETE /v2.0/routers/{router_id}/conntrack_helpers/{conntrack_helper_id} Deletes a router conntrack helper. Normal response codes: 204 Error response codes: 404 Request ------- .. rest_parameters:: parameters.yaml - router_id: router_id - conntrack_helper_id: conntrack_helper_id-path Response -------- There is no body content for the response of a successful DELETE request. List router conntrack helpers ============================= .. rest_method:: GET /v2.0/routers/{router_id}/conntrack_helpers Lists router conntrack helpers associated with a router. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 400, 404 Request ------- .. rest_parameters:: parameters.yaml - router_id: router_id - id: id-query - helper: conntrack_helper_helper-query - protocol: conntrack_helper_protocol-query - port: conntrack_helper_port-query - sort_key: conntrack_helper-sort_key - sort_dir: sort_dir - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - conntrack_helpers: conntrack_helpers - id: conntrack_helper_id-body - helper: conntrack_helper_helper-body - protocol: conntrack_helper_protocol-body - port: conntrack_helper_port-body Response Example ---------------- .. literalinclude:: samples/conntrack_helpers/conntrack-helper-list-response.json :language: javascript Create conntrack helper ======================= .. rest_method:: POST /v2.0/routers/{router_id}/conntrack_helpers Creates a router conntrack helper. Normal response codes: 201 Error response codes: 400, 404 Request ------- .. rest_parameters:: parameters.yaml - conntrack_helper: conntrack_helper - router_id: router_id - helper: conntrack_helper_helper-body - protocol: conntrack_helper_protocol-body - port: conntrack_helper_port-body Request Example --------------- .. literalinclude:: samples/conntrack_helpers/conntrack-helper-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - conntrack_helper: conntrack_helper - id: conntrack_helper_id-body - helper: conntrack_helper_helper-body - protocol: conntrack_helper_protocol-body - port: conntrack_helper_port-body Response Example ---------------- .. literalinclude:: samples/conntrack_helpers/conntrack-helper-create-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/address-scopes.inc0000664000175000017500000001133313641427107022566 0ustar zuulzuul00000000000000.. -*- rst -*- ============== Address scopes ============== Lists, creates, shows details for, updates, and deletes address scopes. Show address scope ================== .. rest_method:: GET /v2.0/address-scopes/{address_scope_id} Shows information for an address scope. Use the ``fields`` query parameter to control which fields are returned in the response body. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - address_scope_id: address_scope_id-path - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - address_scope: address_scope - id: address_scope_id_body - name: name - tenant_id: project_id - project_id: project_id - ip_version: ip_version-response - shared: shared-response Response Example ---------------- .. literalinclude:: samples/address-scopes/address-scope-show-response.json :language: javascript Update an address scope ======================= .. rest_method:: PUT /v2.0/address-scopes/{address_scope_id} Updates an address scope. Normal response codes: 200 Error response codes: 400, 401, 403, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - address_scope_id: address_scope_id-path - address_scope: address_scope - name: name-request - shared: shared Request Example --------------- .. literalinclude:: samples/address-scopes/address-scope-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - address_scope: address_scope - id: address_scope_id_body - name: name - tenant_id: project_id - project_id: project_id - ip_version: ip_version-response - shared: shared-response Response Example ---------------- .. literalinclude:: samples/address-scopes/address-scope-update-response.json :language: javascript Delete an address scope ======================= .. rest_method:: DELETE /v2.0/address-scopes/{address_scope_id} Deletes an address scope. Normal response codes: 204 Error response codes: 401, 404, 412 Request ------- .. rest_parameters:: parameters.yaml - address_scope_id: address_scope_id-path Response -------- There is no body content for the response of a successful DELETE request. List address scopes =================== .. rest_method:: GET /v2.0/address-scopes Lists address scopes that the project has access to. Default policy settings return only the address scopes owned by the project of the user submitting the request, unless the user has administrative role. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401 Request ------- .. rest_parameters:: parameters.yaml - id: id-query - name: name-query - tenant_id: project_id-query - project_id: project_id-query - ip_version: ip_version-query - shared: shared-query - sort_key: address_scope-sort_key - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - address_scopes: address_scopes - id: address_scope_id_body - name: name - tenant_id: project_id - project_id: project_id - ip_version: ip_version-response - shared: shared-response Response Example ---------------- .. literalinclude:: samples/address-scopes/address-scopes-list-response.json :language: javascript Create address scope ==================== .. rest_method:: POST /v2.0/address-scopes Creates an address scope. Normal response codes: 201 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - address_scope: address_scope - name: name-request - tenant_id: project_id-request - project_id: project_id-request - ip_version: ip_version-required - shared: shared Request Example --------------- .. literalinclude:: samples/address-scopes/address-scope-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - address_scope: address_scope - id: address_scope_id_body - name: name - tenant_id: project_id - project_id: project_id - ip_version: ip_version-response - shared: shared-response Response Example ---------------- .. literalinclude:: samples/address-scopes/address-scope-create-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/fwaas-v2.inc0000664000175000017500000006243613641427107021307 0ustar zuulzuul00000000000000.. -*- rst -*- ================================================================================ FWaaS v2.0 (CURRENT) (fwaas, firewall_groups, firewall_policies, firewall_rules) ================================================================================ Use the Firewall-as-a-Service (FWaaS) v2.0 extension to deploy firewall groups to protect your networks. The FWaaS extension enables you to: - Apply firewall rules on traffic entering and leaving project networks. - Apply TCP, UDP, ICMP, or protocol-agnostic rules. - Create and share firewall policies that hold an ordered collection of firewall rules. - Audit firewall rules and policies. This extension introduces the following resources: - ``firewall_group``. A logical firewall resource that a project can create and manage. A firewall group can have a firewall policy for ingress traffic and/or a firewall policy for egress traffic. - ``firewall_policy``. An ordered collection of firewall rules. You can share a firewall policy across projects. You can include a firewall policy as part of an audit workflow so that an authorized relevant entity can audit the firewall policy. This entity can differ from the user who created, or the projects that use, the firewall policy. - ``firewall_rule``. A collection of attributes, such as source and destination ports, source and destination IP addresses, protocol, and IP version. These attributes define match criteria and an action to take, such as allow, reject, or deny, on matched data traffic. List firewall groups ==================== .. rest_method:: GET /v2.0/fwaas/firewall_groups Lists all firewall groups. The list might be empty. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 403 Request ------- .. rest_parameters:: parameters.yaml - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - firewall_groups: firewall_groups_object - admin_state_up: firewall_group_admin_state_up-body-required - description: firewall_group_description-body-required - egress_firewall_policy_id: egress_firewall_policy_id-body-required - id: firewall_group_id-body-required - ingress_firewall_policy_id: ingress_firewall_policy_id-body-required - name: firewall_group_name-body-required - ports: firewall_group_ports-body-required - project_id: project_id-body-required - shared: firewall_group_shared-body-required - status: firewall_group_status-body-required - tenant_id: project_id-body-required Response Example ---------------- .. literalinclude:: samples/firewall-v2/firewall-groups-list-response.json :language: javascript Show firewall group details =========================== .. rest_method:: GET /v2.0/fwaas/firewall_groups/{firewall_group_id} Shows details for a firewall group. If the user is not an administrative user and the firewall group object does not belong to the project, this call returns the ``FirewallGroupNotFound (404)`` response code. Normal response codes: 200 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - firewall_group_id: firewall_group_id-path-required Response Parameters ------------------- .. rest_parameters:: parameters.yaml - firewall_group: firewall_group_object - admin_state_up: firewall_group_admin_state_up-body-required - description: firewall_group_description-body-required - egress_firewall_policy_id: egress_firewall_policy_id-body-required - id: firewall_group_id-body-required - ingress_firewall_policy_id: ingress_firewall_policy_id-body-required - name: firewall_group_name-body-required - ports: firewall_group_ports-body-required - project_id: project_id-body-required - shared: firewall_group_shared-body-required - status: firewall_group_status-body-required - tenant_id: project_id-body-required Response Example ---------------- .. literalinclude:: samples/firewall-v2/firewall-group-show-response.json :language: javascript Create firewall group ===================== .. rest_method:: POST /v2.0/fwaas/firewall_groups Creates a firewall group. The firewall group may be associated with an ingress firewall policy and/or an egress firewall policy. If ``admin_state_up`` is ``false``, the firewall group will block all traffic. Normal response codes: 201 Error response codes: 400, 401 Request ------- .. rest_parameters:: parameters.yaml - firewall_group: firewall_group_object - admin_state_up: firewall_group_admin_state_up-body-optional - description: firewall_group_description-body-optional - egress_firewall_policy_id: egress_firewall_policy_id-body-optional - ingress_firewall_policy_id: ingress_firewall_policy_id-body-optional - name: firewall_group_name-body-optional - ports: firewall_group_ports-body-optional - project_id: project_id-body-optional - shared: firewall_group_shared-body-optional - tenant_id: project_id-body-optional Request Example --------------- .. literalinclude:: samples/firewall-v2/firewall-group-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - firewall_group: firewall_group_object - admin_state_up: firewall_group_admin_state_up-body-required - description: firewall_group_description-body-required - egress_firewall_policy_id: egress_firewall_policy_id-body-required - id: firewall_group_id-body-required - ingress_firewall_policy_id: ingress_firewall_policy_id-body-required - name: firewall_group_name-body-required - ports: firewall_group_ports-body-required - project_id: project_id-body-required - shared: firewall_group_shared-body-required - status: firewall_group_status-body-required - tenant_id: project_id-body-required Response Example ---------------- .. literalinclude:: samples/firewall-v2/firewall-group-create-response.json :language: javascript Update firewall group ===================== .. rest_method:: PUT /v2.0/fwaas/firewall_groups/{firewall_group_id} Updates a firewall group. The firewall group cannot be updated if its status is a PENDING_* status. Normal response codes: 200 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - firewall_group_id: firewall_group_id-path-required - firewall_group: firewall_group_object - admin_state_up: firewall_group_admin_state_up-body-optional - description: firewall_group_description-body-optional - egress_firewall_policy_id: egress_firewall_policy_id-body-optional - ingress_firewall_policy_id: ingress_firewall_policy_id-body-optional - name: firewall_group_name-body-optional - ports: firewall_group_ports-body-optional - shared: firewall_group_shared-body-optional Request Example --------------- .. literalinclude:: samples/firewall-v2/firewall-group-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - firewall_group: firewall_group_object - admin_state_up: firewall_group_admin_state_up-body-required - description: firewall_group_description-body-required - egress_firewall_policy_id: egress_firewall_policy_id-body-required - id: firewall_group_id-body-required - ingress_firewall_policy_id: ingress_firewall_policy_id-body-required - name: firewall_group_name-body-required - ports: firewall_group_ports-body-required - project_id: project_id-body-required - shared: firewall_group_shared-body-required - status: firewall_group_status-body-required - tenant_id: project_id-body-required Response Example ---------------- .. literalinclude:: samples/firewall-v2/firewall-group-update-response.json :language: javascript Delete firewall group ===================== .. rest_method:: DELETE /v2.0/fwaas/firewall_groups/{firewall_group_id} Deletes a firewall group. Normal response codes: 204 Error response codes: 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - firewall_group_id: firewall_group_id-path-required Response -------- There is no body content for the response of a successful DELETE request. List firewall policies ====================== .. rest_method:: GET /v2.0/fwaas/firewall_policies Lists all firewall policies. The list might be empty. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 403 Request ------- .. rest_parameters:: parameters.yaml - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - firewall_policies: firewall_policies_object - audited: firewall_policy_audited-body-required - description: firewall_policy_description-body-required - id: firewall_policy_id-body-required - firewall_rules: firewall_rules-body-required - name: firewall_policy_name-body-required - project_id: project_id-body-required - shared: firewall_policy_shared-body-required - tenant_id: project_id-body-required Response Example ---------------- .. literalinclude:: samples/firewall-v2/firewall-policies-list-response.json :language: javascript Show firewall policy details ============================ .. rest_method:: GET /v2.0/fwaas/firewall_policies/{firewall_policy_id} Shows details of a firewall policy. Normal response codes: 200 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - firewall_policy_id: firewall_policy_id-path-required Response Parameters ------------------- .. rest_parameters:: parameters.yaml - audited: firewall_policy_audited-body-required - description: firewall_policy_description-body-required - firewall_rules: firewall_rules-body-required - id: firewall_policy_id-body-required - name: firewall_policy_name-body-required - project_id: project_id-body-required - shared: firewall_policy_shared-body-required - tenant_id: project_id-body-required Response Example ---------------- .. literalinclude:: samples/firewall-v2/firewall-policy-show-response.json :language: javascript Create firewall policy ====================== .. rest_method:: POST /v2.0/fwaas/firewall_policies Creates a firewall policy. Normal response codes: 201 Error response codes: 400, 401 Request ------- .. rest_parameters:: parameters.yaml - firewall_policy: firewall_policy_object - audited: firewall_policy_audited-body-optional - description: firewall_policy_description-body-optional - firewall_rules: firewall_rules-body-optional - name: firewall_policy_name-body-optional - project_id: project_id-body-optional - shared: firewall_policy_shared-body-optional - tenant_id: project_id-body-optional Request Example --------------- .. literalinclude:: samples/firewall-v2/firewall-policy-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - firewall_policy: firewall_policy_object - audited: firewall_policy_audited-body-required - description: firewall_policy_description-body-required - firewall_rules: firewall_rules-body-required - id: firewall_policy_id-body-required - name: firewall_policy_name-body-required - project_id: project_id-body-required - shared: firewall_policy_shared-body-required - tenant_id: project_id-body-required Response Example ---------------- .. literalinclude:: samples/firewall-v2/firewall-policy-create-response.json :language: javascript Update firewall policy ====================== .. rest_method:: PUT /v2.0/fwaas/firewall_policies/{firewall_policy_id} Updates a firewall policy. Normal response codes: 200 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - firewall_policy_id: firewall_policy_id-path-required - firewall_policy: firewall_policy_object - audited: firewall_policy_audited-body-optional - description: firewall_policy_description-body-optional - firewall_rules: firewall_rules-body-optional - name: firewall_policy_name-body-optional - project_id: project_id-body-optional - shared: firewall_policy_shared-body-optional - tenant_id: project_id-body-optional Request Example --------------- .. literalinclude:: samples/firewall-v2/firewall-policy-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - firewall_policy: firewall_policy_object - audited: firewall_policy_audited-body-required - description: firewall_policy_description-body-required - firewall_rules: firewall_rules-body-required - id: firewall_policy_id-body-required - name: firewall_policy_name-body-required - shared: firewall_policy_shared-body-required - project_id: project_id-body-required - tenant_id: project_id-body-required Response Example ---------------- .. literalinclude:: samples/firewall-v2/firewall-policy-update-response.json :language: javascript Delete firewall policy ====================== .. rest_method:: DELETE /v2.0/fwaas/firewall_policies/{firewall_policy_id} Deletes a firewall policy. Normal response codes: 204 Error response codes: 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - firewall_policy_id: firewall_policy_id-path-required Response -------- There is no body content for the response of a successful DELETE request. List firewall rules =================== .. rest_method:: GET /v2.0/fwaas/firewall_rules Lists all firewall rules. The list might be empty. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 401, 403 Request ------- .. rest_parameters:: parameters.yaml - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - firewall_rules: firewall_rules_object - action: firewall_rule_action-body-required - description: firewall_rule_description-body-required - destination_firewall_group_id: destination_firewall_group_id-body-required - destination_ip_address: firewall_rule_destination_ip_address-body-required - destination_port: firewall_rule_destination_port-body-required - enabled: firewall_rule_enabled-body-required - firewall_policy_id: firewall_policy_id-body-required - id: firewall_rule_id-body-required - ip_version: firewall_rule_ip_version-body-required - name: firewall_rule_name-body-required - project_id: project_id-body-required - protocol: firewall_rule_protocol-body-required - shared: firewall_rule_shared-body-required - source_firewall_group_id: source_firewall_group_id-body-required - source_ip_address: firewall_rule_source_ip_address-body-required - source_port: firewall_rule_source_port-body-required - tenant_id: project_id-body-required Response Example ---------------- .. literalinclude:: samples/firewall-v2/firewall-rules-list-response.json :language: javascript Show firewall rule details ========================== .. rest_method:: GET /v2.0/fwaas/firewall_rules/{firewall_rule_id} Shows details for a firewall rule. If the user is not an administrative user and the firewall rule object does not belong to the project, this call returns the ``Forbidden (403)`` response code. Normal response codes: 200 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - firewall_rule_id: firewall_rule_id-path-required Response Parameters ------------------- .. rest_parameters:: parameters.yaml - firewall_rule: firewall_rule_object - action: firewall_rule_action-body-required - description: firewall_rule_description-body-required - destination_firewall_group_id: destination_firewall_group_id-body-required - destination_ip_address: firewall_rule_destination_ip_address-body-required - destination_port: firewall_rule_destination_port-body-required - enabled: firewall_rule_enabled-body-required - firewall_policy_id: firewall_policy_id-body-required - id: firewall_rule_id-body-required - ip_version: firewall_rule_ip_version-body-required - name: firewall_rule_name-body-required - project_id: project_id-body-required - protocol: firewall_rule_protocol-body-required - shared: firewall_rule_shared-body-required - source_firewall_group_id: source_firewall_group_id-body-required - source_ip_address: firewall_rule_source_ip_address-body-required - source_port: firewall_rule_source_port-body-required - tenant_id: project_id-body-required Response Example ---------------- .. literalinclude:: samples/firewall-v2/firewall-rule-show-response.json :language: javascript Create firewall rule ==================== .. rest_method:: POST /v2.0/fwaas/firewall_rules Creates a firewall rule. Normal response codes: 201 Error response codes: 400, 401 Request ------- .. rest_parameters:: parameters.yaml - firewall_rule: firewall_rule_object - action: firewall_rule_action-body-optional - description: firewall_rule_description-body-optional - destination_firewall_group_id: destination_firewall_group_id-body-optional - destination_ip_address: firewall_rule_destination_ip_address-body-optional - destination_port: firewall_rule_destination_port-body-optional - enabled: firewall_rule_enabled-body-optional - ip_version: firewall_rule_ip_version-body-optional - name: firewall_rule_name-body-optional - project_id: project_id-body-optional - protocol: firewall_rule_protocol-body-optional - shared: firewall_rule_shared-body-optional - source_firewall_group_id: source_firewall_group_id-body-optional - source_ip_address: firewall_rule_source_ip_address-body-optional - source_port: firewall_rule_source_port-body-optional - tenant_id: project_id-body-optional Request Example --------------- .. literalinclude:: samples/firewall-v2/firewall-rule-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - firewall_rule: firewall_rule_object - action: firewall_rule_action-body-required - description: firewall_rule_description-body-required - destination_firewall_group_id: destination_firewall_group_id-body-required - destination_ip_address: firewall_rule_destination_ip_address-body-required - destination_port: firewall_rule_destination_port-body-required - enabled: firewall_rule_enabled-body-required - firewall_policy_id: firewall_policy_id-body-required - id: firewall_rule_id-body-required - ip_version: firewall_rule_ip_version-body-required - name: firewall_rule_name-body-required - project_id: project_id-body-required - protocol: firewall_rule_protocol-body-required - shared: firewall_rule_shared-body-required - source_firewall_group_id: source_firewall_group_id-body-required - source_ip_address: firewall_rule_source_ip_address-body-required - source_port: firewall_rule_source_port-body-required - tenant_id: project_id-body-required Response Example ---------------- .. literalinclude:: samples/firewall-v2/firewall-rule-create-response.json :language: javascript Update firewall rule ==================== .. rest_method:: PUT /v2.0/fwaas/firewall_rules/{firewall_rule_id} Updates a firewall rule. Normal response codes: 200 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - firewall_rule_id: firewall_rule_id-path-required - firewall_rule: firewall_rule_object - action: firewall_rule_action-body-optional - description: firewall_rule_description-body-optional - destination_firewall_group_id: destination_firewall_group_id-body-optional - destination_ip_address: firewall_rule_destination_ip_address-body-optional - destination_port: firewall_rule_destination_port-body-optional - enabled: firewall_rule_enabled-body-optional - firewall_policy_id: firewall_policy_id-body-required - ip_version: firewall_rule_ip_version-body-optional - name: firewall_rule_name-body-optional - project_id: project_id-body-optional - protocol: firewall_rule_protocol-body-optional - shared: firewall_rule_shared-body-optional - source_firewall_group_id: source_firewall_group_id-body-optional - source_ip_address: firewall_rule_source_ip_address-body-optional - source_port: firewall_rule_source_port-body-optional - tenant_id: project_id-body-optional Request Example --------------- .. literalinclude:: samples/firewall-v2/firewall-rule-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - firewall_rule: firewall_rule_object - action: firewall_rule_action-body-required - description: firewall_rule_description-body-required - destination_firewall_group_id: destination_firewall_group_id-body-required - destination_ip_address: firewall_rule_destination_ip_address-body-required - destination_port: firewall_rule_destination_port-body-required - enabled: firewall_rule_enabled-body-required - firewall_policy_id: firewall_policy_id-body-required - id: firewall_rule_id-body-required - ip_version: firewall_rule_ip_version-body-required - name: firewall_rule_name-body-required - project_id: project_id-body-required - protocol: firewall_rule_protocol-body-required - shared: firewall_rule_shared-body-required - source_firewall_group_id: source_firewall_group_id-body-required - source_ip_address: firewall_rule_source_ip_address-body-required - source_port: firewall_rule_source_port-body-required - tenant_id: project_id-body-required Response Example ---------------- .. literalinclude:: samples/firewall-v2/firewall-rule-update-response.json :language: javascript Delete firewall rule ==================== .. rest_method:: DELETE /v2.0/fwaas/firewall_rules/{firewall_rule_id} Deletes a firewall rule. samples/firewall-v2/firewall-policy-create-response.json Normal response codes: 204 Error response codes: 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - firewall_rule_id: firewall_rule_id-path-required Insert rule into a firewall policy ================================== .. rest_method:: PUT /v2.0/fwaas/firewall_policies/{firewall_policy_id}/insert_rule Insert firewall rule into a policy. A firewall_rule_id is inserted relative to the position of the firewall_rule_id set in ``insert_before`` or ``insert_after``. If ``insert_before`` is set, ``insert_after`` is ignored. If both ``insert_before`` and ``insert_after`` are not set, the new firewall_rule_id is inserted as the first rule of the policy. Normal response codes: 200 Error response codes: 400, 401, 404, 409 Request ------- .. rest_parameters:: parameters.yaml - firewall_policy_id: firewall_policy_id-path-required - firewall_rule_id: firewall_rule_id-body-required - insert_after: firewall_rule_insert_after-body-required - insert_before: firewall_rule_insert_before-body-required Request Example --------------- .. literalinclude:: samples/firewall-v2/firewall-policy-insert-rule-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - audited: firewall_policy_audited-body-required - description: firewall_policy_description-body-required - firewall_rules: firewall_rules-body-required - id: firewall_policy_id-body-required - name: firewall_policy_name-body-required - project_id: project_id-body-required - shared: firewall_policy_shared-body-required - tenant_id: project_id-body-required Response Example ---------------- .. literalinclude:: samples/firewall-v2/firewall-policy-insert-rule-response.json :language: javascript Remove rule from firewall policy ================================ .. rest_method:: PUT /v2.0/fwaas/firewall_policies/{firewall_policy_id}/remove_rule Remove firewall rule from a policy. Normal response codes: 200 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - firewall_policy_id: firewall_policy_id-path-required - firewall_rule_id: firewall_rule_id-body-required Request Example --------------- .. literalinclude:: samples/firewall-v2/firewall-policy-remove-rule-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - audited: firewall_policy_audited-body-required - description: firewall_policy_description-body-required - firewall_rules: firewall_rules-body-required - id: firewall_policy_id-body-required - name: firewall_policy_name-body-required - project_id: project_id-body-required - shared: firewall_policy_shared-body-required - tenant_id: project_id-body-required Response Example ---------------- .. literalinclude:: samples/firewall-v2/firewall-policy-remove-rule-response.json :language: javascript neutron-lib-2.3.0/api-ref/source/v2/bgpvpn-network_associations.inc0000664000175000017500000000755313641427107025422 0ustar zuulzuul00000000000000==================== Network Associations ==================== Associating a BGPVPN to a Network can be done for both BGPVPN of type L2 and of type L3. For type L3, the semantic is that all Subnets bound to the Network will be interconnected with the BGP VPN (and thus between themselves). A given Network can be associated with multiple BGPVPNs. Associating or disassociating a BGPVPN to a Network is done by manipulating a Network association API resource as a sub-resource of the BGPVPN resource: List Network Associations ========================= .. rest_method:: GET /v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/network_associations Lists network associations for a given BGP VPN. Use the ``fields`` query parameter to control which fields are returned in the response body. Additionally, you can filter results by using query string parameters. For information, see `Filtering and Column Selection `__. Normal response codes: 200 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - bgpvpn_id: bgpvpn-id-path - fields: fields Response Parameters ------------------- .. rest_parameters:: parameters.yaml - network_associations: bgpvpn-network_associations - id: bgpvpn-network_association_id - network_id: bgpvpn-network_id - tenant_id: project_id - project_id: project_id Response Example ---------------- .. literalinclude:: samples/bgpvpn/network_associations/network_association-list-response.json :language: javascript Create Network Association ========================== .. rest_method:: POST /v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/network_associations Creates a network association for a given BGP VPN Normal response codes: 201 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - bgpvpn_id: bgpvpn-id-path - network_association: bgpvpn-network_association - network_id: bgpvpn-network_id Request Example --------------- .. literalinclude:: samples/bgpvpn/network_associations/network_association-create-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - network_association: bgpvpn-network_association - id: bgpvpn-network_association_id - network_id: bgpvpn-network_id - tenant_id: project_id - project_id: project_id Response Example ---------------- .. literalinclude:: samples/bgpvpn/network_associations/network_association-create-response.json :language: javascript Show Network Association details ================================ .. rest_method:: GET /v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/network_associations/{network_association_id} Shows details for a network association. Normal response codes: 200 Error response codes: 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - bgpvpn_id: bgpvpn-id-path - network_association_id: bgpvpn-network_association_id-path Response Parameters ------------------- .. rest_parameters:: parameters.yaml - network_association: bgpvpn-network_association - id: bgpvpn-network_association_id - network_id: bgpvpn-network_id - tenant_id: project_id - project_id: project_id Response Example ---------------- .. literalinclude:: samples/bgpvpn/network_associations/network_association-show-response.json :language: javascript Delete Network Association ========================== .. rest_method:: DELETE /v2.0/bgpvpn/bgpvpns/{bgpvpn_id}/network_associations/{network_association_id} Deletes a network association. Normal response codes: 204 Error response codes: 400, 401, 403, 404 Request ------- .. rest_parameters:: parameters.yaml - bgpvpn_id: bgpvpn-id-path - network_association_id: bgpvpn-network_association_id-path Response -------- There is no body content for the response of a successful DELETE request. neutron-lib-2.3.0/api-ref/source/v2/tags.inc0000664000175000017500000000756013641427107020614 0ustar zuulzuul00000000000000 ==================== Tag extension (tags) ==================== Shows details for, updates, and deletes tags. The maximum number of characters allowed in a tag is 60. If the length is longer than 60, the API returns the HTTP ``Bad Request (400)`` response code with 'invalid input for operation' error message. Tag Extension ============= .. note:: NOTE: This extension is deprecated in favor of ``standard-attr-tag``. The ``tag`` extension allows users to set tags on their networks. This extension supports networks only. Enhanced Tag Extension ====================== .. note:: NOTE: This extension is deprecated in favor of ``standard-attr-tag``. The ``tag-ext`` extension allows users to set tags on their resources. This extension supports subnets, ports, routers, and subnet pools. Standard Attributes Tag Extension ================================= The ``standard-attr-tag`` extends tagging support to some resources that support standard attributes. This includes networks, ports, subnets, subnet pools, floating IPs, routers, security groups, security group rules, QoS policies and trunks. Replace all tags ================ .. rest_method:: PUT /v2.0/{resource_type}/{resource_id}/tags Replaces all tags on the resource. Normal response codes: 200 Error response codes: 400, 401, 404 Request ------- .. rest_parameters:: parameters.yaml - resource_type: resource_type - resource_id: resource_id - tags: tags Request Example --------------- .. literalinclude:: samples/tag/tag-update-request.json :language: javascript Response Parameters ------------------- .. rest_parameters:: parameters.yaml - tags: tags Response Example ---------------- .. literalinclude:: samples/tag/tag-update-response.json :language: javascript Remove all tags =============== .. rest_method:: DELETE /v2.0/{resource_type}/{resource_id}/tags Removes all tags on the resource. Normal response codes: 204 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - resource_type: resource_type - resource_id: resource_id Response -------- There is no body content for the response of a successful DELETE request. Confirm a tag ============= .. rest_method:: GET /v2.0/{resource_type}/{resource_id}/tags/{tag} Confirms a given tag is set on the resource. Normal response codes: 204 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - resource_type: resource_type - resource_id: resource_id - tag: tag Response -------- There is no body content for the response of a successful GET request. Add a tag ========= .. rest_method:: PUT /v2.0/{resource_type}/{resource_id}/tags/{tag} Adds a tag on the resource. Normal response codes: 201 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - resource_type: resource_type - resource_id: resource_id - tag: tag Response -------- There is no body content for the response of a successful PUT request. Obtain Tag List =============== .. rest_method:: GET /v2.0/{resource_type}/{resource_id}/tags Obtains the tags for a resource. Normal response codes: 200 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - resource_type: resource_type - resource_id: resource_id Response -------- .. rest_parameters:: parameters.yaml - tags: tags Response Example ---------------- .. literalinclude:: samples/tag/tag-obtain-response.json :language: javascript Remove a tag ============ .. rest_method:: DELETE /v2.0/{resource_type}/{resource_id}/tags/{tag} Removes a tag on the resource. Normal response codes: 204 Error response codes: 401, 404 Request ------- .. rest_parameters:: parameters.yaml - resource_type: resource_type - resource_id: resource_id - tag: tag Response -------- There is no body content for the response of a successful DELETE request. neutron-lib-2.3.0/api-ref/source/conf.py0000664000175000017500000001552413641427107020132 0ustar zuulzuul00000000000000# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # # neutron documentation build configuration file, created by # sphinx-quickstart on Sat May 1 15:17:47 2010. # # This file is execfile()d with the current directory set to # its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os import sys extensions = [ 'os_api_ref', 'openstackdocstheme', ] html_theme = 'openstackdocs' html_theme_options = { "sidebar_mode": "toc", } # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('../../')) sys.path.insert(0, os.path.abspath('../')) sys.path.insert(0, os.path.abspath('./')) # -- General configuration ---------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. # # source_encoding = 'utf-8' # The master toctree document. master_doc = 'index' # General information about the project. project = u'Networking API Reference' copyright = u'2010-present, OpenStack Foundation' # openstackdocstheme options repository_name = 'openstack/neutron-lib' bug_project = 'neutron' bug_tag = 'api-ref' release = '' # The short X.Y version. version = '' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' # The reST default role (used for this markup: `text`) to use # for all documents. # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. # add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). add_module_names = False # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # -- Options for man page output ---------------------------------------------- # Grouping the document tree for man pages. # List of tuples 'sourcefile', 'target', u'title', u'Authors name', 'manual' # -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. # html_theme_path = ["."] # html_theme = '_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". # html_title = None # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. # html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". # html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. # html_last_updated_fmt = '%b %d, %Y' html_last_updated_fmt = '%Y-%m-%d %H:%M' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. # html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. # html_additional_pages = {} # If false, no module index is generated. # html_use_modindex = True # If false, no index is generated. # html_use_index = True # If true, the index is split into individual pages for each letter. # html_split_index = False # If true, links to the reST sources are added to the pages. # html_show_sourcelink = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. # html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = '' # Output file base name for HTML help builder. htmlhelp_basename = 'neutrondoc' # -- Options for LaTeX output ------------------------------------------------- # The paper size ('letter' or 'a4'). # latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). # latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ ('index', 'Neutron.tex', u'OpenStack Networking API Documentation', u'OpenStack Foundation', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. # latex_use_parts = False # Additional stuff for the LaTeX preamble. # latex_preamble = '' # Documents to append as an appendix to all manuals. # latex_appendices = [] # If false, no module index is generated. # latex_use_modindex = True linkcheck_anchors_ignore = [ # skip gerrit anchors '\\/q\\/.*', 'q\\,.*', '\\/c\\/.*' ] neutron-lib-2.3.0/setup.cfg0000664000175000017500000000224613641427200015620 0ustar zuulzuul00000000000000[metadata] name = neutron-lib summary = Neutron shared routines and utilities description-file = README.rst author = OpenStack author-email = openstack-discuss@lists.openstack.org home-page = https://docs.openstack.org/neutron-lib/latest/ python-requires = >=3.6 classifier = Environment :: OpenStack Intended Audience :: Information Technology Intended Audience :: System Administrators License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux Programming Language :: Python Programming Language :: Python :: 3 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 [files] packages = neutron_lib [entry_points] oslo.policy.enforcer = neutron_lib = neutron_lib._policy:get_enforcer oslo.policy.policies = neutron_lib = neutron_lib._policy:list_rules [compile_catalog] directory = neutron_lib/locale domain = neutron_lib [update_catalog] domain = neutron_lib output_dir = neutron_lib/locale input_file = neutron_lib/locale/neutron_lib.pot [extract_messages] keywords = _ gettext ngettext l_ lazy_gettext mapping_file = babel.cfg output_file = neutron_lib/locale/neutron_lib.pot [egg_info] tag_build = tag_date = 0